aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-09-08 21:46:21 +0000
committerPedro Alves <palves@redhat.com>2008-09-08 21:46:21 +0000
commit347bddb745acda8fb591511a547e66bbe00d768b (patch)
treee1ae89f31d0e51854b0454eaa75ec215a4c42191 /gdb/infcmd.c
parent078130d0caa5d5ec686abe6ee5589a644885082a (diff)
downloadgdb-347bddb745acda8fb591511a547e66bbe00d768b.zip
gdb-347bddb745acda8fb591511a547e66bbe00d768b.tar.gz
gdb-347bddb745acda8fb591511a547e66bbe00d768b.tar.bz2
* inferior.h (stop_bpstat): Delete.
* breakpoint.h (bpstat_do_actions): Remove bpstat* argument. * breakpoint.c (bpstat_do_actions): Rename to ... (bpstat_do_actions_1): ... this. Make static. Change return type to int. Return true if a breakpoint proceeded. (bpstat_do_actions): New, as wrapper around bpstat_do_actions_1. (delete_breakpoint): Don't reference the global stop_bpstat; it's gone. * gdbthread.h (struct thread_info): Add stop_bpstat. (save_infrun_state, load_infrun_state): Remove stop_bpstat argument. * thread.c (load_infrun_state, save_infrun_state): Remove stop_bpstat argument, and the code referencing it. * infcall.c: Include "gdbthread.h". (call_function_by_hand): Adjust. * exceptions.c: Include "gdbthread.h". (throw_exception): Adjust. * infcmd.c (stop_bpstat): Delete. (continue_command): In all-stop, set the ignore count on the thread that reported the stop. In non-stop, set it on the current thread. (finish_command_continuation): Adjust. (program_info): Adjust. * infrun.c (clear_proceed_status): Adjust. (context_switch): Don't context-switch stop_bpstat. (handle_inferior_event): Adjust. (normal_stop): Adjust. (save_inferior_status, restore_inferior_status): Adjust. * inf-loop.c (inferior_event_handler): Remove parameter to bpstat_do_actions call. * top.c (command_loop): Remove parameter to bpstat_do_actions call. Call it unconditionally. * event-top.c (command_handler): Ditto. * python/python.c (execute_gdb_command): Ditto.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c55
1 files changed, 45 insertions, 10 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index d6b9d02..e197467 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -155,10 +155,6 @@ enum target_signal stop_signal;
CORE_ADDR stop_pc;
-/* Chain containing status of breakpoint(s) that we have stopped at. */
-
-bpstat stop_bpstat;
-
/* Flag indicating that a command has proceeded the inferior past the
current breakpoint. */
@@ -673,9 +669,23 @@ Can't resume all threads and specify proceed count simultaneously."));
stopped at. */
if (args != NULL)
{
- bpstat bs = stop_bpstat;
+ bpstat bs = NULL;
int num, stat;
int stopped = 0;
+ struct thread_info *tp;
+
+ if (non_stop)
+ tp = find_thread_pid (inferior_ptid);
+ else
+ {
+ ptid_t last_ptid;
+ struct target_waitstatus ws;
+
+ get_last_target_status (&last_ptid, &ws);
+ tp = find_thread_pid (last_ptid);
+ }
+ if (tp != NULL)
+ bs = tp->stop_bpstat;
while ((stat = bpstat_num (&bs, &num)) != 0)
if (stat > 0)
@@ -1319,7 +1329,14 @@ finish_command_continuation (void *arg)
{
struct finish_command_continuation_args *a = arg;
- if (bpstat_find_breakpoint (stop_bpstat, a->breakpoint) != NULL
+ bpstat bs = NULL;
+
+ if (!ptid_equal (inferior_ptid, null_ptid)
+ && target_has_execution
+ && is_stopped (inferior_ptid))
+ bs = inferior_thread ()->stop_bpstat;
+
+ if (bpstat_find_breakpoint (bs, a->breakpoint) != NULL
&& a->function != NULL)
{
struct type *value_type;
@@ -1339,7 +1356,7 @@ finish_command_continuation (void *arg)
next stop will be in the same thread that we started doing a
finish on. This suppressing (or some other replacement means)
should be a thread property. */
- observer_notify_normal_stop (stop_bpstat);
+ observer_notify_normal_stop (bs);
suppress_stop_observer = 0;
delete_breakpoint (a->breakpoint);
}
@@ -1436,9 +1453,10 @@ finish_command (char *arg, int from_tty)
static void
program_info (char *args, int from_tty)
{
- bpstat bs = stop_bpstat;
- int num;
- int stat = bpstat_num (&bs, &num);
+ bpstat bs;
+ int num, stat;
+ struct thread_info *tp;
+ ptid_t ptid;
if (!target_has_execution)
{
@@ -1446,6 +1464,23 @@ program_info (char *args, int from_tty)
return;
}
+ if (non_stop)
+ ptid = inferior_ptid;
+ else
+ {
+ struct target_waitstatus ws;
+ get_last_target_status (&ptid, &ws);
+ }
+
+ if (ptid_equal (ptid, null_ptid) || is_exited (ptid))
+ error (_("Invalid selected thread."));
+ else if (is_running (ptid))
+ error (_("Selected thread is running."));
+
+ tp = find_thread_pid (ptid);
+ bs = tp->stop_bpstat;
+ stat = bpstat_num (&bs, &num);
+
target_files_info ();
printf_filtered (_("Program stopped at %s.\n"),
hex_string ((unsigned long) stop_pc));