From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25285 invoked by alias); 18 Dec 2008 21:42:00 -0000 Received: (qmail 25272 invoked by uid 22791); 18 Dec 2008 21:41:58 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.172) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Dec 2008 21:41:22 +0000 Received: by wf-out-1314.google.com with SMTP id 28so648681wfc.24 for ; Thu, 18 Dec 2008 13:41:20 -0800 (PST) Received: by 10.142.48.3 with SMTP id v3mr997264wfv.0.1229636480949; Thu, 18 Dec 2008 13:41:20 -0800 (PST) Received: by 10.142.114.9 with HTTP; Thu, 18 Dec 2008 13:41:20 -0800 (PST) Message-ID: <74fef6df0812181341x8ecdd31me028bd4d658384b1@mail.gmail.com> Date: Thu, 18 Dec 2008 21:42:00 -0000 From: "Mathieu Lacage" To: gdb@sourceware.org Subject: how to make gdb happy with my linkmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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: 2008-12/txt/msg00083.txt.bz2 hi, I am currently trying to write a small ELF loader and make gdb be happy with it. One of the things I have been doing until now is manage the following link map: (gdb) info linkmap 084661e0 ldso 08430518 084661e0 /lib/libc.so.6 (gdb) The most notable thing to note here is that the first item in the linkmap is not the main binary: it is the loader itself. This, however, seems to be problematic for gdb since I get the following message: warning: Temporarily disabling breakpoints for unloaded shared library "ldso" when I invoke the _r_debug_state function where gdb has put a breakpoint (I should point out that, of course, I did not remove _any_ entry from the link map at this point) Although it seems clear to me that I won't be able to keep managing my link map as I do now and that I will have to move the main binary as the first entry in the map (I have already done this and it makes gdb much happier), I was trying to figure out why this so problematic for gdb, mainly because I fear that there are some other subtle requirements from gdb on the structure of the link map. Hence, my question: what are the requirements on the structure of a linkmap which is compatible with gdb's usage (beyond the mere ABI offset requirements). I am also curious to know if there is anywhere a document which describes the overall interface between gdb and the inferior's loader: so far, reading the code has been enough for me to figure out how this all works but, well, I wonder if I could have saved myself all this code-reading work. Anyhow, that piece of code is fairly readable and really nicely structured so, thanks a lot for this cool software I have been using for so long. Mathieu -- Mathieu Lacage