gdb: don't print global thread-id to CLI in describe_other_breakpoints

I noticed that describe_other_breakpoints was printing the global
thread-id to the CLI.  For CLI output we should be printing the
inferior local thread-id (e.g. "2.1").  This can be seen in the
following GDB session:

  (gdb) info threads
    Id   Target Id                                Frame
    1.1  Thread 4065742.4065742 "bp-thread-speci" main () at /tmp/bp-thread-specific.c:27
  * 2.1  Thread 4065743.4065743 "bp-thread-speci" main () at /tmp/bp-thread-specific.c:27
  (gdb) break foo thread 2.1
  Breakpoint 3 at 0x40110a: foo. (2 locations)
  (gdb) break foo thread 1.1
  Note: breakpoint 3 (thread 2) also set at pc 0x40110a.
  Note: breakpoint 3 (thread 2) also set at pc 0x40110a.
  Breakpoint 4 at 0x40110a: foo. (2 locations)

Notice that GDB says:

  Note: breakpoint 3 (thread 2) also set at pc 0x40110a.

The 'thread 2' in here is using the global thread-id, we should
instead say 'thread 2.1' which corresponds to how the user specified
the breakpoint.

This commit fixes this issue and adds a test.

Approved-By: Pedro Alves <pedro@palves.net>
This commit is contained in:
Andrew Burgess
2023-02-08 11:37:44 +00:00
parent bb146a79c7
commit ce068c5f45
3 changed files with 93 additions and 1 deletions

View File

@@ -7045,7 +7045,10 @@ describe_other_breakpoints (struct gdbarch *gdbarch,
if (b->thread == -1 && thread != -1)
gdb_printf (" (all threads)");
else if (b->thread != -1)
gdb_printf (" (thread %d)", b->thread);
{
struct thread_info *thr = find_thread_global_id (b->thread);
gdb_printf (" (thread %s)", print_thread_id (thr));
}
gdb_printf ("%s%s ",
((b->enable_state == bp_disabled
|| b->enable_state == bp_call_disabled)