This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

possible loc2c problem, DW_OP_rot


Hi, Mark -

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
      {
        uintptr_t s0, s1, s2, s3;
        s0 = fetch_register (0) + 0L;
        s1 = 8L;
        s2 = s0;
        s3 = s1;
        s2 = s2 << s3;
        s3 = 65535L;
        s2 = s2 & s3;
        s3 = s2, s2 = s1, s1 = s0, s4294967295 = s3;
        s3 = s2, s2 = s1, s1 = s3;
        s3 = 65535L;
        s2 = s2 & s3;
        s3 = s2, s2 = s1, s1 = s3;
        s2 = - (s2);
        s2 = s2 + 16UL;
        s1 = s1 >> s2;
        s0 = s0 | s1;
        s1 = 65535L;
        s0 = s0 & s1;
        addr = s0;
      }
    }

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)?

- FChE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]