[lldb-dev] No LineEntry info fom FindFunctions in SBTarget?

Greg Clayton gclayton at apple.com
Wed Apr 23 17:18:50 PDT 2014


On Apr 23, 2014, at 3:32 PM, Yin Ma <yin at affinic.com> wrote:

> Hi,
>  
> I am calling FindFunctions in SBTarget to retrieve function info.
> From returned SBSymbolContext object, I can get valid SBFunction
> And SBModule objects but not any valid SBLineEntry object. I used
> SBSymbolContext.GetLineEntry().
>  
> I am wondering why LineEntry is not available there? And how to get
> corresponding LineEntry info for a SBFunction Object.

Which line entry? All of them for the entire function? My point being that a function has many possibly line entries contained within all of the code for the function.

If you want the line entry for the entry point of the function itself, you can do:

SBFunction func = SBSymbolContext().GetFunction();
SBAddress func_entry_addr = func.GetStartAddress();
SBLineEntry func_entry_line = func_entry_addr.GetLineEntry();

You might also want the first line entry at which you can set a breakpoint. For this you will want to skip the function prologue. An easy method that usually works it to grab the second line entry in the function:

SBLineEntry second_func_line = func_entry_line.GetEndAddress().GetLineEntry();






More information about the lldb-dev mailing list