From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12862 invoked by alias); 13 Jan 2009 09:45:40 -0000 Received: (qmail 12840 invoked by uid 22791); 13 Jan 2009 09:45:39 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from rv-out-0708.google.com (HELO rv-out-0708.google.com) (209.85.198.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Jan 2009 09:45:00 +0000 Received: by rv-out-0708.google.com with SMTP id b17so10796185rvf.48 for ; Tue, 13 Jan 2009 01:44:59 -0800 (PST) Received: by 10.142.217.17 with SMTP id p17mr12793341wfg.275.1231839899085; Tue, 13 Jan 2009 01:44:59 -0800 (PST) Received: by 10.142.54.20 with HTTP; Tue, 13 Jan 2009 01:44:59 -0800 (PST) Message-ID: <74fef6df0901130144x1fe3cc5dm783b06f3fd9c5b1c@mail.gmail.com> Date: Tue, 13 Jan 2009 09:45:00 -0000 From: "Mathieu Lacage" To: "Mathieu Lacage" , gdb@sourceware.org Subject: Re: weird errors when notifying gdb of linkmap changes In-Reply-To: <20090112192841.GA4460@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <74fef6df0901121120m52fa4dacrb797a9b750da3d43@mail.gmail.com> <20090112192841.GA4460@caradoc.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-01/txt/msg00062.txt.bz2 On Mon, Jan 12, 2009 at 8:28 PM, Daniel Jacobowitz 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