aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-03-22 18:06:07 +0000
committerPedro Alves <palves@redhat.com>2009-03-22 18:06:07 +0000
commitf3b1572e1aedb92f0d7672c384de4bbc70b59757 (patch)
tree156787f18411aebdcd4ea9c7af26977336416e08 /gdb/mi
parentc5a4d20bb945df22e3244f60cff1860932802354 (diff)
downloadfsf-binutils-gdb-f3b1572e1aedb92f0d7672c384de4bbc70b59757.zip
fsf-binutils-gdb-f3b1572e1aedb92f0d7672c384de4bbc70b59757.tar.gz
fsf-binutils-gdb-f3b1572e1aedb92f0d7672c384de4bbc70b59757.tar.bz2
gdb/
* mi/mi-interp.c (mi_interpreter_init): Attach mi_about_to_proceed to the about_to_proceed observer notification. (mi_about_to_proceed): New. (mi_on_resume): Only output ^running and the prompt here if the target was proceeded. * breakpoint.c (breakpoint_proceeded): New static. (breakpoint_about_to_proceed): New. (_initialize_breakpoints): Attach breakpoint_about_to_proceed to the about_to_proceed observer notification. * inferior.h (breakpoint_proceeded): Delete declaration. * infrun.c (clear_proceed_status): Don't set breakpoint_proceeded. Notify the about_to_proceed observers. (struct inferior_status): Delete breakpoint_proceeded member. (save_inferior_status): Don't save it. (restore_inferior_status): Don't restore it. * mi-main.h (mi_proceeded): Declare. * mi/mi-main.c (mi_cmd_execute): Clear mi_proceeded before running a command. gdb/doc/ * observer.texi (about_to_proceed): New.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-interp.c21
-rw-r--r--gdb/mi/mi-main.c5
-rw-r--r--gdb/mi/mi-main.h1
3 files changed, 25 insertions, 2 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index fb4b4d5..dee921f 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -61,6 +61,7 @@ static void mi_inferior_exit (int pid);
static void mi_on_resume (ptid_t ptid);
static void mi_solib_loaded (struct so_list *solib);
static void mi_solib_unloaded (struct so_list *solib);
+static void mi_about_to_proceed (void);
static void *
mi_interpreter_init (int top_level)
@@ -91,6 +92,7 @@ mi_interpreter_init (int top_level)
observer_attach_target_resumed (mi_on_resume);
observer_attach_solib_loaded (mi_solib_loaded);
observer_attach_solib_unloaded (mi_solib_unloaded);
+ observer_attach_about_to_proceed (mi_about_to_proceed);
}
return mi;
@@ -368,6 +370,21 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
}
static void
+mi_about_to_proceed (void)
+{
+ /* Suppress output while calling an inferior function. */
+
+ if (!ptid_equal (inferior_ptid, null_ptid))
+ {
+ struct thread_info *tp = inferior_thread ();
+ if (tp->in_infcall)
+ return;
+ }
+
+ mi_proceeded = 1;
+}
+
+static void
mi_on_resume (ptid_t ptid)
{
struct thread_info *tp = NULL;
@@ -389,7 +406,7 @@ mi_on_resume (ptid_t ptid)
will make it impossible for frontend to know what's going on.
In future (MI3), we'll be outputting "^done" here. */
- if (!running_result_record_printed)
+ if (!running_result_record_printed && mi_proceeded)
{
if (current_token)
fputs_unfiltered (current_token, raw_stdout);
@@ -411,7 +428,7 @@ mi_on_resume (ptid_t ptid)
fprintf_unfiltered (raw_stdout, "*running,thread-id=\"%d\"\n", ti->num);
}
- if (!running_result_record_printed)
+ if (!running_result_record_printed && mi_proceeded)
{
running_result_record_printed = 1;
/* This is what gdb used to do historically -- printing prompt even if
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 97a136b..d7d8dc4 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -78,6 +78,10 @@ static int do_timings = 0;
char *current_token;
int running_result_record_printed = 1;
+/* Flag indicating that the target has proceeded since the last
+ command was issued. */
+int mi_proceeded;
+
extern void _initialize_mi_main (void);
static void mi_cmd_execute (struct mi_parse *parse);
@@ -1147,6 +1151,7 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
cleanup = make_cleanup (free_current_contents, &current_token);
running_result_record_printed = 0;
+ mi_proceeded = 0;
switch (context->op)
{
case MI_COMMAND:
diff --git a/gdb/mi/mi-main.h b/gdb/mi/mi-main.h
index 90a61e3..c8e0b7e 100644
--- a/gdb/mi/mi-main.h
+++ b/gdb/mi/mi-main.h
@@ -31,6 +31,7 @@ extern void mi_print_timing_maybe (void);
extern char *current_token;
extern int running_result_record_printed;
+extern int mi_proceeded;
#endif