Bug 27580 - gcore: stream libthread_db information
Summary: gcore: stream libthread_db information
Status: ASSIGNED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-15 13:44 UTC by Martin Liska
Modified: 2023-01-17 13:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2023-01-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liska 2021-03-15 13:44:21 UTC
I think gcore should stream also build-id and path:
/lib/libthread_db.so.1. I see the following error message when opening a core file:

  warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

And gdb should be able to load the specified file when loading a core file.
Comment 1 Martin Liska 2023-01-13 08:42:55 UTC
@Aaron: Is this something you're planning to take a look?
Comment 2 Aaron Merey 2023-01-16 22:48:56 UTC
(In reply to Martin Liska from comment #1)
> @Aaron: Is this something you're planning to take a look?

I'm not seeing the "unable to find libthread_db" warning when opening a core file. Do you have a reproducer for this?
Comment 3 Martin Liska 2023-01-17 13:57:31 UTC
The message will be displayed if you debug a core file from a machine that has e.g. ancient version of glibc:

gdb/linux-thread-db.c:

/* Predicate which tests whether objfile OBJ refers to the library
   containing pthread related symbols.  Historically, this library has
   been named in such a way that looking for "libpthread" in the name
   was sufficient to identify it.  As of glibc-2.34, the C library
   (libc) contains the thread library symbols.  Therefore we check
   that the name matches a possible thread library, but we also check
   that it contains at least one of the symbols (pthread_create) that
   we'd expect to find in the thread library.  */

static bool
libpthread_objfile_p (objfile *obj)
{
  return (libpthread_name_p (objfile_name (obj))
          && lookup_minimal_symbol ("pthread_create",
	                            NULL,
				    obj).minsym != NULL);
}