Re: [PATCH] Disallow pseudo-registers in agent expression.

andrzej zaborowski
2008-01-26T19:10:29Z

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

On 26/01/2008, andrzej zaborowski <balrogg@gmail.com> wrote:
> Attached is a mailer-unmangled version of the same file:

Oops

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gdb-trace-syn.patch --]
[-- Type: text/x-patch; name=gdb-trace-syn.patch, Size: 1081 bytes --]

2008-01-26 Andrzej Zaborowski <balrog@zabor.org>
* ax-gdb.c (gen_expr): Check that register is raw or cooked.
* tracepoint.c (read_actions): Actions need to be free-able.

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 */