From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7125 invoked by alias); 29 Feb 2012 20:07:47 -0000 Received: (qmail 6991 invoked by uid 22791); 29 Feb 2012 20:07:44 -0000 X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=AWL,BAYES_00,KAM_STOCKTIP,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Feb 2012 20:07:29 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 0B0AB1C6B7F; Wed, 29 Feb 2012 15:07:29 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id siYV0B9LwLlg; Wed, 29 Feb 2012 15:07:28 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id C35EA1C6B73; Wed, 29 Feb 2012 15:07:28 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id A5F22145615; Wed, 29 Feb 2012 12:07:21 -0800 (PST) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Joel Brobecker Subject: [commit/Ada 2/3] processId: Do not modify already encoded IDs Date: Wed, 29 Feb 2012 20:16:00 -0000 Message-Id: <1330546034-27156-3-git-send-email-brobecker@adacore.com> In-Reply-To: <1330546034-27156-1-git-send-email-brobecker@adacore.com> References: <1330546034-27156-1-git-send-email-brobecker@adacore.com> 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: 2012-02/txt/msg00742.txt.bz2 The processID function is supposed to take a symbol name, and process it in a way that allows us to look that symbol up. This patch is adding a guard to make sure that we do not apply any transformation if we detect that we are given an already-encoded symbol name. For instance: gv___XR_pck__global_variable___XE This happens in the case where we are trying to print the value of a renaming. To do this, we simply parse and evaluate the XR symbol name as an expression. Without this change, the expression parser transforms gv___XR_pck__global_variable___XE into somethink like gv___xr_pck__global_variable___xe, which then screws up the rest of the renaming evaluation. gdb/ChangeLog: * ada-lex.p (processId): Do not modify already encoded IDs. Update function documentation. Tested on x86_64-linux, checked in. --- gdb/ChangeLog | 5 +++++ gdb/ada-lex.l | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c6a6d8f..621da5b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2012-02-29 Joel Brobecker + * ada-lex.p (processId): Do not modify already encoded IDs. + Update function documentation. + +2012-02-29 Joel Brobecker + * ada-lang.h (ada_find_renaming_symbol): Replace parameter "name" with "struct symbol *name_sym". * ada-exp.y (write_var_or_type): Update call to diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index 48667d0..5102ff4 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -410,7 +410,9 @@ processReal (const char *num0) /* Store a canonicalized version of NAME0[0..LEN-1] in yylval.ssym. The - resulting string is valid until the next call to ada_parse. It differs + resulting string is valid until the next call to ada_parse. If + NAME0 contains the substring "___", it is assumed to be already + encoded and the resulting name is equal to it. Otherwise, it differs from NAME0 in that: + Characters between '...' or <...> are transfered verbatim to yylval.ssym. @@ -430,8 +432,18 @@ processId (const char *name0, int len) int i0, i; struct stoken result; + result.ptr = name; while (len > 0 && isspace (name0[len-1])) len -= 1; + + if (strstr (name0, "___") != NULL) + { + strncpy (name, name0, len); + name[len] = '\000'; + result.length = len; + return result; + } + i = i0 = 0; while (i0 < len) { @@ -471,7 +483,6 @@ processId (const char *name0, int len) } name[i] = '\000'; - result.ptr = name; result.length = i; return result; } -- 1.7.1