yeah i'm lazy today
Apr. 4th, 2009 12:39 pmHas anyone already written a script - I don't care how - that does, or can be made to do, this:
- Starts GDB on a specified program, with specified command line arguments.
- Runs the program; does not molest its input or output in any way.
- If the program running under GDB exits normally, the script exits too, with the same exit code as the program and without producing any output.
- But if the program running under GDB receives a fatal signal or calls any of a list of lethal functions (e.g.
abort,std::terminate- it's okay if this list is hardwired into the script) then GDB should regain control and dump out a stack trace on standard error. The script should then exit with a nonzero exit code.
[EDIT April 6: Tom Tromey, who knows, tells me that it's not possible to do this using only GDB's internal scripting language. So, y'know, if you want to write, or have already written, a super duper expect script that does this, or something like that, that would be wonderful; but don't waste any time staring at the gdb manual thinking there must be a convenience variable to tell me if the program stopped on a signal....
Because there isn't.]