This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/commit+doco] GDB/MI: Document support for -exec-run --start in -list-features


Hello,

While reviewing all the changes I made for GDB/MI, recently, and making
sure that every new features should be check-able before use, I noticed
that were were missing a way to test if --exec-run supports --start.

This adds "exec-run-start-option" in the output of the -list-features
commands, allowing front-ends to easily determine whether -exec-run
supports the --start option.

gdb/ChangeLog:

        * mi/mi-main.c (mi_cmd_list_features): add "exec-run-start-option".
        * NEWS: Expand the entry documenting the new -exec-run --start
        option to mention the corresponding new entry in the output of
        "-list-features".

gdb/doc/ChangeLog:

	* gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new
	"exec-run-start-option" entry in the output of the "-list-features"
	command.

gdb/testsuite/ChangeLog:

        * gdb.mi/mi-start.exp: Add test verifying that -list-features
        contains "exec-run-start-option".

Tested on x86_64-linux. Both code and doco parts are relatively
straightforward, so I am planning on checking this in in a day or
two, assuming doco approval.

Thanks,
-- 
Joel

---
 gdb/NEWS                          | 4 +++-
 gdb/doc/gdb.texinfo               | 3 +++
 gdb/mi/mi-main.c                  | 1 +
 gdb/testsuite/gdb.mi/mi-start.exp | 6 ++++++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index 72816a0..04f4acd 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -188,7 +188,9 @@ show code-cache
   ** The -exec-run command now accepts an optional "--start" option.
      When used, the command follows the same semantics as the "start"
      command, stopping the program's execution at the start of its
-     main subprogram.
+     main subprogram.  Support for this feature can be verified using
+     the "-list-features" command, which should contain
+     "exec-run-start-option".
 
   ** The new commands -catch-assert and -catch-exceptions insert
      catchpoints stopping the program when Ada exceptions are raised.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 2602427..30a7227 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -35213,6 +35213,9 @@ Indicates support for the @code{-info-gdb-mi-command} command.
 Indicates support for the "undefined-command" error code in error result
 records, produced when trying to execute an undefined @sc{gdb/mi} command
 (@pxref{GDB/MI Result Records}).
+@item exec-run-start-option
+Indicates that the @code{-exec-run} command supports the @option{--start}
+option (@pxref{GDB/MI Program Execution}).
 @end table
 
 @subheading The @code{-list-target-features} Command
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 07f1dc1..63456cd 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1818,6 +1818,7 @@ mi_cmd_list_features (char *command, char **argv, int argc)
       ui_out_field_string (uiout, NULL, "language-option");
       ui_out_field_string (uiout, NULL, "info-gdb-mi-command");
       ui_out_field_string (uiout, NULL, "undefined-command-error-code");
+      ui_out_field_string (uiout, NULL, "exec-run-start-option");
 
 #if HAVE_PYTHON
       if (gdb_python_initialized)
diff --git a/gdb/testsuite/gdb.mi/mi-start.exp b/gdb/testsuite/gdb.mi/mi-start.exp
index 98dfef4..0cd759f 100644
--- a/gdb/testsuite/gdb.mi/mi-start.exp
+++ b/gdb/testsuite/gdb.mi/mi-start.exp
@@ -41,6 +41,12 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
+# First, verify that the debugger correctly advertises support
+# for the --start option of the -exec-run command.
+mi_gdb_test "-list-features" \
+            "\\^done,features=\\\[.*\"exec-run-start-option\".*\\\]" \
+            "-list-features includes \"exec-run-start-option\""
+
 mi_run_cmd "--start"
 mi_expect_stop "breakpoint-hit" "main" "" ".*mi-start.c" "$decimal" \
 { "" "disp=\"del\"" } "run to main"
-- 
1.8.1.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]