]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Tweak "Using the running image of ..." output
authorPedro Alves <pedro@palves.net>
Sat, 3 Dec 2022 16:20:51 +0000 (16:20 +0000)
committerPedro Alves <pedro@palves.net>
Mon, 27 Feb 2023 19:12:28 +0000 (19:12 +0000)
Currently, "info files" and "info program" on a few native targets
show:

 (gdb) info files
 Symbols from "/home/pedro/gdb/tests/threads".
 Native process:
 Using the running image of child Thread 0x7ffff7d89740 (LWP 1097968).
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ...

 (gdb) info program
 Using the running image of child Thread 0x7ffff7d89740 (LWP 1097968).
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 Program stopped at 0x555555555278.
 ...

This patch changes them to:

 (gdb) info files
 Symbols from "/home/pedro/gdb/tests/threads".
 Native process:
 Using the running image of child process 1097968.
                                  ^^^^^^^^^^^^^^^
 ...

 (gdb) info program
 Using the running image of child process 1097968.
                                  ^^^^^^^^^^^^^^^
 Program stopped at 0x555555555278.
 ...

... which I think makes a lot more sense in this context.  The "info
program" manual entry even says:

  "Display information about the status of your program: whether it is
   running or not, what process it is, and why it stopped."
                        ^^^^^^^^^^^^^

This change affects ptrace targets, procfs targets, and Windows.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I6aab061ff494a84ba3398cf98fd49efd7a6ec1ca

gdb/inf-ptrace.c
gdb/nto-procfs.c
gdb/procfs.c
gdb/windows-nat.c

index a335165870586e8cf843d0849f8f0ce6a1dd69ad..ececf0e94986bd14339240c203be556dde62b52e 100644 (file)
@@ -522,7 +522,7 @@ inf_ptrace_target::files_info ()
 
   gdb_printf (_("\tUsing the running image of %s %s.\n"),
              inf->attach_flag ? "attached" : "child",
-             target_pid_to_str (inferior_ptid).c_str ());
+             target_pid_to_str (ptid_t (inf->pid)).c_str ());
 }
 
 std::string
index ffe11c69abfa4cba9555cd5fa124e89b8a25efcd..8e40efa31fcf0e85923ab2eb529ec34654acd915 100644 (file)
@@ -658,7 +658,7 @@ nto_procfs_target::files_info ()
 
   gdb_printf ("\tUsing the running image of %s %s via %s.\n",
              inf->attach_flag ? "attached" : "child",
-             target_pid_to_str (inferior_ptid).c_str (),
+             target_pid_to_str (ptid_t (inf->pid)).c_str (),
              (nodestr != NULL) ? nodestr : "local node");
 }
 
index 2c009c3e32047512c4053a197da0b6778cc640a4..741e62a24026e5fb75e40931ba1760229f116ecf 100644 (file)
@@ -2533,7 +2533,7 @@ procfs_target::files_info ()
 
   gdb_printf (_("\tUsing the running image of %s %s via /proc.\n"),
              inf->attach_flag? "attached": "child",
-             target_pid_to_str (inferior_ptid).c_str ());
+             target_pid_to_str (ptid_t (inf->pid)).c_str ());
 }
 
 /* Make it die.  Wait for it to die.  Clean up after it.  Note: this
index a8ce05393b9ea8ea8d97136425d4b51bd51caa06..26ad04b27be3415e9c7878cf2663a50eb883f509 100644 (file)
@@ -2123,7 +2123,7 @@ windows_nat_target::files_info ()
 
   gdb_printf ("\tUsing the running image of %s %s.\n",
              inf->attach_flag ? "attached" : "child",
-             target_pid_to_str (inferior_ptid).c_str ());
+             target_pid_to_str (ptid_t (inf->pid)).c_str ());
 }
 
 /* Modify CreateProcess parameters for use of a new separate console.