mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
Replace:
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0) with: if (ui_out_is_mi_like_p (uiout))
This commit is contained in:
parent
7fb088be89
commit
9dc5e2a936
@ -1,3 +1,14 @@
|
||||
2001-07-04 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* ui-out.h (struct ui_out_impl): Add field is_mi_like_p.
|
||||
(ui_out_is_mi_like_p): Declare.
|
||||
* ui-out.c (ui_out_is_mi_like_p): Define.
|
||||
(default_ui_out_impl): Initialize is_mi_like_p to zero.
|
||||
* cli-out.c (cli_ui_out_impl): Ditto.
|
||||
* breakpoint.c (print_it_typical): Use ui_out_is_mi_like_p.
|
||||
(watchpoint_check, print_one_breakpoint, mention): Ditto.
|
||||
* infrun.c (print_stop_reason, normal_stop): Ditto.
|
||||
|
||||
2001-07-05 Daniel Jacobowitz <drow@mvista.com>
|
||||
|
||||
* mips-tdep.c (mips_software_single_step): New function.
|
||||
|
@ -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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
ui_out_field_string (uiout, "reason", "watchpoint-scope");
|
||||
ui_out_text (uiout, "\nWatchpoint ");
|
||||
ui_out_field_int (uiout, "wpnum", bs->breakpoint_at->number);
|
||||
@ -3481,7 +3481,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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
if (show_breakpoint_hit_counts && b->hit_count == 0)
|
||||
ui_out_field_int (uiout, "times", b->hit_count);
|
||||
#endif
|
||||
@ -4509,7 +4509,7 @@ mention (struct breakpoint *b)
|
||||
#endif
|
||||
case bp_breakpoint:
|
||||
#ifdef UI_OUT
|
||||
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
{
|
||||
say_where = 0;
|
||||
break;
|
||||
@ -4520,7 +4520,7 @@ mention (struct breakpoint *b)
|
||||
break;
|
||||
case bp_hardware_breakpoint:
|
||||
#ifdef UI_OUT
|
||||
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
{
|
||||
say_where = 0;
|
||||
break;
|
||||
@ -4583,7 +4583,7 @@ mention (struct breakpoint *b)
|
||||
do_cleanups (old_chain);
|
||||
#endif
|
||||
#ifdef UI_OUT
|
||||
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
return;
|
||||
#endif
|
||||
printf_filtered ("\n");
|
||||
|
@ -89,7 +89,8 @@ static struct ui_out_impl cli_ui_out_impl =
|
||||
cli_text,
|
||||
cli_message,
|
||||
cli_wrap_hint,
|
||||
cli_flush
|
||||
cli_flush,
|
||||
0, /* Does not need MI hacks (i.e. needs CLI hacks). */
|
||||
};
|
||||
|
||||
/* Prototypes for local functions */
|
||||
|
12
gdb/infrun.c
12
gdb/infrun.c
@ -3308,7 +3308,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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
ui_out_field_string (uiout, "reason", "end-stepping-range");
|
||||
#endif
|
||||
break;
|
||||
@ -3320,7 +3320,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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
ui_out_field_string (uiout, "reason", "exited-signalled");
|
||||
ui_out_text (uiout, "\nProgram terminated with signal ");
|
||||
annotate_signal_name ();
|
||||
@ -3354,7 +3354,7 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
|
||||
annotate_exited (stop_info);
|
||||
if (stop_info)
|
||||
{
|
||||
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
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);
|
||||
@ -3362,7 +3362,7 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
ui_out_field_string (uiout, "reason", "exited-normally");
|
||||
ui_out_text (uiout, "\nProgram exited normally.\n");
|
||||
}
|
||||
@ -3548,12 +3548,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 && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
source_flag = LOC_AND_ADDRESS;
|
||||
#endif
|
||||
|
||||
#ifdef UI_OUT
|
||||
if (interpreter_p && strncmp (interpreter_p, "mi", 2) == 0)
|
||||
if (ui_out_is_mi_like_p (uiout))
|
||||
ui_out_field_int (uiout, "thread-id",
|
||||
pid_to_thread_id (inferior_ptid));
|
||||
#endif
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-07-04 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* mi-out.c (mi_ui_out_impl): Initialize is_mi_like_p to one.
|
||||
|
||||
2001-06-27 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* mi-out.c (mi_table_begin): Include nr_cols and nr_rows in mi1
|
||||
|
@ -88,7 +88,8 @@ struct ui_out_impl mi_ui_out_impl =
|
||||
mi_text,
|
||||
mi_message,
|
||||
mi_wrap_hint,
|
||||
mi_flush
|
||||
mi_flush,
|
||||
1, /* Needs MI hacks. */
|
||||
};
|
||||
|
||||
/* Prototypes for local functions */
|
||||
|
@ -190,7 +190,8 @@ struct ui_out_impl default_ui_out_impl =
|
||||
default_text,
|
||||
default_message,
|
||||
default_wrap_hint,
|
||||
default_flush
|
||||
default_flush,
|
||||
0, /* Does not need MI hacks. */
|
||||
};
|
||||
|
||||
/* The default ui_out */
|
||||
@ -712,6 +713,12 @@ gdb_query (struct ui_out *uiout, int qflags, char *qprompt)
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
ui_out_is_mi_like_p (struct ui_out *uiout)
|
||||
{
|
||||
return uiout->impl->is_mi_like_p;
|
||||
}
|
||||
|
||||
/* default gdb-out hook functions */
|
||||
|
||||
static void
|
||||
|
@ -184,6 +184,13 @@ extern void gdb_error (struct ui_out *uiout, int severity, char *format, ...);
|
||||
extern void gdb_query (struct ui_out *uiout, int qflags, char *qprompt);
|
||||
#endif
|
||||
|
||||
/* HACK: Code in GDB is currently checking to see the type of ui_out
|
||||
builder when determining which output to produce. This function is
|
||||
a hack to encapsulate that test. Once GDB manages to separate the
|
||||
CLI/MI from the core of GDB the problem should just go away .... */
|
||||
|
||||
extern int ui_out_is_mi_like_p (struct ui_out *uiout);
|
||||
|
||||
/* From here on we have things that are only needed by implementation
|
||||
routines and main.c. We should pehaps have a separate file for that,
|
||||
like a ui-out-impl.h file */
|
||||
@ -253,6 +260,7 @@ struct ui_out_impl
|
||||
message_ftype *message;
|
||||
wrap_hint_ftype *wrap_hint;
|
||||
flush_ftype *flush;
|
||||
int is_mi_like_p;
|
||||
};
|
||||
|
||||
extern struct ui_out_data *ui_out_data (struct ui_out *uiout);
|
||||
|
Loading…
Reference in New Issue
Block a user