public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "blarsen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/32079] New: Can't insert internal breakpoints after inferior dlclose some share objects
Date: Tue, 13 Aug 2024 13:16:07 +0000	[thread overview]
Message-ID: <bug-32079-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2024-08-13 13:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13 13:16 blarsen at redhat dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-32079-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).