aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2009-03-12 20:08:04 +0000
committerVladimir Prus <vladimir@codesourcery.com>2009-03-12 20:08:04 +0000
commit1f31650a613dfe2ba24b6c61b7f6af54267e109d (patch)
tree51560c0d9408d958f6607a9d838ba37d759aad5b /gdb
parent4333ada327bfce18df7d41eaff019fe560fda084 (diff)
downloadgdb-1f31650a613dfe2ba24b6c61b7f6af54267e109d.zip
gdb-1f31650a613dfe2ba24b6c61b7f6af54267e109d.tar.gz
gdb-1f31650a613dfe2ba24b6c61b7f6af54267e109d.tar.bz2
Include token in ^running notification for CLI commands.
* mi/mi-main.c (mi_execute_command): Set current_token here. (mi_cmd_execute): Do not set current_token here.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/mi/mi-main.c11
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.mi/mi-cli.exp20
4 files changed, 38 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9e6ecda..2aeca94 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2009-03-12 Vladimir Prus <vladimir@codesourcery.com>
+ Include token in ^running notification for CLI commands.
+
+ * mi/mi-main.c (mi_execute_command): Set current_token here.
+ (mi_cmd_execute): Do not set current_token here.
+
+2009-03-12 Vladimir Prus <vladimir@codesourcery.com>
+
Fix MI timings.
* mi/mi-main.c (mi_print_timing_maybe): New.
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 2873b4d..97a136b 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1137,11 +1137,15 @@ mi_cmd_list_target_features (char *command, char **argv, int argc)
static void
captured_mi_execute_command (struct ui_out *uiout, void *data)
{
+ struct cleanup *cleanup;
struct mi_parse *context = (struct mi_parse *) data;
if (do_timings)
current_command_ts = context->cmd_start;
+ current_token = xstrdup (context->token);
+ cleanup = make_cleanup (free_current_contents, &current_token);
+
running_result_record_printed = 0;
switch (context->op)
{
@@ -1216,6 +1220,8 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
}
+ do_cleanups (cleanup);
+
return;
}
@@ -1310,10 +1316,9 @@ mi_cmd_execute (struct mi_parse *parse)
{
struct cleanup *cleanup;
int i;
- free_all_values ();
- current_token = xstrdup (parse->token);
- cleanup = make_cleanup (free_current_contents, &current_token);
+ free_all_values ();
+ cleanup = make_cleanup (null_cleanup, NULL);
if (parse->frame != -1 && parse->thread == -1)
error (_("Cannot specify --frame without --thread"));
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 50e61ce..9407f9f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-12 Vladimir Prus <vladimir@codesourcery.com>
+
+ * gdb.mi/mi-cli.exp: Verify that CLI commands that run inferior
+ include the token in ^running and frame info in *stopped.
+
2009-03-05 Paul Pluzhnikov <ppluzhnikov@google.com>
* solib-display.exp: New file.
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index b469acb..8427edf 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -155,8 +155,24 @@ mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*basics.c" \
$line_main_hello { "" "disp=\"del\"" } \
"-exec-continue to line $line_main_hello"
-mi_execute_to "exec-next" "end-stepping-range" "main" "" ".*basics.c" $line_main_return "" \
- "-exec-next to line $line_main_return"
+# Test that the token is output even for CLI commands
+# Also test that *stopped includes frame information.
+mi_gdb_test "34 next" \
+ ".*34\\\^running.*\\*running,thread-id=\"all\"" \
+ "34 next: run"
+
+gdb_expect {
+ -re "~\[^\r\n\]+\r\n" {
+ verbose -log "Hi there"
+ }
+}
+
+# Note that the output does not include stop reason. This is fine.
+# The purpose of *stopped notification for CLI command is to make
+# sure that frontend knows that inferior is stopped, and knows where.
+# Supplementary information is not necessary.
+mi_expect_stop "" "main" "" ".*basics.c" $line_main_return "" \
+ "34 next: stop"
mi_gdb_test "-interpreter-exec console \"list\"" \
"\~\"$line_main_return\[\\\\t ]*callme \\(1\\);\\\\n\".*\\^done" \