This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [mi] organize possible exec async mi oc command reasons
> I don't have much comment about the patch; it seems like a plausible
> idea. However, please pay attention to the coding and formatting
> standards:
>
> - ChangeLog entries are capitalized and end with periods.
> - Function definitions have the function name in the first column.
> - Function braces are in the first column.
> - There's a space before function argument lists.
> - Function argument lists have to be indented normally; an argument
> on a new line goes at the same depth as the first argument on the
> previous line.
> - Comments don't use multiple leading *s.
>
> and so forth.
>
> I sometimes consider myself the pedantic guardian of GDB's source code
> formatting :-)
Very sorry for not getting the formatting correct. I respect the rules,
I just have a hard time formatting everything perfectly, I'm sure I can
do better!
Here is an updated patch, without the testsuite concerns.
Eli, I hope this doco patch makes more sense, please let me know.
2005-03-24 Bob Rossi <bob@brasko.net>
* Makefile.in (SUBDIR_MI_OBS, SUBDIR_MI_SRCS): Add mi-common.
(gdb/mi/ headers): Add mi_common_h.
(breakpoint.o, infrun.o): Add dependencies mi_common_h.
* breakpoint.c (include): Add include 'mi/mi-common.h'.
(print_it_typical): Use async_reason_lookup.
(watchpoint_check): Ditto.
* infrun.c (include): Add include 'mi/mi-common.h'.
(print_stop_reason): Use async_reason_lookup.
2005-03-24 Bob Rossi <bob@brasko.net>
* gdb.texinfo (GDB/MI Out-of-band Records): Add bullet enumerating
the possible reasons why an exec async record would be returned to FE.
Thanks,
Bob Rossi
Index: src/gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.707
diff -w -u -r1.707 Makefile.in
--- src/gdb/Makefile.in 18 Mar 2005 21:03:38 -0000 1.707
+++ src/gdb/Makefile.in 24 Mar 2005 21:15:08 -0000
@@ -171,14 +171,14 @@
mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o \
mi-interp.o \
- mi-main.o mi-parse.o mi-getopt.o
+ mi-main.o mi-parse.o mi-getopt.o mi-common.o
SUBDIR_MI_SRCS = \
mi/mi-out.c mi/mi-console.c \
mi/mi-cmds.c mi/mi-cmd-env.c \
mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
mi/mi-cmd-file.c mi/mi-cmd-disas.c mi/mi-symbol-cmds.c \
mi/mi-interp.c \
- mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
+ mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c mi/mi-common.c
SUBDIR_MI_DEPS =
SUBDIR_MI_LDFLAGS=
SUBDIR_MI_CFLAGS= \
@@ -824,6 +824,7 @@
mi_main_h = $(srcdir)/mi/mi-main.h
mi_out_h = $(srcdir)/mi/mi-out.h
mi_parse_h = $(srcdir)/mi/mi-parse.h
+mi_common_h = $(srcdir)/mi/mi-common.h
#
# gdb/tui/ headers
@@ -1773,7 +1774,7 @@
$(gdb_string_h) $(demangle_h) $(annotate_h) $(symfile_h) \
$(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
$(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solist_h) \
- $(observer_h) $(exceptions_h) $(gdb_events_h)
+ $(observer_h) $(exceptions_h) $(gdb_events_h) $(mi_common_h)
bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds_h) $(command_h) $(frame_h) \
$(regcache_h) $(target_h) $(value_h) $(gdbcore_h) $(gdb_assert_h) \
$(readline_h) $(bsd_kvm_h)
@@ -2121,7 +2122,7 @@
$(inferior_h) $(exceptions_h) $(breakpoint_h) $(gdb_wait_h) \
$(gdbcore_h) $(gdbcmd_h) $(cli_script_h) $(target_h) $(gdbthread_h) \
$(annotate_h) $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) \
- $(value_h) $(observer_h) $(language_h) $(gdb_assert_h)
+ $(value_h) $(observer_h) $(language_h) $(gdb_assert_h) $(mi_common_h)
inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
$(gdbcore_h) $(command_h) $(gdb_stat_h) $(observer_h) $(gdb_wait_h) \
$(inflow_h)
@@ -2990,6 +2991,8 @@
mi-symbol-cmds.o: $(srcdir)/mi/mi-symbol-cmds.c $(defs_h) $(mi_cmds_h) \
$(symtab_h) $(ui_out_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-symbol-cmds.c
+mi-common.o: $(srcdir)/mi/mi-common.c $(mi_common_h)
+ $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-common.c
#
# rdi-share sub-directory
Index: src/gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.212
diff -w -u -r1.212 breakpoint.c
--- src/gdb/breakpoint.c 24 Feb 2005 13:51:30 -0000 1.212
+++ src/gdb/breakpoint.c 24 Mar 2005 21:15:12 -0000
@@ -54,6 +54,7 @@
#include "exceptions.h"
#include "gdb-events.h"
+#include "mi/mi-common.h"
/* Prototypes for local functions. */
@@ -2108,7 +2109,8 @@
annotate_breakpoint (bs->breakpoint_at->number);
ui_out_text (uiout, "\nBreakpoint ");
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "breakpoint-hit");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup(EXEC_ASYNC_BREAKPOINT_HIT));
ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number);
ui_out_text (uiout, ", ");
return PRINT_SRC_AND_LOC;
@@ -2243,7 +2245,9 @@
{
annotate_watchpoint (bs->breakpoint_at->number);
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "watchpoint-trigger");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup
+ (EXEC_ASYNC_WATCHPOINT_TRIGGER));
mention (bs->breakpoint_at);
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
ui_out_text (uiout, "\nOld value = ");
@@ -2263,7 +2267,9 @@
case bp_read_watchpoint:
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "read-watchpoint-trigger");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup
+ (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
mention (bs->breakpoint_at);
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
ui_out_text (uiout, "\nValue = ");
@@ -2279,7 +2285,9 @@
{
annotate_watchpoint (bs->breakpoint_at->number);
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup
+ (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
mention (bs->breakpoint_at);
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
ui_out_text (uiout, "\nOld value = ");
@@ -2293,7 +2301,9 @@
{
mention (bs->breakpoint_at);
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup
+ (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
ui_out_text (uiout, "\nValue = ");
}
@@ -2309,7 +2319,8 @@
case bp_finish:
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "function-finished");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup(EXEC_ASYNC_FUNCTION_FINISHED));
return PRINT_UNKNOWN;
break;
@@ -2539,7 +2550,8 @@
will be deleted already. So we have no choice but print the
information here. */
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "watchpoint-scope");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup(EXEC_ASYNC_WATCHPOINT_SCOPE));
ui_out_text (uiout, "\nWatchpoint ");
ui_out_field_int (uiout, "wpnum", bs->breakpoint_at->number);
ui_out_text (uiout, " deleted because the program has left the block in\n\
Index: src/gdb/infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.199
diff -w -u -r1.199 infrun.c
--- src/gdb/infrun.c 24 Feb 2005 13:51:32 -0000 1.199
+++ src/gdb/infrun.c 24 Mar 2005 21:15:14 -0000
@@ -46,6 +46,7 @@
#include "observer.h"
#include "language.h"
#include "gdb_assert.h"
+#include "mi/mi-common.h"
/* Prototypes for local functions */
@@ -2866,7 +2867,9 @@
operation for n > 1 */
if (!step_multi || !stop_step)
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "end-stepping-range");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup
+ (EXEC_ASYNC_END_STEPPING_RANGE));
break;
case BREAKPOINT_HIT:
/* We found a breakpoint. */
@@ -2876,7 +2879,9 @@
/* The inferior was terminated by a signal. */
annotate_signalled ();
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "exited-signalled");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup
+ (EXEC_ASYNC_EXITED_SIGNALLED));
ui_out_text (uiout, "\nProgram terminated with signal ");
annotate_signal_name ();
ui_out_field_string (uiout, "signal-name",
@@ -2896,7 +2901,8 @@
if (stop_info)
{
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "exited");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup(EXEC_ASYNC_EXITED));
ui_out_text (uiout, "\nProgram exited with code ");
ui_out_field_fmt (uiout, "exit-code", "0%o",
(unsigned int) stop_info);
@@ -2905,7 +2911,9 @@
else
{
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "exited-normally");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup
+ (EXEC_ASYNC_EXITED_NORMALLY));
ui_out_text (uiout, "\nProgram exited normally.\n");
}
break;
@@ -2916,7 +2924,9 @@
ui_out_text (uiout, "\nProgram received signal ");
annotate_signal_name ();
if (ui_out_is_mi_like_p (uiout))
- ui_out_field_string (uiout, "reason", "signal-received");
+ ui_out_field_string (uiout, "reason",
+ async_reason_lookup
+ (EXEC_ASYNC_SIGNAL_RECEIVED));
ui_out_field_string (uiout, "signal-name",
target_signal_to_name (stop_info));
annotate_signal_name_end ();
Index: src/gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.233
diff -w -u -r1.233 gdb.texinfo
--- src/gdb/doc/gdb.texinfo 10 Mar 2005 13:12:33 -0000 1.233
+++ src/gdb/doc/gdb.texinfo 24 Mar 2005 21:15:29 -0000
@@ -15418,9 +15418,50 @@
The following is a preliminary list of possible out-of-band records.
@table @code
-@item "*" "stop"
+@item "*" "stopped"
@end table
+The following enumerates the current set of reasons why @sc{gdb/mi} would
+send an @var{exec-async-output} command to the front end.
+
+@itemize @bullet
+@item
+@code{breakpoint-hit} happens when a breakpoint is reached
+
+@item
+@code{watchpoint-trigger} happens when a watchpoint is triggered
+
+@item
+@code{read-watchpoint-trigger} happens when a read watchpoint is triggered
+
+@item
+@code{access-watchpoint-trigger} happens when an access watchpoint is triggered
+
+@item
+@code{function-finished}
+
+@item
+@code{location-reached}
+
+@item
+@code{watchpoint-scope}
+
+@item
+@code{end-stepping-range}
+
+@item
+@code{exited-signalled} happens when the inferior exits because of a signal
+
+@item
+@code{exited} happens when the inferior exited
+
+@item
+@code{exited-normally} happens when the inferior exited normally
+
+@item
+@code{signal-received} happens when a signal was received by the inferior
+@end itemize
+
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Command Description Format
/* Interface for common GDB/MI data
Copyright 2005 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "mi-common.h"
static const char *async_reason_string_lookup[EXEC_ASYNC_LAST+1] =
{
"breakpoint-hit",
"watchpoint-trigger",
"read-watchpoint-trigger",
"access-watchpoint-trigger",
"function-finished",
"location-reached",
"watchpoint-scope",
"end-stepping-range",
"exited-signalled",
"exited",
"exited-normally",
"signal-received",
(char*)0
};
const char *
async_reason_lookup (enum async_reply_reason reason)
{
return async_reason_string_lookup[reason];
}
/* Interface for common GDB/MI data
Copyright 2005 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef MI_COMMON_H
#define MI_COMMON_H
/* Represents the reason why GDB is sending an asyncronous command to the
front end.
NOTE: When modifing this, don't forget to update gdb.texinfo! */
enum async_reply_reason
{
EXEC_ASYNC_BREAKPOINT_HIT = 0,
EXEC_ASYNC_WATCHPOINT_TRIGGER,
EXEC_ASYNC_READ_WATCHPOINT_TRIGGER,
EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER,
EXEC_ASYNC_FUNCTION_FINISHED,
EXEC_ASYNC_LOCATION_REACHED,
EXEC_ASYNC_WATCHPOINT_SCOPE,
EXEC_ASYNC_END_STEPPING_RANGE,
EXEC_ASYNC_EXITED_SIGNALLED,
EXEC_ASYNC_EXITED,
EXEC_ASYNC_EXITED_NORMALLY,
EXEC_ASYNC_SIGNAL_RECEIVED,
/* This is here only to represent the number of enum's */
EXEC_ASYNC_LAST
};
const char *async_reason_lookup (enum async_reply_reason reason);
#endif