This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: weird errors when notifying gdb of linkmap changes


On Mon, Jan 12, 2009 at 8:28 PM, Daniel Jacobowitz <drow@false.org> wrote:

>> Starting program: /home/mathieu/code/elf-loader/ls
>> [Thread debugging using libthread_db enabled]
>> Error while reading shared library symbols:
>> Cannot find new threads: generic error
>> Cannot find new threads: generic error
>> (gdb) bt
>> #0  0xb7f228d1 in _r_debug_state () at gdb.c:10
>> #1  0xb7f22964 in gdb_notify () at gdb.c:36
>> #2  0xb7f1d7fd in stage2 (args=
>>       {interpreter_load_base = 3086077952, program_phdr = 0x8048034,
>> program_phnum = 8, sysinfo = 3086074880, program_argc = 1,
>> program_argv = 0xbfa13ff4, program_envp = 0xbfa13ffc}) at ldso.c:253
>> #3  0xb7f1d9b0 in stage1 () at ldso.c:312
>> #4  0x00000001 in ?? ()
>>
>> I wonder if there is an obvious well-known reason for this.
>
> You'll have to build a debuggable libthread_db to figure out what it's
> complaining about.  Most likely you have told it that the thread
> library is loaded, but provided some incorrect information that led to
> GDB not finding the thread library's data structures.

Ok. I looked a bit a this. What is happening is that I invoke
_r_debug_state _before_ calling the ELF initializers so,
__pthread_initialize_minimal has not been invoked yet so the data
structure for the main thread is not yet initialized so, nptl_db is
confused.

The bug https://bugzilla.redhat.com/show_bug.cgi?id=179072#c14 pointed
out by Jan sheds some light on a similar problem and points out that,
theoretically, the content of the libthread data structures is
parseable by libpthread_db _before_ _pthread_initialize_minimal is
called which would lead me to believe that I have screwed up something
in the memory layout of libpthread or something similar.

To summarize, I should be able to still call _r_debug_state _before_
calling __pthread_initialize_minimal but I have probably screwed up
something else.

bah, more debugging.
Mathieu
-- 
Mathieu Lacage <mathieu.lacage@gmail.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]