From: simon.marchi@polymtl.ca (Simon Marchi)
Subject: [lttng-dev] Printing bit fields with LTTng
Date: Wed, 10 Jun 2015 17:28:42 -0400 [thread overview]
Message-ID: <CAFXXi0k-HfWxPVmmF8=nap20pS-HRQwWwMc0P8jj0-RRhjXkYw@mail.gmail.com> (raw)
In-Reply-To: <CAL1ZhON=nEPuoXks2AKq4k7nCpK_W_FQ96TM3299V69V6RgW_w@mail.gmail.com>
On 10 June 2015 at 17:16, Chidhu R <chid1989 at gmail.com> wrote:
> Hello,
>
> I am getting compilation issues while trying to print bit field values with
> LTTng.
>
> Error:
>
> hello.c: In function ?main?:
> hello.c:36:1: error: ?typeof? applied to a bit-field
> hello.c:36:1: error: ?typeof? applied to a bit-field
> hello.c:36:1: error: ?typeof? applied to a bit-field
> hello.c:36:1: error: ?sizeof? applied to a bit-field
>
> Snippet:
>
> struct abc{
> int a:16;
> int b:8;
> };
>
> Line 36: tracepoint(hello_world, my_third_tracepoint, aa.a, "welcome");
> Line 37: printf("val = %x\n",aa.a);
>
> tracepoint line results in compilation error.
> printf succeeds.
>
> Tp definition looks like this.
>
> TRACEPOINT_EVENT(
> hello_world,
> my_third_tracepoint,
> TP_ARGS(
> uint32_t, arg,
> const char * , my_string_arg
> ),
> TP_FIELDS(
> ctf_integer_hex(uint32_t, my_arg, arg)
> ctf_string(field, my_string_arg)
> )
> )
>
> How to print bit field values?
>
> Thanks
> Chid
I have no idea what the right fix would be, but an easy workaround
could be to add 0 to your value:
tracepoint(hello_world, my_third_tracepoint, aa.a + 0, "welcome");
I just tried it and it works.
Simon
next prev parent reply other threads:[~2015-06-10 21:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-10 21:16 Chidhu R
2015-06-10 21:28 ` Simon Marchi [this message]
2015-06-10 22:20 ` Simon Marchi
2015-06-11 18:11 ` Chidhu R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFXXi0k-HfWxPVmmF8=nap20pS-HRQwWwMc0P8jj0-RRhjXkYw@mail.gmail.com' \
--to=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox