diff options
author | Tom Tromey <tromey@redhat.com> | 2013-12-18 14:38:04 -0700 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-02-19 07:48:11 -0700 |
commit | 098dba18ee55150df53f3a6846de4dd9c7564088 (patch) | |
tree | d611f281682d1585b4ba273f947d85c6537234e7 /gdb/target.c | |
parent | 423a48075e748691f7fa83dbae404da3e4edc914 (diff) | |
download | gdb-098dba18ee55150df53f3a6846de4dd9c7564088.zip gdb-098dba18ee55150df53f3a6846de4dd9c7564088.tar.gz gdb-098dba18ee55150df53f3a6846de4dd9c7564088.tar.bz2 |
convert to_follow_fork
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (default_follow_fork): New function.
(target_follow_fork): Unconditionally delegate.
* target.h (struct target_ops) <to_follow_fork>: Use
TARGET_DEFAULT_FUNC.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/gdb/target.c b/gdb/target.c index 3d27eda..9afb317 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -60,6 +60,9 @@ static void default_rcmd (struct target_ops *, char *, struct ui_file *); static ptid_t default_get_ada_task_ptid (struct target_ops *self, long lwp, long tid); +static int default_follow_fork (struct target_ops *self, int follow_child, + int detach_fork); + static void tcomplain (void) ATTRIBUTE_NORETURN; static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *); @@ -2632,31 +2635,29 @@ target_program_signals (int numsigs, unsigned char *program_signals) } } +static int +default_follow_fork (struct target_ops *self, int follow_child, + int detach_fork) +{ + /* Some target returned a fork event, but did not know how to follow it. */ + internal_error (__FILE__, __LINE__, + _("could not find a target to follow fork")); +} + /* Look through the list of possible targets for a target that can follow forks. */ int target_follow_fork (int follow_child, int detach_fork) { - struct target_ops *t; - - for (t = current_target.beneath; t != NULL; t = t->beneath) - { - if (t->to_follow_fork != NULL) - { - int retval = t->to_follow_fork (t, follow_child, detach_fork); - - if (targetdebug) - fprintf_unfiltered (gdb_stdlog, - "target_follow_fork (%d, %d) = %d\n", - follow_child, detach_fork, retval); - return retval; - } - } + int retval = current_target.to_follow_fork (¤t_target, + follow_child, detach_fork); - /* Some target returned a fork event, but did not know how to follow it. */ - internal_error (__FILE__, __LINE__, - _("could not find a target to follow fork")); + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, + "target_follow_fork (%d, %d) = %d\n", + follow_child, detach_fork, retval); + return retval; } void |