This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] (Ada) problem printing renaming which references a subprogram parameter


*** TEST RESULTS FOR COMMIT 342f82403949c74517a6353baec73b94d18549ad ***

Author: Joel Brobecker <brobecker@adacore.com>
Branch: master
Commit: 342f82403949c74517a6353baec73b94d18549ad

(Ada) problem printing renaming which references a subprogram parameter

Consider the following code, which creates a local variable B
which is a renaming whose expression references a subprogram
parameter:

   procedure Flip (Bits : in out Bits_Type; I : Natural) is
   begin
      declare
         B : Boolean renames Bits (I);
      begin
         B := not B; -- BREAK
      end;
   end Flip;

Trying to print the value of B when at the "BREAK" line currently
does not work:

    (gdb) p b
    Could not find i

What happens is the following: For the renaming, GNAT generates
a variable whose name is encoded as follow:

    b___XR_bits___XEXSi

GDB properly detects that variable, determines that, to compute
the variable's value, we start from the symbol "Bits", which
we then have to subscript (XS) using 'i' as the index. The error
occurs while trying to find 'i'.

This is because we forgot to pass the block in the call to
ada_lookup_encoded_symbol, which this patch fixes.

gdb/ChangeLog:

        * ada-exp.y (write_object_renaming): When subscripting an array
        using a symbol as the index, pass the block in call to
        ada_lookup_encoded_symbol when looking that symbol up.

gdb/testsuite/ChangeLog:

        * gdb.ada/rename_subscript_param: New testcase.

Tested on x86_64-linux.

Note: This requires the following GCC patch:

  | 2017-04-25  Pierre-Marie de Rodat  <derodat@adacore.com>
  |
  | * exp_dbug.adb: In Debug_Renaming_Declaration,
  | when dealing with indexed component, accept to produce a renaming
  | symbol when the index is an IN parameter or when it is a name
  | defined in an outer scope.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]