[lldb-dev] Different Behavior between Terminal and GUI simulated terminal

Richard Mitton richard at codersnotes.com
Fri Oct 4 10:20:38 PDT 2013


I've noticed this same bug myself, and actually spent a while this week 
trying to fix it (with no luck).

The problem is simply a threading race condition, which manifests 
sometimes. You can usually (on Linux at least) trigger it by just doing 
a 'run' repeatedly until it happens.

It's because the process's input reader is created asynchronously on a 
thread, so isn't guaranteed to be at the top of the input stack at the 
time the 'run' command has finished. So the driver may or may not try to 
refresh the prompt.

I don't have a fix for this I'm afraid.

Also, regarding the original problem, it sounds to me like you're trying 
to capture the lldb output so you can build a debugger interface on top 
(like GDB interfaces often work). For what it's worth, this is a really 
bad idea. lldb has a C++ and Python API which are much better suited for 
that kind of thing.

-- 
Richard Mitton
richard at codersnotes.com

> jingham at apple.com <mailto:jingham at apple.com>
> Friday, October 04, 2013 8:41 AM
> Did you launch the two processes in the same way in both cases? It 
> looks like in the first instance lldb is running synchronously, and in 
> the second instance asynchronously. I sent a note to the list a couple 
> of days ago describing when lldb uses the two modes, check that and 
> see if it explains what you are seeing. Otherwise, this may be some 
> bug in the input driver?
>
> Jim
>
>
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> Yin Ma <mailto:yin at affinic.com>
> Thursday, October 03, 2013 11:30 PM
>
> Hi,
>
> I got different behavior between run lldb under regular terminal
>
> And GUI simulated terminal (posix_openpt or pipe based).
>
> In the regular terminal:
>
> (lldb) run
>
> Process 10992 launched: ‘…’
>
> Process 10992 stopped
>
>  Thread …
>
> In the GUI, If I run the same thing, I got
>
> (lldb) run
>
> Process 10992 launched: ‘…’
>
> (lldb) Process 10992 stopped
>
>  Thread …
>
> There already is (lldb) after the first line.
>
> My lldb is 179.5
>
> Could anybody let me know why there is this difference?
>
> And How to switch to the regular mode?
>
> Thanks,
>
> Yin
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20131004/832117cc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20131004/832117cc/attachment.jpg>


More information about the lldb-dev mailing list