diff options
author | Pedro Alves <palves@redhat.com> | 2014-05-21 18:30:45 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-05-21 18:30:45 +0100 |
commit | 132f8e032c8e82980c12d861089da561fc4dda35 (patch) | |
tree | dcb67ad6811f04153ece17173a75f4cc4758dca6 /gdb/nto-procfs.c | |
parent | 03c136c31c777605cb4f13cfc1286d21b4ffa3b0 (diff) | |
download | binutils-gdb-132f8e032c8e82980c12d861089da561fc4dda35.tar.gz |
nto-procfs.c: Add "target native".
This makes QNX/NTO end up with two targets. It preserves "target
procfs <node>", and adds a "native" target to be like other native
ports.
Not tested.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* nto-procfs.c (procfs_can_run): New function.
(nto_procfs_ops): New global.
(init_procfs_targets): New, based on procfs_target. Install
"target native" in addition to "target procfs".
(_initialize_procfs): Call init_procfs_targets instead of adding
the target here.
Diffstat (limited to 'gdb/nto-procfs.c')
-rw-r--r-- | gdb/nto-procfs.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index c552a8eb1f1..b328dfa99bf 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -1370,18 +1370,31 @@ procfs_pid_to_str (struct target_ops *ops, ptid_t ptid) return buf; } -/* Create a nto-procfs target. */ +/* to_can_run implementation for "target procfs". Note this really + means "can this target be the default run target", which there can + be only one, and we make it be "target native" like other ports. + "target procfs <node>" wouldn't make sense as default run target, as + it needs <node>. */ -static struct target_ops * -procfs_target (void) +static int +procfs_can_run (struct target_ops *self) +{ + return 0; +} + +/* "target procfs". */ +static struct target_ops nto_procfs_ops; + +/* Create the "native" and "procfs" targets. */ + +static void +init_procfs_targets (void) { struct target_ops *t = inf_child_target (); - t->to_shortname = "procfs"; - t->to_longname = "QNX Neutrino procfs child process"; - t->to_doc - = "QNX Neutrino procfs child process (started by the \"run\" command).\n\ - target procfs <node>"; + /* Leave to_shortname as "native". */ + t->to_longname = "QNX Neutrino local process"; + t->to_doc = "QNX Neutrino local process (started by the \"run\" command)."; t->to_open = procfs_open; t->to_attach = procfs_attach; t->to_post_attach = procfs_post_attach; @@ -1411,7 +1424,16 @@ procfs_target (void) t->to_have_continuable_watchpoint = 1; t->to_extra_thread_info = nto_extra_thread_info; - return t; + /* Register "target native". This is the default run target. */ + add_target (t); + + /* Register "target procfs <node>". */ + nto_procfs_ops = *t; + nto_procfs_ops.to_shortname = "procfs"; + nto_procfs_ops.to_can_run = procfs_can_run; + t->to_longname = "QNX Neutrino local or remote process"; + t->to_doc = "QNX Neutrino process. target procfs <node>"; + add_target (&nto_procfs_ops); } #define OSTYPE_NTO 1 @@ -1420,10 +1442,8 @@ void _initialize_procfs (void) { sigset_t set; - struct target_ops *t; - t = procfs_target (); - add_target (t); + init_procfs_targets (); /* We use SIGUSR1 to gain control after we block waiting for a process. We use sigwaitevent to wait. */ |