aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2003-01-30 21:45:07 +0000
committerJim Blandy <jimb@codesourcery.com>2003-01-30 21:45:07 +0000
commitfe36c4f4c2610656568214ec55a1e482e1674fdf (patch)
tree724c4cc599fcc6a541a2898de1c0dfe86c30dfe3 /gdb/symfile.c
parent85b9a938393dbd673c860872e35a49767d40786e (diff)
downloadgdb-fe36c4f4c2610656568214ec55a1e482e1674fdf.zip
gdb-fe36c4f4c2610656568214ec55a1e482e1674fdf.tar.gz
gdb-fe36c4f4c2610656568214ec55a1e482e1674fdf.tar.bz2
* symfile.c (find_separate_debug_file): Assert that the objfile's
directory name we compute ends with a slash, and then assume that that's so everywhere we use it.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 6863301..81e1f74 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1167,12 +1167,16 @@ find_separate_debug_file (struct objfile *objfile)
dir = xstrdup (objfile->name);
- /* Strip off filename part */
+ /* Strip off the final filename part, leaving the directory name,
+ followed by a slash. Objfile names should always be absolute and
+ tilde-expanded, so there should always be a slash in there
+ somewhere. */
for (i = strlen(dir) - 1; i >= 0; i--)
{
if (IS_DIR_SEPARATOR (dir[i]))
break;
}
+ gdb_assert (i >= 0 && IS_DIR_SEPARATOR (dir[i]));
dir[i+1] = '\0';
debugfile = alloca (strlen (debug_file_directory) + 1
@@ -1210,7 +1214,6 @@ find_separate_debug_file (struct objfile *objfile)
strcpy (debugfile, debug_file_directory);
strcat (debugfile, "/");
strcat (debugfile, dir);
- strcat (debugfile, "/");
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32))