zwol: ((mad) science)
[personal profile] zwol

Has anyone already written a script - I don't care how - that does, or can be made to do, this:

  1. Starts GDB on a specified program, with specified command line arguments.
  2. Runs the program; does not molest its input or output in any way.
  3. 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.
  4. 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.]

This account has disabled anonymous posting.
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819 202122
23242526272829
30      

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 11th, 2026 01:50 am
Powered by Dreamwidth Studios