1

In a non-trivial program, there may be any number of exceptions, being thrown and caught. While this is intended to prevent crashes, it makes debugging harder (I debug with gdb) since I don't get to see the point (and its backtrace) where the exception was thrown when debugging the binary unless I identify the line and introduce a break point.

So, to facilitate analysis, it would be useful to tell g++ (or gdb?) to consider all throws as critical errors, similar to assertion failures. Is this at all possible without hacking the code?

bitmask
  • 32,434
  • 14
  • 99
  • 159
  • Your debugger should have a way to break on exceptions. I do not know `gdb` though, so I can't help with finding out how. – Andy Prowl Feb 21 '13 at 21:21
  • @DavidBrown: You are correct. I should have included gdb in my preliminary search :/ – bitmask Feb 21 '13 at 21:26

1 Answers1

4

It's trivial. The command is catch throw. Start gdb pointing it at your executable. Issue the catch throw command and then the run command.

David Schwartz
  • 179,497
  • 17
  • 214
  • 278
  • Ah, silly me. In my defence, I haven't been using exceptions in the past, but I'm starting to warm up to them. – bitmask Feb 21 '13 at 21:25