From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix PR 13392 : check offset of JMP insn
Date: Thu, 08 Mar 2012 17:07:00 -0000 [thread overview]
Message-ID: <4F58DDAB.7000304@redhat.com> (raw)
In-Reply-To: <4F571B2E.3080707@codesourcery.com>
On 03/07/2012 08:24 AM, Yao Qi wrote:
> On 03/07/2012 01:03 AM, Pedro Alves wrote:
>> > send a clearer error back to GDB, and we end up with:
>> >
>> > Target returns error code '.Tracepoint 2 at 0x7ffff67c2579 already exists'.
> It is OK for me to let remote target to reports a duplicated tracepoint.
I don't know what you mean then. It already does, but with a cryptic E01.
> In this version, some changes compared with last one,
>
> - move `tracepoint already exist' patch out, which can be a separate one,
> - remove downloaded tracepoint in target when failed to install,
We should also check what happens when we do "enable TRACEPOINT_FOO", and
that tracepoints fails to be likewise inserted. Following this direction,
we should make sure it stays disabled in the target, but _not_ deleted.
> +/* Remove TPOINT from global list. */
> +
> +static void
> +remove_tracepoint (struct tracepoint *tpoint)
> +{
> + struct tracepoint *tp, *tp_prev;
> +
> + for (tp = tracepoints, tp_prev = NULL; tp && tp != tpoint;
> + tp_prev = tp, tp = tp->next)
> + ;
> +
> + if (tp)
> + {
> + if (tp_prev)
> + tp_prev->next = tp->next;
> + else
> + tracepoints->next = tp->next;
This doesn't look correct. If there's no tp_prev, then TP must be
TRACEPOINTS, and so you need to do 'tracepoints = tp->next;'.
Or just rewrite this as:
static int
remove_tracepoint (struct tracepoint *todel)
{
struct tracepoint *tp, **tp_link;
tp = tracepoints;
tp_link = &tracepoints;
while (tp != NULL)
{
if (tp == todel)
{
*tp_link = tp->next;
xfree (tp);
return;
}
tp_link = &tp->next;
tp = *tp_link;
}
}
> /* There may be several tracepoints with the same number (because they
> are "locations", in GDB parlance); return the next one after the
> given tracepoint, or search from the beginning of the list if the
> @@ -2391,6 +2413,8 @@ cmd_qtdp (char *own_buf)
>
> download_tracepoint (tpoint);
> install_tracepoint (tpoint, own_buf);
> + if (strncmp (own_buf, "OK", 2) != 0)
> + remove_tracepoint (tpoint);
own_buf is a \0 terminated string. You can make that a straight strcmp(own_buf, "OK").
(Or change install_tracepoint's return type to int, to signal error.)
> + -re "Target returns error code .* too far .*$gdb_prompt $" {
> + if [string equal $trace_type "ftrace"] {
> + # The target was unable to install the fast tracepoint
> + # (e.g., jump pad too far from tracepoint).
> + pass "$test (too far)"
> + # Skip the rest of the tests.
> + return
Can you check tab/spaces here, and in the similar places, please? I may
have messed that up myself.
Otherwise okay.
--
Pedro Alves
next prev parent reply other threads:[~2012-03-08 17:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 13:39 Yao Qi
2012-03-06 17:03 ` Pedro Alves
2012-03-06 20:15 ` Philippe Waroquiers
2012-03-06 21:48 ` Stan Shebs
2012-03-07 20:41 ` Documenting E. packet. (was Re: [patch] Fix PR 13392 : check offset of JMP insn) Philippe Waroquiers
2012-03-07 20:59 ` Pedro Alves
2012-03-07 21:21 ` Philippe Waroquiers
2012-03-07 8:25 ` [patch] Fix PR 13392 : check offset of JMP insn Yao Qi
2012-03-08 17:07 ` Pedro Alves [this message]
2012-03-09 3:51 ` 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=4F58DDAB.7000304@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=yao@codesourcery.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