From: Jim Blandy Date: Thu, 30 Jan 2003 21:45:07 +0000 (+0000) Subject: * symfile.c (find_separate_debug_file): Assert that the objfile's X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fe36c4f4c2610656568214ec55a1e482e1674fdf;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 84de0ea404e..436d69ba5e5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-01-30 Jim Blandy + + * 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. + 2003-01-30 Daniel Jacobowitz * valops.c (value_assign): Flush frame cache after stores to memory diff --git a/gdb/symfile.c b/gdb/symfile.c index 68633010cf8..81e1f7446fe 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))