aboutsummaryrefslogtreecommitdiff
path: root/gdb/inferior.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-09-30 10:24:40 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-09-30 10:24:40 +0000
commitcd2effb255e6018687256a2d10072a1e4da0c6c5 (patch)
treeac6d0a134f37ca0759e8f10558093af355aea302 /gdb/inferior.c
parentf81bc8b5f1973d3b89d1504adf2fe216e86968c2 (diff)
downloadgdb-cd2effb255e6018687256a2d10072a1e4da0c6c5.zip
gdb-cd2effb255e6018687256a2d10072a1e4da0c6c5.tar.gz
gdb-cd2effb255e6018687256a2d10072a1e4da0c6c5.tar.bz2
gdb/
PR corefiles/12071. * inferior.c (have_live_inferiors): New variables old_chain, inf and tp. Iterate INFERIOR_LIST and call target_has_execution. gdb/testsuite/ PR corefiles/12071. * gdb.base/corefile.exp (quit with a process, no question: load core) (quit with a core file): New tests.
Diffstat (limited to 'gdb/inferior.c')
-rw-r--r--gdb/inferior.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 28c5867..0f94f18 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -461,16 +461,29 @@ have_inferiors (void)
int
have_live_inferiors (void)
{
- struct target_ops *t;
+ struct cleanup *old_chain;
+ struct inferior *inf;
- /* The check on stratum suffices, as GDB doesn't currently support
- multiple target interfaces. */
- if (have_inferiors ())
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- if (t->to_stratum == process_stratum)
- return 1;
+ old_chain = make_cleanup_restore_current_thread ();
- return 0;
+ for (inf = inferior_list; inf; inf = inf->next)
+ if (inf->pid != 0)
+ {
+ struct thread_info *tp;
+
+ tp = any_thread_of_process (inf->pid);
+ if (tp)
+ {
+ switch_to_thread (tp->ptid);
+
+ if (target_has_execution)
+ break;
+ }
+ }
+
+ do_cleanups (old_chain);
+
+ return inf != NULL;
}
/* Prune away automatically added program spaces that aren't required