[lldb-dev] help for lldb command like gdb info sources & info source
jingham at apple.com
jingham at apple.com
Tue Sep 3 18:49:37 PDT 2013
On Sep 3, 2013, at 6:29 PM, Yin Ma <yin at affinic.com> wrote:
> Hi Jim,
>
> Thank you for your help.
>
> I tried image lookup -va $pc on my lldb.
> I got
> error: invalid address string '$pc'
>
> I am using lldb-179.3, is your version much higher than mine?
Yes. The -a option values were changed to be "address expressions" rather than just straight addresses, certainly in the current LLDB TOT, but also in the lldb from any of the Xcode 5 beta's as well.
>
> Do you know any method that I can retrieve the source file list
> from lldb?
If you don't mind writing some Python, you can do something like:
def PrintCompUnitNames (target):
num_modules = target.GetNumModules()
for mod_idx in range(num_modules):
module = lldb.target.GetModuleAtIndex(mod_idx)
print "Module: ", module
num_comp_units = module.GetNumCompileUnits()
for idx in range(num_comp_units):
print module.GetCompileUnitAtIndex(idx)
That's pretty rough, you probably don't care about printing modules without compile units. This also won't print .h files that get inlined into your code. You can get the "support files" from an SBCompileUnit, which should list all the included files, but that will have lots of duplication so you should maybe put them in a unique list. But something like this should do.
Jim
>
> Yin
>
>
>
> -----Original Message-----
> From: jingham at apple.com [mailto:jingham at apple.com]
> Sent: Tuesday, September 03, 2013 6:15 PM
> To: Yin Ma
> Cc: lldb-dev at cs.uiuc.edu
> Subject: Re: [lldb-dev] help for lldb command like gdb info sources & info source
>
> There isn't an equivalent of "info sources" yet.
>
> There is a rough equivalent of "info line" (listed in the gdb->lldb cheat sheet at http://lldb.llvm.org/lldb-gdb.html), which is to do:
>
> (lldb) image lookup -va $pc
> ...
> LineEntry: [0x000000010001a98e-0x000000010001a99f): /Work/Foo.c:11
> ...
>
> It isn't as good as "info line" because it only gives the address range from the given source line that surrounds the address passed to the lookup command. It doesn't answer the question "what are ALL the address ranges that contribute to the implementation of this source line?"
>
> Hope this helps,
>
> Jim
>
>
> On Sep 3, 2013, at 4:58 PM, Yin Ma <yin at affinic.com> wrote:
>
>> Hi,
>>
>> Could anyone let me know what is the lldb command
>> to show all source files like gdb info sources and
>> the command to show the source file info of the
>> current $pc location?
>>
>> 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