aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorSami Wagiaalla <swagiaal@redhat.com>2009-06-29 15:18:07 +0000
committerSami Wagiaalla <swagiaal@redhat.com>2009-06-29 15:18:07 +0000
commit794684b64f780fbecb3443d6783284919c83c07f (patch)
treec5ff18ecd050872ef7ed2b7cf7fed96765dfb207 /gdb/dwarf2read.c
parent2497b4984582be980b40913ef1bf561ccad2f265 (diff)
downloadgdb-794684b64f780fbecb3443d6783284919c83c07f.zip
gdb-794684b64f780fbecb3443d6783284919c83c07f.tar.gz
gdb-794684b64f780fbecb3443d6783284919c83c07f.tar.bz2
2009-06-29 Sami Wagiaalla <swagiaal@redhat.com>
* dwarf2read.c (read_import_statement): Properly set import location and destination. * cp-support.h (cp_add_using, cp_add_using_directive): Now take char* inner, char* outer arguments. Updated callers. 2009-06-29 Sami Wagiaalla <swagiaal@redhat.com> * gdb.cp/namespace-nested-import.cc: New test. * gdb.cp/namespace-nested-import.exp: New test.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index cd92843..218c85a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3043,6 +3043,9 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
struct attribute *import_attr;
struct die_info *imported_die;
const char *imported_name;
+ const char *imported_name_prefix;
+ const char *import_prefix;
+ char *canonical_name;
import_attr = dwarf2_attr (die, DW_AT_import, cu);
if (import_attr == NULL)
@@ -3093,8 +3096,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
/* FIXME: dwarf2_name (die); for the local name after import. */
- using_directives = cp_add_using (imported_name, strlen (imported_name), 0,
- using_directives);
+ /* Figure out where the statement is being imported to. */
+ import_prefix = determine_prefix (die, cu);
+
+ /* Figure out what the scope of the imported die is and prepend it
+ to the name of the imported die. */
+ imported_name_prefix = determine_prefix (imported_die, cu);
+
+ if (strlen (imported_name_prefix) > 0)
+ {
+ canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1);
+ strcpy (canonical_name, imported_name_prefix);
+ strcat (canonical_name, "::");
+ strcat (canonical_name, imported_name);
+ }
+ else
+ {
+ canonical_name = alloca (strlen (imported_name) + 1);
+ strcpy (canonical_name, imported_name);
+ }
+
+ using_directives = cp_add_using (import_prefix,canonical_name, using_directives);
}
static void
@@ -5053,9 +5075,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
if (is_anonymous)
{
const char *previous_prefix = determine_prefix (die, cu);
- cp_add_using_directive (TYPE_NAME (type),
- strlen (previous_prefix),
- strlen (TYPE_NAME (type)));
+ cp_add_using_directive (previous_prefix, TYPE_NAME (type));
}
}