mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-19 13:53:29 +08:00
(find_separate_debug_file): Use the canonical
absolute name of the bfd object for finding the debug file in the global debugfile directory.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2008-08-23 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
|
* opncls.c (find_separate_debug_file): Use the canonical
|
||||||
|
absolute name of the bfd object for finding the debug file in
|
||||||
|
the global debugfile directory.
|
||||||
|
|
||||||
2008-08-22 Jakub Jelinek <jakub@redhat.com>
|
2008-08-22 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
Fix PR ld/3290 regression for cross-files DW_FORM_ref_addr relocations.
|
Fix PR ld/3290 regression for cross-files DW_FORM_ref_addr relocations.
|
||||||
|
30
bfd/opncls.c
30
bfd/opncls.c
@ -1,6 +1,6 @@
|
|||||||
/* opncls.c -- open and close a BFD.
|
/* opncls.c -- open and close a BFD.
|
||||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
|
||||||
2001, 2002, 2003, 2004, 2005, 2006, 2007
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by Cygnus Support.
|
Written by Cygnus Support.
|
||||||
@ -1224,9 +1224,10 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
|
|||||||
char *basename;
|
char *basename;
|
||||||
char *dir;
|
char *dir;
|
||||||
char *debugfile;
|
char *debugfile;
|
||||||
|
char *canon_dir;
|
||||||
unsigned long crc32;
|
unsigned long crc32;
|
||||||
int i;
|
|
||||||
size_t dirlen;
|
size_t dirlen;
|
||||||
|
size_t canon_dirlen;
|
||||||
|
|
||||||
BFD_ASSERT (abfd);
|
BFD_ASSERT (abfd);
|
||||||
if (debug_file_directory == NULL)
|
if (debug_file_directory == NULL)
|
||||||
@ -1263,8 +1264,16 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
|
|||||||
memcpy (dir, abfd->filename, dirlen);
|
memcpy (dir, abfd->filename, dirlen);
|
||||||
dir[dirlen] = '\0';
|
dir[dirlen] = '\0';
|
||||||
|
|
||||||
|
/* Compute the canonical name of the bfd object with all symbolic links
|
||||||
|
resolved, for use in the global debugfile directory. */
|
||||||
|
canon_dir = lrealpath (abfd->filename);
|
||||||
|
for (canon_dirlen = strlen (canon_dir); canon_dirlen > 0; canon_dirlen--)
|
||||||
|
if (IS_DIR_SEPARATOR (canon_dir[canon_dirlen - 1]))
|
||||||
|
break;
|
||||||
|
canon_dir[canon_dirlen] = '\0';
|
||||||
|
|
||||||
debugfile = bfd_malloc (strlen (debug_file_directory) + 1
|
debugfile = bfd_malloc (strlen (debug_file_directory) + 1
|
||||||
+ dirlen
|
+ (canon_dirlen > dirlen ? canon_dirlen : dirlen)
|
||||||
+ strlen (".debug/")
|
+ strlen (".debug/")
|
||||||
+ strlen (basename)
|
+ strlen (basename)
|
||||||
+ 1);
|
+ 1);
|
||||||
@ -1272,6 +1281,7 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
|
|||||||
{
|
{
|
||||||
free (basename);
|
free (basename);
|
||||||
free (dir);
|
free (dir);
|
||||||
|
free (canon_dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1283,6 +1293,7 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
|
|||||||
{
|
{
|
||||||
free (basename);
|
free (basename);
|
||||||
free (dir);
|
free (dir);
|
||||||
|
free (canon_dir);
|
||||||
return debugfile;
|
return debugfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1295,29 +1306,32 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
|
|||||||
{
|
{
|
||||||
free (basename);
|
free (basename);
|
||||||
free (dir);
|
free (dir);
|
||||||
|
free (canon_dir);
|
||||||
return debugfile;
|
return debugfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then try in the global debugfile directory. */
|
/* Then try in the global debugfile directory. */
|
||||||
strcpy (debugfile, debug_file_directory);
|
strcpy (debugfile, debug_file_directory);
|
||||||
i = strlen (debug_file_directory) - 1;
|
dirlen = strlen (debug_file_directory) - 1;
|
||||||
if (i > 0
|
if (dirlen > 0
|
||||||
&& debug_file_directory[i] != '/'
|
&& debug_file_directory[dirlen] != '/'
|
||||||
&& dir[0] != '/')
|
&& canon_dir[0] != '/')
|
||||||
strcat (debugfile, "/");
|
strcat (debugfile, "/");
|
||||||
strcat (debugfile, dir);
|
strcat (debugfile, canon_dir);
|
||||||
strcat (debugfile, basename);
|
strcat (debugfile, basename);
|
||||||
|
|
||||||
if (separate_debug_file_exists (debugfile, crc32))
|
if (separate_debug_file_exists (debugfile, crc32))
|
||||||
{
|
{
|
||||||
free (basename);
|
free (basename);
|
||||||
free (dir);
|
free (dir);
|
||||||
|
free (canon_dir);
|
||||||
return debugfile;
|
return debugfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
free (debugfile);
|
free (debugfile);
|
||||||
free (basename);
|
free (basename);
|
||||||
free (dir);
|
free (dir);
|
||||||
|
free (canon_dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user