aboutsummaryrefslogtreecommitdiff
path: root/gdb/xml-tdesc.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-06-04 12:34:11 +0000
committerDaniel Jacobowitz <drow@false.org>2007-06-04 12:34:11 +0000
commite1024ff1ddc5fdc00175c3fa2bdfdea412d6687f (patch)
tree2925881313e29580ac614cb86abcf39825df9d57 /gdb/xml-tdesc.c
parent9dfacfd20b2906ee57cfbca7ee11631c0d82c1d5 (diff)
downloadgdb-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/xml-tdesc.c')
-rw-r--r--gdb/xml-tdesc.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index a4e1fe9..31db9c3 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -487,7 +487,6 @@ file_read_description_xml (const char *filename)
struct target_desc *tdesc;
char *tdesc_str;
struct cleanup *back_to;
- const char *base;
char *dirname;
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);
- /* Simple, portable version of dirname that does not modify its
- argument. */
- 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);
- }
- else
- dirname = NULL;
+ dirname = ldirname (filename);
+ if (dirname != NULL)
+ make_cleanup (xfree, dirname);
tdesc = tdesc_parse_xml (tdesc_str, fetch_xml_from_file, dirname);
do_cleanups (back_to);