[Ada] processId: Do not modify already encoded IDs
authorJoel Brobecker <brobecker@gnat.com>
Wed, 29 Feb 2012 19:53:16 +0000 (19:53 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 29 Feb 2012 19:53:16 +0000 (19:53 +0000)
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.

gdb/ChangeLog
gdb/ada-lex.l

index c6a6d8f552244300f08941597fe1cbff61db8e46..621da5be4768f79b139e27dfa9d463f7958e019d 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-29  Joel Brobecker  <brobecker@adacore.com>
+
+       * ada-lex.p (processId): Do not modify already encoded IDs.
+       Update function documentation.
+
 2012-02-29  Joel Brobecker  <brobecker@adacore.com>
 
        * ada-lang.h (ada_find_renaming_symbol): Replace parameter
index 48667d062b5bbd93c08fa6266550817fde400136..5102ff49f59642c484596b1591faf5bc0cd21b1e 100644 (file)
@@ -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;
 }
This page took 0.03063 seconds and 4 git commands to generate.