[PATCH v4 11/44] gdb: revise the pid_to_exec_file target op

Markus Metzger <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
From: Tankut Baris Aktemur <[email protected]>

Some targets, such as Intel GT, do not have the notion of an exec
file.  These targets may leave the pid_to_exec_file target op
unimplemented, but from GDB's point of view, this means the exec file
could not be determined, and GDB issues a warning.

Extend the meaning of the pid_to_exec_file target op, so that if the
exec file path is empty, it means that the target does not have exec
files at all.  This way, GDB can omit checking the exec file while
also not issuing the warning.
---
 gdb/exec.c   | 6 ++++++
 gdb/target.h | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/gdb/exec.c b/gdb/exec.c
index f4c82519449..2a0626d6161 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -337,6 +337,12 @@ exec_file_locate_attach (int pid, int defer_bp_reset, int from_tty)
       return;
     }
 
+  if (*exec_file_target == '\0')
+    {
+      /* The target does not have the notion of an exec file.  */
+      return;
+    }
+
   scoped_normalized_path path_storage (&exec_file_target);
 
   gdb::unique_xmalloc_ptr<char> exec_file_host
diff --git a/gdb/target.h b/gdb/target.h
index 6d1c21f29f6..fd25afb12dc 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2025,6 +2025,9 @@ extern gdb::array_view<const gdb_byte> target_thread_info_to_thread_handle
 
    If the executable file cannot be determined, NULL is returned.
 
+   If the target does not have the notion of executable files,
+   an empty string is returned.
+
    Else, a pointer to a character string containing the pathname
    is returned.  This string should be copied into a buffer by
    the client if the string will not be immediately used, or if
-- 
2.43.0

________________________________________
Intel Deutschland GmbH 

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany 

Tel: +49 (89) 99143-0 

www.intel.de 

Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman

Chairperson of the Supervisory Board: Sonja Pierer

Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.