mdb's substitute for gdb's catch throw?

末鹿安然 提交于 2020-01-07 02:58:24

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!