Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Mathieu Lacage" <mathieu.lacage@gmail.com>
To: gdb@sourceware.org
Subject: how to make gdb happy with my linkmap
Date: Thu, 18 Dec 2008 21:42:00 -0000	[thread overview]
Message-ID: <74fef6df0812181341x8ecdd31me028bd4d658384b1@mail.gmail.com> (raw)

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 <mathieu.lacage@gmail.com>


             reply	other threads:[~2008-12-18 21:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-18 21:42 Mathieu Lacage [this message]
2008-12-18 21:49 ` Daniel Jacobowitz
2008-12-18 22:03   ` Mathieu Lacage
2008-12-18 22:10     ` Daniel Jacobowitz
2008-12-26 10:40       ` Mathieu Lacage
2008-12-26 12:54         ` Daniel Jacobowitz
2009-01-05 14:58           ` Mathieu Lacage
2009-01-05 17:13             ` Daniel Jacobowitz
2009-01-07 16:46               ` Doug Evans
2009-01-12 15:08             ` Mathieu Lacage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74fef6df0812181341x8ecdd31me028bd4d658384b1@mail.gmail.com \
    --to=mathieu.lacage@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox