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]

[Bug translator/10726] New: Getting wrong scope for inlined function


In the following example (which doesn't currently work because we don't support
DW_AT_const_value yet), we get the scope wrong when probing func (inlined into
main with gcc -O2):

#include "sdt.h"

struct foo
{
  const int i;
  const long j;
};

typedef struct foo fooer;

static volatile int foobar;

static int bar (const int i, const long j)
{
  return i * j;
}

static int func (int (*f) ())
{
  const fooer baz = { .i = 2, .j = 21 };
  STAP_PROBE (test, constvalues);
  return f(baz.i, baz.j);
}

int
main (int argc, char *argv[], char *envp[])
{
  return func (&bar) - 42;
}

This is because of the following logic in dwarf_var_expanding_visitor::getscopes:

      // If the address is at the beginning of the scope_die, we can do a fast
      // getscopes from there.  Otherwise we need to look it up by address.
      Dwarf_Addr entrypc;
      if (q.dw.die_entrypc(scope_die, &entrypc) && entrypc == addr)
        scopes = q.dw.getscopes(scope_die);
      else
        scopes = q.dw.getscopes(addr);

-- 
           Summary: Getting wrong scope for inlined function
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: mjw at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10726

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


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