Recognize -i=mi0, -i=mi1 and -i=mi.

This commit is contained in:
Andrew Cagney 2001-06-18 17:57:43 +00:00
parent 6f9efd9751
commit b30bf9ee99
44 changed files with 125 additions and 39 deletions

View File

@ -1,3 +1,8 @@
2001-06-18 Andrew Cagney <ac131313@redhat.com>
* infrun.c, breakpoint.c: Use strncmp as the "mi" test. Allow,
"mi", "mi0" and "mi1".
2001-06-17 Andrew Cagney <ac131313@redhat.com>
* gdbarch.sh: Generate an error when conflicting macro

View File

@ -1889,7 +1889,7 @@ print_it_typical (bpstat bs)
#ifdef UI_OUT
annotate_breakpoint (bs->breakpoint_at->number);
ui_out_text (uiout, "\nBreakpoint ");
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "breakpoint-hit");
ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number);
ui_out_text (uiout, ", ");
@ -2034,7 +2034,7 @@ print_it_typical (bpstat bs)
{
annotate_watchpoint (bs->breakpoint_at->number);
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "watchpoint-trigger");
mention (bs->breakpoint_at);
ui_out_tuple_begin (uiout, "value");
@ -2064,7 +2064,7 @@ print_it_typical (bpstat bs)
case bp_read_watchpoint:
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "read-watchpoint-trigger");
mention (bs->breakpoint_at);
ui_out_tuple_begin (uiout, "value");
@ -2088,7 +2088,7 @@ print_it_typical (bpstat bs)
if (bs->old_val != NULL)
{
annotate_watchpoint (bs->breakpoint_at->number);
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
mention (bs->breakpoint_at);
ui_out_tuple_begin (uiout, "value");
@ -2102,7 +2102,7 @@ print_it_typical (bpstat bs)
else
{
mention (bs->breakpoint_at);
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
ui_out_tuple_begin (uiout, "value");
ui_out_text (uiout, "\nValue = ");
@ -2139,7 +2139,7 @@ print_it_typical (bpstat bs)
case bp_finish:
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "function-finished");
#endif
return PRINT_UNKNOWN;
@ -2147,7 +2147,7 @@ print_it_typical (bpstat bs)
case bp_until:
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "location-reached");
#endif
return PRINT_UNKNOWN;
@ -2354,7 +2354,7 @@ watchpoint_check (PTR p)
will be deleted already. So we have no choice but print the
information here. */
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "watchpoint-scope");
ui_out_text (uiout, "\nWatchpoint ");
ui_out_field_int (uiout, "wpnum", bs->breakpoint_at->number);
@ -3476,7 +3476,7 @@ print_one_breakpoint (struct breakpoint *b,
#ifdef UI_OUT
/* Output the count also if it is zero, but only if this is
mi. FIXME: Should have a better test for this. */
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
if (show_breakpoint_hit_counts && b->hit_count == 0)
ui_out_field_int (uiout, "times", b->hit_count);
#endif
@ -4476,7 +4476,7 @@ mention (struct breakpoint *b)
#endif
case bp_breakpoint:
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
{
say_where = 0;
break;
@ -4487,7 +4487,7 @@ mention (struct breakpoint *b)
break;
case bp_hardware_breakpoint:
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
{
say_where = 0;
break;
@ -4550,7 +4550,7 @@ mention (struct breakpoint *b)
do_cleanups (old_chain);
#endif
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
return;
#endif
printf_filtered ("\n");

View File

@ -3334,7 +3334,7 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
/* Print a message only if not in the middle of doing a "step n"
operation for n > 1 */
if (!step_multi || !stop_step)
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "end-stepping-range");
#endif
break;
@ -3346,7 +3346,7 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
/* The inferior was terminated by a signal. */
#ifdef UI_OUT
annotate_signalled ();
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "exited-signalled");
ui_out_text (uiout, "\nProgram terminated with signal ");
annotate_signal_name ();
@ -3380,7 +3380,7 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
annotate_exited (stop_info);
if (stop_info)
{
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "exited");
ui_out_text (uiout, "\nProgram exited with code ");
ui_out_field_fmt (uiout, "exit-code", "0%o", (unsigned int) stop_info);
@ -3388,7 +3388,7 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
}
else
{
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_string (uiout, "reason", "exited-normally");
ui_out_text (uiout, "\nProgram exited normally.\n");
}
@ -3574,12 +3574,12 @@ and/or watchpoints.\n");
#ifdef UI_OUT
/* For mi, have the same behavior every time we stop:
print everything but the source line. */
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
source_flag = LOC_AND_ADDRESS;
#endif
#ifdef UI_OUT
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
ui_out_field_int (uiout, "thread-id",
pid_to_thread_id (inferior_ptid));
#endif

View File

@ -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

View File

@ -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. */
@ -1464,6 +1464,18 @@ mi_command_loop (void)
start_event_loop ();
}
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)
{
@ -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? */

View File

@ -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 ();

View File

@ -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);

View File

@ -1,3 +1,17 @@
2001-06-18 Andrew Cagney <ac131313@redhat.com>
* mi-basics.exp, mi-break.exp, mi-console.exp, mi-disassemble.exp,
mi-eval.exp, mi-hack-cli.exp, mi-read-memory.exp, mi-regs.exp,
mi-return.exp, mi-simplerun.exp, mi-stack.exp, mi-stepi.exp,
mi-until.exp, mi-var-block.exp, mi-var-child.exp, mi-var-cmd.exp,
mi-var-display.exp, mi-watch.exp, mi0-basics.exp, mi0-break.exp,
mi0-console.exp, mi0-disassemble.exp, mi0-eval.exp,
mi0-hack-cli.exp, mi0-read-memory.exp, mi0-regs.exp,
mi0-return.exp, mi0-simplerun.exp, mi0-stack.exp, mi0-stepi.exp,
mi0-until.exp, mi0-var-block.exp, mi0-var-child.exp,
mi0-var-cmd.exp, mi0-var-display.exp, mi0-watch.exp: Use MIFLAGS
to explictly select an interpreter.
2001-06-16 Andrew Cagney <ac131313@redhat.com>
MI0 was the never enabled MI interface included in GDB 5.0.

View File

@ -30,6 +30,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -29,6 +29,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -33,6 +33,7 @@
# remote target.
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -25,6 +25,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -21,6 +21,7 @@
# Some basic checks for the CLI.
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -30,6 +30,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -29,6 +29,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -24,6 +24,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -24,6 +24,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -24,6 +24,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -24,6 +24,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -29,6 +29,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {

View File

@ -30,6 +30,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -29,6 +29,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -33,6 +33,7 @@
# remote target.
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -25,6 +25,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -21,6 +21,7 @@
# Some basic checks for the CLI.
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -30,6 +30,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -29,6 +29,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -27,6 +27,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -24,6 +24,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -24,6 +24,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -24,6 +24,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -24,6 +24,7 @@
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {

View File

@ -29,6 +29,7 @@
#
load_lib mi-support.exp
set MIFLAGS "-i=mi0"
gdb_exit
if [mi_gdb_start] {