Dr.Kameleon
Dr.Kameleon

Reputation: 22820

LLDB - Exit on... exit?

I'm currently writing a script to fully automate my compile-run-debug procedure, for Cocoa/Objective-C projects.

My last line of code is :

lldb -f Build/MyApp.app -o "run"

Which actually opens the debugger, attaches the process, and runs it.

However, when the application exits, the debugger stays open, waiting for a command.

Any way to make it close as well, once the attached process quits?

Upvotes: 3

Views: 2355

Answers (2)

Jim Ingham
Jim Ingham

Reputation: 27203

Using the Python interface will give you much more flexibility & power if you are planning to automate more complex tasks, definitely worth learning if you have that in mind.

However, you should be able to say:

lldb -f <Whatever> -o run -o quit

That that doesn't work at present is just a bug. That got fixed in TOT lldb a couple of days ago. Don't know when it will show up in an Apple released Xcode, but it should work there too before too long.

Upvotes: 4

Krzysztof
Krzysztof

Reputation: 1471

One way of doing it would be to use the python bindings, and listen for events from lldb.

If you run following script it will lunch app in debug mode, and if you close app script will finish as well :

http://www.opensource.apple.com/source/lldb/lldb-179.1/examples/python/process_events.py

Other way possibly should work as well:

  • run the app,
  • obtain pid of running app,
  • start the lldb and attach to pid
  • monitor if app is running and if not kill the lldb.

Upvotes: 1

Related Questions