Bug 149125 - FEAT: Gdb can't set break point at inlined function
Summary: FEAT: Gdb can't set break point at inlined function
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jan Kratochvil
QA Contact: Fedora Extras Quality Assurance
: 149126 (view as bug list)
Depends On:
Blocks: 418441
TreeView+ depends on / blocked
Reported: 2005-02-18 23:18 UTC by H.J. Lu
Modified: 2016-03-21 19:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed: 2016-03-21 19:11:18 UTC
Type: ---

Attachments (Terms of Use)
A testcase (462 bytes, application/octet-stream)
2005-04-22 20:02 UTC, H.J. Lu
no flags Details

System ID Private Priority Status Summary Last Updated
Sourceware 10738 0 None None None Never

Description H.J. Lu 2005-02-18 23:18:46 UTC
When I tried to debug the linker from default binutils build, I got

(gdb) b map_sections_to_segments
Function "map_sections_to_segments" not defined.

From readelf -w, I see

<1><a7e8>: Abbrev Number: 75 (DW_TAG_subprogram)
     DW_AT_sibling     : <a97e>
     DW_AT_name        : (indirect string, offset: 0x6801):
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3405
     DW_AT_prototyped  : 1
     DW_AT_type        : <942>
     DW_AT_inline      : 1      (inlined)

The line number looks right. Gdb should be able to figure something

Comment 1 H.J. Lu 2005-04-22 19:54:39 UTC
FYI, Intel't idb has no problem with it.

Comment 2 H.J. Lu 2005-04-22 20:02:09 UTC
Created attachment 113572 [details]
A testcase

[hjl@gnu-10 inline]$ make
/usr/gcc-4.0/bin/gcc -O2 -g -o x x.c
[hjl@gnu-10 inline]$ gdb x
GNU gdb
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 "i686-pc-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".

(gdb) b foo
Function "foo" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) q
[hjl@gnu-10 inline]$ /opt/intel/idb80/bin/idb -gdb x
Linux Application Debugger for 32-bit applications, Version 8.1-7, Build
object file name: x
Reading symbols from /export/home/hjl/bugs/gcc/debug/inline/x...done.
(idb) b foo
Breakpoint 1 at 0x8048371: file x.c, line 11.
(idb) r
Starting program: /export/home/hjl/bugs/gcc/debug/inline/x

Breakpoint 1, foo (x=Info: symbol x is defined but not allocated (optimized
<no value>) at x.c:11
11	      printf ("%d\n", y);
(idb) bt
#0  0x08048371 in inlined foo (x=Info: symbol x is defined but not allocated
(optimized away)
<no value>) at x.c:11
#1	       in main () at x.c:27
#2  0x4e11be33 in __libc_start_main () in /lib/tls/libc-2.3.4.so
#3  0x080482e1 in _start () in /export/home/hjl/bugs/gcc/debug/inline/x

Comment 3 Jan Kratochvil 2007-01-02 02:00:43 UTC
Confirming this feature is not present, neither in upstream CVS:

dwarf2read.c: process_die ():
    case DW_TAG_inlined_subroutine:
      /* FIXME:  These are ignored for now.
         They could be used to set breakpoints on all inlined instances
         of a function and make GDB `next' properly over inlined functions.  */

Comment 4 Jan Kratochvil 2007-01-02 02:05:10 UTC
*** Bug 149126 has been marked as a duplicate of this bug. ***

Comment 5 Andrew Cagney 2007-12-10 18:38:13 UTC
This is an upstream problem; close the bug with category "UPSTREAM".

Comment 7 Fedora Admin XMLRPC Client 2011-01-06 03:21:58 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 8 Jay Turner 2011-02-15 15:21:20 UTC
Just a tad over 3 years . . . can this be closed out or should it be re-prioritized for recent Fedora development?

Comment 9 Jan Kratochvil 2011-02-15 15:26:26 UTC
It is still a valid Bug, it is occasionally discussed as one of the next TODO items.

Comment 11 Jan Kratochvil 2016-03-21 19:11:18 UTC
(gdb) b foo
Breakpoint 1 at 0x400444: file x.c, line 11.
(gdb) r
Starting program: /tmp/foodir/x 
Breakpoint 1, main () at x.c:30
30	  i = foo (1);
(gdb) bt
#0  main () at x.c:30
(gdb) p/x $pc
$1 = 0x400444
(gdb) step
foo (x=1) at x.c:11
11	      printf ("%d\n", y);
(gdb) p/x $pc
$2 = 0x400444
(gdb) bt
#0  foo (x=1) at x.c:11
#1  main () at x.c:30

Fixed by Gary Benson in 2012

Note You need to log in before you can comment on or make changes to this bug.