Bug 149125

Summary: FEAT: Gdb can't set break point at inlined function
Product: [Fedora] Fedora Reporter: H.J. Lu <hongjiu.lu>
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: gbenson, jan.kratochvil
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-21 19:11:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 418441    
Description Flags
A testcase none

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