[RFA] Fix c++/16253 (tag/variable name collision)

Joel Brobecker brobecker@adacore.com
Mon Mar 24 14:15:00 GMT 2014


Hey Keith,

> I must also give a shout out to Joel -- I've largely avoided hacking
> with/at Ada. In fact, Ada *largely* remains unchanged. However, it
> now must explicitly search STRUCT_DOMAIN in a few places itself (an
> analogous change to the other symbol table API changes I've made).
> Joel, if you could run this through your internal AdaCore test
> harness, that would be most helpful.

I had a chance to test your patch today, and unfortunately our testsuite
detected some regressions. I think they might all be the same, so I
picked the simplest testcase. I might be running short of time today
to look deeper into this, but I can try scheduling some time for it
tomorrow or Wed.

    % gnatmake -g foo
    % gdb foo
    (gdb) ptype base

It should have been:

    (gdb) ptype base
    type = (first, middle, last)

The debugger finds the type if you start the program, but I think
it's because it finds it via the DIE generated inside the main
subprogram's DIE because of the variable of that type declared
there:

    (gdb) start
    Temporary breakpoint 1 at 0x401d86: file foo.adb, line 4.
    Starting program: /[...]/foo

    Temporary breakpoint 1, foo () at foo.adb:4
    4          B : Base := Base'First;   <<<<<---  the variable of type Base
    (gdb) ptype base
    type = (first, middle, last)

This may not be directly related to your patch. I seem to have seen
some unexplainable behavior in GDB occasionally in the recent past
making me wonder whether there might be something fishy in the symbol
lookup for Ada.

-- 
Joel
-------------- next part --------------
with System;

package Pck is
   type Base is (First, Middle, Last);
   subtype Enum is Base range First .. Last;

   procedure Do_Nothing (A : System.Address);
end Pck;
-------------- next part --------------
package body Pck is

   procedure Do_Nothing (A : System.Address) is
   begin
      null;
   end Do_Nothing;

end Pck;
-------------- next part --------------
with Pck; use Pck;

procedure Foo is
   B : Base := Base'First;
begin
   Do_Nothing (B'Address);
end Foo;


More information about the Gdb-patches mailing list