Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export bt_ctf_field_type_{integer_get_base,string_get_encoding} #106

Open
wants to merge 3 commits into
base: stable-1.5
Choose a base branch
from

Conversation

milianw
Copy link

@milianw milianw commented May 17, 2019

These two functions are useful when you want to write a custom CTF analyzer using libbacktrace

This makes it possible to access the integer base for consumers
of libbabeltrace.

Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
This allows consumers of libbabeltrace to query the encoding
of string values.

Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
@milianw
Copy link
Author

milianw commented May 17, 2019

I just realize there's bt_ctf_get_encoding and bt_ctf_get_int_base which can be used as alternatives for now. I still think it would be good to have these functions available though.

@jgalar
Copy link
Member

jgalar commented May 17, 2019

Hi Milian,

The functions you exported are exclusively used by the CTF-Writer API.
For the reader-side of the Babeltrace 1.x API, see include/babeltrace/ctf/events.h.

Both bt_ctf_get_encoding and bt_ctf_get_int_base are available in the "reader" header. The 1.x API is not fresh to my mind, but I think that to determine if an array or a sequence contains a string, you need to:

  1. access the first element of the array/sequence
  2. get the element's declaration (see bt_ctf_get_decl_from_def())
  3. use that declaration with bt_ctf_get_encoding and bt_ctf_get_int_base to emulate the logic of bt_int_is_char() (see types/integer.c)

Does that work?

@jgalar
Copy link
Member

jgalar commented May 17, 2019

Note that there is no way to access the alignment property of a bt_declaration. Hence, that part of the check is not possible without adding a suitable accessor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants