public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions
@ 2013-02-23 13:41 marc.khouzam at ericsson dot com
2013-02-27 19:09 ` [Bug breakpoints/15180] " marc.khouzam at ericsson dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-02-23 13:41 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=15180
Bug #: 15180
Summary: Agent style dprintf does not respect conditions
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: breakpoints
AssignedTo: unassigned@sourceware.org
ReportedBy: marc.khouzam@ericsson.com
Classification: Unclassified
When I set a condition on an "agent"-style dprintf, the condition does not seem
to be respected, and I get extra printouts.
> gdb.7.6 loopfirst
GNU gdb (GDB) 7.5.50.20130223-cvs
(gdb) target extended-remote :9999
Remote debugging using :9999
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
0x00110850 in ?? () from /lib/ld-linux.so.2
(gdb) set dprintf-style agent
(gdb) l
1 #include <unistd.h>
2 #include <stdio.h>
3
4 int main() {
5 for (int i=0;i<20;i++) {
6 printf("hello");
7 printf("friend\n");
8 printf("home\n");
9 sleep(1);
10 }
(gdb) dprintf 8,"i is %d\n",i
Dprintf 1 at 0x804855f: file loopfirst.cc, line 8.
(gdb) cond 1 i>5
(gdb) info b
Num Type Disp Enb Address What
1 dprintf keep y 0x0804855f in main() at loopfirst.cc:8
stop only if i>5 (host evals)
agent-printf "i is %d\n",i
(gdb) c
Continuing.
[Inferior 1 (process 8361) exited normally]
I would expect to see the "i is %d" printout only once i hits 6, but this is
what I see on the gdbserver window. Notice that the dprintf prints from i == 0
but also the extra printouts "Found breakpoint condition"
Process /home/lmckhou/loopfirst created; pid = 8361
Listening on port 9999
Remote debugging from host 127.0.0.1
Found breakpoint condition.
Found breakpoint condition.
Found breakpoint condition.
hellofriend
i is 0
home
hellofriend
i is 1
home
hellofriend
i is 2
home
hellofriend
i is 3
home
hellofriend
i is 4
home
hellofriend
i is 5
home
hellofriend
i is 6
home
hellofriend
i is 7
[and so on]
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug breakpoints/15180] Agent style dprintf does not respect conditions
2013-02-23 13:41 [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions marc.khouzam at ericsson dot com
@ 2013-02-27 19:09 ` marc.khouzam at ericsson dot com
2013-04-23 7:00 ` teawater at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-02-27 19:09 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=15180
Marc Khouzam <marc.khouzam at ericsson dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |qiyao at gcc dot gnu.org
--- Comment #1 from Marc Khouzam <marc.khouzam at ericsson dot com> 2013-02-27 19:09:51 UTC ---
(In reply to comment #0)
> but also the extra printouts "Found breakpoint condition"
Yao just posted a patch for that part of the problem:
http://sourceware.org/ml/gdb-patches/2013-02/msg00679.html
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug breakpoints/15180] Agent style dprintf does not respect conditions
2013-02-23 13:41 [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions marc.khouzam at ericsson dot com
2013-02-27 19:09 ` [Bug breakpoints/15180] " marc.khouzam at ericsson dot com
@ 2013-04-23 7:00 ` teawater at gmail dot com
2013-04-23 7:15 ` teawater at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: teawater at gmail dot com @ 2013-04-23 7:00 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=15180
teawater <teawater at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |teawater at gmail dot com
AssignedTo|unassigned at sourceware |teawater at gmail dot com
|dot org |
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug breakpoints/15180] Agent style dprintf does not respect conditions
2013-02-23 13:41 [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions marc.khouzam at ericsson dot com
2013-02-27 19:09 ` [Bug breakpoints/15180] " marc.khouzam at ericsson dot com
2013-04-23 7:00 ` teawater at gmail dot com
@ 2013-04-23 7:15 ` teawater at gmail dot com
2013-04-24 1:22 ` teawater at gmail dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: teawater at gmail dot com @ 2013-04-23 7:15 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=15180
--- Comment #2 from teawater <teawater at gmail dot com> 2013-04-23 07:15:06 UTC ---
http://sourceware.org/ml/gdb-patches/2013-04/msg00690.html
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug breakpoints/15180] Agent style dprintf does not respect conditions
2013-02-23 13:41 [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions marc.khouzam at ericsson dot com
` (2 preceding siblings ...)
2013-04-23 7:15 ` teawater at gmail dot com
@ 2013-04-24 1:22 ` teawater at gmail dot com
2013-09-23 18:06 ` marc.khouzam at ericsson dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: teawater at gmail dot com @ 2013-04-24 1:22 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=15180
--- Comment #3 from teawater <teawater at gmail dot com> 2013-04-24 01:21:59 UTC ---
(In reply to comment #2)
> http://sourceware.org/ml/gdb-patches/2013-04/msg00690.html
After patch the patch, still have bug with 2 dprintf:
(gdb) !cat 1
dprintf /home/teawater/gdb/bgdbno/gdb/2.c:8,"1:i is %d\n",i
condition $bpnum i>5
dprintf /home/teawater/gdb/bgdbno/gdb/2.c:8,"2:i is %d\n",i
condition $bpnum i>6
gdbserver/gdbserver :1234 ./a.out
Process ./a.out created; pid = 6571
Listening on port 1234
Remote debugging from host 127.0.0.1
hellofriend
2:i is 0
1:i is 0
2:i is 0
home
hellofriend
2:i is 1
1:i is 1
2:i is 1
home
hellofriend
2:i is 2
1:i is 2
2:i is 2
home
hellofriend
2:i is 3
1:i is 3
2:i is 3
home
hellofriend
2:i is 4
1:i is 4
2:i is 4
home
hellofriend
2:i is 5
1:i is 5
2:i is 5
home
hellofriend
2:i is 6
1:i is 6
2:i is 6
home
hellofriend
2:i is 7
1:i is 7
2:i is 7
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug breakpoints/15180] Agent style dprintf does not respect conditions
2013-02-23 13:41 [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions marc.khouzam at ericsson dot com
` (3 preceding siblings ...)
2013-04-24 1:22 ` teawater at gmail dot com
@ 2013-09-23 18:06 ` marc.khouzam at ericsson dot com
2014-01-10 16:49 ` marc.khouzam at ericsson dot com
2014-06-02 22:32 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-09-23 18:06 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=15180
--- Comment #4 from Marc Khouzam <marc.khouzam at ericsson dot com> ---
I believe a new fix for this problem was posted here:
https://sourceware.org/ml/gdb-patches/2013-07/msg00038.html
The above fix tries to deal with two dprintf at the same address. I don't have
an opinion about the validity of the fix. However, until this fix is approved,
I think the very simple partial fix posted at
http://sourceware.org/ml/gdb-patches/2013-04/msg00690.html would be a nice
improvement. It would at least allow dprintf at different address to respect
their conditions.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug breakpoints/15180] Agent style dprintf does not respect conditions
2013-02-23 13:41 [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions marc.khouzam at ericsson dot com
` (4 preceding siblings ...)
2013-09-23 18:06 ` marc.khouzam at ericsson dot com
@ 2014-01-10 16:49 ` marc.khouzam at ericsson dot com
2014-06-02 22:32 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: marc.khouzam at ericsson dot com @ 2014-01-10 16:49 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=15180
--- Comment #5 from Marc Khouzam <marc.khouzam at ericsson dot com> ---
New post to fix this bug:
https://sourceware.org/ml/gdb-patches/2013-12/msg00822.html
If the above does not make it into 7.7, I still think accepting:
http://sourceware.org/ml/gdb-patches/2013-04/msg00690.html
would be a nice improvement.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug breakpoints/15180] Agent style dprintf does not respect conditions
2013-02-23 13:41 [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions marc.khouzam at ericsson dot com
` (5 preceding siblings ...)
2014-01-10 16:49 ` marc.khouzam at ericsson dot com
@ 2014-06-02 22:32 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-06-02 22:32 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=15180
--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".
The branch, master has been updated
via 41fac0cf495b84994046901e3293d54e8eef3534 (commit)
via cd1608cc4ed6e657deb405283011a6c2a795fb80 (commit)
via 0a261ed82e9b5f6fbc3725258a742515df8f4b42 (commit)
from 96ae5695ce2512600524915ace0bfef95a9734fc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=41fac0cf495b84994046901e3293d54e8eef3534
commit 41fac0cf495b84994046901e3293d54e8eef3534
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jun 2 22:27:33 2014 +0100
Installing a breakpoint on top of a dprintf makes GDB lose control.
While the full fix for PR 15180 isn't in, it's best if we at least
make sure that GDB doesn't lose control when a breakpoint is set at
the same address as a dprintf.
gdb/
2014-06-02 Pedro Alves <palves@redhat.com>
* breakpoint.c (build_target_command_list): Don't build a command
list if we have any duplicate location that isn't a dprintf.
gdb/testsuite/
2014-06-02 Pedro Alves <palves@redhat.com>
* gdb.base/dprintf-bp-same-addr.c: New file.
* gdb.base/dprintf-bp-same-addr.exp: New file.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cd1608cc4ed6e657deb405283011a6c2a795fb80
commit cd1608cc4ed6e657deb405283011a6c2a795fb80
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jun 2 22:27:32 2014 +0100
dprintf-style agent can't explain a trap.
If some event happens to trigger at the same address as a dprintf-style
agent dprintf is installed, GDB will complain, like:
(gdb) continue
Continuing.
May only run agent-printf on the target
(gdb)
Such dprintfs are completely handled on the target side, so they can't
explain a stop, but GDB is currently putting then on the bpstat chain
anyway, because they currently unconditionally use bkpt_breakpoint_hit
as breakpoint_hit method.
gdb/
2014-06-02 Pedro Alves <palves@redhat.com>
* breakpoint.c (dprintf_breakpoint_hit): New function.
(initialize_breakpoint_ops): Install it as dprintf's
breakpoint_hit method.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0a261ed82e9b5f6fbc3725258a742515df8f4b42
commit 0a261ed82e9b5f6fbc3725258a742515df8f4b42
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jun 2 22:27:32 2014 +0100
gdbserver: on GDB breakpoint reinsertion, also delete the breakpoint's
commands.
If GDB decides to change the breakpoint's conditions or commands,
it'll reinsert the same breakpoint again, with the new options
attached, without deleting the previous breakpoint. E.g.,
(gdb) set breakpoint always-inserted on
(gdb) b main if 0
Breakpoint 1 at 0x400594: file foo.c, line 21.
Sending packet: $Z0,400594,1;X3,220027#68...Packet received: OK
(gdb) b main
Breakpoint 15 at 0x400594: file foo.c, line 21.
Sending packet: $Z0,400594,1#49...Packet received: OK
GDBserver understands this and deletes the breakpoint's previous
conditions. But, it forgets to delete the previous commands.
gdb/gdbserver/
2014-06-02 Pedro Alves <palves@redhat.com>
* ax.c (gdb_free_agent_expr): New function.
* ax.h (gdb_free_agent_expr): New declaration.
* mem-break.c (delete_gdb_breakpoint_1): Also clear the commands
list.
(clear_breakpoint_conditions, clear_breakpoint_commands): Make
static.
(clear_breakpoint_conditions_and_commands): New function.
* mem-break.h (clear_breakpoint_conditions): Delete declaration.
(clear_breakpoint_conditions_and_commands): New declaration.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 11 ++++
gdb/breakpoint.c | 38 ++++++++++++--
gdb/gdbserver/ChangeLog | 12 ++++
gdb/gdbserver/ax.c | 10 ++++
gdb/gdbserver/ax.h | 3 +
gdb/gdbserver/mem-break.c | 43 +++++++++++++--
gdb/gdbserver/mem-break.h | 5 +-
gdb/gdbserver/server.c | 2 +-
gdb/testsuite/ChangeLog | 5 ++
gdb/testsuite/gdb.base/dprintf-bp-same-addr.c | 28 ++++++++++
gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp | 66 +++++++++++++++++++++++
11 files changed, 210 insertions(+), 13 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/dprintf-bp-same-addr.c
create mode 100644 gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-06-02 22:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-23 13:41 [Bug breakpoints/15180] New: Agent style dprintf does not respect conditions marc.khouzam at ericsson dot com
2013-02-27 19:09 ` [Bug breakpoints/15180] " marc.khouzam at ericsson dot com
2013-04-23 7:00 ` teawater at gmail dot com
2013-04-23 7:15 ` teawater at gmail dot com
2013-04-24 1:22 ` teawater at gmail dot com
2013-09-23 18:06 ` marc.khouzam at ericsson dot com
2014-01-10 16:49 ` marc.khouzam at ericsson dot com
2014-06-02 22:32 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).