From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [PATCH 1/3] [Ada] New GDB/MI command: -ada-tasks-info
Date: Fri, 16 Sep 2011 19:30:00 -0000 [thread overview]
Message-ID: <1316201377-14830-2-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <1316201377-14830-1-git-send-email-brobecker@adacore.com>
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.
---
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
next parent reply other threads:[~2011-09-16 19:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1316201377-14830-1-git-send-email-brobecker@adacore.com>
2011-09-16 19:30 ` Joel Brobecker [this message]
2011-09-16 20:45 ` Joel Brobecker
2011-09-16 19:30 ` [PATCH 2/3] [Ada] Add field "thread-id" in -ada-task-info output Joel Brobecker
2011-09-16 20:27 ` [PATCH 3/3] [Ada/doco] Document the new -ada-task-info GDB/MI command Joel Brobecker
2011-09-17 7:02 ` Eli Zaretskii
2011-09-19 18:57 ` Joel Brobecker
2011-10-03 21:41 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1316201377-14830-2-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox