System.Diagnostics.Debugger.Break()喜欢使用java? [英] System.Diagnostics.Debugger.Break() like using java?

查看:85
本文介绍了System.Diagnostics.Debugger.Break()喜欢使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆