Bug 30086 - thread-specific breakpoints end up unnecessarily set in every inferior / address space
Summary: thread-specific breakpoints end up unnecessarily set in every inferior / addr...
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-06 17:23 UTC by Pedro Alves
Modified: 2023-02-06 17:23 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Alves 2023-02-06 17:23:32 UTC
A thread-specific breakpoint really only needs to have locations for the address/program space of the inferior which the thread belongs to.  However, we currently expand the breakpoint spec in every program space anyhow.  Vis:

 (gdb) b main thread 1.1
 Breakpoint 1 at 0x1285: main. (2 locations)
 (gdb) info breakpoints 
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>          thread 1
         stop only in thread 1.1
 1.1                         y   0x0000000000001285 in main at 
 gdb.multi/goodbye.c:61 inf 2
 1.2                         y   0x00005555555551f0 in main at 
 gdb.multi/hello.c:51 inf 1

Location 1.1 above is worse than useless, as it'll end up inserted and cause inferior 2 to unnecessarily stop only to always be re-resumed.

We should instead end up with only one location for inferior 1, just like if inferior 2 did not exist, like:

 (gdb) b main thread 1.1
 Breakpoint 1 at 0x5555555551f0: file  gdb.multi/hello.c, line 51.
 (gdb) info breakpoints 
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   0x00005555555551f0 in main at 
 gdb.multi/hello.c:51 thread 1
         stop only in thread 1