* 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.
This commit is contained in:
parent
9dfacfd20b
commit
e1024ff1dd
5 changed files with 60 additions and 34 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2007-06-04 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2007-06-01 Ulrich Weigand <uweigand@de.ibm.com>
|
2007-06-01 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
* spu-tdep.c (spu_push_dummy_call): Store stack back chain.
|
* spu-tdep.c (spu_push_dummy_call): Store stack back chain.
|
||||||
|
|
|
@ -417,6 +417,8 @@ extern unsigned long gnu_debuglink_crc32 (unsigned long crc,
|
||||||
|
|
||||||
ULONGEST strtoulst (const char *num, const char **trailer, int base);
|
ULONGEST strtoulst (const char *num, const char **trailer, int base);
|
||||||
|
|
||||||
|
char *ldirname (const char *filename);
|
||||||
|
|
||||||
/* From demangle.c */
|
/* From demangle.c */
|
||||||
|
|
||||||
extern void set_demangling_style (char *);
|
extern void set_demangling_style (char *);
|
||||||
|
|
|
@ -2783,7 +2783,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
CORE_ADDR lowpc = ((CORE_ADDR) -1);
|
CORE_ADDR lowpc = ((CORE_ADDR) -1);
|
||||||
CORE_ADDR highpc = ((CORE_ADDR) 0);
|
CORE_ADDR highpc = ((CORE_ADDR) 0);
|
||||||
struct attribute *attr;
|
struct attribute *attr;
|
||||||
char *name = "<unknown>";
|
char *name = NULL;
|
||||||
char *comp_dir = NULL;
|
char *comp_dir = NULL;
|
||||||
struct die_info *child_die;
|
struct die_info *child_die;
|
||||||
bfd *abfd = objfile->obfd;
|
bfd *abfd = objfile->obfd;
|
||||||
|
@ -2806,11 +2806,17 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
{
|
{
|
||||||
name = DW_STRING (attr);
|
name = DW_STRING (attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
attr = dwarf2_attr (die, DW_AT_comp_dir, cu);
|
attr = dwarf2_attr (die, DW_AT_comp_dir, cu);
|
||||||
if (attr)
|
if (attr)
|
||||||
{
|
|
||||||
comp_dir = DW_STRING (attr);
|
comp_dir = DW_STRING (attr);
|
||||||
if (comp_dir)
|
else if (name != NULL && IS_ABSOLUTE_PATH (name))
|
||||||
|
{
|
||||||
|
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
|
/* Irix 6.2 native cc prepends <machine>.: to the compilation
|
||||||
directory, get rid of it. */
|
directory, get rid of it. */
|
||||||
|
@ -2819,7 +2825,9 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
if (cp && cp != comp_dir && cp[-1] == '.' && cp[1] == '/')
|
if (cp && cp != comp_dir && cp[-1] == '.' && cp[1] == '/')
|
||||||
comp_dir = cp + 1;
|
comp_dir = cp + 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (name == NULL)
|
||||||
|
name = "<unknown>";
|
||||||
|
|
||||||
attr = dwarf2_attr (die, DW_AT_language, cu);
|
attr = dwarf2_attr (die, DW_AT_language, cu);
|
||||||
if (attr)
|
if (attr)
|
||||||
|
|
28
gdb/utils.c
28
gdb/utils.c
|
@ -3195,3 +3195,31 @@ strtoulst (const char *num, const char **trailer, int base)
|
||||||
else
|
else
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Simple, portable version of dirname that does not modify its
|
||||||
|
argument. */
|
||||||
|
|
||||||
|
char *
|
||||||
|
ldirname (const char *filename)
|
||||||
|
{
|
||||||
|
const char *base = lbasename (filename);
|
||||||
|
char *dirname;
|
||||||
|
|
||||||
|
while (base > filename && IS_DIR_SEPARATOR (base[-1]))
|
||||||
|
--base;
|
||||||
|
|
||||||
|
if (base == filename)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dirname = xmalloc (base - filename + 2);
|
||||||
|
memcpy (dirname, filename, base - filename);
|
||||||
|
|
||||||
|
/* On DOS based file systems, convert "d:foo" to "d:.", so that we
|
||||||
|
create "d:./bar" later instead of the (different) "d:/bar". */
|
||||||
|
if (base - filename == 2 && IS_ABSOLUTE_PATH (base)
|
||||||
|
&& !IS_DIR_SEPARATOR (filename[0]))
|
||||||
|
dirname[base++ - filename] = '.';
|
||||||
|
|
||||||
|
dirname[base - filename] = '\0';
|
||||||
|
return dirname;
|
||||||
|
}
|
||||||
|
|
|
@ -487,7 +487,6 @@ file_read_description_xml (const char *filename)
|
||||||
struct target_desc *tdesc;
|
struct target_desc *tdesc;
|
||||||
char *tdesc_str;
|
char *tdesc_str;
|
||||||
struct cleanup *back_to;
|
struct cleanup *back_to;
|
||||||
const char *base;
|
|
||||||
char *dirname;
|
char *dirname;
|
||||||
|
|
||||||
tdesc_str = fetch_xml_from_file (filename, NULL);
|
tdesc_str = fetch_xml_from_file (filename, NULL);
|
||||||
|
@ -499,28 +498,9 @@ file_read_description_xml (const char *filename)
|
||||||
|
|
||||||
back_to = make_cleanup (xfree, tdesc_str);
|
back_to = make_cleanup (xfree, tdesc_str);
|
||||||
|
|
||||||
/* Simple, portable version of dirname that does not modify its
|
dirname = ldirname (filename);
|
||||||
argument. */
|
if (dirname != NULL)
|
||||||
base = lbasename (filename);
|
|
||||||
while (base > filename && IS_DIR_SEPARATOR (base[-1]))
|
|
||||||
--base;
|
|
||||||
if (base > filename)
|
|
||||||
{
|
|
||||||
dirname = xmalloc (base - filename + 2);
|
|
||||||
memcpy (dirname, filename, base - filename);
|
|
||||||
|
|
||||||
/* On DOS based file systems, convert "d:foo" to "d:.", so that
|
|
||||||
we create "d:./bar" later instead of the (different)
|
|
||||||
"d:/bar". */
|
|
||||||
if (base - filename == 2 && IS_ABSOLUTE_PATH (base)
|
|
||||||
&& !IS_DIR_SEPARATOR (filename[0]))
|
|
||||||
dirname[base++ - filename] = '.';
|
|
||||||
|
|
||||||
dirname[base - filename] = '\0';
|
|
||||||
make_cleanup (xfree, dirname);
|
make_cleanup (xfree, dirname);
|
||||||
}
|
|
||||||
else
|
|
||||||
dirname = NULL;
|
|
||||||
|
|
||||||
tdesc = tdesc_parse_xml (tdesc_str, fetch_xml_from_file, dirname);
|
tdesc = tdesc_parse_xml (tdesc_str, fetch_xml_from_file, dirname);
|
||||||
do_cleanups (back_to);
|
do_cleanups (back_to);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue