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 breakpoints/17534] New: GDB failed to set bp on source line that includes an inlined function call


https://sourceware.org/bugzilla/show_bug.cgi?id=17534

            Bug ID: 17534
           Summary: GDB failed to set bp on source line that includes an
                    inlined function call
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: flameroc at gmail dot com

When try to set breakpoint on a source line that includes an inlined function
call, gdb complains:

No line 19 in file "g.c".
Make breakpoint pending on future shared library load? (y or [n]) n

But from the view of user, indeed there is a souce code at line 19. Is there
any way to allow setting bp on line 19 to improve debug experience? Here are
complete case and steps to reproduce this issue on x86:

GNU gdb (GDB) 7.8.50.20141029-cvs
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from g.o...done.
(gdb) !cat -n g.c
     1    volatile int x;
     2    
     3    static inline void NVIC_EnableIRQ(int IRQn)
     4    {
     5      volatile int y;
     6      y = IRQn;
     7    }
     8    
     9    __attribute__( ( always_inline ) ) static inline void __WFI(void)
    10    {
    11        __asm volatile ("nop");
    12    }
    13    
    14    int main(void) {
    15    
    16        x= 42;
    17    
    18        if (x)
    19          NVIC_EnableIRQ(16);
    20        else
    21          NVIC_EnableIRQ(18);
    22    
    23        while (1)
    24          {
    25        __WFI();
    26          }
    27    
    28        return 0 ;
    29    }
    30    
(gdb) b g.c:19
No line 19 in file "g.c".
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) 

The g.o is generated from command "../x86/install/bin/gcc -O2 -g3 -c g.c". The
gcc is from pretty recent gcc trunk.

I checked the assembly code and found the call on line 19 is turnd into below
assembly code:

.LBB9:
        .loc 1 6 0
        movl    $16, -8(%rsp)

If I add more dwarf line information here like below:

.LBB9:
        .loc 1 6 0
        .loc 1 19 0
        movl    $16, -8(%rsp)

I am able to set the bp on line 19. I guess I can improve gcc to generate more
dwarf line information to solve this issue. But not sure whether it is a
correct direction. Could somebody please give some advice? Thanks.

-- 
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]