diff options
author | Daniel Jacobowitz <drow@false.org> | 2007-06-04 12:34:11 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2007-06-04 12:34:11 +0000 |
commit | e1024ff1ddc5fdc00175c3fa2bdfdea412d6687f (patch) | |
tree | 2925881313e29580ac614cb86abcf39825df9d57 /gdb/dwarf2read.c | |
parent | 9dfacfd20b2906ee57cfbca7ee11631c0d82c1d5 (diff) | |
download | gdb-e1024ff1ddc5fdc00175c3fa2bdfdea412d6687f.zip gdb-e1024ff1ddc5fdc00175c3fa2bdfdea412d6687f.tar.gz gdb-e1024ff1ddc5fdc00175c3fa2bdfdea412d6687f.tar.bz2 |
* defs.h (ldirname): New prototype.
* dwarf2read.c (read_file_scope): Use DW_AT_name if DW_AT_comp_dir is
missing.
* utils.c (ldirname): New function.
* xml-tdesc.c (file_read_description_xml): Use ldirname.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 2cb455e..6314c4c 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2783,7 +2783,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) CORE_ADDR lowpc = ((CORE_ADDR) -1); CORE_ADDR highpc = ((CORE_ADDR) 0); struct attribute *attr; - char *name = "<unknown>"; + char *name = NULL; char *comp_dir = NULL; struct die_info *child_die; bfd *abfd = objfile->obfd; @@ -2806,21 +2806,29 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) { name = DW_STRING (attr); } + attr = dwarf2_attr (die, DW_AT_comp_dir, cu); if (attr) + comp_dir = DW_STRING (attr); + else if (name != NULL && IS_ABSOLUTE_PATH (name)) { - comp_dir = DW_STRING (attr); - if (comp_dir) - { - /* Irix 6.2 native cc prepends <machine>.: to the compilation - directory, get rid of it. */ - char *cp = strchr (comp_dir, ':'); + comp_dir = ldirname (name); + if (comp_dir != NULL) + make_cleanup (xfree, comp_dir); + } + if (comp_dir != NULL) + { + /* Irix 6.2 native cc prepends <machine>.: to the compilation + directory, get rid of it. */ + char *cp = strchr (comp_dir, ':'); - if (cp && cp != comp_dir && cp[-1] == '.' && cp[1] == '/') - comp_dir = cp + 1; - } + if (cp && cp != comp_dir && cp[-1] == '.' && cp[1] == '/') + comp_dir = cp + 1; } + if (name == NULL) + name = "<unknown>"; + attr = dwarf2_attr (die, DW_AT_language, cu); if (attr) { |