What is the stop/pause command for lldb?

Hi people,

What is the command to get a running target (inferior) process to stop
from the lldb command line?

Is it the Control-C sequence, as in gdb?

I've built (from the TRUNK) on 32-bit linux an lldb, with a couple of
local patches (for incorrect register map and broken writes to
dr6/7) and Control-C does not stop the program-being-debugged.

$ lldb hello
Current executable set to 'hello' (i386).
(lldb) run
Process 1996 launching
Process 1996 stopped
* thread #1: tid = 1996, 0x00000000, name = 'hello', stop reason = trace
     frame #0: 0x00000000
error: Input/output error
(lldb) Process 1996 launched: '/home/mg11/src/play/clang-tests/hello/hello' (i386)
Hello from test program!!
<--- I pressed Control-C now --->
(lldb)

All I see is the (lldb) prompt return. But clearly my inferior is not
stopped by the tracer:

$ cat /proc/1996/status
Name: hello
State: R (running)
Tgid: 1996
Pid: 1996
PPid: 1989
TracerPid: 1995
...

So is Control-C the correct command? In which case I imagine I've found
a bug?

Can someone answer this simple question?

thanks
Matthew Gardiner

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.

Try "process interrupt"

Abid, Hafiz wrote:

Try "process interrupt"

Thanks, Hafiz
My bad for not seeing it in http://lldb.llvm.org/tutorial.html I suppose.
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.

Hey Matthew,

  • thread #1: tid = 1996, 0x00000000, name = ‘hello’, stop reason = trace
    frame #0: 0x00000000

I suspect more may be broken given that thread #1 line above. Did the “process interrupt” actually work?

Control-C is currently broken in TOT lldb. It pops the input reader for the program you are debugging off the stack, but doesn't interrupt it, leaving you in a kind of odd state...

Greg's on this.

Jim

Todd Fiala wrote:

Hey Matthew,

> * thread #1: tid = 1996, 0x00000000, name = 'hello', stop reason = trace
    frame #0: 0x00000000

I suspect more may be broken given that thread #1 line above. Did the "process interrupt" actually work?

Hi Todd,

Yes. The kernel now reports that the my single-threaded test program that in tracer stop:

$ cat /proc/6965/status
Name: hello
State: t (tracing stop)
Tgid: 6965
Pid: 6965
PPid: 6955
TracerPid: 6964
...

after I launch the process interrupt command.

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.

jingham@apple.com wrote:

Control-C is currently broken in TOT lldb. It pops the input reader for the program you are debugging off the stack, but doesn't interrupt it, leaving you in a kind of odd state...

Greg's on this.

Jim

Thanks for this, Jim.

However, this leaves me a bit puzzled. Surely, if lldb *already* has a command intended to SIGTRAP the inferior (i.e. process interrupt), then why is Control-C broken? What is Control-C's intended purpose in lldb?

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.

Just bringing this up again as I’m seeing some unexpected behavior on startup with this on Linux and wanted to know if it’s still expected or something to investigate. I can look into it if this should be working.

andrew@host:~$ lldb /usr/bin/python
Current executable set to ‘/usr/bin/python’ (x86_64).
(lldb) r
Process 22284 launching
Process 22284 launched: ‘/usr/bin/python’ (x86_64)
Process 22284 stopped
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

(lldb)
^^^^^
I would expect to be at a Python prompt here, not lldb. Ctrl-C does nothing.

error: No auto repeat.
(lldb) process interrupt
Process 22284 stopped

  • thread #1: tid = 22284, 0x00007f869ef0adc3 libc.so.6__select + 19, name = 'python', stop reason = signal SIGSTOP frame #0: 0x00007f869ef0adc3 libc.so.6__select + 19
    libc.so.6`__select + 19:
    → 0x7f869ef0adc3: cmpq $-0xfff, %rax
    0x7f869ef0adc9: jae 0x7f869ef0adff ; __select + 79
    0x7f869ef0adcb: retq
    0x7f869ef0adcc: subq $0x8, %rsp
    (lldb) c
    Process 22284 resuming

^^^^^
Now at a Python prompt, hitting Ctrl-C works as expected.

Process 22284 stopped

  • thread #1: tid = 22284, 0x00007f869ef0adc3 libc.so.6__select + 19, name = 'python', stop reason = signal SIGSTOP frame #0: 0x00007f869ef0adc3 libc.so.6__select + 19
    libc.so.6`__select + 19:
    → 0x7f869ef0adc3: cmpq $-0xfff, %rax
    0x7f869ef0adc9: jae 0x7f869ef0adff ; __select + 79
    0x7f869ef0adcb: retq
    0x7f869ef0adcc: subq $0x8, %rsp
    (lldb)