* Re: [RFA 1/3] [Ada] New GDB/MI command: -ada-tasks-info
@ 2011-09-20 6:09 Prus, Vladimir
0 siblings, 0 replies; 4+ messages in thread
From: Prus, Vladimir @ 2011-09-20 6:09 UTC (permalink / raw)
To: Joel Brobecker, Vladimir Prus; +Cc: gdb-patches
OK. In that case, I have no more comments.
Joel Brobecker <brobecker@adacore.com> wrote:
> I don't have any questions about the implementation, but I do wonder
> whether reusing "info os xxx" mechanism might be better here, e.g.:
>
> info os ada-tasks
I don't think it makes sense in this case. I could see system-wide
queries, or os-specific commands to use that prefix. But I don't see
how the list of Ada tasks would fit in the `info os' prefix. Ada tasks
and threads are very similar, so I would treat them the same.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread* [GDB/MI Ada] New GDB/MI command: -ada-tasks-info @ 2011-09-16 20:45 Joel Brobecker 2011-09-16 20:46 ` [RFA 1/3] [Ada] " Joel Brobecker 0 siblings, 1 reply; 4+ messages in thread From: Joel Brobecker @ 2011-09-16 20:45 UTC (permalink / raw) To: gdb-patches; +Cc: vladimir Hello, As mentioned earlier, I am resending this patch set, with corrected email subjects. The purpose of this patchset is to add a new GDB/MI command to get the list of Ada tasks. I mirrored that new command after the -thread-info command, except that it returns a table rather than a list (the latter is done for backwards compatibility reasons, which do not apply to this new command). I would appreciate some feedback, at least on the user-visible part of it (the command syntax and output). So, I will wait for comments before I commit anything. The series was tested on x86_64-linux. Thank you, -- Joel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [RFA 1/3] [Ada] New GDB/MI command: -ada-tasks-info 2011-09-16 20:45 [GDB/MI Ada] " Joel Brobecker @ 2011-09-16 20:46 ` Joel Brobecker 2011-09-19 17:52 ` Vladimir Prus 0 siblings, 1 reply; 4+ messages in thread From: Joel Brobecker @ 2011-09-16 20:46 UTC (permalink / raw) To: gdb-patches; +Cc: vladimir, Joel Brobecker This patch introduces a new GDB/MI command: -ada-tasks-info, which is meant to be the MI equivalent of the CLI `info tasks' command. This new command returns an array, with each row corresponding to one task. For now, the columns of the array corresponds to the columns displayed in the CLI output. gdb/ChangeLog: * ada-lang.h (struct inferior): Declare. (print_ada_task_info): Add declaration. * ada-tasks.c (print_ada_task_info): Make non-static. * mi/mi-cmds.c (mi_cmds): Add "ada-task-info". * mi/mi-cmds.h (mi_cmd_ada_task_info): Add declaration. * mi/mi-main.c: #include "ada-lang.h". (mi_cmd_list_features): Add "ada-task-info" to the list of supported features. (mi_cmd_ada_task_info): New function. Tested on x86_64-linux. Thanks, -- Joel --- gdb/ada-lang.h | 5 +++++ gdb/ada-tasks.c | 2 +- gdb/mi/mi-cmds.c | 1 + gdb/mi/mi-cmds.h | 1 + gdb/mi/mi-main.c | 13 +++++++++++++ 5 files changed, 21 insertions(+), 1 deletions(-) diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index cea9804..d887ef3 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -22,6 +22,7 @@ #define ADA_LANG_H 1 struct frame_info; +struct inferior; #include "value.h" #include "gdbtypes.h" @@ -385,4 +386,8 @@ extern void iterate_over_live_ada_tasks extern int ada_build_task_list (void); +extern void print_ada_task_info (struct ui_out *uiout, + char *taskno_str, + struct inferior *inf); + #endif diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 6e2f2f5..7dff8f8 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -929,7 +929,7 @@ ada_build_task_list (void) interpreted as a task number, and the table will be limited to that task only. */ -static void +void print_ada_task_info (struct ui_out *uiout, char *arg_str, struct inferior *inf) diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 0b32db0..960d2dc 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -33,6 +33,7 @@ static void build_table (struct mi_cmd *commands); struct mi_cmd mi_cmds[] = { + { "ada-task-info", { NULL, 0 }, mi_cmd_ada_task_info }, { "add-inferior", { NULL, 0 }, mi_cmd_add_inferior }, { "break-after", { "ignore", 1 }, NULL }, { "break-condition", { "cond", 1 }, NULL }, diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 18b4ad7..67aae59 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -36,6 +36,7 @@ extern const char mi_all_values[]; typedef void (mi_cmd_argv_ftype) (char *command, char **argv, int argc); /* Function implementing each command */ +extern mi_cmd_argv_ftype mi_cmd_ada_task_info; extern mi_cmd_argv_ftype mi_cmd_add_inferior; extern mi_cmd_argv_ftype mi_cmd_break_insert; extern mi_cmd_argv_ftype mi_cmd_break_commands; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 59fa576..36c4fe6 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -52,6 +52,7 @@ #include "osdata.h" #include "splay-tree.h" #include "tracepoint.h" +#include "ada-lang.h" #include <ctype.h> #include <sys/time.h> @@ -1720,6 +1721,7 @@ mi_cmd_list_features (char *command, char **argv, int argc) ui_out_field_string (uiout, NULL, "thread-info"); ui_out_field_string (uiout, NULL, "data-read-memory-bytes"); ui_out_field_string (uiout, NULL, "breakpoint-notifications"); + ui_out_field_string (uiout, NULL, "ada-task-info"); #if HAVE_PYTHON ui_out_field_string (uiout, NULL, "python"); @@ -2503,3 +2505,14 @@ mi_cmd_trace_stop (char *command, char **argv, int argc) stop_tracing (); trace_status_mi (1); } + +/* Implement the "-ada-task-info" GDB/MI command. */ + +void +mi_cmd_ada_task_info (char *command, char **argv, int argc) +{ + if (argc != 0 && argc != 1) + error (_("Invalid MI command")); + + print_ada_task_info (current_uiout, argv[0], current_inferior ()); +} -- 1.7.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA 1/3] [Ada] New GDB/MI command: -ada-tasks-info 2011-09-16 20:46 ` [RFA 1/3] [Ada] " Joel Brobecker @ 2011-09-19 17:52 ` Vladimir Prus 2011-09-20 4:12 ` Joel Brobecker 0 siblings, 1 reply; 4+ messages in thread From: Vladimir Prus @ 2011-09-19 17:52 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches On Saturday, September 17, 2011 00:45:19 Joel Brobecker wrote: > This patch introduces a new GDB/MI command: -ada-tasks-info, > which is meant to be the MI equivalent of the CLI `info tasks' > command. > > This new command returns an array, with each row corresponding > to one task. For now, the columns of the array corresponds to > the columns displayed in the CLI output. > > gdb/ChangeLog: > > * ada-lang.h (struct inferior): Declare. > (print_ada_task_info): Add declaration. > * ada-tasks.c (print_ada_task_info): Make non-static. > * mi/mi-cmds.c (mi_cmds): Add "ada-task-info". > * mi/mi-cmds.h (mi_cmd_ada_task_info): Add declaration. > * mi/mi-main.c: #include "ada-lang.h". > (mi_cmd_list_features): Add "ada-task-info" to the list > of supported features. > (mi_cmd_ada_task_info): New function. Hi Joel, I don't have any questions about the implementation, but I do wonder whether reusing "info os xxx" mechanism might be better here, e.g.: info os ada-tasks and a matching MI command. Oops, it appears we never submitted the matching MI command, but that's a one line patch anyway, below. I don't have the slighest clue whether "info os" mechanism is a good match here; I'm speaking purely from extensible interface point of view. Thanks, -- Vladimir Prus CodeSourcery / Mentor Graphics +7 (812) 677-68-40 Index: gdb/mi/mi-cmds.c =================================================================== --- gdb/mi/mi-cmds.c (revision 305439) +++ gdb/mi/mi-cmds.c (revision 305440) @@ -84,6 +84,7 @@ { "gdb-version", { "show version", 0 }, 0 }, { "inferior-tty-set", { NULL, 0 }, mi_cmd_inferior_tty_set}, { "inferior-tty-show", { NULL, 0 }, mi_cmd_inferior_tty_show}, + { "info-os", { "info os", 1 }, NULL }, { "interpreter-exec", { NULL, 0 }, mi_cmd_interpreter_exec}, { "list-features", { NULL, 0 }, mi_cmd_list_features}, { "list-target-features", { NULL, 0 }, mi_cmd_list_target_features}, ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA 1/3] [Ada] New GDB/MI command: -ada-tasks-info 2011-09-19 17:52 ` Vladimir Prus @ 2011-09-20 4:12 ` Joel Brobecker 0 siblings, 0 replies; 4+ messages in thread From: Joel Brobecker @ 2011-09-20 4:12 UTC (permalink / raw) To: Vladimir Prus; +Cc: gdb-patches > I don't have any questions about the implementation, but I do wonder > whether reusing "info os xxx" mechanism might be better here, e.g.: > > info os ada-tasks I don't think it makes sense in this case. I could see system-wide queries, or os-specific commands to use that prefix. But I don't see how the list of Ada tasks would fit in the `info os' prefix. Ada tasks and threads are very similar, so I would treat them the same. -- Joel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-20 5:42 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-09-20 6:09 [RFA 1/3] [Ada] New GDB/MI command: -ada-tasks-info Prus, Vladimir -- strict thread matches above, loose matches on Subject: below -- 2011-09-16 20:45 [GDB/MI Ada] " Joel Brobecker 2011-09-16 20:46 ` [RFA 1/3] [Ada] " Joel Brobecker 2011-09-19 17:52 ` Vladimir Prus 2011-09-20 4:12 ` Joel Brobecker
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox