Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "andrzej zaborowski" <balrogg@gmail.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Disallow pseudo-registers in agent expression.
Date: Sat, 26 Jan 2008 19:09:00 -0000	[thread overview]
Message-ID: <fb249edb0801261107s6444f842s45ef63860c38f4d3@mail.gmail.com> (raw)

Collecting a pseudo-register in a tracepoint action gives a failed
assert and probably wouldn't work anyway:

(gdb) action
Enter actions for tracepoint 1, one per line.
End with a line saying just "end".
> collect $pc
regcache.c:163: internal-error: register_type: Assertion `regnum >= 0
&& regnum < descr->nr_cooked_registers' failed.
A problem internal to GDB has been detected,

The patch also prevents a segfault when "action" or "while-stepping"
is ended with a ^D.

Attached is a mailer-unmangled version of the same file:
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1607,6 +1607,8 @@ gen_expr (union exp_element **pc, struct agent_expr *ax,
        if (reg == -1)
          internal_error (__FILE__, __LINE__,
                          _("Register $%s not available"), name);
+       if (reg >= gdbarch_num_regs (current_gdbarch))
+         error (_("GDB agent expressions cannot use pseudo-registers."));
        value->kind = axs_lvalue_register;
        value->u.reg = reg;
        value->type = register_type (current_gdbarch, reg);
index 2d744ae..ba57fee 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -862,8 +862,11 @@ read_actions (struct tracepoint *t)
        line = gdb_readline (0);

       if (!line)
-       line = "end";
-
+       {
+         line = xstrdup ("end");
+         printf_filtered ("end\n");
+       }
+
       linetype = validate_actionline (&line, t);
       if (linetype == BADLINE)
        continue;               /* already warned -- collect another line */


             reply	other threads:[~2008-01-26 19:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-26 19:09 andrzej zaborowski [this message]
2008-01-26 19:15 ` andrzej zaborowski
2008-01-27 21:11   ` Jim Blandy
2008-01-29  0:19     ` andrzej zaborowski
2008-01-29  1:49       ` Jim Blandy
2008-02-05 15:34         ` Jim Blandy
2008-02-05 15:58           ` Jim Blandy
2008-02-05 16:07             ` Jim Blandy
2008-02-05 18:23           ` andrzej zaborowski
2008-02-05 19:16             ` Jim Blandy

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=fb249edb0801261107s6444f842s45ef63860c38f4d3@mail.gmail.com \
    --to=balrogg@gmail.com \
    --cc=gdb-patches@sources.redhat.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