diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2015-07-14 20:31:21 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2015-07-14 20:31:21 +0200 |
commit | 452802827f0870df0c8ece81a7e098d94cee4536 (patch) | |
tree | fd2c6e2b3800bbca5075dce49de0af5bb03f469c /gdb | |
parent | cfa68bae4271a51a4402f8ca7ccdc014be95d79d (diff) | |
download | gdb-452802827f0870df0c8ece81a7e098d94cee4536.zip gdb-452802827f0870df0c8ece81a7e098d94cee4536.tar.gz gdb-452802827f0870df0c8ece81a7e098d94cee4536.tar.bz2 |
Add support reading D modules from DWARF
Extends existing support for namespaces/modules in C++/Fortran/Java to
include language_d too. However unlike Fortran/C++, the separator for
qualified names is a single dot.
2015-07-14 Iain Buclaw <ibuclaw@gdcproject.org>
* dwarf2read.c (find_slot_in_mapped_hash): Extend language support to
also test for language_d.
(dwarf2_compute_name): Likewise.
(read_func_scope): Likewise.
(read_structure_type): Likewise.
(determine_prefix): Likewise.
(read_import_statement): Use dot as the separator for language_d.
(typename_concat): Likewise, but don't prefix the D main function.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 34 |
2 files changed, 38 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 158ebcb..2ace643 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2015-07-14 Iain Buclaw <ibuclaw@gdcproject.org> + + * dwarf2read.c (find_slot_in_mapped_hash): Extend language support to + also test for language_d. + (dwarf2_compute_name): Likewise. + (read_func_scope): Likewise. + (read_structure_type): Likewise. + (new_symbol_full): Likewise. + (determine_prefix): Likewise. + (read_import_statement): Use dot as the separator for language_d. + (typename_concat): Likewise, but don't prefix the D main function. + 2015-07-14 Peter Bergner <bergner@vnet.ibm.com> * nat/linux-namespaces.c (setns): Rename from this ... diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 496b74f..91c6a8f 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2974,7 +2974,8 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name, if (current_language->la_language == language_cplus || current_language->la_language == language_java - || current_language->la_language == language_fortran) + || current_language->la_language == language_fortran + || current_language->la_language == language_d) { /* NAME is already canonical. Drop any qualifiers as .gdb_index does not contain any. */ @@ -8463,7 +8464,7 @@ dwarf2_compute_name (const char *name, /* These are the only languages we know how to qualify names in. */ if (name != NULL && (cu->language == language_cplus || cu->language == language_java - || cu->language == language_fortran)) + || cu->language == language_fortran || cu->language == language_d)) { if (die_needs_namespace (die, cu)) { @@ -8941,8 +8942,9 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) } else if (strlen (imported_name_prefix) > 0) canonical_name = obconcat (&objfile->objfile_obstack, - imported_name_prefix, "::", imported_name, - (char *) NULL); + imported_name_prefix, + (cu->language == language_d ? "." : "::"), + imported_name, (char *) NULL); else canonical_name = imported_name; @@ -11445,7 +11447,9 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) lowpc, highpc); /* For C++, set the block's scope. */ - if ((cu->language == language_cplus || cu->language == language_fortran) + if ((cu->language == language_cplus + || cu->language == language_fortran + || cu->language == language_d) && cu->processing_has_namespace_info) block_set_scope (block, determine_prefix (die, cu), &objfile->objfile_obstack); @@ -13140,7 +13144,8 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) if (name != NULL) { if (cu->language == language_cplus - || cu->language == language_java) + || cu->language == language_java + || cu->language == language_d) { const char *full_name = dwarf2_full_name (name, die, cu); @@ -18554,7 +18559,8 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, class. */ if (cu->language == language_cplus || cu->language == language_java - || cu->language == language_ada) + || cu->language == language_ada + || cu->language == language_d) { /* The symbol's name is already allocated along with this objfile, so we don't need to @@ -19228,7 +19234,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) char *retval; if (cu->language != language_cplus && cu->language != language_java - && cu->language != language_fortran) + && cu->language != language_fortran && cu->language != language_d) return ""; retval = anonymous_struct_prefix (die, cu); @@ -19384,6 +19390,18 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix, sep = ""; else if (cu->language == language_java) sep = "."; + else if (cu->language == language_d) + { + /* For D, the 'main' function could be defined in any module, but it + should never be prefixed. */ + if (strcmp (suffix, "D main") == 0) + { + prefix = ""; + sep = ""; + } + else + sep = "."; + } else if (cu->language == language_fortran && physname) { /* This is gfortran specific mangling. Normally DW_AT_linkage_name or |