如何让Netbeans默认为Hex显示以获取监视变量?

时间:2021-09-02 22:40:43

In Netbeans 6.5 I am debugging a network stream and need to view the memory in Hex. The only way I have found to do this is to right click on each row and select display as Hex. This is very inefficient and I would like either a memory dump or default to hex. Is there a way to do this?

在Netbeans 6.5中,我正在调试网络流,需要以十六进制查看内存。我发现这样做的唯一方法是右键单击每一行并选择显示为十六进制。这是非常低效的,我想要一个内存转储或默认为十六进制。有没有办法做到这一点?

3 个解决方案

#1


  • Looks like the context option you're using now is it. See the bottom of this netbeans.org page.
  • 看起来你现在正在使用的上下文选项就是它。请参阅此netbeans.org页面的底部。

  • Questions on the Netbeans forums relating to a global hex display option in the debugger remain unanswered (for example).
  • Netbeans论坛上与调试器中的全局十六进制显示选项相关的问题仍未得到答复(例如)。

  • You might try out a hex editor plugin.
  • 您可以尝试使用十六进制编辑器插件。

#2


It's not particularly about individual bytes, but I keep a special watch in my watch expression list for when I need to see what a byte array holds:

它并不是特别关注单个字节,但是我在监视表达式列表中保留了一个特殊的监视,以便在需要查看字节数组时:

new java.math.BigInteger(1, myByteArray).toString(16)

When I need it, I simply change the byte array name to whatever local variable I want to check. This hex representation matches what I see in my hex editor, which is what I need.

当我需要它时,我只需将字节数组名称更改为我想要检查的任何局部变量。这个十六进制表示符合我在十六进制编辑器中看到的内容,这就是我需要的内容。

#3


  1. Go to Tools -> Options -> Java Debugger -> Variable Formatters.
  2. 转到工具 - >选项 - > Java调试器 - >变量格式化程序。

  3. Click the “Add...” button.
  4. 单击“添加...”按钮。

  5. In the “Add Variable Formatter” dialog enter:
  6. 在“添加变量格式化程序”对话框中输入:


  • Formatter name: “MyHexByte”. Class types: “java.lang.Byte”.
  • 格式化名称:“MyHexByte”。类类型:“java.lang.Byte”。

  • Value formatted as a result of code snipped:

    由于代码剪切而格式化的值:

    "0x" + java.lang.Integer.toHexString(byteValue() & 0xFF)

    “0x”+ java.lang.Integer.toHexString(byteValue()&0xFF)

  • Click “OK”.


  1. Click the “Apply “button in the Java Debugger dialog.
  2. 单击Java Debugger对话框中的“Apply”按钮。

#1


  • Looks like the context option you're using now is it. See the bottom of this netbeans.org page.
  • 看起来你现在正在使用的上下文选项就是它。请参阅此netbeans.org页面的底部。

  • Questions on the Netbeans forums relating to a global hex display option in the debugger remain unanswered (for example).
  • Netbeans论坛上与调试器中的全局十六进制显示选项相关的问题仍未得到答复(例如)。

  • You might try out a hex editor plugin.
  • 您可以尝试使用十六进制编辑器插件。

#2


It's not particularly about individual bytes, but I keep a special watch in my watch expression list for when I need to see what a byte array holds:

它并不是特别关注单个字节,但是我在监视表达式列表中保留了一个特殊的监视,以便在需要查看字节数组时:

new java.math.BigInteger(1, myByteArray).toString(16)

When I need it, I simply change the byte array name to whatever local variable I want to check. This hex representation matches what I see in my hex editor, which is what I need.

当我需要它时,我只需将字节数组名称更改为我想要检查的任何局部变量。这个十六进制表示符合我在十六进制编辑器中看到的内容,这就是我需要的内容。

#3


  1. Go to Tools -> Options -> Java Debugger -> Variable Formatters.
  2. 转到工具 - >选项 - > Java调试器 - >变量格式化程序。

  3. Click the “Add...” button.
  4. 单击“添加...”按钮。

  5. In the “Add Variable Formatter” dialog enter:
  6. 在“添加变量格式化程序”对话框中输入:


  • Formatter name: “MyHexByte”. Class types: “java.lang.Byte”.
  • 格式化名称:“MyHexByte”。类类型:“java.lang.Byte”。

  • Value formatted as a result of code snipped:

    由于代码剪切而格式化的值:

    "0x" + java.lang.Integer.toHexString(byteValue() & 0xFF)

    “0x”+ java.lang.Integer.toHexString(byteValue()&0xFF)

  • Click “OK”.


  1. Click the “Apply “button in the Java Debugger dialog.
  2. 单击Java Debugger对话框中的“Apply”按钮。