From 8dd27370eb43ed1a76883f04c9d93f83a1d195a0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:35:01 -0700 Subject: [PATCH] Add target_ops argument to to_pid_to_exec_file 2014-02-19 Tom Tromey * windows-nat.c (windows_pid_to_exec_file): Add 'self' argument. * target.h (struct target_ops) : Add argument. (target_pid_to_exec_file): Add argument. * target.c (debug_to_pid_to_exec_file): Add argument. (update_current_target): Update. * nbsd-nat.h (nbsd_pid_to_exec_file): Add 'self' argument. * nbsd-nat.c (nbsd_pid_to_exec_file): Add 'self' argument. * linux-nat.c (linux_child_pid_to_exec_file): Add 'self' argument. (linux_handle_extended_wait): Update. * inf-child.c (inf_child_pid_to_exec_file): Add 'self' argument. * fbsd-nat.h (fbsd_pid_to_exec_file): Add 'self' argument. * fbsd-nat.c (fbsd_pid_to_exec_file): Add 'self' argument. * darwin-nat.c (darwin_pid_to_exec_file): Add 'self' argument. --- gdb/ChangeLog | 17 +++++++++++++++++ gdb/darwin-nat.c | 2 +- gdb/fbsd-nat.c | 2 +- gdb/fbsd-nat.h | 2 +- gdb/inf-child.c | 2 +- gdb/linux-nat.c | 6 +++--- gdb/nbsd-nat.c | 2 +- gdb/nbsd-nat.h | 2 +- gdb/target.c | 6 +++--- gdb/target.h | 4 ++-- gdb/windows-nat.c | 2 +- 11 files changed, 32 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 09b88f7238..f9102b3dfe 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2014-02-19 Tom Tromey + + * windows-nat.c (windows_pid_to_exec_file): Add 'self' argument. + * target.h (struct target_ops) : Add + argument. + (target_pid_to_exec_file): Add argument. + * target.c (debug_to_pid_to_exec_file): Add argument. + (update_current_target): Update. + * nbsd-nat.h (nbsd_pid_to_exec_file): Add 'self' argument. + * nbsd-nat.c (nbsd_pid_to_exec_file): Add 'self' argument. + * linux-nat.c (linux_child_pid_to_exec_file): Add 'self' argument. + (linux_handle_extended_wait): Update. + * inf-child.c (inf_child_pid_to_exec_file): Add 'self' argument. + * fbsd-nat.h (fbsd_pid_to_exec_file): Add 'self' argument. + * fbsd-nat.c (fbsd_pid_to_exec_file): Add 'self' argument. + * darwin-nat.c (darwin_pid_to_exec_file): Add 'self' argument. + 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 9027010557..6cbfc83243 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1989,7 +1989,7 @@ set_enable_mach_exceptions (char *args, int from_tty, } static char * -darwin_pid_to_exec_file (int pid) +darwin_pid_to_exec_file (struct target_ops *self, int pid) { char *path; int res; diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 662fa554c5..43ee605cee 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -37,7 +37,7 @@ the child process identified by PID. */ char * -fbsd_pid_to_exec_file (int pid) +fbsd_pid_to_exec_file (struct target_ops *self, int pid) { size_t len = PATH_MAX; char *buf = xcalloc (len, sizeof (char)); diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h index d9d1443e0c..a048733da4 100644 --- a/gdb/fbsd-nat.h +++ b/gdb/fbsd-nat.h @@ -23,7 +23,7 @@ /* Return the name of a file that can be opened to get the symbols for the child process identified by PID. */ -extern char *fbsd_pid_to_exec_file (int pid); +extern char *fbsd_pid_to_exec_file (struct target_ops *self, int pid); /* Iterate over all the memory regions in the current inferior, calling FUNC for each memory region. OBFD is passed as the last diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 37fac4b412..e047636888 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -134,7 +134,7 @@ inf_child_can_run (struct target_ops *self) } static char * -inf_child_pid_to_exec_file (int pid) +inf_child_pid_to_exec_file (struct target_ops *self, int pid) { /* This version of Unix doesn't support translation of a process ID to the filename of the executable file. */ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 50eef3ad7a..9652692439 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -844,7 +844,7 @@ linux_nat_pass_signals (struct target_ops *self, /* Prototypes for local functions. */ static int stop_wait_callback (struct lwp_info *lp, void *data); static int linux_thread_alive (ptid_t ptid); -static char *linux_child_pid_to_exec_file (int pid); +static char *linux_child_pid_to_exec_file (struct target_ops *self, int pid); /* Convert wait status STATUS to a string. Used for printing debug @@ -2193,7 +2193,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status, ourstatus->kind = TARGET_WAITKIND_EXECD; ourstatus->value.execd_pathname - = xstrdup (linux_child_pid_to_exec_file (pid)); + = xstrdup (linux_child_pid_to_exec_file (NULL, pid)); return 0; } @@ -4033,7 +4033,7 @@ linux_nat_thread_name (struct target_ops *self, struct thread_info *thr) can be opened to get the symbols for the child process. */ static char * -linux_child_pid_to_exec_file (int pid) +linux_child_pid_to_exec_file (struct target_ops *self, int pid) { char *name1, *name2; diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c index 347636f0ab..72c471b4c2 100644 --- a/gdb/nbsd-nat.c +++ b/gdb/nbsd-nat.c @@ -25,7 +25,7 @@ the child process identified by PID. */ char * -nbsd_pid_to_exec_file (int pid) +nbsd_pid_to_exec_file (struct target_ops *self, int pid) { size_t len = PATH_MAX; char *buf = xcalloc (len, sizeof (char)); diff --git a/gdb/nbsd-nat.h b/gdb/nbsd-nat.h index dc6a57092e..145505d57c 100644 --- a/gdb/nbsd-nat.h +++ b/gdb/nbsd-nat.h @@ -23,6 +23,6 @@ /* Return the name of a file that can be opened to get the symbols for the child process identified by PID. */ -extern char *nbsd_pid_to_exec_file (int pid); +extern char *nbsd_pid_to_exec_file (struct target_ops *self, int pid); #endif /* nbsd-nat.h */ diff --git a/gdb/target.c b/gdb/target.c index 38504945ef..7ffe2df3eb 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -831,7 +831,7 @@ update_current_target (void) (void (*) (struct target_ops *, char *, struct ui_file *)) tcomplain); de_fault (to_pid_to_exec_file, - (char *(*) (int)) + (char *(*) (struct target_ops *, int)) return_null); de_fault (to_thread_architecture, default_thread_architecture); @@ -5004,11 +5004,11 @@ debug_to_rcmd (struct target_ops *self, char *command, } static char * -debug_to_pid_to_exec_file (int pid) +debug_to_pid_to_exec_file (struct target_ops *self, int pid) { char *exec_file; - exec_file = debug_target.to_pid_to_exec_file (pid); + exec_file = debug_target.to_pid_to_exec_file (&debug_target, pid); fprintf_unfiltered (gdb_stdlog, "target_pid_to_exec_file (%d) = %s\n", pid, exec_file); diff --git a/gdb/target.h b/gdb/target.h index af8d8343cb..d1bb68c896 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -527,7 +527,7 @@ struct target_ops void (*to_stop) (struct target_ops *, ptid_t); void (*to_rcmd) (struct target_ops *, char *command, struct ui_file *output); - char *(*to_pid_to_exec_file) (int pid); + char *(*to_pid_to_exec_file) (struct target_ops *, int pid); void (*to_log_command) (const char *); struct target_section_table *(*to_get_section_table) (struct target_ops *); enum strata to_stratum; @@ -1545,7 +1545,7 @@ extern char *target_thread_name (struct thread_info *); it must persist. */ #define target_pid_to_exec_file(pid) \ - (current_target.to_pid_to_exec_file) (pid) + (current_target.to_pid_to_exec_file) (¤t_target, pid) /* See the to_thread_architecture description in struct target_ops. */ diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 7514eb5a62..bc00c43c00 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1994,7 +1994,7 @@ windows_detach (struct target_ops *ops, const char *args, int from_tty) } static char * -windows_pid_to_exec_file (int pid) +windows_pid_to_exec_file (struct target_ops *self, int pid) { static char path[__PMAX]; #ifdef __CYGWIN__ -- 2.34.1