From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14857 invoked by alias); 27 Sep 2006 06:21:41 -0000 Received: (qmail 14849 invoked by uid 22791); 27 Sep 2006 06:21:41 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.188) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 27 Sep 2006 06:21:39 +0000 Received: by nf-out-0910.google.com with SMTP id k26so448165nfc for ; Tue, 26 Sep 2006 23:21:38 -0700 (PDT) Received: by 10.48.242.19 with SMTP id p19mr2026442nfh; Tue, 26 Sep 2006 23:21:38 -0700 (PDT) Received: from ?82.57.32.114? ( [82.57.32.114]) by mx.gmail.com with ESMTP id z73sm2835032nfb.2006.09.26.23.21.37; Tue, 26 Sep 2006 23:21:38 -0700 (PDT) Message-ID: <451A18E9.9070500@gmail.com> Date: Wed, 27 Sep 2006 06:21:00 -0000 From: Carmelo Amoroso Reply-To: carmelo73@gmail.com User-Agent: Thunderbird 1.5.0.5 (Macintosh/20060719) MIME-Version: 1.0 To: Michael Snyder CC: gdb@sourceware.org Subject: Re: howto debug libthread_db References: <45193401.7000502@gmail.com> <1159294840.24808.76.camel@localhost.localdomain> In-Reply-To: <1159294840.24808.76.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00161.txt.bz2 Michael Snyder wrote: > On Tue, 2006-09-26 at 16:06 +0200, Carmelo Amoroso wrote: >> Hi All, >> I'm trying to debug a simple multithread application on a remote target, >> and I like to debug the libthread_db itself... is it possible to do it? >> is it possible to set some breakpoints and stepping through? >> Is there anyone already played with it? >> >> I tried to use symbol-file to gdb client, and I successfully added a >> breakpoint, but I cannot reach it after I connected to the target and >> issued 'continue'. >> >> Any help will be appreciated > > Interesting. I haven't done it (or not much anyway). > > The first thing you must bear in mind is that libthread_db is not > part of the target application -- it is part of gdb (or in the > remote debugging context, part of gdbserver). So to debug it, > you must debug gdb, or in your case gdbserver. > Yes. it's what I want to do > It might be easier if you try this out first using a native gdb, > debugging itself. > > When you debug gdb with gdb, it is easier if you change the prompt. > I usually do this in the 'parent' gdb, so I can tell it apart from > the 'child' gdb: > > (gdb) set prompt (GDB) > (GDB) > > Now, in the parent GDB, you should be able to set your > breakpoints in libthread_db, then start the child gdb, > load the multi-threaded program, and begin debugging it. > Does the native gdb use the thread_db as the gdbserver does? I was thinking to run gdb --args my-gdbserver ont the target, and connect to the my-gdbserver from the host just to trigger the thread_db initialization process. Comments? > When you get ready to try this with gdbserver, you will > have to start one gdbserver and attach to it with another > gdbserver. Then you'll again have two gdbs running on the > host side, which you can again think of as parent and child, > only now the parent is debugging the child's gdbserver, not > the child gdb itself. > Well, just before reading your reply, I tried with this: target: gdbserver localhost:999 my-gdbserver localhost:998 host: xxx-gdb my-gdbserver (connecting to port 999) xxx-gdb application (connecting to port 998) Wit the first gdb session I was able to set a breakpoint into thread_db, but not able to stepping through the code. Is this approach as well as the gdb native session. Btw, I'll try again (both the native and the remote technique) Thanks a lot Carmelo