Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Cc: Marc Khouzam <marc.khouzam@ericsson.com>
Subject: [PATCH] Fix bug 15181 Missing continue on dprintf that defaults to "gdb" style from "agent"
Date: Mon, 22 Apr 2013 09:22:00 -0000	[thread overview]
Message-ID: <CANFwon0wo7REDHb7FFk59Qoty_i_-NAwErFSQw7TZJWtqWNWrg@mail.gmail.com> (raw)

[-- 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\"." \

             reply	other threads:[~2013-04-21 11:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22  9:22 Hui Zhu [this message]
2013-04-22 13:31 ` Yao Qi
2013-04-23 17:53   ` Hui Zhu
2013-04-23 18:03     ` Yao Qi

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=CANFwon0wo7REDHb7FFk59Qoty_i_-NAwErFSQw7TZJWtqWNWrg@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    /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