public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/17534] New: GDB failed to set bp on source line that includes an inlined function call
@ 2014-11-03  4:04 flameroc at gmail dot com
  2015-06-25 22:38 ` [Bug breakpoints/17534] " sergiodj at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: flameroc at gmail dot com @ 2014-11-03  4:04 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug breakpoints/17534] GDB failed to set bp on source line that includes an inlined function call
  2014-11-03  4:04 [Bug breakpoints/17534] New: GDB failed to set bp on source line that includes an inlined function call flameroc at gmail dot com
@ 2015-06-25 22:38 ` sergiodj at redhat dot com
  2020-05-17 22:00 ` ssbssa at sourceware dot org
  2024-01-08 17:54 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: sergiodj at redhat dot com @ 2015-06-25 22:38 UTC (permalink / raw)
  To: gdb-prs

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

Sergio Durigan Junior <sergiodj at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sergiodj at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug breakpoints/17534] GDB failed to set bp on source line that includes an inlined function call
  2014-11-03  4:04 [Bug breakpoints/17534] New: GDB failed to set bp on source line that includes an inlined function call flameroc at gmail dot com
  2015-06-25 22:38 ` [Bug breakpoints/17534] " sergiodj at redhat dot com
@ 2020-05-17 22:00 ` ssbssa at sourceware dot org
  2024-01-08 17:54 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2020-05-17 22:00 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
I can reproduce this problem when I use gcc 7 or older to compile the example,
but with gcc 8.1 or newer, the breakpoint on line 19 works fine (it doesn't
matter which gdb version, I tested from 7.8 to current master):

(gdb) b 19
Breakpoint 1 at 0x402bfd: file gdb-17534.c, line 19.
(gdb) r
Starting program: C:\src\tests\gdb-17534-8.1.exe
[New Thread 1140.0x404]

Breakpoint 1, main () at gdb-17534.c:19
19          NVIC_EnableIRQ(16);


Not sure if this means that we can close this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug breakpoints/17534] GDB failed to set bp on source line that includes an inlined function call
  2014-11-03  4:04 [Bug breakpoints/17534] New: GDB failed to set bp on source line that includes an inlined function call flameroc at gmail dot com
  2015-06-25 22:38 ` [Bug breakpoints/17534] " sergiodj at redhat dot com
  2020-05-17 22:00 ` ssbssa at sourceware dot org
@ 2024-01-08 17:54 ` ssbssa at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-08 17:54 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |MOVED
             Status|NEW                         |RESOLVED

--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
I'm closing this since this was probably a debug info problem on gcc side that
was already fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-08 17:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-03  4:04 [Bug breakpoints/17534] New: GDB failed to set bp on source line that includes an inlined function call flameroc at gmail dot com
2015-06-25 22:38 ` [Bug breakpoints/17534] " sergiodj at redhat dot com
2020-05-17 22:00 ` ssbssa at sourceware dot org
2024-01-08 17:54 ` ssbssa at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).