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>
Subject: [PATCH] fix Bug 15180 Agent style dprintf does not respect conditions
Date: Tue, 23 Apr 2013 20:00:00 -0000	[thread overview]
Message-ID: <CANFwon21X1C6nUjU1v6=nSGUCXEeJ2+gSPVi6U_xOaahjqFZVw@mail.gmail.com> (raw)

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

Hi,

This is because in linux_wait_1, it didn't add any check just call
run_breakpoint_commands (event_child->stop_pc);

So I add a check call run_breakpoint_commands only when condition is true.

Because I don't know howto handle the output in gdbserver.  So I
didn't add test for it.

Thanks,
Hui

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

	PR gdb/15180

	* linux-low.c (linux_wait_1): Add a check before call
	run_breakpoint_commands.

[-- Attachment #2: dprintf-gdbserver-cond.txt --]
[-- Type: text/plain, Size: 1369 bytes --]

--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -2313,6 +2313,7 @@ linux_wait_1 (ptid_t ptid,
   int maybe_internal_trap;
   int report_to_gdb;
   int trace_event;
+  int condition_true;
 
   /* Translate generic target options into linux options.  */
   options = __WALL;
@@ -2615,6 +2616,9 @@ Check if we're already there.\n",
       goto retry;
     }
 
+  condition_true = gdb_breakpoint_here (event_child->stop_pc)
+		   && gdb_condition_true_at_breakpoint (event_child->stop_pc);
+
   /* If GDB wanted this thread to single step, we always want to
      report the SIGTRAP, and let GDB handle it.  Watchpoints should
      always be reported.  So should signals we can't explain.  A
@@ -2628,11 +2632,11 @@ Check if we're already there.\n",
 		   || event_child->stopped_by_watchpoint
 		   || (!step_over_finished
 		       && !bp_explains_trap && !trace_event)
-		   || (gdb_breakpoint_here (event_child->stop_pc)
-		       && gdb_condition_true_at_breakpoint (event_child->stop_pc)
+		   || (condition_true
 		       && gdb_no_commands_at_breakpoint (event_child->stop_pc)));
 
-  run_breakpoint_commands (event_child->stop_pc);
+  if (condition_true)
+    run_breakpoint_commands (event_child->stop_pc);
 
   /* We found no reason GDB would want us to stop.  We either hit one
      of our own breakpoints, or finished an internal step GDB

             reply	other threads:[~2013-04-23  7:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 20:00 Hui Zhu [this message]
2013-04-23 20:38 ` 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='CANFwon21X1C6nUjU1v6=nSGUCXEeJ2+gSPVi6U_xOaahjqFZVw@mail.gmail.com' \
    --to=teawater@gmail.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