System.Diagnostics.Debugger.Break()喜欢使用java? [英] System.Diagnostics.Debugger.Break() like using java?
问题描述
是否有一种方法来发送Java中的断点,如System.Diagnostics.Debugger.Break()在C# >是的,我想要这样的东西,所以我在C天实现了一个非常简单的解决方案。如果你想要一个轻量级的答案,这可能是有用的。
public class DebugHelper
{
public static breakHere()
{
int i = 0; //在IDE中设置断点
}
}
使用这种方法。在你的代码中放置一个断点在int i = 0;线。并在调试代码中调用该方法。这是一个快速的答案,得到一些动态的调试和比一个变量的手表更快。
示例...
$($)
$($)
{
if(null == value) DebugHelper.breakHere();
}
}
当然在C中,您可以放置正确的ASM断点指令;-)对于我来说,这个工作对我来说很少见,我想要这样的东西。
Is there a method to signal a breakpoint in Java like System.Diagnostics.Debugger.Break() in C#?
yes I wanted something like this, so I implemented a pretty simple solution from my C days. This may be useful if you want a lightweight answer.
public class DebugHelper
{
public static breakHere()
{
int i = 0; // Set breakpoint on this line in your IDE
}
}
To use this method. Put a breakpoint in your code on the "int i = 0;" line. And call that method in the code you are debugging. It is a quick answer to getting some dynamic debugging and faster than a watch on a variable.
Example ...
private something(...)
{
for( ... )
{
if( null == value ) DebugHelper.breakHere();
}
}
Of course in C, you can put the right ASM breakpoint instruction ;-) This works fine for me on the rare occasions I want something like this.
这篇关于System.Diagnostics.Debugger.Break()喜欢使用java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!