[lldb-dev] How to get the entry point of a target like the one in --stop-at-entry

jingham at apple.com jingham at apple.com
Mon Feb 17 11:15:10 PST 2014


lldb doesn't implement "stop at entry" by putting a breakpoint on some function and hitting it.  Traditionally on ptrace based systems this was implemented using the "PT_TRACEME" ptrace argument run in the child side of the fork that will create the target process, and on MacOS X, we use a posix_spawn option to start a process suspended that does basically the same thing.

So we don't know in advance where this entry point will be.  We just tell the OS to start the target suspended and then assume when it starts, that's where it is...

I note that in one place (following exec's on OS X) we hard code the knowledge that _dyld_start is where "start suspended" is expected to end up.  That's informally done there, it's not a property of the dynamic linker plugin.  If this is generally determinable in advance, we could make this an API on the dynamic linker plugin.

Anyway, maybe we could be more help if we knew why you wanted to know this.

Jim

On Feb 16, 2014, at 3:17 PM, Yin Ma <yin at affinic.com> wrote:

> Hi,
>  
> LLDB has provided an option to –stop-at-entry. I would like to
> Get the address of this entry point by a way. I checked API
> I didn’t found a function that could get this information. Could
> Anyone help me on this?
>  
> Thanks,
>  
> Yin
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list