ben
ben

Reputation: 472

upon exception I would like debugging without any stack unwinding

I am a C developer looking into C++:

Do I understand it correctly that if I throw an exception then the stack will unwind until the first exception-handler is found? Is it possible to instead open a debugger upon any throw without unwinding (ie without leaving the scope in which it was declared or any higher scope)?

The reason I am asking is, that - even though there are exception handlers in a higher scope - I am interested in the locals of that scope (and also dont want to lose the RAII'ed objs) and want to look at them during debugging.

EDIT: mostly for g++ on win+linux, but also interested in other platforms.

Upvotes: 1

Views: 184

Answers (1)

paulm
paulm

Reputation: 5892

You didn't specify your toolset/platform.

But in MSVC you can configure the debugger to break on various types of exceptions, in your case it would be C++ exceptions.

See here for details:

http://msdn.microsoft.com/en-us/library/d14azbfh.aspx

Edit: For gcc/gdb see this question Run an Application in GDB Until an Exception Occurs

Upvotes: 1

Related Questions