Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [mi] organize possible exec async mi oc command reasons
@ 2005-03-24 15:46 Bob Rossi
  2005-03-24 15:54 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Bob Rossi @ 2005-03-24 15:46 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 11468 bytes --]

Hi,

I am going to attempt to organize the possible MI exec async output
commands. The current problem is that it is not easy to understand the
possible number of 'exec async output commands' that GDB/MI can return
to the FE. I would like to simply this, and eventually add a testcase
for each case. This is a start at enumerating all of the case's and
giving the user a minimal amount of information.

The design is to have mi-common.h be the interface to the rest of 
GDB. Also, MI developers can have a place to look at to determine all
possible supported command types.

Eli, if you can think of a better way for me to add to the doco, let me
know.

BTW, someone please tell me if the testsuite diff is OK, for some reason
there are minor differences between a fresh checkout and my patched
tree, although, I think it has nothing to do with my changes.

I've attached the added files and the testsuite diff. The patch is
below.

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 03:11:05 -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 03:11:09 -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,8 @@
 	{
 	  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 +2266,8 @@
 
     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 +2283,8 @@
 	{
 	  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 +2298,8 @@
 	{
 	  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 +2315,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 +2546,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 03:11:11 -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,8 @@
          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 +2878,8 @@
       /* 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 +2899,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 +2909,8 @@
       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 +2921,8 @@
       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 03:11:23 -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
+return with *stopped (exec-async-output).  
+
+@itemize @bullet
+@item
+A breakpoint was reached, "breakpoint-hit"
+
+@item
+A watchpoint was triggered, "watchpoint-trigger"
+
+@item
+A read watchpoint was triggered, "read-watchpoint-trigger"
+
+@item
+An access watchpoint was triggered, "access-watchpoint-trigger"
+
+@item
+A function finished, "function-finished"
+
+@item
+A location was reached, "location-reached"
+
+@item
+A watchpoint scope, "watchpoint-scope"
+
+@item
+end stepping range, "end-stepping-range"
+
+@item
+inferior exited because of a signal, "exited-signalled"
+
+@item
+inferior exited, "exited"
+
+@item
+inferior exited normally, "exited-normally"
+
+@item
+a signal was received by the inferior, "signal-received"
+@end itemize
+
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 @node GDB/MI Command Description Format

[-- Attachment #2: mi-common.h --]
[-- Type: text/x-chdr, Size: 1653 bytes --]

/* List lines of source files for GDB, the GNU debugger.
   Copyright 1999 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

[-- Attachment #3: mi-common.c --]
[-- Type: text/x-csrc, Size: 530 bytes --]

#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];
  }

[-- Attachment #4: mi-common-ts.diff --]
[-- Type: text/plain, Size: 3718 bytes --]

--- /home/bob/cvs/gdb/original/builddir/gdb/testsuite/gdb.sum	2005-03-23 22:37:30.000000000 -0500
+++ /home/bob/cvs/gdb/gdb_async/build/gdb/testsuite/gdb.sum	2005-03-23 22:25:18.000000000 -0500
@@ -1,4 +1,4 @@
-Test Run By bob on Wed Mar 23 22:27:39 2005
+Test Run By bob on Wed Mar 23 22:12:02 2005
 Native configuration is i686-pc-linux-gnu
 
 		=== gdb tests ===
@@ -10825,7 +10825,7 @@
 PASS: gdb.threads/manythreads.exp: info threads
 PASS: gdb.threads/manythreads.exp: second continue
 FAIL: gdb.threads/manythreads.exp: stop threads 2
-FAIL: gdb.threads/manythreads.exp: GDB exits after stopping multithreaded program (timeout)
+PASS: gdb.threads/manythreads.exp: GDB exits after stopping multithreaded program
 Running ../../../src/gdb/testsuite/gdb.threads/print-threads.exp ...
 PASS: gdb.threads/print-threads.exp: successfully compiled posix threads test case
 PASS: gdb.threads/print-threads.exp: set print sevenbit-strings
@@ -10866,6 +10866,7 @@
 PASS: gdb.threads/print-threads.exp: Hit kill breakpoint, 9 (slow with kill breakpoint)
 PASS: gdb.threads/print-threads.exp: Hit thread_function breakpoint, 4 (slow with kill breakpoint)
 PASS: gdb.threads/print-threads.exp: Hit kill breakpoint, 10 (slow with kill breakpoint)
+PASS: gdb.threads/print-threads.exp: Hit kill breakpoint, 11 (slow with kill breakpoint)
 PASS: gdb.threads/print-threads.exp: Hit thread_function breakpoint, 5 (slow with kill breakpoint)
 KFAIL: gdb.threads/print-threads.exp: Running threads (slow with kill breakpoint) (zombie thread) (PRMS: gdb/1265)
 Running ../../../src/gdb/testsuite/gdb.threads/pthread_cond_wait.exp ...
@@ -10957,8 +10958,8 @@
 PASS: gdb.threads/schedlock.exp: other thread 0 didn't run
 PASS: gdb.threads/schedlock.exp: other thread 1 didn't run
 PASS: gdb.threads/schedlock.exp: other thread 2 didn't run
-PASS: gdb.threads/schedlock.exp: other thread 3 didn't run
 PASS: gdb.threads/schedlock.exp: current thread ran
+PASS: gdb.threads/schedlock.exp: other thread 4 didn't run
 PASS: gdb.threads/schedlock.exp: other thread 5 didn't run
 PASS: gdb.threads/schedlock.exp: step to increment (locked 0)
 PASS: gdb.threads/schedlock.exp: step to increment (locked 1)
@@ -10976,8 +10977,8 @@
 PASS: gdb.threads/schedlock.exp: other thread 0 didn't run (stepping)
 PASS: gdb.threads/schedlock.exp: other thread 1 didn't run (stepping)
 PASS: gdb.threads/schedlock.exp: other thread 2 didn't run (stepping)
-PASS: gdb.threads/schedlock.exp: other thread 3 didn't run (stepping)
 PASS: gdb.threads/schedlock.exp: current thread stepped locked
+PASS: gdb.threads/schedlock.exp: other thread 4 didn't run (stepping)
 PASS: gdb.threads/schedlock.exp: other thread 5 didn't run (stepping)
 Running ../../../src/gdb/testsuite/gdb.threads/staticthreads.exp ...
 PASS: gdb.threads/staticthreads.exp: successfully compiled posix threads test case
@@ -11095,8 +11096,8 @@
 PASS: gdb.threads/watchthreads.exp: watch args[1]
 FAIL: gdb.threads/watchthreads.exp: threaded watch loop
 PASS: gdb.threads/watchthreads.exp: first watchpoint on args[0] hit
-PASS: gdb.threads/watchthreads.exp: first watchpoint on args[1] hit
-FAIL: gdb.threads/watchthreads.exp: watchpoint on args[0] hit in thread
+FAIL: gdb.threads/watchthreads.exp: first watchpoint on args[1] hit
+PASS: gdb.threads/watchthreads.exp: watchpoint on args[0] hit in thread
 FAIL: gdb.threads/watchthreads.exp: watchpoint on args[1] hit in thread
 FAIL: gdb.threads/watchthreads.exp: combination of threaded watchpoints = 30
 Running ../../../src/gdb/testsuite/gdb.trace/actions.exp ...
@@ -11240,12 +11241,12 @@
 
 		=== gdb Summary ===
 
-# of expected passes		10746
-# of unexpected failures	36
+# of expected passes		10749
+# of unexpected failures	34

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 15:46 [mi] organize possible exec async mi oc command reasons Bob Rossi
@ 2005-03-24 15:54 ` Daniel Jacobowitz
  2005-03-24 16:06 ` Daniel Jacobowitz
  2005-03-24 20:00 ` Eli Zaretskii
  2 siblings, 0 replies; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-03-24 15:54 UTC (permalink / raw)
  To: gdb-patches

On Thu, Mar 24, 2005 at 10:46:02AM -0500, Bob Rossi wrote:
> BTW, someone please tell me if the testsuite diff is OK, for some reason
> there are minor differences between a fresh checkout and my patched
> tree, although, I think it has nothing to do with my changes.

Those tests all change on repeat runnings.  I'm not sure why
manythreads fails for you; may be an old kernel.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 15:46 [mi] organize possible exec async mi oc command reasons Bob Rossi
  2005-03-24 15:54 ` Daniel Jacobowitz
@ 2005-03-24 16:06 ` Daniel Jacobowitz
  2005-03-24 18:47   ` Stan Shebs
  2005-03-24 21:20   ` Bob Rossi
  2005-03-24 20:00 ` Eli Zaretskii
  2 siblings, 2 replies; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-03-24 16:06 UTC (permalink / raw)
  To: gdb-patches

On Thu, Mar 24, 2005 at 10:46:02AM -0500, Bob Rossi wrote:
> Hi,
> 
> I am going to attempt to organize the possible MI exec async output
> commands. The current problem is that it is not easy to understand the
> possible number of 'exec async output commands' that GDB/MI can return
> to the FE. I would like to simply this, and eventually add a testcase
> for each case. This is a start at enumerating all of the case's and
> giving the user a minimal amount of information.
> 
> The design is to have mi-common.h be the interface to the rest of 
> GDB. Also, MI developers can have a place to look at to determine all
> possible supported command types.
> 
> Eli, if you can think of a better way for me to add to the doco, let me
> know.
> 
> BTW, someone please tell me if the testsuite diff is OK, for some reason
> there are minor differences between a fresh checkout and my patched
> tree, although, I think it has nothing to do with my changes.
> 
> I've attached the added files and the testsuite diff. The patch is
> below.

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 :-)

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 16:06 ` Daniel Jacobowitz
@ 2005-03-24 18:47   ` Stan Shebs
  2005-03-24 21:20   ` Bob Rossi
  1 sibling, 0 replies; 29+ messages in thread
From: Stan Shebs @ 2005-03-24 18:47 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:

>I sometimes consider myself the pedantic guardian of GDB's source code
>formatting :-)
>
>
Way back when, I thought the whole formatting thing was too
anal, and didn't enforce strictly; but after several years of
this, GDB got to be looking rather random, with nothing ever quite
where one expected to find it, and we had to do a mega-reformat
(CVS still credits me with all the code. :-) ).

It's a little bit like picking up litter on the streets; one
cigarette butt is trivial, but without any effort to keep
things clean, pretty soon you're wading through trash.

Stan


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 15:46 [mi] organize possible exec async mi oc command reasons Bob Rossi
  2005-03-24 15:54 ` Daniel Jacobowitz
  2005-03-24 16:06 ` Daniel Jacobowitz
@ 2005-03-24 20:00 ` Eli Zaretskii
  2005-03-24 21:02   ` Bob Rossi
  2 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2005-03-24 20:00 UTC (permalink / raw)
  To: gdb-patches

> Date: Thu, 24 Mar 2005 10:46:02 -0500
> From: Bob Rossi <bob@brasko.net>
> 
> Eli, if you can think of a better way for me to add to the doco, let me
> know.

I'm sorry to say that I don't understand the text you wrote.  My
problem starts right with the first sentence:

    +The following lists the current set of reasons why @sc{gdb/mi} would
    +return with *stopped (exec-async-output).  

What does this sentence mean? and why there's a `*' before "stopped"?
and what's with the "exec-async-output" inside parens?

Also, I couldn't parse sentences like this in the itemized list:

    +A breakpoint was reached, "breakpoint-hit"

This is not an English sentence, AFAIU.

So could you please explain what you tried to tell in the doco patch?

TIA


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 20:00 ` Eli Zaretskii
@ 2005-03-24 21:02   ` Bob Rossi
  2005-03-26 10:40     ` Eli Zaretskii
  0 siblings, 1 reply; 29+ messages in thread
From: Bob Rossi @ 2005-03-24 21:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On Thu, Mar 24, 2005 at 09:57:35PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 24 Mar 2005 10:46:02 -0500
> > From: Bob Rossi <bob@brasko.net>
> > 
> > Eli, if you can think of a better way for me to add to the doco, let me
> > know.
> 
> I'm sorry to say that I don't understand the text you wrote.  My
> problem starts right with the first sentence:
> 
>     +The following lists the current set of reasons why @sc{gdb/mi} would
>     +return with *stopped (exec-async-output).  
> What does this sentence mean? and why there's a `*' before "stopped"?
> and what's with the "exec-async-output" inside parens?
> 

How about I replace that with this, 

The following enumerates the current set of reasons why @sc{gdb/mi} would
return with an @var{exec-async-output} command.

> Also, I couldn't parse sentences like this in the itemized list:
> 
>     +A breakpoint was reached, "breakpoint-hit"
> 
> This is not an English sentence, AFAIU.

The list is suppossed to be all of the reasons why GDB would return an
exec async output command to the FE.

The first part of each item is a description of why GDB returned, the
second part is the actual reason GDB/MI will give. 
(ie "reason=breakpoint-hit").

Thanks,
Bob Rossi


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 16:06 ` Daniel Jacobowitz
  2005-03-24 18:47   ` Stan Shebs
@ 2005-03-24 21:20   ` Bob Rossi
  2005-03-26 10:43     ` Eli Zaretskii
                       ` (2 more replies)
  1 sibling, 3 replies; 29+ messages in thread
From: Bob Rossi @ 2005-03-24 21:20 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 11764 bytes --]

> 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

[-- Attachment #2: mi-common.c --]
[-- Type: text/x-csrc, Size: 1329 bytes --]

/* 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];
}

[-- Attachment #3: mi-common.h --]
[-- Type: text/x-chdr, Size: 1632 bytes --]

/* 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

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 21:02   ` Bob Rossi
@ 2005-03-26 10:40     ` Eli Zaretskii
  2005-03-26 13:32       ` Eli Zaretskii
  0 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2005-03-26 10:40 UTC (permalink / raw)
  To: gdb-patches

> Date: Thu, 24 Mar 2005 16:02:31 -0500
> From: Bob Rossi <bob@brasko.net>
> Cc: gdb-patches@sources.redhat.com
> 
> >     +The following lists the current set of reasons why @sc{gdb/mi} would
> >     +return with *stopped (exec-async-output).  
> > What does this sentence mean? and why there's a `*' before "stopped"?
> > and what's with the "exec-async-output" inside parens?
> > 
> 
> How about I replace that with this, 
> 
> The following enumerates the current set of reasons why @sc{gdb/mi} would
> return with an @var{exec-async-output} command.

This still doesn't look right: if exec-async-output is in @var, it
should stand for something.  Do I understand correctly that it stands
for one of these:

    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

?  If so, then you should modify the @table with "stopped" like this:

    @table @code
    @item *stopped @var{reason}
    @end table

and then list the possible values for @var{reason}, see below.

Also, these are not commands, so it's wrong to say ``GDB/MI would
return with an EXEC-ASYNC-OUTPUT command''.  You should say something
like

    The following enumerates the current set of possible values for
    @var{reason}.

or, better yet

    @var{reason} can be one of the following:

> >     +A breakpoint was reached, "breakpoint-hit"
> > 
> > This is not an English sentence, AFAIU.
> 
> The list is suppossed to be all of the reasons why GDB would return an
> exec async output command to the FE.
> 
> The first part of each item is a description of why GDB returned, the
> second part is the actual reason GDB/MI will give. 
> (ie "reason=breakpoint-hit").

Then you should use @table, like this:

    @table @code
    @item breakpoint-hit
    A breakpoint was reached.
    @item watchpoint-trigger
    A watchpoint was triggered.
    ...
    @end table

Btw, do we always have @var{reason} after "stopped"?  If not, then
it's optional and should be inside [...].


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 21:20   ` Bob Rossi
@ 2005-03-26 10:43     ` Eli Zaretskii
  2005-04-30 19:32     ` Daniel Jacobowitz
  2005-06-15 19:25     ` David Lecomber
  2 siblings, 0 replies; 29+ messages in thread
From: Eli Zaretskii @ 2005-03-26 10:43 UTC (permalink / raw)
  To: gdb-patches

> Date: Thu, 24 Mar 2005 16:20:36 -0500
> From: Bob Rossi <bob@brasko.net>
> 
> Eli, I hope this doco patch makes more sense, please let me know.

See my comments in my other mail in this thread.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-26 10:40     ` Eli Zaretskii
@ 2005-03-26 13:32       ` Eli Zaretskii
  2005-03-27  2:56         ` Bob Rossi
  0 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2005-03-26 13:32 UTC (permalink / raw)
  To: gdb-patches

> Date: Sat, 26 Mar 2005 12:36:32 +0200
> From: "Eli Zaretskii" <eliz@gnu.org>
> 
> Btw, do we always have @var{reason} after "stopped"?  If not, then
> it's optional and should be inside [...].

In addition, it looks to me like "stopped" states the reason like so:

  *stopped,reason="REASON"

If this is true, then the first @table in the section we are talking
about should say

  @table @code
  @item
  *stopped,reason="@var{reason}"
  @end table


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-26 13:32       ` Eli Zaretskii
@ 2005-03-27  2:56         ` Bob Rossi
  2005-03-27  4:42           ` Eli Zaretskii
  0 siblings, 1 reply; 29+ messages in thread
From: Bob Rossi @ 2005-03-27  2:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On Sat, Mar 26, 2005 at 03:29:05PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 26 Mar 2005 12:36:32 +0200
> > From: "Eli Zaretskii" <eliz@gnu.org>
> > 
> > Btw, do we always have @var{reason} after "stopped"?  If not, then
> > it's optional and should be inside [...].
> 
> In addition, it looks to me like "stopped" states the reason like so:
> 
>   *stopped,reason="REASON"
> 
> If this is true, then the first @table in the section we are talking
> about should say
> 
>   @table @code
>   @item
>   *stopped,reason="@var{reason}"
>   @end table

Hi Eli,

Thanks for all the excellent suggestions, I can see how this is much
much nicer than what I had. There is probably still room for improving,
what do you think?

BTW, you might already know, but it's worth mentioning, there are 3
types of out-of-band records. In this section only the *stopped, which
is exec-async-output, is mentioned. That's why I added the sentence, 
   +In particular, the @var{exec-async-output} records.
After this doco and patch is approved, I'm going to enumerate the other
2 case's, status-async-output and notify-async-output.

Also, For each item, I could add the MI commands that could be done to get the
response described. Like, -exec-finish produces function-finished.
However, the user won't know when you get 'read-watchpoint-trigger'.
What do you think? and if so, how would that fit into this description?
Another table perhaps?

Thanks,
Bob Rossi

2005-03-26  Bob Rossi  <bob@brasko.net>

   * gdb.texinfo (GDB/MI Out-of-band Records): Enumerating the possible 
   out-of-band exec-async-output reasons.

Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.233
diff -w -u -r1.233 gdb.texinfo
--- gdb.texinfo 10 Mar 2005 13:12:33 -0000  1.233
+++ gdb.texinfo 27 Mar 2005 02:50:34 -0000
@@ -15416,9 +15416,40 @@
 target activity (e.g., target stopped).
 
 The following is a preliminary list of possible out-of-band records.
+In particular, the @var{exec-async-output} records.
 
 @table @code
-@item "*" "stop"
+@item *stopped,reason="@var{reason}"
+@end table
+
+@var{reason} can be one of the following:
+
+@table @code
+@item breakpoint-hit
+A breakpoint was reached.
+@item watchpoint-trigger
+A watchpoint was triggered.
+@item read-watchpoint-trigger
+A read watchpoint was triggered
+@item access-watchpoint-trigger 
+An access watchpoint was triggered.
+@item function-finished
+An -exec-finish or similar CLI command was accomplished.
+@item location-reached
+An -exec-until or similar CLI command was accomplished.
+@item watchpoint-scope
+A watchpoint has gone out of scope.
+@item end-stepping-range
+An -exec-next,-exec-next-instruction,-exec-step,-exec-step-instruction or 
+similar CLI command was accomplished.
+@item exited-signalled 
+The inferior exited because of a signal.
+@item exited 
+The inferior exited.
+@item exited-normally 
+The inferior exited normally.
+@item signal-received 
+A signal was received by the inferior.
 @end table



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-27  2:56         ` Bob Rossi
@ 2005-03-27  4:42           ` Eli Zaretskii
  0 siblings, 0 replies; 29+ messages in thread
From: Eli Zaretskii @ 2005-03-27  4:42 UTC (permalink / raw)
  To: gdb-patches

> Date: Sat, 26 Mar 2005 22:55:29 -0500
> From: Bob Rossi <bob@brasko.net>
> Cc: gdb-patches@sources.redhat.com
> 
> Thanks for all the excellent suggestions, I can see how this is much
> much nicer than what I had. There is probably still room for improving,
> what do you think?

It's fine now, I have only one minor comment, see below.

> After this doco and patch is approved, I'm going to enumerate the other
> 2 case's, status-async-output and notify-async-output.

Thanks.

> Also, For each item, I could add the MI commands that could be done to get the
> response described. Like, -exec-finish produces function-finished.

That would be good, I think.

> However, the user won't know when you get 'read-watchpoint-trigger'.
> What do you think? and if so, how would that fit into this description?
> Another table perhaps?

Why not mention that with each @item in the table you already added?
That is, under "@item function-finished" mention -exec-finish.

> +@item function-finished
> +An -exec-finish or similar CLI command was accomplished.

CLI commands such as -exec-finish should be in @code.

Otherwise, this can go in (provided that the code patch was approved).

Thanks.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 21:20   ` Bob Rossi
  2005-03-26 10:43     ` Eli Zaretskii
@ 2005-04-30 19:32     ` Daniel Jacobowitz
  2005-05-18  3:29       ` Bob Rossi
  2005-05-18  8:53       ` Bob Rossi
  2005-06-15 19:25     ` David Lecomber
  2 siblings, 2 replies; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-04-30 19:32 UTC (permalink / raw)
  To: gdb-patches

On Thu, Mar 24, 2005 at 04:20:36PM -0500, Bob Rossi wrote:
> > 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!

You're still having a bit of trouble with those pesky spaces before
function argument lists.  You've also got spaces in the first column;
please don't start lines with eight spaces, make sure you use tabs
appropriately instead.

For example:
	ui_out_field_string (uiout, "reason", 
                             async_reason_lookup(EXEC_ASYNC_BREAKPOINT_HIT));

Needs to be:
	ui_out_field_string (uiout, "reason", 
			     async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));

When you wrap a line between a function and its argument list, it gains
one level of indentation (i.e. two spaces).

> 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

NULL, please.

A couple of other places in GDB have similar idioms, for instance
osabi.c/osabi.h.  If you use [] for the array, you can create an
_initialize_mi_common function which verifies that the array has the
correct number of entries and issues an internal error if they get out
of step.

You can also do this as a compile time test in C, but it's kind of
ugly.  For instance, here's one way to do it:

static int dummy[(ARRAY_SIZE (async_reason_string_lookup)
		  == EXEC_ASYNC_LAST + 1) ? 0 : -1];

Probably should stick with the internal error; that way there's an
obvious message associated.

The accessor function should issue an internal error if the reason is
out of bounds.

The documentation had a couple of comma-separated lists with missing
spaces, i.e. "-exec-step,-exec-next" should be "-exec-step, -exec-next".

Would you mind reposting the patch with these fixes, and the latest
revision of the documentation?

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-04-30 19:32     ` Daniel Jacobowitz
@ 2005-05-18  3:29       ` Bob Rossi
  2005-05-18  3:34         ` Daniel Jacobowitz
  2005-05-18  8:53       ` Bob Rossi
  1 sibling, 1 reply; 29+ messages in thread
From: Bob Rossi @ 2005-05-18  3:29 UTC (permalink / raw)
  To: gdb-patches

On Sat, Apr 30, 2005 at 03:32:20PM -0400, Daniel Jacobowitz wrote:
> On Thu, Mar 24, 2005 at 04:20:36PM -0500, Bob Rossi wrote:
> > > 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!
> 
> You're still having a bit of trouble with those pesky spaces before
> function argument lists.  You've also got spaces in the first column;
> please don't start lines with eight spaces, make sure you use tabs
> appropriately instead.
> 
> For example:
> 	ui_out_field_string (uiout, "reason", 
>                              async_reason_lookup(EXEC_ASYNC_BREAKPOINT_HIT));
> 
> Needs to be:
> 	ui_out_field_string (uiout, "reason", 
> 			     async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
> 
> When you wrap a line between a function and its argument list, it gains
> one level of indentation (i.e. two spaces).
> 
> > 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
> 
> NULL, please.

Hi Daniel, I didn't put NULL simply because I didn't know what header to
include to get the symbol. So, should I include defs.h? Or should I
include stdlib.h directly? What if stdlib.h is not defined?

Thanks,
Bob Rossi


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-18  3:29       ` Bob Rossi
@ 2005-05-18  3:34         ` Daniel Jacobowitz
  2005-05-18  3:36           ` Bob Rossi
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-05-18  3:34 UTC (permalink / raw)
  To: gdb-patches

On Tue, May 17, 2005 at 11:18:12PM -0400, Bob Rossi wrote:
> Hi Daniel, I didn't put NULL simply because I didn't know what header to
> include to get the symbol. So, should I include defs.h? Or should I
> include stdlib.h directly? What if stdlib.h is not defined?

You should always be including "defs.h" in GDB source files anyway.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-18  3:34         ` Daniel Jacobowitz
@ 2005-05-18  3:36           ` Bob Rossi
  2005-05-18  3:43             ` Daniel Jacobowitz
  0 siblings, 1 reply; 29+ messages in thread
From: Bob Rossi @ 2005-05-18  3:36 UTC (permalink / raw)
  To: gdb-patches

On Tue, May 17, 2005 at 11:20:47PM -0400, Daniel Jacobowitz wrote:
> On Tue, May 17, 2005 at 11:18:12PM -0400, Bob Rossi wrote:
> > Hi Daniel, I didn't put NULL simply because I didn't know what header to
> > include to get the symbol. So, should I include defs.h? Or should I
> > include stdlib.h directly? What if stdlib.h is not defined?
> 
> You should always be including "defs.h" in GDB source files anyway.

Thanks, finally, I've got the _initialize function, but I can't find
where to call it from. Either I'm slowly going blind, or I simply can't
see where all the _init* functions are being called from. Any idea?

Bob Rossi


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-18  3:36           ` Bob Rossi
@ 2005-05-18  3:43             ` Daniel Jacobowitz
  2005-05-18  4:00               ` Bob Rossi
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-05-18  3:43 UTC (permalink / raw)
  To: gdb-patches

On Tue, May 17, 2005 at 11:29:19PM -0400, Bob Rossi wrote:
> On Tue, May 17, 2005 at 11:20:47PM -0400, Daniel Jacobowitz wrote:
> > On Tue, May 17, 2005 at 11:18:12PM -0400, Bob Rossi wrote:
> > > Hi Daniel, I didn't put NULL simply because I didn't know what header to
> > > include to get the symbol. So, should I include defs.h? Or should I
> > > include stdlib.h directly? What if stdlib.h is not defined?
> > 
> > You should always be including "defs.h" in GDB source files anyway.
> 
> Thanks, finally, I've got the _initialize function, but I can't find
> where to call it from. Either I'm slowly going blind, or I simply can't
> see where all the _init* functions are being called from. Any idea?

You shouldn't need to do a thing.  It's a generated file, see the
Makefile.

You might have missed adding the file to the appropriate SFILES list?

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-18  3:43             ` Daniel Jacobowitz
@ 2005-05-18  4:00               ` Bob Rossi
  0 siblings, 0 replies; 29+ messages in thread
From: Bob Rossi @ 2005-05-18  4:00 UTC (permalink / raw)
  To: gdb-patches

On Tue, May 17, 2005 at 11:34:06PM -0400, Daniel Jacobowitz wrote:
> On Tue, May 17, 2005 at 11:29:19PM -0400, Bob Rossi wrote:
> > On Tue, May 17, 2005 at 11:20:47PM -0400, Daniel Jacobowitz wrote:
> > > On Tue, May 17, 2005 at 11:18:12PM -0400, Bob Rossi wrote:
> > > > Hi Daniel, I didn't put NULL simply because I didn't know what header to
> > > > include to get the symbol. So, should I include defs.h? Or should I
> > > > include stdlib.h directly? What if stdlib.h is not defined?
> > > 
> > > You should always be including "defs.h" in GDB source files anyway.
> > 
> > Thanks, finally, I've got the _initialize function, but I can't find
> > where to call it from. Either I'm slowly going blind, or I simply can't
> > see where all the _init* functions are being called from. Any idea?
> 
> You shouldn't need to do a thing.  It's a generated file, see the
> Makefile.
> 
> You might have missed adding the file to the appropriate SFILES list?

Wow, that's great! Yes, it automatically works. Since I didn't see it
failing, I didn't know that it was running. I put a failing case and saw
GDB give the error upon startup.

Thanks very much,
Bob Rossi


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-04-30 19:32     ` Daniel Jacobowitz
  2005-05-18  3:29       ` Bob Rossi
@ 2005-05-18  8:53       ` Bob Rossi
  2005-05-26  2:35         ` Bob Rossi
  2005-05-28 18:56         ` Daniel Jacobowitz
  1 sibling, 2 replies; 29+ messages in thread
From: Bob Rossi @ 2005-05-18  8:53 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 13999 bytes --]

On Sat, Apr 30, 2005 at 03:32:20PM -0400, Daniel Jacobowitz wrote:
> On Thu, Mar 24, 2005 at 04:20:36PM -0500, Bob Rossi wrote:
> > > 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!
> 
> You're still having a bit of trouble with those pesky spaces before
> function argument lists.  You've also got spaces in the first column;
> please don't start lines with eight spaces, make sure you use tabs
> appropriately instead.
> 
> For example:
> 	ui_out_field_string (uiout, "reason", 
>                              async_reason_lookup(EXEC_ASYNC_BREAKPOINT_HIT));
> 
> Needs to be:
> 	ui_out_field_string (uiout, "reason", 
> 			     async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));

OK, fixed, thanks.

> > 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
> 
> NULL, please.

OK, done.

> A couple of other places in GDB have similar idioms, for instance
> osabi.c/osabi.h.  If you use [] for the array, you can create an
> _initialize_mi_common function which verifies that the array has the
> correct number of entries and issues an internal error if they get out
> of step.

Done.

> The documentation had a couple of comma-separated lists with missing
> spaces, i.e. "-exec-step,-exec-next" should be "-exec-step, -exec-next".

Done.

> Would you mind reposting the patch with these fixes, and the latest
> revision of the documentation?

Not at all. Thanks for taking the time to review my patches, even though
I'm still learning some of the basics (ie. GNU coding standard).

I have a feeling that I messed up the internal_error coding style
function call in _initialize_gdb_mi_common, but I have no idea how to
fix it. The constant char* error message is longer than 80 char's. Any
ideas? (I even ran gdb_indent on it, but it didn't help)

2005-05-17  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.
	* mi/mi-common.h: New file.
	* mi/mi-common.c: Ditto.

Thanks,
Bob Rossi

Index: src/gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.731
diff -w -u -r1.731 Makefile.in
--- src/gdb/Makefile.in	15 May 2005 18:19:43 -0000	1.731
+++ src/gdb/Makefile.in	18 May 2005 03:53:58 -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
@@ -1777,7 +1778,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) $(solib_h) \
-	$(solist_h) $(observer_h) $(exceptions_h) $(gdb_events_h)
+	$(solist_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)
@@ -2128,7 +2129,8 @@
 	$(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) $(solib_h) $(gdb_assert_h)
+	$(value_h) $(observer_h) $(language_h) $(solib_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)
@@ -2995,6 +2997,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.214
diff -w -u -r1.214 breakpoint.c
--- src/gdb/breakpoint.c	12 May 2005 20:21:16 -0000	1.214
+++ src/gdb/breakpoint.c	18 May 2005 03:54:02 -0000
@@ -55,6 +55,7 @@
 #include "exceptions.h"
 
 #include "gdb-events.h"
+#include "mi/mi-common.h"
 
 /* Prototypes for local functions. */
 
@@ -2113,7 +2114,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;
@@ -2248,7 +2250,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 = ");
@@ -2268,7 +2272,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 = ");
@@ -2284,7 +2290,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 = ");
@@ -2298,7 +2306,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 = ");
 	}
@@ -2314,7 +2324,9 @@
 
     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;
 
@@ -2544,7 +2556,9 @@
 	 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.201
diff -w -u -r1.201 infrun.c
--- src/gdb/infrun.c	12 May 2005 20:21:17 -0000	1.201
+++ src/gdb/infrun.c	18 May 2005 03:54:04 -0000
@@ -48,6 +48,7 @@
 #include "solib.h"
 
 #include "gdb_assert.h"
+#include "mi/mi-common.h"
 
 /* Prototypes for local functions */
 
@@ -2876,7 +2877,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. */
@@ -2886,7 +2889,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",
@@ -2906,7 +2911,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);
@@ -2915,7 +2921,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;
@@ -2926,7 +2934,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/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
retrieving revision 1.494
diff -w -u -r1.494 ChangeLog
--- src/gdb/doc/ChangeLog	12 May 2005 09:05:45 -0000	1.494
+++ src/gdb/doc/ChangeLog	18 May 2005 03:54:07 -0000
@@ -1,3 +1,8 @@
+2005-05-17  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.
+
 2005-05-12  Eli Zaretskii  <eliz@gnu.org>
 
 	* gdb.texinfo (Startup): Fix last change.  Treat gdb.ini like we
Index: src/gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.253
diff -w -u -r1.253 gdb.texinfo
--- src/gdb/doc/gdb.texinfo	12 May 2005 09:05:42 -0000	1.253
+++ src/gdb/doc/gdb.texinfo	18 May 2005 03:54:20 -0000
@@ -16953,9 +16953,40 @@
 target activity (e.g., target stopped).
 
 The following is a preliminary list of possible out-of-band records.
+In particular, the @var{exec-async-output} records.
 
 @table @code
-@item "*" "stop"
+@item *stopped,reason="@var{reason}"
+@end table
+
+@var{reason} can be one of the following:
+
+@table @code
+@item breakpoint-hit
+A breakpoint was reached.
+@item watchpoint-trigger
+A watchpoint was triggered.
+@item read-watchpoint-trigger
+A read watchpoint was triggered
+@item access-watchpoint-trigger 
+An access watchpoint was triggered.
+@item function-finished
+An -exec-finish or similar CLI command was accomplished.
+@item location-reached
+An -exec-until or similar CLI command was accomplished.
+@item watchpoint-scope
+A watchpoint has gone out of scope.
+@item end-stepping-range
+An -exec-next, -exec-next-instruction, -exec-step, -exec-step-instruction or 
+similar CLI command was accomplished.
+@item exited-signalled 
+The inferior exited because of a signal.
+@item exited 
+The inferior exited.
+@item exited-normally 
+The inferior exited normally.
+@item signal-received 
+A signal was received by the inferior.
 @end table
 
 

[-- Attachment #2: mi-common.c --]
[-- Type: text/x-csrc, Size: 1559 bytes --]

/* 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 "defs.h"
#include "mi-common.h"

static const char * const async_reason_string_lookup[] =
{
  "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",
  NULL
};

const char *
async_reason_lookup (enum async_reply_reason reason)
{
  return async_reason_string_lookup[reason];
}

void
_initialize_gdb_mi_common (void)
{
  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__,
      _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));
}

[-- Attachment #3: mi-common.h --]
[-- Type: text/x-chdr, Size: 1632 bytes --]

/* 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

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-18  8:53       ` Bob Rossi
@ 2005-05-26  2:35         ` Bob Rossi
  2005-05-28 18:56         ` Daniel Jacobowitz
  1 sibling, 0 replies; 29+ messages in thread
From: Bob Rossi @ 2005-05-26  2:35 UTC (permalink / raw)
  To: gdb-patches

1 Week Ping. (finger's crossed)

Bob Rossi

On Wed, May 18, 2005 at 12:00:11AM -0400, Bob Rossi wrote:
> On Sat, Apr 30, 2005 at 03:32:20PM -0400, Daniel Jacobowitz wrote:
> > On Thu, Mar 24, 2005 at 04:20:36PM -0500, Bob Rossi wrote:
> > > > 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!
> > 
> > You're still having a bit of trouble with those pesky spaces before
> > function argument lists.  You've also got spaces in the first column;
> > please don't start lines with eight spaces, make sure you use tabs
> > appropriately instead.
> > 
> > For example:
> > 	ui_out_field_string (uiout, "reason", 
> >                              async_reason_lookup(EXEC_ASYNC_BREAKPOINT_HIT));
> > 
> > Needs to be:
> > 	ui_out_field_string (uiout, "reason", 
> > 			     async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
> 
> OK, fixed, thanks.
> 
> > > 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
> > 
> > NULL, please.
> 
> OK, done.
> 
> > A couple of other places in GDB have similar idioms, for instance
> > osabi.c/osabi.h.  If you use [] for the array, you can create an
> > _initialize_mi_common function which verifies that the array has the
> > correct number of entries and issues an internal error if they get out
> > of step.
> 
> Done.
> 
> > The documentation had a couple of comma-separated lists with missing
> > spaces, i.e. "-exec-step,-exec-next" should be "-exec-step, -exec-next".
> 
> Done.
> 
> > Would you mind reposting the patch with these fixes, and the latest
> > revision of the documentation?
> 
> Not at all. Thanks for taking the time to review my patches, even though
> I'm still learning some of the basics (ie. GNU coding standard).
> 
> I have a feeling that I messed up the internal_error coding style
> function call in _initialize_gdb_mi_common, but I have no idea how to
> fix it. The constant char* error message is longer than 80 char's. Any
> ideas? (I even ran gdb_indent on it, but it didn't help)
> 
> 2005-05-17  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.
> 	* mi/mi-common.h: New file.
> 	* mi/mi-common.c: Ditto.
> 
> Thanks,
> Bob Rossi
> 
> Index: src/gdb/Makefile.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/Makefile.in,v
> retrieving revision 1.731
> diff -w -u -r1.731 Makefile.in
> --- src/gdb/Makefile.in	15 May 2005 18:19:43 -0000	1.731
> +++ src/gdb/Makefile.in	18 May 2005 03:53:58 -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
> @@ -1777,7 +1778,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) $(solib_h) \
> -	$(solist_h) $(observer_h) $(exceptions_h) $(gdb_events_h)
> +	$(solist_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)
> @@ -2128,7 +2129,8 @@
>  	$(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) $(solib_h) $(gdb_assert_h)
> +	$(value_h) $(observer_h) $(language_h) $(solib_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)
> @@ -2995,6 +2997,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.214
> diff -w -u -r1.214 breakpoint.c
> --- src/gdb/breakpoint.c	12 May 2005 20:21:16 -0000	1.214
> +++ src/gdb/breakpoint.c	18 May 2005 03:54:02 -0000
> @@ -55,6 +55,7 @@
>  #include "exceptions.h"
>  
>  #include "gdb-events.h"
> +#include "mi/mi-common.h"
>  
>  /* Prototypes for local functions. */
>  
> @@ -2113,7 +2114,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;
> @@ -2248,7 +2250,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 = ");
> @@ -2268,7 +2272,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 = ");
> @@ -2284,7 +2290,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 = ");
> @@ -2298,7 +2306,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 = ");
>  	}
> @@ -2314,7 +2324,9 @@
>  
>      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;
>  
> @@ -2544,7 +2556,9 @@
>  	 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.201
> diff -w -u -r1.201 infrun.c
> --- src/gdb/infrun.c	12 May 2005 20:21:17 -0000	1.201
> +++ src/gdb/infrun.c	18 May 2005 03:54:04 -0000
> @@ -48,6 +48,7 @@
>  #include "solib.h"
>  
>  #include "gdb_assert.h"
> +#include "mi/mi-common.h"
>  
>  /* Prototypes for local functions */
>  
> @@ -2876,7 +2877,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. */
> @@ -2886,7 +2889,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",
> @@ -2906,7 +2911,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);
> @@ -2915,7 +2921,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;
> @@ -2926,7 +2934,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/ChangeLog
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
> retrieving revision 1.494
> diff -w -u -r1.494 ChangeLog
> --- src/gdb/doc/ChangeLog	12 May 2005 09:05:45 -0000	1.494
> +++ src/gdb/doc/ChangeLog	18 May 2005 03:54:07 -0000
> @@ -1,3 +1,8 @@
> +2005-05-17  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.
> +
>  2005-05-12  Eli Zaretskii  <eliz@gnu.org>
>  
>  	* gdb.texinfo (Startup): Fix last change.  Treat gdb.ini like we
> Index: src/gdb/doc/gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.253
> diff -w -u -r1.253 gdb.texinfo
> --- src/gdb/doc/gdb.texinfo	12 May 2005 09:05:42 -0000	1.253
> +++ src/gdb/doc/gdb.texinfo	18 May 2005 03:54:20 -0000
> @@ -16953,9 +16953,40 @@
>  target activity (e.g., target stopped).
>  
>  The following is a preliminary list of possible out-of-band records.
> +In particular, the @var{exec-async-output} records.
>  
>  @table @code
> -@item "*" "stop"
> +@item *stopped,reason="@var{reason}"
> +@end table
> +
> +@var{reason} can be one of the following:
> +
> +@table @code
> +@item breakpoint-hit
> +A breakpoint was reached.
> +@item watchpoint-trigger
> +A watchpoint was triggered.
> +@item read-watchpoint-trigger
> +A read watchpoint was triggered
> +@item access-watchpoint-trigger 
> +An access watchpoint was triggered.
> +@item function-finished
> +An -exec-finish or similar CLI command was accomplished.
> +@item location-reached
> +An -exec-until or similar CLI command was accomplished.
> +@item watchpoint-scope
> +A watchpoint has gone out of scope.
> +@item end-stepping-range
> +An -exec-next, -exec-next-instruction, -exec-step, -exec-step-instruction or 
> +similar CLI command was accomplished.
> +@item exited-signalled 
> +The inferior exited because of a signal.
> +@item exited 
> +The inferior exited.
> +@item exited-normally 
> +The inferior exited normally.
> +@item signal-received 
> +A signal was received by the inferior.
>  @end table
>  
>  




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-18  8:53       ` Bob Rossi
  2005-05-26  2:35         ` Bob Rossi
@ 2005-05-28 18:56         ` Daniel Jacobowitz
  2005-05-29  2:55           ` Bob Rossi
  1 sibling, 1 reply; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-05-28 18:56 UTC (permalink / raw)
  To: gdb-patches

On Wed, May 18, 2005 at 12:00:11AM -0400, Bob Rossi wrote:
> I have a feeling that I messed up the internal_error coding style
> function call in _initialize_gdb_mi_common, but I have no idea how to
> fix it. The constant char* error message is longer than 80 char's. Any
> ideas? (I even ran gdb_indent on it, but it didn't help)

There's lots of ways to do this.  You have:

  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__,
      _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));

You could do:

  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__, _("\
_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));

Or:
  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__,
		    _("_initialize_gdb_mi_common: "
		      "async_reason_string_lookup[] is inconsistent"));

Or:
  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error
      (__FILE__, __LINE__,
       _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));

Except that last one is still past 80 chars.

Or, you could do this:
  if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
    internal_error (__FILE__, __LINE__,
		    _("async_reason_string_lookup[] is inconsistent"));

Or my personal favorite of the bunch:
  if (ARRAY_SIZE (async_reason_string_lookup) != EXEC_ASYNC_LAST + 1)
    internal_error (__FILE__, __LINE__,
		    _("async_reason_string_lookup is inconsistent"));

Which won't access out of bounds memory if someone shortens the array. 
No one ever will, of course, but...

> 
> 2005-05-17  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.
> 	* mi/mi-common.h: New file.
> 	* mi/mi-common.c: Ditto.

The other half of your changelog was lost in the patch below :-)

> -	    ui_out_field_string (uiout, "reason", "watchpoint-trigger");
> +	    ui_out_field_string (uiout, "reason", 
> +				 async_reason_lookup
> +				 (EXEC_ASYNC_WATCHPOINT_TRIGGER));

This is fine, but if the indentation bugs you, here's an alternative:

	    ui_out_field_string
	      (uiout, "reason",
	       async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));


> +@item read-watchpoint-trigger
> +A read watchpoint was triggered

This one lost a trailing period.

> /* 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!  */

In general stray line breaks in comments will get eaten by
gdb_indent.sh.  You can just put the NOTE on the same line.  Also,
"asynchronous" with an h.

>     /* This is here only to represent the number of enum's */

"the number of enums.  "

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-28 18:56         ` Daniel Jacobowitz
@ 2005-05-29  2:55           ` Bob Rossi
  2005-05-29  3:00             ` Bob Rossi
  2005-05-29  3:11             ` Daniel Jacobowitz
  0 siblings, 2 replies; 29+ messages in thread
From: Bob Rossi @ 2005-05-29  2:55 UTC (permalink / raw)
  To: gdb-patches

On Sat, May 28, 2005 at 02:53:02PM -0400, Daniel Jacobowitz wrote:
> On Wed, May 18, 2005 at 12:00:11AM -0400, Bob Rossi wrote:
> > I have a feeling that I messed up the internal_error coding style
> > function call in _initialize_gdb_mi_common, but I have no idea how to
> > fix it. The constant char* error message is longer than 80 char's. Any
> > ideas? (I even ran gdb_indent on it, but it didn't help)
> 
> There's lots of ways to do this.  You have:
> 
>   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
>     internal_error (__FILE__, __LINE__,
>       _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));
> 
> You could do:
> 
>   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
>     internal_error (__FILE__, __LINE__, _("\
> _initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));
> 
> Or:
>   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
>     internal_error (__FILE__, __LINE__,
> 		    _("_initialize_gdb_mi_common: "
> 		      "async_reason_string_lookup[] is inconsistent"));
> 
> Or:
>   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
>     internal_error
>       (__FILE__, __LINE__,
>        _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));
> 
> Except that last one is still past 80 chars.
> 
> Or, you could do this:
>   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
>     internal_error (__FILE__, __LINE__,
> 		    _("async_reason_string_lookup[] is inconsistent"));
> 
> Or my personal favorite of the bunch:
>   if (ARRAY_SIZE (async_reason_string_lookup) != EXEC_ASYNC_LAST + 1)
>     internal_error (__FILE__, __LINE__,
> 		    _("async_reason_string_lookup is inconsistent"));

OK, I choose the last one. Seems good to me. Honestly, seeing all of the
choices above really helps me understand a bit better the GNU coding
standard. Thanks for taking the time to show some options.

> > -	    ui_out_field_string (uiout, "reason", "watchpoint-trigger");
> > +	    ui_out_field_string (uiout, "reason", 
> > +				 async_reason_lookup
> > +				 (EXEC_ASYNC_WATCHPOINT_TRIGGER));
> 
> This is fine, but if the indentation bugs you, here's an alternative:
> 
> 	    ui_out_field_string
> 	      (uiout, "reason",
> 	       async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));

Yes, I didn't like the way it looked. I've changed it in the revised
patch. 
> 
> 
> > +@item read-watchpoint-trigger
> > +A read watchpoint was triggered
> 
> This one lost a trailing period.

Done.

> > /* 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!  */
> 
> In general stray line breaks in comments will get eaten by
> gdb_indent.sh.  You can just put the NOTE on the same line.  Also,
> "asynchronous" with an h.

Done.

> >     /* This is here only to represent the number of enum's */
> 
> "the number of enums.  "

Done.

The patch below should contain all of the changes. Thank you again for
all your help. The more I do this, the more reliable my patches should
become. At least as the GNU coding standard is concerned.

RCS file: /cvs/src/src/gdb/ChangeLog,v
+	* 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.
+	* mi/mi-common.h: New file.
+	* mi/mi-common.c: Ditto.

RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
+	* 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: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.733
diff -w -u -r1.733 Makefile.in
--- gdb/Makefile.in	22 May 2005 20:36:18 -0000	1.733
+++ gdb/Makefile.in	29 May 2005 02:45:29 -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
@@ -1778,7 +1779,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) $(solib_h) \
-	$(solist_h) $(observer_h) $(exceptions_h) $(gdb_events_h)
+	$(solist_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)
@@ -2129,7 +2130,8 @@
 	$(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) $(solib_h) $(gdb_assert_h)
+	$(value_h) $(observer_h) $(language_h) $(solib_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)
@@ -3000,6 +3002,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: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.216
diff -w -u -r1.216 breakpoint.c
--- gdb/breakpoint.c	26 May 2005 20:48:56 -0000	1.216
+++ gdb/breakpoint.c	29 May 2005 02:45:33 -0000
@@ -55,6 +55,7 @@
 #include "exceptions.h"
 
 #include "gdb-events.h"
+#include "mi/mi-common.h"
 
 /* Prototypes for local functions. */
 
@@ -2114,7 +2115,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;
@@ -2249,7 +2251,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 = ");
@@ -2269,7 +2273,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 = ");
@@ -2285,7 +2291,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 = ");
@@ -2299,7 +2307,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 = ");
 	}
@@ -2315,7 +2325,9 @@
 
     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;
 
@@ -2545,7 +2557,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: gdb/infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.201
diff -w -u -r1.201 infrun.c
--- gdb/infrun.c	12 May 2005 20:21:17 -0000	1.201
+++ gdb/infrun.c	29 May 2005 02:45:35 -0000
@@ -48,6 +48,7 @@
 #include "solib.h"
 
 #include "gdb_assert.h"
+#include "mi/mi-common.h"
 
 /* Prototypes for local functions */
 
@@ -2876,7 +2877,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. */
@@ -2886,7 +2889,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",
@@ -2906,7 +2911,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);
@@ -2915,7 +2921,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;
@@ -2926,7 +2934,8 @@
       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: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.257
diff -w -u -r1.257 gdb.texinfo
--- gdb/doc/gdb.texinfo	26 May 2005 19:28:23 -0000	1.257
+++ gdb/doc/gdb.texinfo	29 May 2005 02:45:51 -0000
@@ -16969,9 +16969,40 @@
 target activity (e.g., target stopped).
 
 The following is a preliminary list of possible out-of-band records.
+In particular, the @var{exec-async-output} records.
 
 @table @code
-@item "*" "stop"
+@item *stopped,reason="@var{reason}"
+@end table
+
+@var{reason} can be one of the following:
+
+@table @code
+@item breakpoint-hit
+A breakpoint was reached.
+@item watchpoint-trigger
+A watchpoint was triggered.
+@item read-watchpoint-trigger
+A read watchpoint was triggered.
+@item access-watchpoint-trigger 
+An access watchpoint was triggered.
+@item function-finished
+An -exec-finish or similar CLI command was accomplished.
+@item location-reached
+An -exec-until or similar CLI command was accomplished.
+@item watchpoint-scope
+A watchpoint has gone out of scope.
+@item end-stepping-range
+An -exec-next, -exec-next-instruction, -exec-step, -exec-step-instruction or 
+similar CLI command was accomplished.
+@item exited-signalled 
+The inferior exited because of a signal.
+@item exited 
+The inferior exited.
+@item exited-normally 
+The inferior exited normally.
+@item signal-received 
+A signal was received by the inferior.
 @end table
 
 


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-29  2:55           ` Bob Rossi
@ 2005-05-29  3:00             ` Bob Rossi
  2005-05-29  4:57               ` Daniel Jacobowitz
  2005-05-29  3:11             ` Daniel Jacobowitz
  1 sibling, 1 reply; 29+ messages in thread
From: Bob Rossi @ 2005-05-29  3:00 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 14544 bytes --]

Oops, here is the 2 new files I forgot to put in the last patch. 

Bob Rossi

On Sat, May 28, 2005 at 10:53:49PM -0400, Bob Rossi wrote:
> On Sat, May 28, 2005 at 02:53:02PM -0400, Daniel Jacobowitz wrote:
> > On Wed, May 18, 2005 at 12:00:11AM -0400, Bob Rossi wrote:
> > > I have a feeling that I messed up the internal_error coding style
> > > function call in _initialize_gdb_mi_common, but I have no idea how to
> > > fix it. The constant char* error message is longer than 80 char's. Any
> > > ideas? (I even ran gdb_indent on it, but it didn't help)
> > 
> > There's lots of ways to do this.  You have:
> > 
> >   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
> >     internal_error (__FILE__, __LINE__,
> >       _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));
> > 
> > You could do:
> > 
> >   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
> >     internal_error (__FILE__, __LINE__, _("\
> > _initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));
> > 
> > Or:
> >   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
> >     internal_error (__FILE__, __LINE__,
> > 		    _("_initialize_gdb_mi_common: "
> > 		      "async_reason_string_lookup[] is inconsistent"));
> > 
> > Or:
> >   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
> >     internal_error
> >       (__FILE__, __LINE__,
> >        _("_initialize_gdb_mi_common: async_reason_string_lookup[] is inconsistent"));
> > 
> > Except that last one is still past 80 chars.
> > 
> > Or, you could do this:
> >   if (async_reason_string_lookup[EXEC_ASYNC_LAST] != NULL)
> >     internal_error (__FILE__, __LINE__,
> > 		    _("async_reason_string_lookup[] is inconsistent"));
> > 
> > Or my personal favorite of the bunch:
> >   if (ARRAY_SIZE (async_reason_string_lookup) != EXEC_ASYNC_LAST + 1)
> >     internal_error (__FILE__, __LINE__,
> > 		    _("async_reason_string_lookup is inconsistent"));
> 
> OK, I choose the last one. Seems good to me. Honestly, seeing all of the
> choices above really helps me understand a bit better the GNU coding
> standard. Thanks for taking the time to show some options.
> 
> > > -	    ui_out_field_string (uiout, "reason", "watchpoint-trigger");
> > > +	    ui_out_field_string (uiout, "reason", 
> > > +				 async_reason_lookup
> > > +				 (EXEC_ASYNC_WATCHPOINT_TRIGGER));
> > 
> > This is fine, but if the indentation bugs you, here's an alternative:
> > 
> > 	    ui_out_field_string
> > 	      (uiout, "reason",
> > 	       async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
> 
> Yes, I didn't like the way it looked. I've changed it in the revised
> patch. 
> > 
> > 
> > > +@item read-watchpoint-trigger
> > > +A read watchpoint was triggered
> > 
> > This one lost a trailing period.
> 
> Done.
> 
> > > /* 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!  */
> > 
> > In general stray line breaks in comments will get eaten by
> > gdb_indent.sh.  You can just put the NOTE on the same line.  Also,
> > "asynchronous" with an h.
> 
> Done.
> 
> > >     /* This is here only to represent the number of enum's */
> > 
> > "the number of enums.  "
> 
> Done.
> 
> The patch below should contain all of the changes. Thank you again for
> all your help. The more I do this, the more reliable my patches should
> become. At least as the GNU coding standard is concerned.
> 
> RCS file: /cvs/src/src/gdb/ChangeLog,v
> +	* 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.
> +	* mi/mi-common.h: New file.
> +	* mi/mi-common.c: Ditto.
> 
> RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
> +	* 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: gdb/Makefile.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/Makefile.in,v
> retrieving revision 1.733
> diff -w -u -r1.733 Makefile.in
> --- gdb/Makefile.in	22 May 2005 20:36:18 -0000	1.733
> +++ gdb/Makefile.in	29 May 2005 02:45:29 -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
> @@ -1778,7 +1779,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) $(solib_h) \
> -	$(solist_h) $(observer_h) $(exceptions_h) $(gdb_events_h)
> +	$(solist_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)
> @@ -2129,7 +2130,8 @@
>  	$(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) $(solib_h) $(gdb_assert_h)
> +	$(value_h) $(observer_h) $(language_h) $(solib_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)
> @@ -3000,6 +3002,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: gdb/breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.216
> diff -w -u -r1.216 breakpoint.c
> --- gdb/breakpoint.c	26 May 2005 20:48:56 -0000	1.216
> +++ gdb/breakpoint.c	29 May 2005 02:45:33 -0000
> @@ -55,6 +55,7 @@
>  #include "exceptions.h"
>  
>  #include "gdb-events.h"
> +#include "mi/mi-common.h"
>  
>  /* Prototypes for local functions. */
>  
> @@ -2114,7 +2115,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;
> @@ -2249,7 +2251,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 = ");
> @@ -2269,7 +2273,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 = ");
> @@ -2285,7 +2291,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 = ");
> @@ -2299,7 +2307,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 = ");
>  	}
> @@ -2315,7 +2325,9 @@
>  
>      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;
>  
> @@ -2545,7 +2557,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: gdb/infrun.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infrun.c,v
> retrieving revision 1.201
> diff -w -u -r1.201 infrun.c
> --- gdb/infrun.c	12 May 2005 20:21:17 -0000	1.201
> +++ gdb/infrun.c	29 May 2005 02:45:35 -0000
> @@ -48,6 +48,7 @@
>  #include "solib.h"
>  
>  #include "gdb_assert.h"
> +#include "mi/mi-common.h"
>  
>  /* Prototypes for local functions */
>  
> @@ -2876,7 +2877,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. */
> @@ -2886,7 +2889,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",
> @@ -2906,7 +2911,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);
> @@ -2915,7 +2921,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;
> @@ -2926,7 +2934,8 @@
>        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: gdb/doc/gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.257
> diff -w -u -r1.257 gdb.texinfo
> --- gdb/doc/gdb.texinfo	26 May 2005 19:28:23 -0000	1.257
> +++ gdb/doc/gdb.texinfo	29 May 2005 02:45:51 -0000
> @@ -16969,9 +16969,40 @@
>  target activity (e.g., target stopped).
>  
>  The following is a preliminary list of possible out-of-band records.
> +In particular, the @var{exec-async-output} records.
>  
>  @table @code
> -@item "*" "stop"
> +@item *stopped,reason="@var{reason}"
> +@end table
> +
> +@var{reason} can be one of the following:
> +
> +@table @code
> +@item breakpoint-hit
> +A breakpoint was reached.
> +@item watchpoint-trigger
> +A watchpoint was triggered.
> +@item read-watchpoint-trigger
> +A read watchpoint was triggered.
> +@item access-watchpoint-trigger 
> +An access watchpoint was triggered.
> +@item function-finished
> +An -exec-finish or similar CLI command was accomplished.
> +@item location-reached
> +An -exec-until or similar CLI command was accomplished.
> +@item watchpoint-scope
> +A watchpoint has gone out of scope.
> +@item end-stepping-range
> +An -exec-next, -exec-next-instruction, -exec-step, -exec-step-instruction or 
> +similar CLI command was accomplished.
> +@item exited-signalled 
> +The inferior exited because of a signal.
> +@item exited 
> +The inferior exited.
> +@item exited-normally 
> +The inferior exited normally.
> +@item signal-received 
> +A signal was received by the inferior.
>  @end table
>  
>  

[-- Attachment #2: mi-common.h --]
[-- Type: text/x-chdr, Size: 1629 bytes --]

/* 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 asynchronous 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 enums.  */
    EXEC_ASYNC_LAST
  };

const char *async_reason_lookup (enum async_reply_reason reason);

#endif

[-- Attachment #3: mi-common.c --]
[-- Type: text/x-csrc, Size: 1541 bytes --]

/* 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 "defs.h"
#include "mi-common.h"

static const char * const async_reason_string_lookup[] =
{
  "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",
  NULL
};

const char *
async_reason_lookup (enum async_reply_reason reason)
{
  return async_reason_string_lookup[reason];
}

void
_initialize_gdb_mi_common (void)
{
  if (ARRAY_SIZE (async_reason_string_lookup) != EXEC_ASYNC_LAST + 1)
    internal_error (__FILE__, __LINE__,
		    _("async_reason_string_lookup is inconsistent"));
}

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-29  2:55           ` Bob Rossi
  2005-05-29  3:00             ` Bob Rossi
@ 2005-05-29  3:11             ` Daniel Jacobowitz
  1 sibling, 0 replies; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-05-29  3:11 UTC (permalink / raw)
  To: gdb-patches

On Sat, May 28, 2005 at 10:53:49PM -0400, Bob Rossi wrote:
> The patch below should contain all of the changes. Thank you again for
> all your help. The more I do this, the more reliable my patches should
> become. At least as the GNU coding standard is concerned.
> 
> RCS file: /cvs/src/src/gdb/ChangeLog,v
> +	* 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.
> +	* mi/mi-common.h: New file.
> +	* mi/mi-common.c: Ditto.
> 
> RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
> +	* gdb.texinfo (GDB/MI Out-of-band Records): Add bullet enumerating
> +	the possible reasons why an exec async record would be returned to FE.

These bits all look fine, but the new files are missing.

I really recommend using "cvs add" in your working trees, or cvsdo add
(from the cvsutils package), so that cvs diff -N can include new files. 
My $HOME/.cvsrc has this:

cvs -q
rdiff -u
diff -upN
co -P
update -P
log -N

Some of those options you probably don't want, they're specific to the
way I work - but the line for diff is very, very useful because it
means I rarely forget about new files.


-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-29  3:00             ` Bob Rossi
@ 2005-05-29  4:57               ` Daniel Jacobowitz
  2005-05-29  5:53                 ` Bob Rossi
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-05-29  4:57 UTC (permalink / raw)
  To: gdb-patches

On Sat, May 28, 2005 at 10:55:30PM -0400, Bob Rossi wrote:
> Oops, here is the 2 new files I forgot to put in the last patch. 

You're faster than I am :-)  This patch is now OK.  Please do me a
favor and add an extra space here:

> /* Represents the reason why GDB is sending an asynchronous command to the
>    front end. NOTE: When modifing this, don't forget to update gdb.texinfo!  */

               ^ right there.  Might need an extra line after that if
it pushes the end-comment out too far.

Thanks for your perseverance, as usual.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-05-29  4:57               ` Daniel Jacobowitz
@ 2005-05-29  5:53                 ` Bob Rossi
  0 siblings, 0 replies; 29+ messages in thread
From: Bob Rossi @ 2005-05-29  5:53 UTC (permalink / raw)
  To: gdb-patches

On Sat, May 28, 2005 at 11:00:04PM -0400, Daniel Jacobowitz wrote:
> On Sat, May 28, 2005 at 10:55:30PM -0400, Bob Rossi wrote:
> > Oops, here is the 2 new files I forgot to put in the last patch. 
> 
> You're faster than I am :-)  This patch is now OK.  Please do me a
> favor and add an extra space here:
> 
> > /* Represents the reason why GDB is sending an asynchronous command to the
> >    front end. NOTE: When modifing this, don't forget to update gdb.texinfo!  */
> 
>                ^ right there.  Might need an extra line after that if
> it pushes the end-comment out too far.
> 
> Thanks for your perseverance, as usual.

Thanks very much! I couldn't be more happy. I'd really like to see some
major improvements to GDB/MI over the next few months, and this is a good
start.

Thanks,
Bob Rossi


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-03-24 21:20   ` Bob Rossi
  2005-03-26 10:43     ` Eli Zaretskii
  2005-04-30 19:32     ` Daniel Jacobowitz
@ 2005-06-15 19:25     ` David Lecomber
  2005-06-15 20:03       ` Bob Rossi
  2 siblings, 1 reply; 29+ messages in thread
From: David Lecomber @ 2005-06-15 19:25 UTC (permalink / raw)
  To: Bob Rossi; +Cc: patches

Dear all,

Since this commit, it's now no longer possible to build with ./configure
--disable-gdbmi.  The reason is failure to link because it doesn't find 
async_reason_lookup.

Can I propose we disable that configure option, or are there some
platforms where mi doesn't build?  Patch to follow if we're all in
agreement. 

Regards
David



On Thu, 2005-03-24 at 16:20 -0500, Bob Rossi wrote: 
[..]
> 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.
[..]
-- 
David Lecomber <david@allinea.com>


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-06-15 19:25     ` David Lecomber
@ 2005-06-15 20:03       ` Bob Rossi
  2005-06-15 20:46         ` Daniel Jacobowitz
  0 siblings, 1 reply; 29+ messages in thread
From: Bob Rossi @ 2005-06-15 20:03 UTC (permalink / raw)
  To: David Lecomber; +Cc: patches

On Wed, Jun 15, 2005 at 08:30:04PM +0100, David Lecomber wrote:
> Dear all,
> 
> Since this commit, it's now no longer possible to build with ./configure
> --disable-gdbmi.  The reason is failure to link because it doesn't find 
> async_reason_lookup.
> 
> Can I propose we disable that configure option, or are there some
> platforms where mi doesn't build?  Patch to follow if we're all in
> agreement. 
> 
> Regards
> David

Oops, sorry. Well, I don't know of any need for the option, and support
removing it. Although, I you'll obviously have to wait for a maintainer.

Bob Rossi

> On Thu, 2005-03-24 at 16:20 -0500, Bob Rossi wrote: 
> [..]
> > 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.
> [..]
> -- 
> David Lecomber <david@allinea.com>


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [mi] organize possible exec async mi oc command reasons
  2005-06-15 20:03       ` Bob Rossi
@ 2005-06-15 20:46         ` Daniel Jacobowitz
  0 siblings, 0 replies; 29+ messages in thread
From: Daniel Jacobowitz @ 2005-06-15 20:46 UTC (permalink / raw)
  To: David Lecomber, patches

On Wed, Jun 15, 2005 at 04:02:50PM -0400, Bob Rossi wrote:
> On Wed, Jun 15, 2005 at 08:30:04PM +0100, David Lecomber wrote:
> > Dear all,
> > 
> > Since this commit, it's now no longer possible to build with ./configure
> > --disable-gdbmi.  The reason is failure to link because it doesn't find 
> > async_reason_lookup.
> > 
> > Can I propose we disable that configure option, or are there some
> > platforms where mi doesn't build?  Patch to follow if we're all in
> > agreement. 
> > 
> > Regards
> > David
> 
> Oops, sorry. Well, I don't know of any need for the option, and support
> removing it. Although, I you'll obviously have to wait for a maintainer.

I didn't even remember it existed.  I think, at this point, there is no
further point in supporting it.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2005-06-15 20:46 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-24 15:46 [mi] organize possible exec async mi oc command reasons Bob Rossi
2005-03-24 15:54 ` Daniel Jacobowitz
2005-03-24 16:06 ` Daniel Jacobowitz
2005-03-24 18:47   ` Stan Shebs
2005-03-24 21:20   ` Bob Rossi
2005-03-26 10:43     ` Eli Zaretskii
2005-04-30 19:32     ` Daniel Jacobowitz
2005-05-18  3:29       ` Bob Rossi
2005-05-18  3:34         ` Daniel Jacobowitz
2005-05-18  3:36           ` Bob Rossi
2005-05-18  3:43             ` Daniel Jacobowitz
2005-05-18  4:00               ` Bob Rossi
2005-05-18  8:53       ` Bob Rossi
2005-05-26  2:35         ` Bob Rossi
2005-05-28 18:56         ` Daniel Jacobowitz
2005-05-29  2:55           ` Bob Rossi
2005-05-29  3:00             ` Bob Rossi
2005-05-29  4:57               ` Daniel Jacobowitz
2005-05-29  5:53                 ` Bob Rossi
2005-05-29  3:11             ` Daniel Jacobowitz
2005-06-15 19:25     ` David Lecomber
2005-06-15 20:03       ` Bob Rossi
2005-06-15 20:46         ` Daniel Jacobowitz
2005-03-24 20:00 ` Eli Zaretskii
2005-03-24 21:02   ` Bob Rossi
2005-03-26 10:40     ` Eli Zaretskii
2005-03-26 13:32       ` Eli Zaretskii
2005-03-27  2:56         ` Bob Rossi
2005-03-27  4:42           ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox