public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/32079] New: Can't insert internal breakpoints after inferior dlclose some share objects
@ 2024-08-13 13:16 blarsen at redhat dot com
  2024-08-14 12:19 ` [Bug breakpoints/32079] " ssbssa at sourceware dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: blarsen at redhat dot com @ 2024-08-13 13:16 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 32079
           Summary: Can't insert internal breakpoints after inferior
                    dlclose some share objects
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: blarsen at redhat dot com
  Target Milestone: ---

As I'm trying to debug what I think is an unrelated issue in
gdb.base/dlmopen.exp, I noticed that stepping through the program (using next)
GDB gets into a state where it tries to insert some internal breakpoints, and
so refuses to let me move forward, but I can't see the number of the breakpoint
to delete it.

Here's a simplified session:

```
$ ./gdb testsuite/outputs/gdb.base/dlmopen/dlmopen
(gdb) start
[Thread debugging using libthread_db enabled]                                   
Using host libthread_db library "/lib64/libthread_db.so.1".                     

Temporary breakpoint 1, main ()                                                 
    at
/home/gwenthekween/Documents/upstream-build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/dlmopen
.c:36
36        handle[0] = dlmopen (LM_ID_NEWLM, DSO1_NAME, RTLD_LAZY | RTLD_LOCAL);
(gdb) n
Python Exception <class 'AttributeError'>: module 'gdb' has no attribute
'_handle_missing_debuginfo'
Python Exception <class 'AttributeError'>: module 'gdb' has no attribute
'_handle_missing_debuginfo'
37        assert (handle[0] != NULL);
(gdb) print wait_for_gdb  = 0
$1 = 0
(gdb) handle SIGALRM ignore
Signal        Stop      Print   Pass to program Description
SIGALRM       No        No      No              Alarm clock
(gdb) next

<snip. removing unimportant "next"s>

54        for (dl = 0; dl < 4; ++dl)                     
(gdb)                                                    
56            fun = dlsym (handle[dl], "inc");           
(gdb)                                                    
57            assert (fun != NULL);                      
(gdb)                                                    
59            fun (42);                                  
(gdb)                                                    
61            dlclose (handle[dl]);                      
(gdb)                                                    
warning: error removing breakpoint 0 at 0x7ffff78169b9   
warning: error removing breakpoint 0 at 0x7ffff7730b57   
warning: error removing breakpoint 0 at 0x7ffff7730ad3   
54        for (dl = 0; dl < 4; ++dl)                     
(gdb)                                                    
Warning:                                                 
Cannot insert breakpoint 0.                              
Cannot access memory at address 0x7ffff7730ad3           
Cannot insert breakpoint 0.                              
Cannot access memory at address 0x7ffff7730b57           
Cannot insert breakpoint 0.                              
Cannot access memory at address 0x7ffff78169b9           

Command aborted.                                         
(gdb) p dl                                               
$2 = 2                                                   
(gdb) info break                                         
No breakpoints, watchpoints, tracepoints, or catchpoints.
(gdb) disas /m                           
Dump of assembler code for function main:

<snip unimportant disassembly>

54        for (dl = 0; dl < 4; ++dl)
   0x00000000004012bc <+294>:   movl   $0x0,-0x4(%rbp)
   0x00000000004012c3 <+301>:   jmp    0x401321 <main+395>
=> 0x000000000040131d <+391>:   addl   $0x1,-0x4(%rbp)
   0x0000000000401321 <+395>:   cmpl   $0x3,-0x4(%rbp)
   0x0000000000401325 <+399>:   jle    0x4012c5 <main+303>

<snip disassembly continues>

(gdb)
```

So, this happened after the last dlmopen-lib.1.so was dlclose'd, we are no
longer able to step.

If I set a breakpoint after the loop and continue over it, the issue doesn't
occur, so it seems to be related to internal "next" breakpoints in some way

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

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

end of thread, other threads:[~2025-02-24 17:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-13 13:16 [Bug breakpoints/32079] New: Can't insert internal breakpoints after inferior dlclose some share objects blarsen at redhat dot com
2024-08-14 12:19 ` [Bug breakpoints/32079] " ssbssa at sourceware dot org
2024-08-14 13:11 ` blarsen at redhat dot com
2024-08-16 19:42 ` ssbssa at sourceware dot org
2024-08-19 20:36 ` woodard at redhat dot com
2024-08-23 17:06 ` tromey at sourceware dot org
2024-08-30 11:22 ` aburgess at redhat dot com
2025-02-24 11:02 ` cvs-commit at gcc dot gnu.org
2025-02-24 11:02 ` cvs-commit at gcc dot gnu.org
2025-02-24 11:03 ` cvs-commit at gcc dot gnu.org
2025-02-24 16:35 ` aburgess at redhat dot com
2025-02-24 17:08 ` 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).