1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-09-27 17:09:29 +02: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:
Arun Sharma 2010-05-15 11:57:35 -07:00
parent 66b7335ff3
commit b115ab645a

View file

@ -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;