diff options
author | Josh Stone <jistone@redhat.com> | 2015-12-04 13:28:07 -0800 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2015-12-04 18:25:26 -0800 |
commit | ece66d651004eac0210217c4d48babf4e80d1f2e (patch) | |
tree | 4033870f99986038ba2eaa491d2d4b4e31dcfc52 /gdb/gdbserver/target.h | |
parent | cc51fd4ccfdca1559efb0351b498bd8c0f3d1eed (diff) | |
download | gdb-ece66d651004eac0210217c4d48babf4e80d1f2e.zip gdb-ece66d651004eac0210217c4d48babf4e80d1f2e.tar.gz gdb-ece66d651004eac0210217c4d48babf4e80d1f2e.tar.bz2 |
gdbserver: set ptrace flags after creating inferiors
Rename target_ops.arch_setup to .post_create_inferior. In the Linux
hook, continue calling the low arch setup, then also set ptrace flags.
This corrects the possibility of running without flags, demonstrated by
a new test that would fail to catch a fork before.
gdb/gdbserver/ChangeLog:
2015-12-04 Josh Stone <jistone@redhat.com>
* target.h (struct target_ops) <arch_setup>: Rename to ...
(struct target_ops) <post_create_inferior>: ... this.
(target_arch_setup): Rename to ...
(target_post_create_inferior): ... this, calling post_create_inferior.
* server.c (start_inferior): Update target_arch_setup calls to
target_post_create_inferior.
* linux-low.c (linux_low_ptrace_options): Forward declare.
(linux_arch_setup): Update its comment for general use.
(linux_post_create_inferior): New, run arch_setup and setup ptrace.
(struct linux_target_ops): Use linux_post_create_inferior.
* lynx-low.c (struct lynx_target_ops): Update arch_setup stub comment
to post_create_inferior.
* nto-low.c (struct nto_target_ops): Likewise.
* spu-low.c (struct spu_target_ops): Likewise.
* win32-low.c (struct win32_target_ops): Likewise.
gdb/testsuite/ChangeLog:
2015-12-04 Josh Stone <jistone@redhat.com>
* gdb.base/catch-fork-static.exp: New.
Diffstat (limited to 'gdb/gdbserver/target.h')
-rw-r--r-- | gdb/gdbserver/target.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 9cd07bc..1a38b20 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -75,8 +75,9 @@ struct target_ops int (*create_inferior) (char *program, char **args); - /* Architecture-specific setup. */ - void (*arch_setup) (void); + /* Do additional setup after a new process is created, including + exec-wrapper completion. */ + void (*post_create_inferior) (void); /* Attach to a running process. @@ -475,11 +476,11 @@ void set_target_ops (struct target_ops *); #define create_inferior(program, args) \ (*the_target->create_inferior) (program, args) -#define target_arch_setup() \ - do \ - { \ - if (the_target->arch_setup != NULL) \ - (*the_target->arch_setup) (); \ +#define target_post_create_inferior() \ + do \ + { \ + if (the_target->post_create_inferior != NULL) \ + (*the_target->post_create_inferior) (); \ } while (0) #define myattach(pid) \ |