4

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?

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Perfect, each of these solutions are exactly what I wanted. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.