如何在 gdb 中打印 Java 数组?
我使用 gcj-4.4 和 -o 选项编译了一个非常简单的 java 程序。我将它加载到 gdb-7.2 中并尝试进行一些调试。我注意到我可以打印 int 类型的变量,但无法打印 int 数组。我收到此错误消息:
(gdb) p orderFinish[0]
cannot find java.lang.Object
(gdb) p (int)orderFinish
$8 = -136261440
(gdb) p orderFinish[3]
cannot find java.lang.Object
(gdb) p in
$9 = 1
(gdb) whatis orderFinish
type = int[]
所以我的问题是如何在 gdb 中打印 Java 数组?我的操作系统是 openSUSE-11.1 x64-86 位。谢谢!
I compiled a very simple java program with gcj-4.4 and -o option. I loaded it in gdb-7.2 and tried to do some debugging. I noticed at I could print the variables in int type but I could not print an array of int. I received this error message:
(gdb) p orderFinish[0]
cannot find java.lang.Object
(gdb) p (int)orderFinish
$8 = -136261440
(gdb) p orderFinish[3]
cannot find java.lang.Object
(gdb) p in
$9 = 1
(gdb) whatis orderFinish
type = int[]
So my question is how can I print a Java array in gdb? My OS is openSUSE-11.1 x64-86bit. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
p *array-variable@length 应该可以工作。
来源:http://www.yolinux.com/TUTORIALS/GDB-Commands.html< /a>
p *array-variable@length should work.
Source: http://www.yolinux.com/TUTORIALS/GDB-Commands.html