gdb: don't print global thread-id to CLI in describe_other_breakpoints
authorAndrew Burgess <aburgess@redhat.com>
Wed, 8 Feb 2023 11:37:44 +0000 (11:37 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Sat, 11 Feb 2023 17:35:14 +0000 (17:35 +0000)
commitce068c5f45aeebc9729499253e0a8f1f29be65c2
treec171af9481d70451fa50a355b23a268537a2cb52
parentbb146a79c7d65e2b578e8c3f652cb118c63741e5
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>
gdb/breakpoint.c
gdb/testsuite/gdb.multi/bp-thread-specific.c [new file with mode: 0644]
gdb/testsuite/gdb.multi/bp-thread-specific.exp [new file with mode: 0644]