Files
binutils-gdb/gdb/testsuite/gdb.multi
Kevin Buettner 4df2f3f971 Print only process ptids from linux-fork.c
This commit causes a "process ptid" to be passed to all calls
of target_pid_to_str in linux-fork.c.  A "process ptid" is one
in which only the pid component is set to a non-zero value;
both the lwp  and tid components are zero.

The reason for doing this is that pids associated with checkpoints can
never be a thread due to the fact that checkpoints (which are
implemented by forking a process) can only (reasonably) work with
single-threaded processes.

Without this commit, many of the "info checkpoints" commands
in gdb.multi/checkpoint-multi.exp will incorrectly show some
of the checkpoints as threads.  E.g...

  Id  Active Target Id                          Frame
* 1.0 y      Thread 0x7ffff7cb5740 (LWP 581704) at 0x401199, file hello.c, line 51
  1.2 n      process 581716                     at 0x401199, file hello.c, line 51
  1.3 n      process 581717                     at 0x401199, file hello.c, line 51
  2.1 n      process 581708                     at 0x401258, file goodbye.c, line 62
  2.2 y      Thread 0x7ffff7cb5740 (LWP 581712) at 0x401258, file goodbye.c, line 62
  3.0 y      Thread 0x7ffff7cb5740 (LWP 581713) at 0x40115c, file hangout.c, line 31
  3.2 n      process 581715                     at 0x40115c, file hangout.c, line 31
(gdb

With this commit in place, the output looks like this instead:

  Id  Active Target Id      Frame
* 1.0 y      process 535276 at 0x401199, file hello.c, line 51
  1.2 n      process 535288 at 0x401199, file hello.c, line 51
  1.3 n      process 535289 at 0x401199, file hello.c, line 51
  2.1 n      process 535280 at 0x401258, file goodbye.c, line 62
  2.2 y      process 535284 at 0x401258, file goodbye.c, line 62
  3.0 y      process 535285 at 0x40115c, file hangout.c, line 31
  3.2 n      process 535287 at 0x40115c, file hangout.c, line 31

(For brevity, I've removed the directory elements in each of the paths
above.)

The testcase, gdb.multi/checkpoint-multi.exp, has been updated to
reflect the fact that only "process" should now appear in output
from "info checkpoints".

Reviewed-By: Tom Tromey <tom@tromey.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-02-05 11:28:29 -07:00
..