summaryrefslogtreecommitdiff
path: root/gdb/procfs.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2012-01-20 09:49:01 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2012-01-20 09:49:01 +0000
commit145b16a97aad6c8c3f30119d7c42b48753a0b1f8 (patch)
tree3aa77e79a0e0f7ffde18ce377e14c1b114b01c48 /gdb/procfs.c
parentb9e7b9c3de60f6aef716ac169d82418ea27d4331 (diff)
downloadbinutils-gdb-145b16a97aad6c8c3f30119d7c42b48753a0b1f8.tar.gz
ChangeLog:
* defs.h (enum info_proc_what): Moved here from linux-nat.c * infcmd.c: (info_proc_cmd_1): New function. (info_proc_cmd): New function, moved here from equivalent routine orignally in linux-nat.c. (info_proc_cmd_mappings): Likewise. (info_proc_cmd_stat): Likewise. (info_proc_cmd_status): Likewise. (info_proc_cmd_cwd): Likewise. (info_proc_cmd_cmdline): Likewise. (info_proc_cmd_exe): Likewise. (info_proc_cmd_all): Likewise. (_initialize_infcmd): Install "info proc" command and subcommands. * target.h (struct target_ops): Add to_info_proc. (target_info_proc): Add prototype. * target.c (target_info_proc): New function. * procfs.c (procfs_info_proc): Add prototype. (info_proc_cmd): Rename into ... (procfs_info_proc): ... this. Update argument types as appropriate for a to_info_proc implementation. Handle "what" argument. (procfs_target): Install procfs_info_proc. (_initialize_procfs): No longer install "info proc" command. * linux-nat.c: (enum info_proc_what): Remove. (linux_nat_info_proc_cmd_1): Rename into ... (linux_nat_info_proc): ... this. Update argument types as appropriate for a to_info_proc implementation. (linux_nat_info_proc_cmd): Remove. (linux_nat_info_proc_cmd_mappings): Likewise. (linux_nat_info_proc_cmd_stat): Likewise. (linux_nat_info_proc_cmd_status): Likewise. (linux_nat_info_proc_cmd_cwd): Likewise. (linux_nat_info_proc_cmd_cmdline): Likewise. (linux_nat_info_proc_cmd_exe): Likewise. (linux_nat_info_proc_cmd_all): Likewise. (linux_target_install_ops): Install linux_nat_info_proc. (_initialize_linux_nat): No longer install "info proc" command and subcommands. testsuite/ChangeLog: * gdb.base/info-proc.exp: Also run on remote targets. Main "info proc" command is now always present; whether target supports actual info proc operation is detected when attempting to issue the command.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r--gdb/procfs.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 14d923d0944..903621d6dfe 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -151,6 +151,9 @@ static char * procfs_make_note_section (bfd *, int *);
static int procfs_can_use_hw_breakpoint (int, int, int);
+static void procfs_info_proc (struct target_ops *, char *,
+ enum info_proc_what);
+
#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
/* When GDB is built as 64-bit application on Solaris, the auxv data
is presented in 64-bit format. We need to provide a custom parser
@@ -211,6 +214,7 @@ procfs_target (void)
t->to_has_thread_control = tc_schedlock;
t->to_find_memory_regions = proc_find_memory_regions;
t->to_make_corefile_notes = procfs_make_note_section;
+ t->to_info_proc = procfs_info_proc;
#if defined(PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
t->to_auxv_parse = procfs_auxv_parse;
@@ -5390,7 +5394,8 @@ info_proc_mappings (procinfo *pi, int summary)
/* Implement the "info proc" command. */
static void
-info_proc_cmd (char *args, int from_tty)
+procfs_info_proc (struct target_ops *ops, char *args,
+ enum info_proc_what what)
{
struct cleanup *old_chain;
procinfo *process = NULL;
@@ -5401,6 +5406,20 @@ info_proc_cmd (char *args, int from_tty)
int tid = 0;
int mappings = 0;
+ switch (what)
+ {
+ case IP_MINIMAL:
+ break;
+
+ case IP_MAPPINGS:
+ case IP_ALL:
+ mappings = 1;
+ break;
+
+ default:
+ error (_("Not supported on this target."));
+ }
+
old_chain = make_cleanup (null_cleanup, 0);
if (args)
{
@@ -5419,14 +5438,6 @@ info_proc_cmd (char *args, int from_tty)
{
tid = strtoul (argv[0] + 1, NULL, 10);
}
- else if (strncmp (argv[0], "mappings", strlen (argv[0])) == 0)
- {
- mappings = 1;
- }
- else
- {
- /* [...] */
- }
argv++;
}
if (pid == 0)
@@ -5567,10 +5578,6 @@ _initialize_procfs (void)
{
observer_attach_inferior_created (procfs_inferior_created);
- add_info ("proc", info_proc_cmd, _("\
-Show /proc process information about any running process.\n\
-Specify process id, or use the program being debugged by default.\n\
-Specify keyword 'mappings' for detailed info on memory mappings."));
add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd,
_("Give a trace of entries into the syscall."));
add_com ("proc-trace-exit", no_class, proc_trace_sysexit_cmd,