From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21010 invoked by alias); 26 Jan 2008 19:08:02 -0000 Received: (qmail 20999 invoked by uid 22791); 26 Jan 2008 19:08:01 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.170) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 26 Jan 2008 19:07:44 +0000 Received: by ug-out-1314.google.com with SMTP id m2so1059517ugc.44 for ; Sat, 26 Jan 2008 11:07:41 -0800 (PST) Received: by 10.66.252.18 with SMTP id z18mr1217106ugh.37.1201374461196; Sat, 26 Jan 2008 11:07:41 -0800 (PST) Received: by 10.66.223.9 with HTTP; Sat, 26 Jan 2008 11:07:41 -0800 (PST) Message-ID: Date: Sat, 26 Jan 2008 19:09:00 -0000 From: "andrzej zaborowski" To: gdb-patches@sources.redhat.com Subject: [PATCH] Disallow pseudo-registers in agent expression. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00626.txt.bz2 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 */