Re: [lldb-dev] API for loading debug symbols

2016-02-28 Thread Mike Gulick via lldb-dev
On Thu, 25 Feb 2016 10:18:42 -0800
Greg Clayton  wrote:

> 
> Yes: use the "target symbols add" to do thing manually:
> 
> (lldb) target symbols add
> --shlib-name /path/to/my/workspace/bin/maci64/libA.dylib 
> /archive/builds/1234/bin/maci64/libA.dylib.dSYM/Contents/Resources/DWARF/libA.dylib
> 

Thanks.  I tested this interactively, and it seems to work, although I
needed to modify the command:

(lldb) target symbols add 
/archive/builds/1234/bin/maci64/libA.dylib.dSYM/Contents/Resources/DWARF/libA.dylib

The '--shlib-name' option doesn't seem to be recognized, but '--shlib'
is.  However it produced the following error:

(lldb) target symbols add --shlib /path/to/my/workspace/bin/maci64/libA.dylib 
/archive/builds/1234/bin/maci64/libA.dylib.dSYM/Contents/Resources/DWARF/libA.dylib
error: specify either one or more paths to symbol files or using the --file 
option without arguments

It looks like the 'target symbols add' without the --shlib does work
correctly, as I can see the compilation unit and source code when I hit
breakpoints in the library.  I'm guessing it works by matching the UUID
of the new library with the UUID of the existing library.

> But, if you are on MacOSX, Spotlight should be locating these files
> for us and should allow us to find them without the need to do
> anything.

Spotlight is not configured to index these paths.  They are
autofs-mounted NFS volumes, so they don't appear by default.  The
archived builds are huge and there are lots of them, so its just
not practical to index them on each system.  That certainly would be
convenient if it worked though.

Thanks,
Mike

___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] API for loading debug symbols

2016-02-28 Thread Mike Gulick via lldb-dev
On Fri, 26 Feb 2016 15:18:00 -0800
Greg Clayton  wrote:

> 
> That makes perfect sense. So will this be enough to get you going
> them?
> 

I think so.  I am curious what the correct way would be to use
the '--shlib' option would be since I couldn't get it to work.

I'm going to try creating a python script which registers for the  
lldb.SBTarget.eBroadcastBitModulesLoaded event, and when a new
module is loaded that doesn't have any compilation units,
it will then call the 'target symbols add' command to add the
additional dylib file.

I'll post back if I'm unable to get it to work.

Thanks,
Mike
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] How to use the C++ API? No useful documentation?

2016-02-28 Thread Paul Peet via lldb-dev
Hey,

Just to let you know that I think I made some progress in determine the problem.
I've basically setup an vm (archlinux, linux 4.4, lldb 3.7.1) and
tried the code on it. To my surprise it gave me proper output without
non-determinism. YEY.
I still don't have any idea why it's not working on my host system. I
might try testing linux 4.4 like I did on the vm.

Do you have any idea/suspicion why it might not work on my system. (I
can provide additional information if needed).

2016-02-25 16:59 GMT+01:00 Paul Peet :
> I updated my code and removed the call to AddListener and as I can
> tell nothing changed. It is still behaving "strange". It also didn't
> work with the python example. I couldn't step over the next
> instruction, so I am getting similar behavior like the c++ code.
>
> The strange thing is that at the first try it worked (c++ code):
>
> * thread #1: tid = 4502, 0x00400953 main`main + 35 at
> main.cpp:7, name = 'main', stop reason = breakpoint 1.1
> frame #0: 0x00400953 main`main + 35 at main.cpp:7
>4
>5   int main() {
>6
> -> 7std::cout << "Hello World" << std::endl;
>8
>9int i = 0;
>10std::cin >> i;
> 0x7f022c000930 Event: broadcaster = 0x56348a831fa8 (lldb.process),
> type = 0x0001 (state-changed), data = { process = 0x56348a831f70
> (pid = 4502), state = stopped}
> --
> * thread #1: tid = 4502, 0x00400953 main`main + 35 at
> main.cpp:7, name = 'main', stop reason = breakpoint 1.1
> frame #0: 0x00400953 main`main + 35 at main.cpp:7
>4
>5   int main() {
>6
> -> 7std::cout << "Hello World" << std::endl;
>8
>9int i = 0;
>10std::cin >> i;
> 0x7f022c003db0 Event: broadcaster = 0x56348a831fa8 (lldb.process),
> type = 0x0001 (state-changed), data = { process = 0x56348a831f70
> (pid = 4502), state = stopped}
> Stopped at breakpoint
> --
> Hello World
> --
> * thread #1: tid = 4502, 0x00400978 main`main + 72 at
> main.cpp:9, name = 'main', stop reason = step over
> frame #0: 0x00400978 main`main + 72 at main.cpp:9
>6
>7std::cout << "Hello World" << std::endl;
>8
> -> 9int i = 0;
>10std::cin >> i;
>11
>12if (i == 1) {
> 0x7f022c001680 Event: broadcaster = 0x56348a831fa8 (lldb.process),
> type = 0x0001 (state-changed), data = { process = 0x56348a831f70
> (pid = 4502), state = stopped}
> Stopped at step
> --
>
> But every try afterwards didn't work:
>
> * thread #1: tid = 5122, 0x00400830 main`_start, name = 'main'
> frame #0: 0x00400830 main`_start
> main`_start:
> 0x400830 <+0>: xorl   %ebp, %ebp
> 0x400832 <+2>: movq   %rdx, %r9
> 0x400835 <+5>: popq   %rsi
> 0x400836 <+6>: movq   %rsp, %rdx
> 0x7f8f98000930 Event: broadcaster = 0x5568372e7fa8 (lldb.process),
> type = 0x0001 (state-changed), data = { process = 0x5568372e7f70
> (pid = 5122), state = stopped}
> --
> * thread #1: tid = 5122, 0x00400830 main`_start, name =
> 'main', stop reason = breakpoint 1.1
> frame #0: 0x00400830 main`_start
> main`_start:
> 0x400830 <+0>: xorl   %ebp, %ebp
> 0x400832 <+2>: movq   %rdx, %r9
> 0x400835 <+5>: popq   %rsi
> 0x400836 <+6>: movq   %rsp, %rdx
> 0x7f8f98001640 Event: broadcaster = 0x5568372e7fa8 (lldb.process),
> type = 0x0001 (state-changed), data = { process = 0x5568372e7f70
> (pid = 5122), state = stopped}
> Stopped at breakpoint
> --
> Hello World
> --
>
> To be honest, I am not sure if this is a bug in linux or lldb?
> I will try to compile lldb/llvm/clang from upstream.
> Do you have any idea what might cause this?
>
>
> 2016-02-25 1:05 GMT+01:00 Greg Clayton :
>> Not sure. First off, you don't need to do:
>>
>> process.GetBroadcaster().AddListener(...)
>>
>> The debugger's listener is already listening to all the events. If you don't 
>> specify a listener during launch the process will use the debugger's 
>> listener automatically. If you end up making your own process listener, you 
>> would actually tell your listener to listen to a broadcaster:
>>
>> SBListener listener("process-listener");
>> launch_info.SetListener (listener);
>> SBProcess process = target.Launch(launch_info, error);
>>
>> Everything else looks good.
>>
>> What happens if you try running using the process_events.py python script? 
>> You might need to specify the PYTHONPATH environment variable to point to 
>> your lldb.so
>>
>> % PYTHONPATH=/path/to/lldb/build/directory python 
>> lldb/examples/python/process_events.py --breakpoint main.c:12 -- ./a.out 
>> arg1 arg2
>>
>> Does this work if you replace a.out with the path and args for your program? 
>> If it does, I would start porting the code from process_events.py and seeing 
>> what works and what doesn't. The process_events.py will call 
>> "process.Continue()" after it stops. Feel free to edit and play with this 
>> script.
>>
>>
>>> On Feb 24, 2016, at 3