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