From: Hui Zhu <teawater@gmail.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [PATCH] Fix tracepoint tstart again get gdb_assert
Date: Tue, 06 Dec 2011 15:57:00 -0000 [thread overview]
Message-ID: <CANFwon2oSCoM=jSmr2S+QqdsvicZL3HzZTy_hBqA=OWNWym0VQ@mail.gmail.com> (raw)
Hi,
I use a gdb tstart again in a section an got:
(gdb) tstart
(gdb) tstop
(gdb) tstart
../../src/gdb/tracepoint.c:1770: internal-error: start_tracing:
Assertion `!loc->inserted' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
The reason is:
start_tracing:
for (loc = b->loc; loc; loc = loc->next)
{
/* Since tracepoint locations are never duplicated, `inserted'
flag should be zero. */
gdb_assert (!loc->inserted);
target_download_tracepoint (loc);
loc->inserted = 1;
}
But in stop_tracing and trace_status_command don't have code to set
inserted back to 0.
So I make a patch for it.
Thanks,
Hui
2011-12-06 Hui Zhu <teawater@gmail.com>
* tracepoint.c (stop_tracing): Set loc->inserted if need.
(trace_status_command): Ditto.
---
tracepoint.c | 41 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 38 insertions(+), 3 deletions(-)
--- a/tracepoint.c
+++ b/tracepoint.c
@@ -1847,6 +1847,9 @@ void
stop_tracing (char *note)
{
int ret;
+ VEC(breakpoint_p) *tp_vec = NULL;
+ int ix;
+ struct breakpoint *b;
target_trace_stop ();
@@ -1859,6 +1862,22 @@ stop_tracing (char *note)
/* Should change in response to reply? */
current_trace_status ()->running = 0;
+
+ tp_vec = all_tracepoints ();
+ for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
+ {
+ struct tracepoint *t = (struct tracepoint *) b;
+ struct bp_location *loc;
+
+ if ((b->type == bp_fast_tracepoint
+ ? !may_insert_fast_tracepoints
+ : !may_insert_tracepoints))
+ continue;
+
+ for (loc = b->loc; loc; loc = loc->next)
+ loc->inserted = 0;
+ }
+ VEC_free (breakpoint_p, tp_vec);
}
/* tstatus command */
@@ -1868,7 +1887,7 @@ trace_status_command (char *args, int fr
struct trace_status *ts = current_trace_status ();
int status, ix;
VEC(breakpoint_p) *tp_vec = NULL;
- struct breakpoint *t;
+ struct breakpoint *b;
status = target_get_trace_status (ts);
@@ -2013,8 +2032,24 @@ trace_status_command (char *args, int fr
/* Now report any per-tracepoint status available. */
tp_vec = all_tracepoints ();
- for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
- target_get_tracepoint_status (t, NULL);
+ for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
+ {
+ struct tracepoint *t = (struct tracepoint *) b;
+ struct bp_location *loc;
+
+ target_get_tracepoint_status (b, NULL);
+
+ if (!ts->running)
+ {
+ if ((b->type == bp_fast_tracepoint
+ ? !may_insert_fast_tracepoints
+ : !may_insert_tracepoints))
+ continue;
+
+ for (loc = b->loc; loc; loc = loc->next)
+ loc->inserted = 0;
+ }
+ }
VEC_free (breakpoint_p, tp_vec);
}
next reply other threads:[~2011-12-06 15:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 15:57 Hui Zhu [this message]
2011-12-07 7:55 ` Yao Qi
2011-12-08 0:05 ` Stan Shebs
2011-12-08 8:00 ` Hui Zhu
2011-12-09 8:19 ` Yao Qi
2011-12-09 12:57 ` Yao Qi
2011-12-09 15:41 ` Pedro Alves
2011-12-09 16:03 ` Yao Qi
2011-12-09 16:14 ` Pedro Alves
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='CANFwon2oSCoM=jSmr2S+QqdsvicZL3HzZTy_hBqA=OWNWym0VQ@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