This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: possible loc2c problem, DW_OP_rot
- From: Mark Wielaard <mjw at redhat dot com>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: systemtap at sourceware dot org
- Date: Sat, 5 Jan 2013 11:18:48 +0100
- Subject: Re: possible loc2c problem, DW_OP_rot
- References: <20130105024706.GB30067@redhat.com>
On Fri, Jan 04, 2013 at 09:47:06PM -0500, Frank Ch. Eigler wrote:
> A particularly wildcardy stap script generates this little ditty:
>
> static void function__dwarf_tvar_get_num_155657 (struct context* __restrict__ c) {
> [...]
> {
> uintptr_t addr;
> { // DWARF expression: 0x70 0x38 0x14 0x14 0x24 0xa(65535) 0x1a 0x17 0x16 0xa(65535) 0x1a 0x16 0x1f 0x23(16) 0x25 0x21 0xa(65535) 0x1a 0x9f
Nice DWARF expression :)
I really should push my elfutils libdw dwarfstrings patch again,
the above is somewhat hard to translate by hand.
> Note the DW_OP_rot ditty, 0x17, where a nonexistent variable
> s4294967295 is used. gcc (via stap -p4) barfs at that point.
>
> Looking at loc2c.c:551,
>
> 551 case DW_OP_rot:
> 552 if (stack_depth < 3)
> 553 goto underflow;
> 554 deepen (); /* Use a temporary slot. */
> 555 emit ("%*s"
> 556 STACKFMT " = " STACKFMT ", "
> 557 STACKFMT " = " STACKFMT ", "
> 558 STACKFMT " = " STACKFMT ", "
> 559 STACKFMT " = " STACKFMT ";\n",
> 560 indent * 2, "",
> 561 STACK (-1), STACK (0),
> 562 STACK (0), STACK (1),
> 563 STACK (1), STACK (2),
> 564 STACK (3), STACK (-1));
> 565 break;
>
> that pattern of STACK(...) numbers looks wrong. Should that last line have
> STACK (2) instead of STACK (3)?
Certainly looks so. Do you happen to have the test binary/script.
Would be good to turn that into a testcase. Apparently we never
saw a DW_OP_rot before. I see the runtime unwinder doesn't even
support it. So if it can also happen in CFI then we should also
add support there.
Cheers,
Mark