How do i use the lldb '-s' flag (command source) properly

211 Views Asked by At

I can successfully launch and debug a program such as octave using lldb in a terminal as follows:

    $ lldb octave  
    (lldb) target create "octave"  
    Current executable set to 'octave' (x86_64).  
    (lldb) r --no-gui  
    Process 76986 launched: '/opt/local/bin/octave' (x86_64)  
    Process 76986 stopped  
    * thread #1: tid = 0x13465f, 0x00007fff5fc01000 dyld`_dyld_start, stop reason = exec
frame #0: 0x00007fff5fc01000 dyld`_dyld_start
   dyld`_dyld_start:
  ->  0x7fff5fc01000 <+0>: popq   %rdi
  ...

  (lldb) c  
  Process 76986 resuming  
  GNU Octave, version 4.2.0  
  ...  
  octave:1> 

Now I can enter octave commands at the octave prompt. For instance:

  octave:1> version  
  ans = 4.2.0

I want to execute an lldb script and therefore start lldb like this instead:

    $ lldb octave -s ~/path/to/lldb_script

where the lldb_script file contains for instance:

    r --no-gui

When I actually run

    $ lldb octave -s ~/path/to/lldb_script

I get

    (lldb) target create "octave"  
    Current executable set to 'octave' (x86_64).  
    (lldb) command source -s 0 '/Users/cyril/trunk/python/lldb_startup'  
    Executing commands in '/Users/cyril/trunk/python/lldb_startup'.
    (lldb) process launch --  --no-gui  
    Process 77138 stopped
    * thread #1: tid = 0x14b1fb, 0x00007fff5fc01000 dyld`_dyld_start, stop      reason = exec
    frame #0: 0x00007fff5fc01000 dyld`_dyld_start
   dyld`_dyld_start:
   ->  0x7fff5fc01000 <+0>: popq   %rdi
   ...

   Process 77138 launched: '/opt/local/bin/octave' (x86_64)

Now when I do 'continue' like this

   (lldb) c  

I get

   Process 77138 resuming  
   GNU Octave, version 4.2.0  
   ...  
   (lldb)

lldb actually returns to (lldb) prompt and not octave> promt. And I cannot run octave commands.

   (lldb) version

returns

   lldb-350.0.21.9

and (lld) c

gives

   error: Process is running.  Use 'process interrupt' to pause execution.

The script scheme was working fine and was actually giving me octave prompt as expected until recently. I may have upgraded lldb inadvertently.

How do i use the lldb '-s' flag (command source) properly so the launched program gets launched properly and does not return to (lldb) prompt?

0

There are 0 best solutions below