This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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 cli/13263] New: Functions marked__attribute__((always_inline,artificial)) are not ignored by 'step'.


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

             Bug #: 13263
           Summary: Functions marked
                    __attribute__((always_inline,artificial)) are not
                    ignored by 'step'.
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dnovillo@google.com
    Classification: Unclassified


This bug comes from the discussion thread at
http://codereview.appspot.com/5132047


$ cat a.c
static inline int foo (int) __attribute__((always_inline,artificial));

static inline int foo (int x)
{
  int y  = x - 3;
  return y;
}

int bar (int y)
{
  return y == 0;
}

main ()
{
  foo (10);
  return bar (foo (3));
}

$ <path-to-gcc-4.7>/bin/gcc -g -o a a.c
$ gdb --args ./a
[...]
Reading symbols from /home/dnovillo/inline-debug/a...done.
(gdb) b main
Breakpoint 1 at 0x400476: file a.c, line 16.
(gdb) run
Starting program: /home/dnovillo/inline-debug/a 

Breakpoint 1, main () at a.c:16
16        foo (10);
(gdb) s
foo () at a.c:5
5         int y  = x - 3;

This is unexpected.  Given that I marked the function always_inline and
artificial, I was expecting not to step into its body.

(gdb) s
foo () at a.c:6
6         return y;
(gdb) s
main () at a.c:17
17        return bar (foo (3));
(gdb) s
bar (y=0) at a.c:11
11        return y == 0;

Like here.  The nested call to foo(3) was skipped.  But the same didn't happen
when the call to foo() was by itself.

(gdb) s
12      }
(gdb) n
main () at a.c:18
18      }
(gdb) n


Is this behaviour expected?  If not, I'm not sure if this is a GCC or a GDB
bug.  I compiled the same program with gcc 4.4.3 and during stepping, I was
taken into *both* foo() calls.


Thanks.  Diego.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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