From 036e93dfdadd23ac73d3bd7f98f1640ded740cc0 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Thu, 7 Nov 2013 08:35:35 +0400 Subject: Set language for Ada minimal symbols. This helps with the following issue: Given an Ada program defining a global variable: package Pck is Watch : Integer := 1974; end Pck; When printing the address of this variable, GDB also tries to print the associated symbol name: (gdb) p watch'address $1 = (access integer) 0x6139d8 ^^ || The problem is that GDB prints the variable's linkage name, instead of its natural name. This is because the language of the associated minimal symbol never really gets set. This patch adds handling for Ada symbols in symbol_find_demangled_name. After this patch, we now get: (gdb) p watch'address $1 = (access integer) 0x6139d8 ^ | gdb/ChangeLog: * symtab.c (symbol_find_demangled_name): Add handling of Ada symbols. gdb/testsuite/ChangeLog: * gdb.ada/int_deref.exp: Add test verifying that we print the decoded symbol name when printing the address of Ada symbols. --- gdb/testsuite/gdb.ada/int_deref.exp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gdb/testsuite/gdb.ada') diff --git a/gdb/testsuite/gdb.ada/int_deref.exp b/gdb/testsuite/gdb.ada/int_deref.exp index 7b8f426..ea61d4a 100644 --- a/gdb/testsuite/gdb.ada/int_deref.exp +++ b/gdb/testsuite/gdb.ada/int_deref.exp @@ -26,6 +26,11 @@ clean_restart ${testfile} set bp_location [gdb_get_line_number "Pck.Watch" ${testdir}/foo.adb] runto "foo.adb:$bp_location" +# Hijack a bit this testcase, to verify that name decoding works +# when doing symbolic address printing. +gdb_test "print watch'address" \ + " = \\(system\\.address\\) $hex " + gdb_test "print *long_integer(watch'address)" \ " = 4874" -- cgit v1.1