Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix bug 15181 Missing continue on dprintf that defaults to "gdb" style from "agent"
@ 2013-04-22  9:22 Hui Zhu
  2013-04-22 13:31 ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Hui Zhu @ 2013-04-22  9:22 UTC (permalink / raw)
  To: gdb-patches ml; +Cc: Marc Khouzam

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]

Hi,

This patch is from Marc to fix
http://sourceware.org/bugzilla/show_bug.cgi?id=15181
I add a test for it.

Please help me review it.

Thanks,
Hui

2013-04-21  Marc Khouzam  <marc.khouzam@ericsson.com>

	PR gdb/15181

	* breakpoint.c (update_dprintf_command_list): Add "continue" to
	command list if target cannot run dprintf commands.

2013-04-21  Hui Zhu  <hui@codesourcery.com>

	PR gdb/15181

	* gdb.base/dprintf.exp: Test dprintf commands if target cannot
	run dprintf commands.

[-- Attachment #2: dprintf-miss-continue.txt --]
[-- Type: text/plain, Size: 883 bytes --]

--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8910,6 +8910,7 @@ update_dprintf_command_list (struct brea
 {
   char *dprintf_args = b->extra_string;
   char *printf_line = NULL;
+  int need_continue = 0;
 
   if (!dprintf_args)
     return;
@@ -8950,6 +8951,7 @@ update_dprintf_command_list (struct brea
 	{
 	  warning (_("Target cannot run dprintf commands, falling back to GDB printf"));
 	  printf_line = xstrprintf ("printf %s", dprintf_args);
+	  need_continue = 1;
 	}
     }
   else
@@ -8961,7 +8963,8 @@ update_dprintf_command_list (struct brea
   {
     struct command_line *printf_cmd_line, *cont_cmd_line = NULL;
 
-    if (strcmp (dprintf_style, dprintf_style_agent) != 0)
+    if (strcmp (dprintf_style, dprintf_style_agent) != 0
+	|| need_continue)
       {
 	cont_cmd_line = xmalloc (sizeof (struct command_line));
 	cont_cmd_line->control_type = simple_control;

[-- Attachment #3: dprintf-miss-continue-test.txt --]
[-- Type: text/plain, Size: 636 bytes --]

--- a/gdb/testsuite/gdb.base/dprintf.exp
+++ b/gdb/testsuite/gdb.base/dprintf.exp
@@ -129,6 +129,17 @@ if $target_can_dprintf {
 	"\[\r\n\]\tbreakpoint already hit 2 times"
 	"\[\r\n\]        agent-printf \"arg=%d, g=%d\\\\n\", arg, g"
     }
+} else {
+    delete_breakpoints
+
+    gdb_test "dprintf foo,\"Hello\\n\"" \
+	"Dprintf .*"
+    gdb_test_sequence "info breakpoints" "dprintf info 3" {
+	"\[\r\n\]Num     Type           Disp Enb Address +What"
+	"\[\r\n\]6       dprintf"
+	"\[\r\n\]        printf \"Hello\\\\n\""
+	"\[\r\n\]        continue"
+    }
 }
 
 gdb_test "set dprintf-style foobar" "Undefined item: \"foobar\"." \

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-23  5:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-22  9:22 [PATCH] Fix bug 15181 Missing continue on dprintf that defaults to "gdb" style from "agent" Hui Zhu
2013-04-22 13:31 ` Yao Qi
2013-04-23 17:53   ` Hui Zhu
2013-04-23 18:03     ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox