This is the mail archive of the gdb-patches@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] |
Hello, Assuming we have a variable whose type is a pointer to a string (in Ada we use "access" types for pointer to a given type): type String_Access is access String; String_P : String_Access := new String'("Hello"); If you print the value of that variable, GDB currently prints the wrong type name: (gdb) p string_p $1 = (string) 0x8060010 The actual encoding is described in exp_dbug.ads: -- For each pointer to this unconstrained array type, the compiler will -- generate a typedef that points to the above "arr___XUP" fat-pointer -- type. As a consequence, when it comes to fat-pointer types: -- 1. The type name is given by the typedef -- 2. If the debugger is asked to output the type, the appropriate -- form is "access arr", except if the type name is "arr___XUP" -- for which it is the array definition. The attached patch implements this suggestion. 2008-01-03 Joel Brobecker <brobecker@adacore.com> * ada-lang.c (static_unwrap_type): Add forward declaration. (template_to_static_fixed_type): Fields of dynamic types sometimes also need to be unwrapped. Take this into account. (ada_to_fixed_type_1): Renamed from ada_to_fixed_type. (ada_to_fixed_type): New wrapper around ada_to_fixed_type_1. * ada-typeprint.c (ada_print_type): Get the typename from the original type, not the base type. Also attached is a small testcase that verifies the fix: 2008-01-03 Joel Brobecker <brobecker@adacore.com> * gdb.ada/arrayptr/pck.ads, gdb.ada/arrayptr/pck.adb, gdb.ada/arrayptr/foo.adb: New files. * gdb.ada/arrayptr.exp: New testcase. All tested on x86-linux, no regression. Checked in. -- Joel
Attachment:
arrayptr.diff
Description: Text document
Attachment:
arrayptr-tc.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |