Eclipse 调试器内部的 Stacktrace
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12782935/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Stacktrace inside of the eclipse debugger
提问by Thom
I have an exception that's not getting handled very well. I'm at a line in the debugger where I have the exception in hand, but it's not in my code, so I can't just log it at that point. So I'm sitting in the debugger with the exception in my variables window and I'm trying to figure out how to get the stack trace from it so i can find where the exception originated and handle it better.
我有一个没有得到很好处理的例外。我在调试器的一行中,我手头有异常,但它不在我的代码中,所以我不能在那个时候记录它。所以我坐在调试器中,我的变量窗口中有异常,我试图弄清楚如何从中获取堆栈跟踪,以便我可以找到异常的来源并更好地处理它。
Ideas?
想法?
采纳答案by David Grant
In the Debug
Perspective, show the Expressions
View. Now you can add a expression of e.printStackTrace()
where e
is your variable.
在Debug
透视图中,显示Expressions
视图。现在,您可以添加变量e.printStackTrace()
where的表达式e
。
Alternatively, you can change your expression to getStackTrace()
and expand the StackTraceElement
array in the Expressions
output window.
或者,您可以将表达式更改为getStackTrace()
并StackTraceElement
在Expressions
输出窗口中展开数组。
回答by Bananeweizen
Why don't you create an Exception Breakpoint? Then you don't have to manually debug through your code until the exception occurs, instead the debugger will just stop whenever that exception is thrown originally and you can see the livestacktrace in the debugger.
你为什么不创建一个异常断点?然后,您不必在异常发生之前手动调试代码,相反,只要最初抛出该异常,调试器就会停止,并且您可以在调试器中看到实时堆栈跟踪。
回答by AlexR
I usually use the following trick.
Go to the "expression" view and add expression e.printStackTrace()
. The stack trace will be printed to your STDERR, i.e. to eclipse console if your application is running inside the Eclipse IDE.
我通常使用以下技巧。转到“表达式”视图并添加表达式e.printStackTrace()
。堆栈跟踪将打印到您的 STDERR,即如果您的应用程序在 Eclipse IDE 中运行,则打印到 eclipse 控制台。