mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 18:14:13 +08:00
* linux-thread-db.c (try_thread_db_load_from_pdir_1): New function.
(try_thread_db_load_from_pdir): Call it. If unable to find libthread_db in directory of libpthread, see if we're looking at the separate-debug-info copy.
This commit is contained in:
parent
cd6eee13df
commit
290351b813
@ -1,5 +1,10 @@
|
||||
2011-05-15 Doug Evans <dje@google.com>
|
||||
|
||||
* linux-thread-db.c (try_thread_db_load_from_pdir_1): New function.
|
||||
(try_thread_db_load_from_pdir): Call it. If unable to find
|
||||
libthread_db in directory of libpthread, see if we're looking at
|
||||
the separate-debug-info copy.
|
||||
|
||||
* python/py-autoload.c (print_script): Print "Missing" instead of
|
||||
"No" for missing scripts.
|
||||
(info_auto_load_scripts): Tweak "Loaded" column to fit "Missing".
|
||||
|
@ -812,6 +812,38 @@ try_thread_db_load (const char *library)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Subroutine of try_thread_db_load_from_pdir to simplify it.
|
||||
Try loading libthread_db from the same directory as OBJ.
|
||||
The result is true for success. */
|
||||
|
||||
static int
|
||||
try_thread_db_load_from_pdir_1 (struct objfile *obj)
|
||||
{
|
||||
char path[PATH_MAX], *cp;
|
||||
|
||||
gdb_assert (strlen (obj->name) < sizeof (path));
|
||||
strcpy (path, obj->name);
|
||||
cp = strrchr (path, '/');
|
||||
|
||||
if (cp == NULL)
|
||||
{
|
||||
warning (_("Expected absolute pathname for libpthread in the"
|
||||
" inferior, but got %s."), path);
|
||||
return 0;
|
||||
}
|
||||
else if (cp + 1 + strlen (LIBTHREAD_DB_SO) + 1 > path + sizeof (path))
|
||||
{
|
||||
warning (_("Unexpected: path to libpthread in the inferior is"
|
||||
" too long: %s"), path);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (cp + 1, LIBTHREAD_DB_SO);
|
||||
return try_thread_db_load (path);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle $pdir in libthread-db-search-path.
|
||||
Look for libthread_db in the directory of libpthread.
|
||||
The result is true for success. */
|
||||
@ -824,28 +856,15 @@ try_thread_db_load_from_pdir (void)
|
||||
ALL_OBJFILES (obj)
|
||||
if (libpthread_name_p (obj->name))
|
||||
{
|
||||
char path[PATH_MAX], *cp;
|
||||
|
||||
gdb_assert (strlen (obj->name) < sizeof (path));
|
||||
strcpy (path, obj->name);
|
||||
cp = strrchr (path, '/');
|
||||
|
||||
if (cp == NULL)
|
||||
{
|
||||
warning (_("Expected absolute pathname for libpthread in the"
|
||||
" inferior, but got %s."), path);
|
||||
}
|
||||
else if (cp + 1 + strlen (LIBTHREAD_DB_SO) + 1 > path + sizeof (path))
|
||||
{
|
||||
warning (_("Unexpected: path to libpthread in the inferior is"
|
||||
" too long: %s"), path);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (cp + 1, LIBTHREAD_DB_SO);
|
||||
if (try_thread_db_load (path))
|
||||
if (try_thread_db_load_from_pdir_1 (obj))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* We may have found the separate-debug-info version of
|
||||
libpthread, and it may live in a directory without a matching
|
||||
libthread_db. */
|
||||
if (obj->separate_debug_objfile_backlink != NULL)
|
||||
return try_thread_db_load_from_pdir_1 (obj->separate_debug_objfile_backlink);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user