Question

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!

Was it helpful?

Solution

Its been a while since I used GDB but p *array-variable@length should work.

Source: http://www.yolinux.com/TUTORIALS/GDB-Commands.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top