Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LLDB Restart process without user input

Tags:

debugging

lldb

I am trying to debug a concurrent program in LLDB and am getting a seg fault, but not on every execution. I would like to run my process over and over until it hits a seg fault. So far, I have the following:

b exit
breakpoint com add 1
Enter your debugger command(s).  Type 'DONE' to end.
> run 
> DONE

The part that I find annoying, is that when I get to the exit function and hit my breakpoint, when the run command gets executed, I get the following prompt from LLDB:

There is a running process, kill it and restart?: [Y/n] 

I would like to automatically restart the process, without having to manually enter Y each time. Anyone know how to do this?

like image 421
Matt Avatar asked Sep 19 '25 10:09

Matt


1 Answers

You could kill the previous instance by hand with kill - which doesn't prompt - then the run command won't prompt either.

Or:

(lldb) settings set auto-confirm 1

will give the default (capitalized) answer to all lldb queries.

Or if you have Xcode 6.x (or current TOT svn lldb) you could use the lldb driver's batch mode:

$ lldb --help
...
       -b 
       --batch 
            Tells the debugger to running the commands from -s, -S, -o & -O,
            and then quit.  However if any run command stopped due to a signal
            or crash, the debugger will return to the interactive prompt at the
            place of the crash.

So for instance, you could script this in the shell, running:

lldb -b -o run

in a loop, and this will stop if the run ends in a crash rather than a normal exit. In some circumstances this might be easier to do.

like image 111
Jim Ingham Avatar answered Sep 21 '25 01:09

Jim Ingham