[lldb-dev] Debugging a running process with lldb
Greg Clayton
gclayton at apple.com
Thu May 15 10:21:04 PDT 2014
So to clear things up:
-t or --tty will attempt to launch the process in a _separate_terminal_window_ (open a new terminal window and launch your process within it so the process gets its own window and we don't have to shared IO) and should never be used with -n (--no-stdio). If they currently can be run together then this is a bug. --tty isn't supported on Linux as far as I know and the linux launch code should return an error saying this isn't supported. The --tty option is designed to be used when you want to debug anything that uses curses (emacs, vi, etc) and where having a different terminal window with its own stdin/out/err is required.
--no-stdio should, as you surmised, launch a process with /dev/null as the stdin/out/err. It also means we should always have a prompt.
To to summarize:
(lldb) process launch ...
No LLDB prompt while running as all input goes to process (though if CTRL+C is pressed and we will stop the target for you)
(lldb) process launch --tty -- ...
LLDB prompt always visible, process launches in a different terminal window, not supported on linux, should never be used with --no-stdio and if our options allow it, this is a bug
(lldb) process launch --no-stdio -- ...
LLDB prompt always visible (if not, then a bug, probably only on the linux side).
Let me know if I
> On May 15, 2014, at 1:53 AM, Matthew Gardiner <mg11 at csr.com> wrote:
>
> Matthew Gardiner wrote:
>> Greg Clayton wrote:
>>> If we launch a process and hookup a pty to its stdin/out/err, then we shouldn't get a prompt.
>> Sorry, I don't understand this. Surely if we attach the inferior's (i.e. what you termed the process) standard IOs to a pty, then we *will* get a prompt, since then lldb can use it's terminal with no corruption from the inferiors in/out?
>>
>> (I'm not actually clear about the relationship between the "process launch" -t and -n commands. I do accept that they are mutually exclusive. I assume, -n means that the stdin/out/err of the inferior is closed, so that lldb has complete use of the foreground, so it could use it's prompt. I assume -t means attach the inferior to a different pty, so again, lldb should still be able to use it's prompt.)
>>> It is probably a bug where if you launch with --no-stdio that the LLDB prompt isn't always active.
>>>
>>> For attach, we will always have a prompt.
>>>
>>> So seems this is a bug that --no-stdio is still pushing a Process IOHandler and taking over the console while the process is running.
>> So you are saying if I do
>> (lldb) process launch -s --no-stdio
>> then
>> (lldb) process continue
>>
>> then I should always see:
>> (lldb)
>> back on my terminal?
>>
>> Todd, could you try this (a couple of times, in case I'm seeing something intermittent) please, to see if your observations agree?
>>
>> thanks
>> Matt
> Hi Greg,
>
> Actually, my colleague just brought his MacBook (OSX 10.9.2) into work, this morning. He installed pre-built xcode/lldb (lldb-310.2.37) on his Mac, and I can confirm that on mac, when we invoked:
>
> (lldb) process launch -s -n
> Process 1002 lanched....
> (lldb) process continue
> Process 1002 resuming
> (lldb)
>
> then we see the interpreter prompt return after the "continue". So what I reported originally is a linux build bug. (Perhaps I'll start digging into this, if I get any time...).
>
> However, using "process launch -s -t" on the mac, was buggy, a terminal-emulator was spawned, but (presumably) lldb and the child terminal fail to synchronise using the UNIX socket.
>
> (lldb) process launch -s -t
> error: failed to launch or debug process
> (lldb)
>
> Anyway, sorry for my earlier rant ;-), but at least now I'm a little clearer about the intended semantics...
>
> Matt
>
>
> Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
> New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.
More information about the lldb-dev
mailing list