/* { dg-options "-g -O2" } */
extern void abort (void);
extern void exit (int);
extern int printf (const char *, ...);

static int
foo (int x)
{
  typedef int T;
  T z = 2 * x;
  if (x <= 0)
    {
      printf ("foo\n");
      printf ("foo\n");
      printf ("foo\n");
      exit (0);
    }
  return 6;
}

__attribute__((noinline))
int bar (int x)
{
  return foo (x) + foo (6) + foo (x);
}

int
main (void)
{
  int l;
  asm volatile ("" : "=r" (l) : "0" (5));
  if (bar (l) != 18)
    abort ();
  bar (l - 10);
  abort ();
}

Debugging experience on this testcase isn't ideal, work will be needed both on
the gcc side and gdb side.  Roland has some ideas what should be done,
certainly DW_AT_artificial should be set on the foo.part* function, and perhaps
it should have some DW_TAG_lexical_block from the abstract DW_TAG_subprogram as
DW_AT_abstract_origin instead of the whole DW_TAG_subroutine (or perhaps some
artificial DW_TAG_lexical_block created just for that purpose?).
I'll let Roland write the details here himself.


-- 
           Summary: Debug info for partially inlined functions
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-debug
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44712

Reply via email to