问题
I am not very much expert in gdb and mdb but What i know is that :-
`(gdb) catch throw`
This will interrupt anytime an exception is thrown
Do i have any similar command in mdb which will interrupt anytime an exception is thrown?
回答1:
No, this doesn't exist as such; that's because on Solaris, it depends on your compiler and/or compile options which C++ ABI is being used (and how exceptions are being thrown).
mdb
isn't making an attempt to know all of that, and neither is gdb
on Solaris (if you compile it, catch throw
will not work with either old- or new-style Sun CC binaries).
Your best option is to figure out what the "C++ ABI hooks" are, i.e. which hidden / internal functions are being called on throw()
, and breakpoint those. Or, once you have found / enumerated those hooks, write your own module that'd implement a ::catch
command (mdb
is extensible - modular debugger).
Edit: (shameless plug) see also this answer of mine (regarding C++ exceptions and DTrace; the "hidden" function names there can be used for mdb
breakpoints as well).
来源:https://stackoverflow.com/questions/10454099/mdbs-substitute-for-gdbs-catch-throw