aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-06-18 17:57:43 +0000
committerAndrew Cagney <cagney@redhat.com>2001-06-18 17:57:43 +0000
commitb30bf9ee99a2fd704f3a335d185041e7432f3105 (patch)
tree8e750381e3675422a8e7a3c5f62141faf912e679 /gdb/mi
parent6f9efd975101f3a93625952de6de81ae36ef8c4b (diff)
downloadgdb-b30bf9ee99a2fd704f3a335d185041e7432f3105.zip
gdb-b30bf9ee99a2fd704f3a335d185041e7432f3105.tar.gz
gdb-b30bf9ee99a2fd704f3a335d185041e7432f3105.tar.bz2
Recognize -i=mi0, -i=mi1 and -i=mi.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/ChangeLog11
-rw-r--r--gdb/mi/mi-main.c56
-rw-r--r--gdb/mi/mi-out.c4
-rw-r--r--gdb/mi/mi-out.h2
4 files changed, 52 insertions, 21 deletions
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index 6c1eb42..e9b6049 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,3 +1,14 @@
+2001-06-18 Andrew Cagney <ac131313@redhat.com>
+
+ * mi-main.c: Use strncmp as the "mi" test. Allow "mi", "mi0" and
+ "mi1".
+ (mi_command_loop): Add parameter mi_version, pass to mi_out_new.
+ (mi1_command_loop, mi0_command_loop): New functions.
+ (_initialize_mi_main): Recognize "mi", "mi0" and "mi1".
+ * mi-out.c (mi_out_new): Add parameter mi_version.
+ (struct ui_out_data): Add field mi_version.
+ * mi-out.h (mi_out_new): Update.
+
2001-06-07 Andrew Cagney <ac131313@redhat.com>
* gdbmi.texinfo (GDB/MI Output Syntax): Add tuples and lists to
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index c7476cd..5f73ddf 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1351,7 +1351,7 @@ mi_load_progress (const char *section_name,
static char *previous_sect_name = NULL;
int new_section;
- if (!interpreter_p || strcmp (interpreter_p, "mi") != 0)
+ if (!interpreter_p || strncmp (interpreter_p, "mi", 2) != 0)
return;
update_threshold.tv_sec = 0;
@@ -1409,7 +1409,7 @@ mi_load_progress (const char *section_name,
}
static void
-mi_command_loop (void)
+mi_command_loop (int mi_version)
{
/* HACK: Force stdout/stderr to point at the console. This avoids
any potential side effects caused by legacy code that is still
@@ -1425,7 +1425,7 @@ mi_command_loop (void)
/* HACK: Poke the ui_out table directly. Should we be creating a
mi_out object wired up to the above gdb_stdout / gdb_stderr? */
- uiout = mi_out_new ();
+ uiout = mi_out_new (mi_version);
/* HACK: Override any other interpreter hooks. We need to create a
real event table and pass in that. */
@@ -1465,6 +1465,18 @@ mi_command_loop (void)
}
static void
+mi0_command_loop (void)
+{
+ mi_command_loop (0);
+}
+
+static void
+mi1_command_loop (void)
+{
+ mi_command_loop (1);
+}
+
+static void
setup_architecture_data (void)
{
/* don't trust REGISTER_BYTES to be zero. */
@@ -1482,24 +1494,30 @@ mi_init_ui (char *arg0)
void
_initialize_mi_main (void)
{
+ if (interpreter_p == NULL)
+ return;
+
/* If we're _the_ interpreter, take control. */
- if (interpreter_p
- && strcmp (interpreter_p, "mi") == 0)
+ if (strcmp (interpreter_p, "mi0") == 0)
+ command_loop_hook = mi0_command_loop;
+ else if (strcmp (interpreter_p, "mi") == 0
+ || strcmp (interpreter_p, "mi1") == 0)
+ command_loop_hook = mi1_command_loop;
+ else
+ return;
+
+ init_ui_hook = mi_init_ui;
+ setup_architecture_data ();
+ register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL);
+ register_gdbarch_swap (NULL, 0, setup_architecture_data);
+ if (event_loop_p)
{
- init_ui_hook = mi_init_ui;
- command_loop_hook = mi_command_loop;
- setup_architecture_data ();
- register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL);
- register_gdbarch_swap (NULL, 0, setup_architecture_data);
- if (event_loop_p)
- {
- /* These overwrite some of the initialization done in
- _intialize_event_loop. */
- call_readline = gdb_readline2;
- input_handler = mi_execute_command_wrapper;
- add_file_handler (input_fd, stdin_event_handler, 0);
- async_command_editing_p = 0;
- }
+ /* These overwrite some of the initialization done in
+ _intialize_event_loop. */
+ call_readline = gdb_readline2;
+ input_handler = mi_execute_command_wrapper;
+ add_file_handler (input_fd, stdin_event_handler, 0);
+ async_command_editing_p = 0;
}
/* FIXME: Should we notify main that we are here as a possible
interpreter? */
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 0e0ac3f..034d3c1 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -33,6 +33,7 @@ struct ui_out_data
{
int suppress_field_separator;
int first_header;
+ int mi_version;
struct ui_file *buffer;
};
@@ -379,11 +380,12 @@ mi_out_put (struct ui_out *uiout,
/* initalize private members at startup */
struct ui_out *
-mi_out_new (void)
+mi_out_new (int mi_version)
{
int flags = 0;
struct ui_out_data *data = XMALLOC (struct ui_out_data);
data->suppress_field_separator = 0;
+ data->mi_version = mi_version;
/* FIXME: This code should be using a ``string_file'' and not the
TUI buffer hack. */
data->buffer = mem_fileopen ();
diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h
index 37a643c..1ae693f 100644
--- a/gdb/mi/mi-out.h
+++ b/gdb/mi/mi-out.h
@@ -25,7 +25,7 @@
struct ui_out;
struct ui_file;
-extern struct ui_out *mi_out_new (void);
+extern struct ui_out *mi_out_new (int mi_version);
extern void mi_out_put (struct ui_out *uiout, struct ui_file *stream);
extern void mi_out_rewind (struct ui_out *uiout);
extern void mi_out_buffered (struct ui_out *uiout, char *string);