aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-06-21 01:11:50 +0100
committerPedro Alves <palves@redhat.com>2016-06-21 01:11:50 +0100
commit05beb2750cd51a0ae1e8bb429aacda567acceba4 (patch)
tree7c8575b0d2905cce05f18084934e324e781ee8a2
parent215d3118fe5f120c1deba66943329e30073ed780 (diff)
downloadfsf-binutils-gdb-05beb2750cd51a0ae1e8bb429aacda567acceba4.zip
fsf-binutils-gdb-05beb2750cd51a0ae1e8bb429aacda567acceba4.tar.gz
fsf-binutils-gdb-05beb2750cd51a0ae1e8bb429aacda567acceba4.tar.bz2
Introduce display_mi_prompt
Just a refactor. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * mi/mi-interp.c (display_mi_prompt): New function.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/mi/mi-interp.c22
2 files changed, 16 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4aa0b3c..23cbfce 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2016-06-21 Pedro Alves <palves@redhat.com>
+ * mi/mi-interp.c (display_mi_prompt): New function.
+
+2016-06-21 Pedro Alves <palves@redhat.com>
+
* target.c (target_terminal_inferior): Bail out after
unregistering input_fd if not on the main UI.
(target_terminal_ours): Bail out after registering input_fd if not
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 397ac1a..18f5677 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -89,6 +89,15 @@ static void mi_on_sync_execution_done (void);
static int report_initial_inferior (struct inferior *inf, void *closure);
+/* Display the MI prompt. */
+
+static void
+display_mi_prompt (void)
+{
+ fputs_unfiltered ("(gdb) \n", raw_stdout);
+ gdb_flush (raw_stdout);
+}
+
/* Returns the INTERP's data cast as mi_interp if INTERP is an MI, and
returns NULL otherwise. */
@@ -300,10 +309,7 @@ mi_on_sync_execution_done (void)
/* If MI is sync, then output the MI prompt now, indicating we're
ready for further input. */
if (!mi_async_p ())
- {
- fputs_unfiltered ("(gdb) \n", raw_stdout);
- gdb_flush (raw_stdout);
- }
+ display_mi_prompt ();
}
/* mi_execute_command_wrapper wrapper suitable for INPUT_HANDLER. */
@@ -319,10 +325,7 @@ mi_execute_command_input_handler (char *cmd)
'synchronous_command_done' observer when the target next
stops. */
if (!sync_execution)
- {
- fputs_unfiltered ("(gdb) \n", raw_stdout);
- gdb_flush (raw_stdout);
- }
+ display_mi_prompt ();
}
static void
@@ -333,8 +336,7 @@ mi_command_loop (void *data)
sevenbit_strings = 1;
/* Tell the world that we're alive. */
- fputs_unfiltered ("(gdb) \n", raw_stdout);
- gdb_flush (raw_stdout);
+ display_mi_prompt ();
start_event_loop ();
}