From 084344da4284d1eb7ff15f6d179ced8235298d45 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sun, 16 Sep 2007 14:59:31 +0000 Subject: [PATCH] * mi/mi-cmds.c (mi_cmds): Register -list-features. * mi/mi-cmds.h (mi_cmd_list_features): New. * mi/mi-main.c (mi_cmd_list_features): New. --- gdb/ChangeLog | 6 ++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 31 +++++++++++++++++++++++++++++++ gdb/mi/mi-cmds.c | 1 + gdb/mi/mi-cmds.h | 1 + gdb/mi/mi-main.c | 19 +++++++++++++++++++ 6 files changed, 63 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4d8e5b0e458..c70570dcbf2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2007-09-16 Vladimir Prus + + * mi/mi-cmds.c (mi_cmds): Register -list-features. + * mi/mi-cmds.h (mi_cmd_list_features): New. + * mi/mi-main.c (mi_cmd_list_features): New. + 2007-09-11 Joel Brobecker GDB 6.7 branch created (branch timestamp: 2007-09-07 14:00 UTC) diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 6be80d6674e..67f74b9e3a1 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2007-09-19 Vladimir Prus + + * gdb.texinfo (Miscellaneous gdb/mi Commands): + Document -list-features. + 2007-09-15 Eli Zaretskii * gdb.texinfo (Output): Spell out which features of C's printf are diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9a743697ae7..4378e0c3f55 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -21277,6 +21277,37 @@ default shows this information when you start an interactive session. (gdb) @end smallexample +@subheading The @code{-list-features} Command +@findex -list-features + +Returns a list of particular features of the MI protocol that +this version of gdb implements. A feature can be a command, +or a new field in an output of some command, or even an +important bugfix. While a frontend can sometimes detect presence +of a feature at runtime, it is easier to perform detection at debugger +startup. + +The command returns a list of strings, with each string naming an +available feature. Each returned string is just a name, it does not +have any internal structure. The list of possible feature names +is given below. + +Example output: + +@smallexample +(gdb) -list-features +^done,result=["feature1","feature2"] +@end smallexample + +The current list of features is: + +@itemize @minus +@item +@samp{frozen-varobjs}---indicates presence of the +@code{-var-set-frozen} command, as well as possible presense of the +@code{frozen} field in the output of @code{-varobj-create}. +@end itemize + @subheading The @code{-interpreter-exec} Command @findex -interpreter-exec diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 48ba2087fa1..5bd8725e9c2 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -88,6 +88,7 @@ struct mi_cmd mi_cmds[] = { "inferior-tty-set", { NULL, 0 }, NULL, mi_cmd_inferior_tty_set}, { "inferior-tty-show", { NULL, 0 }, NULL, mi_cmd_inferior_tty_show}, { "interpreter-exec", { NULL, 0 }, 0, mi_cmd_interpreter_exec}, + { "list-features", { NULL, 0 }, 0, mi_cmd_list_features}, { "overlay-auto", { NULL, 0 }, NULL, NULL }, { "overlay-list-mapping-state", { NULL, 0 }, NULL, NULL }, { "overlay-list-overlays", { NULL, 0 }, NULL, NULL }, diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 7b3eb0e3bae..9888c85fb82 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -91,6 +91,7 @@ extern mi_cmd_argv_ftype mi_cmd_gdb_exit; extern mi_cmd_argv_ftype mi_cmd_inferior_tty_set; extern mi_cmd_argv_ftype mi_cmd_inferior_tty_show; extern mi_cmd_argv_ftype mi_cmd_interpreter_exec; +extern mi_cmd_argv_ftype mi_cmd_list_features; extern mi_cmd_argv_ftype mi_cmd_stack_info_depth; extern mi_cmd_argv_ftype mi_cmd_stack_info_frame; extern mi_cmd_argv_ftype mi_cmd_stack_list_args; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 0c4b904470c..93e28bf5049 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1075,6 +1075,25 @@ mi_cmd_enable_timings (char *command, char **argv, int argc) return MI_CMD_ERROR; } +enum mi_cmd_result +mi_cmd_list_features (char *command, char **argv, int argc) +{ + if (argc == 0) + { + struct cleanup *cleanup = NULL; + cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features"); + + ui_out_field_string (uiout, NULL, "frozen-varobjs"); + + do_cleanups (cleanup); + + return MI_CMD_DONE; + } + + error ("-list-features should be passed no arguments"); + return MI_CMD_ERROR; +} + /* Execute a command within a safe environment. Return <0 for error; >=0 for ok. -- 2.30.2