[RFA/dwarf2read.c] Make Ada structs "typedef"'ed implicitly

Joel Brobecker
2007-01-11T16:05:41Z

[-- Attachment #1: Type: text/plain, Size: 784 bytes --]

Hello,

This should be the last issue before gdb.ada/null_record.exp starts
passing with the Debian Ada compiler. It turned out that the Debian
compiler does not generate a DW_TAG_typedef DIE for each struct
(aka record in Ada), whereas our does. In Ada, records, unions,
and enums are implicitly typedef'ed. The attached patch modifies
the sources to reflect this.

2007-01-11 Joel Brobecker <brobecker@adacore.com>

* dwarf2read.c (add_partial_symbol): Create an extra partial
symbol in the VAR_DOMAIN for Ada structures, unions or enums.
(new_symbol): Likewise for symbols.

Tested on x86-linux. 1 extra PASS in gdb.ada/null_record.exp, no
regression.

OK to apply?

(many thanks to Daniel for bringing all these issues to my attention)

Thanks,
--
Joel

[-- Attachment #2: typedef.diff --]
[-- Type: text/plain, Size: 1161 bytes --]

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.210
diff -u -p -r1.210 dwarf2read.c
--- dwarf2read.c 5 Jan 2007 05:49:56 -0000 1.210
+++ dwarf2read.c 11 Jan 2007 15:55:36 -0000
@@ -2001,7 +2001,8 @@ add_partial_symbol (struct partial_die_i
0, (CORE_ADDR) 0, cu->language, objfile);

if (cu->language == language_cplus
- || cu->language == language_java)
+ || cu->language == language_java
+ || cu->language == language_ada)
{
/* For C++ and Java, these implicitly act as typedefs as well. */
add_psymbol_to_list (actual_name, strlen (actual_name),
@@ -7170,7 +7171,8 @@ new_symbol (struct die_info *die, struct
defines a typedef for the class. Synthesize a typedef symbol
so that "ptype foo" works as expected. */
if (cu->language == language_cplus
- || cu->language == language_java)
+ || cu->language == language_java
+ || cu->language == language_ada)
{
struct symbol *typedef_sym = (struct symbol *)
obstack_alloc (&objfile->objfile_obstack,