Opened 11 years ago

Closed 9 years ago

#36802 closed defect (fixed)

GDB won't "step in" (s)

Reported by: dave@… Owned by: stuartwesterman (Stuart Westerman)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc: cooljeanius (Eric Gallager)
Port: gdb

Description

Compile this program with gcc -O0 -g x.c -o x, then ggdb x. Enter b main, then run, then s. The program should be stopped on line 3 (return 5), but it's not.

int f()
{
    return 5;
}

int main()
{
    return !f();
}

Change History (12)

comment:1 Changed 11 years ago by dave@…

Sorry, this was my own port@7.4.1 Now trying 7.5 and will close if invalid

comment:2 Changed 11 years ago by dave@…

Works! I don't have permissions to close the ticket, but someone should

comment:3 Changed 11 years ago by dave@…

I take it back. Modify the program by adding the inline keyword before f, and it's still broken.

comment:4 Changed 11 years ago by dave@…

If I compile with -finline-limit=0 I can "step in" again. Not sure if there's a bug in a tool or just with me :-)

comment:5 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to dweber@…
Priority: HighNormal

comment:6 Changed 11 years ago by jmroot (Joshua Root)

Seems odd that gcc would be inlining at -O0, but I think if the function is inlined, it's physically impossible to step into it because there's no code emitted for it.

comment:7 Changed 11 years ago by dave@…

There certainly is code emitted for inline functions, and I can step into them using the system gdb.

pluto:/tmp dave% cat > tst.c
inline int f()
{
    return 5;
}

int main()
{
    return !f();
}
pluto:/tmp dave% /usr/bin/gcc -O0 -g tst.c -o tst
pluto:/tmp dave% /usr/bin/gdb tst
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug  5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .. done

(gdb) b main
Breakpoint 1 at 0x100000ee4: file tst.c, line 8.
(gdb) run
Starting program: /private/tmp/tst 
Reading symbols for shared libraries +............................. done

Breakpoint 1, main () at tst.c:8
8	    return !f();
(gdb) s
f () at tst.c:3
3	    return 5;

comment:8 Changed 10 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:9 Changed 10 years ago by mf2k (Frank Schima)

Owner: changed from dweber@… to macports-tickets@…

dweber has retired. See #43834.

comment:10 Changed 10 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to stuartwesterman@…

comment:11 Changed 9 years ago by stuartwesterman (Stuart Westerman)

There is no problem now. Please close.

comment:12 Changed 9 years ago by larryv (Lawrence Velázquez)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.