mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 07:30:54 +00:00
Look in the correct directory for debug info files. (Tim Rowley)
Thu Nov 9 16:47:35 2006 Søren Sandmann <sandmann@redhat.com> Look in the correct directory for debug info files. (Tim Rowley) * binfile.c (N_TRIES): Add this instead of hardcoding '3' * binfile.c (get_debug_file): Also look in "/usr/lib/debug", in addition to "$(libdir)/debug". * binfile.c: Comment out the debug spew.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
5e91fe1818
commit
ea0690817c
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
Thu Nov 9 16:47:35 2006 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
|
Look in the correct directory for debug info files. (Tim Rowley)
|
||||||
|
|
||||||
|
* binfile.c (N_TRIES): Add this instead of hardcoding '3'
|
||||||
|
|
||||||
|
* binfile.c (get_debug_file): Also look in "/usr/lib/debug", in
|
||||||
|
addition to "$(libdir)/debug".
|
||||||
|
|
||||||
|
* binfile.c: Comment out the debug spew.
|
||||||
|
|
||||||
Thu Nov 9 16:17:11 2006 Søren Sandmann <sandmann@redhat.com>
|
Thu Nov 9 16:17:11 2006 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* binfile.c: Add debug spew.
|
* binfile.c: Add debug spew.
|
||||||
|
|||||||
4
TODO
4
TODO
@ -34,6 +34,10 @@ Before 1.0.4:
|
|||||||
|
|
||||||
Before 1.2:
|
Before 1.2:
|
||||||
|
|
||||||
|
* Don't look in $(libdir) for separate debug files (since $libdir is
|
||||||
|
the libdir for sysprof, not a system wide libdir). Tim Rowley.
|
||||||
|
Fix is probably to hardcode /usr/lib, and also look in $libdir.
|
||||||
|
|
||||||
* Make sure that labels look decent in case of "No Map" etc.
|
* Make sure that labels look decent in case of "No Map" etc.
|
||||||
|
|
||||||
* Elf bugs:
|
* Elf bugs:
|
||||||
|
|||||||
31
binfile.c
31
binfile.c
@ -73,10 +73,14 @@ separate_debug_file_exists (const char *name, guint32 crc)
|
|||||||
guint32 file_crc;
|
guint32 file_crc;
|
||||||
ElfParser *parser = elf_parser_new (name, NULL);
|
ElfParser *parser = elf_parser_new (name, NULL);
|
||||||
|
|
||||||
|
#if 0
|
||||||
g_print (" trying %s: ", name);
|
g_print (" trying %s: ", name);
|
||||||
|
#endif
|
||||||
if (!parser)
|
if (!parser)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
g_print ("no.\n");
|
g_print ("no.\n");
|
||||||
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +95,9 @@ separate_debug_file_exists (const char *name, guint32 crc)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
g_print ("found\n");
|
g_print ("found\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
@ -103,10 +109,11 @@ get_debug_file (ElfParser *elf,
|
|||||||
const char *filename,
|
const char *filename,
|
||||||
char **new_name)
|
char **new_name)
|
||||||
{
|
{
|
||||||
|
#define N_TRIES 4
|
||||||
const char *basename;
|
const char *basename;
|
||||||
char *dir;
|
char *dir;
|
||||||
guint32 crc32;
|
guint32 crc32;
|
||||||
char *tries[3];
|
char *tries[N_TRIES];
|
||||||
int i;
|
int i;
|
||||||
ElfParser *result;
|
ElfParser *result;
|
||||||
|
|
||||||
@ -115,7 +122,9 @@ get_debug_file (ElfParser *elf,
|
|||||||
|
|
||||||
basename = elf_parser_get_debug_link (elf, &crc32);
|
basename = elf_parser_get_debug_link (elf, &crc32);
|
||||||
|
|
||||||
|
#if 0
|
||||||
g_print (" debug link for %s is %s\n", filename, basename);
|
g_print (" debug link for %s is %s\n", filename, basename);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!basename)
|
if (!basename)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -124,14 +133,17 @@ get_debug_file (ElfParser *elf,
|
|||||||
|
|
||||||
tries[0] = g_build_filename (dir, basename, NULL);
|
tries[0] = g_build_filename (dir, basename, NULL);
|
||||||
tries[1] = g_build_filename (dir, ".debug", basename, NULL);
|
tries[1] = g_build_filename (dir, ".debug", basename, NULL);
|
||||||
tries[2] = g_build_filename (debug_file_directory, dir, basename, NULL);
|
tries[2] = g_build_filename ("usr", "lib", "debug", dir, basename, NULL);
|
||||||
|
tries[3] = g_build_filename (debug_file_directory, dir, basename, NULL);
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i)
|
for (i = 0; i < N_TRIES; ++i)
|
||||||
{
|
{
|
||||||
result = separate_debug_file_exists (tries[i], crc32);
|
result = separate_debug_file_exists (tries[i], crc32);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
g_print (" found debug binary for %s: %s\n", filename, tries[i]);
|
g_print (" found debug binary for %s: %s\n", filename, tries[i]);
|
||||||
|
#endif
|
||||||
if (new_name)
|
if (new_name)
|
||||||
*new_name = g_strdup (tries[i]);
|
*new_name = g_strdup (tries[i]);
|
||||||
break;
|
break;
|
||||||
@ -140,7 +152,7 @@ get_debug_file (ElfParser *elf,
|
|||||||
|
|
||||||
g_free (dir);
|
g_free (dir);
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i)
|
for (i = 0; i < N_TRIES; ++i)
|
||||||
g_free (tries[i]);
|
g_free (tries[i]);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -176,7 +188,9 @@ find_separate_debug_file (ElfParser *elf,
|
|||||||
{
|
{
|
||||||
if (list_contains_name (seen_names, fname))
|
if (list_contains_name (seen_names, fname))
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
g_print (" cycle detected\n");
|
g_print (" cycle detected\n");
|
||||||
|
#endif
|
||||||
/* cycle detected, just return the original elf file itself */
|
/* cycle detected, just return the original elf file itself */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -191,10 +205,12 @@ find_separate_debug_file (ElfParser *elf,
|
|||||||
seen_names = g_list_prepend (seen_names, fname);
|
seen_names = g_list_prepend (seen_names, fname);
|
||||||
fname = debug_name;
|
fname = debug_name;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_print (" no debug info file for %s\n", fname);
|
g_print (" no debug info file for %s\n", fname);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
while (debug);
|
while (debug);
|
||||||
|
|
||||||
@ -245,8 +261,11 @@ bin_file_new (const char *filename)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bf->elf = elf_parser_new (filename, NULL);
|
bf->elf = elf_parser_new (filename, NULL);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (!bf->elf)
|
if (!bf->elf)
|
||||||
g_print ("Could not parse file %s\n", filename);
|
g_print ("Could not parse file %s\n", filename);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need the text offset of the actual binary, not the
|
/* We need the text offset of the actual binary, not the
|
||||||
@ -262,16 +281,20 @@ bin_file_new (const char *filename)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
oldelf = bf->elf;
|
oldelf = bf->elf;
|
||||||
|
#if 0
|
||||||
if (bf->elf)
|
if (bf->elf)
|
||||||
g_print ("trying to find separate debug file for %s\n", filename);
|
g_print ("trying to find separate debug file for %s\n", filename);
|
||||||
|
#endif
|
||||||
bf->elf = find_separate_debug_file (bf->elf, filename);
|
bf->elf = find_separate_debug_file (bf->elf, filename);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (!bf->elf)
|
if (!bf->elf)
|
||||||
g_print (" returned NULL\n");
|
g_print (" returned NULL\n");
|
||||||
else if (bf->elf != oldelf)
|
else if (bf->elf != oldelf)
|
||||||
g_print (" successfully opened a different elf file than the original\n");
|
g_print (" successfully opened a different elf file than the original\n");
|
||||||
else
|
else
|
||||||
g_print (" opened the original elf file\n");
|
g_print (" opened the original elf file\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bf->inode_check = FALSE;
|
bf->inode_check = FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user