mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-01-23 00:30:29 +01:00
Ignore separate debug files which contain a .gnu_debuglink section.
Current implementation fails to find separate debug symbols when .gnu_debuglink is set to the same name of the target ELF basename (e.g. "libc.so.6" for /lib/libc.so.6). This patch fixes this by ignoring separate debug files that contain a .gnu_debuglink section. It also fixes a small typo in a related Debug() line. Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
This commit is contained in:
parent
66b7335ff3
commit
b115ab645a
1 changed files with 9 additions and 2 deletions
|
@ -154,7 +154,7 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
|
|||
Debug (4, "read %zd bytes of .debug_frame from offset %zd\n",
|
||||
*bufsize, sec_hdrs[i].sh_offset);
|
||||
}
|
||||
else if (is_local >= 0 && strcmp (secname, ".gnu_debuglink") == 0)
|
||||
else if (strcmp (secname, ".gnu_debuglink") == 0)
|
||||
{
|
||||
linksize = sec_hdrs[i].sh_size;
|
||||
linkbuf = malloc (linksize);
|
||||
|
@ -163,7 +163,7 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
|
|||
fread (linkbuf, 1, linksize, f);
|
||||
|
||||
Debug (4, "read %zd bytes of .gnu_debuglink from offset %zd\n",
|
||||
*bufsize, sec_hdrs[i].sh_offset);
|
||||
linksize, sec_hdrs[i].sh_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,6 +172,13 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
|
|||
|
||||
fclose (f);
|
||||
|
||||
/* Ignore separate debug files which contain a .gnu_debuglink section. */
|
||||
if (linkbuf && is_local == -1)
|
||||
{
|
||||
free (linkbuf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*buf == NULL && linkbuf != NULL && memchr (linkbuf, 0, linksize) != NULL)
|
||||
{
|
||||
char *newname, *basedir, *p;
|
||||
|
|
Loading…
Reference in a new issue