mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "writeonce@midipix.org" <writeonce@midipix.org>
To: musl@lists.openwall.com
Subject: _start(ldso) & _start(crt)
Date: Mon, 21 Apr 2014 15:41:23 -0400	[thread overview]
Message-ID: <53557463.2050202@midipix.org> (raw)

Greetings,

When running a dynamically linked program, the general control flow is

     _start(ldso/{arch}/start.s) --> __dynlink --> _start(crt) --> 
__libc_start_main --> main()

When asking gdb to set up a breakpoint at _start (b _start), gdb's 
confirmation message shows the address of _start(crt), but it then 
breaks at _start(ldso), which is actually what I want.  It then later 
also breaks at _start(crt).

If gdb decided to only break at the executable's _start, then I believe 
there would be no way to request a break at the interpreter's (ldso)  
_start routine, since the address of ldso's _start is not known prior to 
execution.

I am not sure whether this is a good-enough motivation to rename ldso's 
start to _ldso_start (and set libc.so's entry point accordingly), or 
whether we could simply count on gdb and other debuggers to continue to 
do the "right thing" by breaking at the earlier _start of the two.  For 
one thing, setting a breakpoint at __dynlink provides pretty much the 
same debugging ability as with _start(ldso), and does not require any 
changes.  Any thoughts?

Kind regards,
zg



             reply	other threads:[~2014-04-21 19:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 19:41 writeonce [this message]
2014-04-21 20:25 ` Rich Felker
2014-04-21 21:15   ` M Farkas-Dyck
2014-04-21 21:39     ` Rich Felker

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=53557463.2050202@midipix.org \
    --to=writeonce@midipix.org \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).