简体   繁体   English

调试一些不打印任何堆栈跟踪的代码

[英]Debugging some code that is not printing any stack trace

So I am debugging someone else's customized code used in a Java based enterprise software.所以我正在调试其他人在基于 Java 的企业软件中使用的定制代码。 As per his documentation, a specific file has the customization I am looking into.根据他的文档,特定文件具有我正在研究的自定义。 I deployed all customized files on the test server and now the browser window crashes as soon as it starts to render data using that code.我在测试服务器上部署了所有自定义文件,现在浏览器窗口一旦开始使用该代码呈现数据就会崩溃。 No stack trace gets printed out.没有堆栈跟踪被打印出来。 The customized code in question is not actually causing the issue.有问题的自定义代码实际上并没有导致问题。 The issues is caused by some other code that uses the data returned from this piece of code.问题是由使用从这段代码返回的数据的其他一些代码引起的。 The puzzle for me is that I don't really know where the data is being returned to, and any error being thrown is not printed out.我的困惑是我真的不知道数据返回到哪里,并且抛出的任何错误都不会打印出来。 Is there anything I can do to figure out what file uses the data returned by this customized code?我能做些什么来弄清楚哪个文件使用了这个自定义代码返回的数据?

Brute force: Tell debugger to break on all exceptions.蛮力:告诉调试器中断所有异常。

Eg in Eclipse, select menu "Run" > "Add Java Exception Breakpoint...", type Exception and select the java.lang.Exception , check both "Suspend on caught exceptions" and "Suspend on uncaught exceptions", and click "OK".例如,在 Eclipse 中,选择菜单“运行”>“添加 Java 异常断点...”,输入Exception并选择java.lang.Exception ,选中“Suspend on catch exceptions”和“Suspend on uncaught exceptions”,然后单击“好的”。 In the "Breakpoints" view, select the new Exception breakpoint and check "Subclasses of this exception".在“Breakpoints”视图中,选择新的Exception断点并选中“此异常的子类”。

This is break on any thrown Exception (not Error ).这是对任何抛出的Exception (不是Error )的中断。 You may see a lot of false positives, which is why I call this the "brute force" method.您可能会看到很多误报,这就是我将其称为“蛮力”方法的原因。

Change to Throwable if you want to catch Error too.如果您也想捕获Error请更改为Throwable

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM