Compiling .class files & stabs

Paul Flinders paul@dawa.demon.co.uk
Wed Feb 7 04:39:00 GMT 2001


Andrew Haley wrote:
> Paul Flinders writes:
> > I notice that stabs are not generated for local variables or arguments
> > when compiling from .class files (i.e no PSYM, LBRAC or RBRAC
> > stabs are generated), even if -g2 or -g3 is specified
>> Are you sure that you compiled the .class file and the .java file with
> -g?
>> Andrew.

I don't have the .java file but I'm trying to build an application which uses
Sun's jdmk. My aim in doing this is to have a decent debugging environment.
I would have though that stabs for local variables should be possible, and
I'd find them useful (especially as the app doesn't work when compiled
with gcj at the moment).
I can take a .class file and compile it with -g and I only get line numbers and
the function types - I don't get any stabs for variables. I can take the same class,
decompile it with jad and get all of the debug info that I expect but jad doesn't
always produce code that compiles cleanly so I'd rather not use it as an
intermediary as I don't really trust it 100%.
Here's the evidence
$ CLASSPATH=../.. gcj -g -v -c ReflectionException.class
Reading specs from /opt/gcc-snap/lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Reading specs from /opt/gcc-snap/lib/gcc-lib/i686-pc-linux-gnu/2.97/../../../libgcj.spec
rename spec lib to liborig
rename spec startfile to startfileorig
Configured with: ../gcc/configure --prefix=/opt/gcc-snap --enable-languages=c,c++,java
gcc version 2.97 20010206 (experimental)
 /opt/gcc-snap/lib/gcc-lib/i686-pc-linux-gnu/2.97/jc1 ReflectionException.class -fno-use-divide-subroutine -fuse-boehm-gc -fasynchronous-exceptions -quiet -dumpbase ReflectionException.class -g -version -o /tmp/cctobt57.s
GNU Java version 2.97 20010206 (experimental) (i686-pc-linux-gnu)
 compiled by GNU C version 2.97 20010206 (experimental).
 as -V -Qy -o ReflectionException.o /tmp/cctobt57.s
GNU assembler version 2.10.91 (i386-redhat-linux) using BFD version 2.10.1.0.2
$ objdump --stabs ReflectionException.o
ReflectionException.o: file format elf32-i386
Contents of .stab section:
Symnum n_type n_othr n_desc n_value n_strx String
-1 HdrSym 0 45 00000b94 1
0 SO 0 0 00000000 27 /home/paul/tmp/javax/management/
1 SO 0 0 00000000 60 ReflectionException.class
2 OPT 0 0 00000000 86 gcc2_compiled.
3 LSYM 0 0 00000000 101 int:t(0,1)=r(0,1);-2147483648;2147483647;
4 LSYM 0 0 00000000 143 char:t(0,2)=@s16;-20;
5 LSYM 0 0 00000000 165 byte:t(0,3)=@s8;r(0,3);-128;127;
6 LSYM 0 0 00000000 198 short:t(0,4)=@s16;r(0,4);-32768;32767;
7 LSYM 0 0 00000000 237 long:t(0,5)=@s64;r(0,5);01000000000000000000000;0777777777777777777777;
8 LSYM 0 0 00000000 309 unsigned byte:t(0,6)=@s8;r(0,6);0;255;
9 LSYM 0 0 00000000 348 unsigned short:t(0,7)=@s16;r(0,7);0;65535;
10 LSYM 0 0 00000000 391 unsigned int:t(0,8)=r(0,8);0000000000000;0037777777777;
11 LSYM 0 0 00000000 447 unsigned long:t(0,9)=@s64;r(0,9);0000000000000;01777777777777777777777;
12 LSYM 0 0 00000000 519 boolean:t(0,10)=@s8;-16;
13 LSYM 0 0 00000000 544 promoted_byte:t(0,11)=r(0,11);-2147483648;2147483647;
14 LSYM 0 0 00000000 598 promoted_short:t(0,12)=r(0,12);-2147483648;2147483647;
15 LSYM 0 0 00000000 653 promoted_char:t(0,13)=@s32;-20;
16 LSYM 0 0 00000000 685 promoted_boolean:t(0,14)=@s32;-16;
17 LSYM 0 0 00000000 720 float:t(0,15)=r(0,1);4;0;
18 LSYM 0 0 00000000 746 double:t(0,16)=r(0,1);8;0;
19 LSYM 0 0 00000000 773
java.lang.Object:T(0,17)=s8vtable:/0(0,18)=*(0,19)=s12class:(0,20)=*(0,21)=xsjava.lang.Class:,0,32;methods:(0,22)=ar(0,23)=r(0,23);0000000000000;0037777777777;;0;1;(0,24)=*(0,25)=(0,25),32,64;;,0,32;sync_info:/0(0,26)=*(0,17),32,32;;
20 LSYM 0 0 00000000 1007 java.lang.Object:Tt(0,17)
21 LSYM 0 0 00000000 1033
java.lang.Class:Tt(0,21)=s92!1,020,(0,17);next:/0(0,20),64,32;name:/0(0,27)=*(0,28)=s4hash:(0,7),0,16;length:(0,7),16,16;;,96,32;accflags:/0(0,7),128,16;superclass:/0(0,20),160,32;constants:/0(0,29)=s12size:(0,8),0,32;tags:(0,24),32,32;data:(0,24),64,32;;,192,96;methods:/0(0,30)=*(0,31)=s16name:(0,27),0,32;signature:(0,27),32,32;accflags:(0,7),64,16;ncode:(0,24),96,32;;,288,32;method_count:/0(0,4),320,16;vtable_method_count:/0(0,4),336,16;fields:/0(0,32)=*(0,33)=s16name:(0,27),0,32;type:(0,20),32,32;accflags:(0,7),64,16;bsize:(0,7),80,16;info:(0,34)=u4boffset:(0,1),0,32;addr:(0,24),0,32;;,96,32;;,352,32;size_in_bytes:/0(0,1),384,32;field_count:/0(0,4),416,16;static_field_count:/0(0,4),432,16;vtable:/0(0,18),448,32;interfaces:/0(0,35)=*(0,20),480,32;loader:/0(0,24),512,32;interface_count:/0(0,4),544,16;state:/0(0,3),560,8;thread:/0(0,24),576,32;depth:/0(0,4),608,16;ancestors:/0(0,24),640,32;idt:/0(0,24),672,32;arrayclass:/0(0,24),704,32;;
22 BINCL 0 0 00000000 1985 javax/management/ReflectionException.java
23 FUN 0 0 00000000 2027 _ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionE:F(0,25)
24 SOL 0 0 00000000 2104 javax/management/ReflectionException.java
25 SLINE 0 38 00000000 0
26 SLINE 0 39 00000006 0
27 SLINE 0 40 00000025 0
28 SLINE 0 38 0000002e 0
29 FUN 0 0 00000032 0
30 FUN 0 0 00000000 2146 _ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionEPNS3_6StringE:F(0,25)
31 SLINE 0 47 00000000 0
32 SLINE 0 48 00000006 0
33 SLINE 0 49 00000028 0
34 SLINE 0 47 00000031 0
35 FUN 0 0 00000035 0
36 FUN 0 0 00000000 2236 _ZN5javax10management19ReflectionException18getTargetExceptionEv:F(1,1)=*(1,2)=xsjava.lang.Exception:
37 SLINE 0 56 00000000 0
38 SLINE 0 56 00000003 0
39 FUN 0 0 0000000b 0
40 LSYM 0 0 00000000 2338
javax.management.ReflectionException:Tt(1,3)=s20!1,020,(1,4)=xsjavax.management.JMException:;exception:/0(1,1),128,32;<init>::(1,5)=#(1,3),(0,25),(1,6)=*(1,3),(1,1),(0,25);:_ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionE;2A.(1,7)=#(1,3),(0,25),(1,6),(1,1),(1,8)=*(1,9)=xsjava.lang.String:,(0,25);:_ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionEPNS3_6StringE;2A.;getTargetException::(1,10)=#(1,3),(1,1),(1,6),(0,25);:_ZN5javax10management19ReflectionException18getTargetExceptionEv;2A*11;(1,3);;;
41 EINCL 0 0 00000000 0
42 FUN 0 0 00000000 2876 _GLOBAL_.I._ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionE:F(0,25)
43 FUN 0 0 0000001a 0
44 SO 0 0 000000aa 0
$jad -sjava ReflectionException.class
Parsing ReflectionException.class... Generating ReflectionException.java
$ CLASSPATH=../.. gcj -g -v -c ReflectionException.java
Reading specs from /opt/gcc-snap/lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Reading specs from /opt/gcc-snap/lib/gcc-lib/i686-pc-linux-gnu/2.97/../../../libgcj.spec
rename spec lib to liborig
rename spec startfile to startfileorig
Configured with: ../gcc/configure --prefix=/opt/gcc-snap --enable-languages=c,c++,java
gcc version 2.97 20010206 (experimental)
 /opt/gcc-snap/lib/gcc-lib/i686-pc-linux-gnu/2.97/jc1 ReflectionException.java -fno-use-divide-subroutine -fuse-boehm-gc -fasynchronous-exceptions -quiet -dumpbase ReflectionException.java -g -version -o /tmp/ccVIDtek.s
GNU Java version 2.97 20010206 (experimental) (i686-pc-linux-gnu)
 compiled by GNU C version 2.97 20010206 (experimental).
 as -V -Qy -o ReflectionException.o /tmp/ccVIDtek.s
GNU assembler version 2.10.91 (i386-redhat-linux) using BFD version 2.10.1.0.2
$ objdump --stabs ReflectionException.o
ReflectionException.o: file format elf32-i386
Contents of .stab section:
Symnum n_type n_othr n_desc n_value n_strx String
-1 HdrSym 0 48 00000bd1 1
0 SO 0 0 00000000 26 /home/paul/tmp/javax/management/
1 SO 0 0 00000000 59 ReflectionException.java
2 OPT 0 0 00000000 84 gcc2_compiled.
3 LSYM 0 0 00000000 99 int:t(0,1)=r(0,1);-2147483648;2147483647;
4 LSYM 0 0 00000000 141 char:t(0,2)=@s16;-20;
5 LSYM 0 0 00000000 163 byte:t(0,3)=@s8;r(0,3);-128;127;
6 LSYM 0 0 00000000 196 short:t(0,4)=@s16;r(0,4);-32768;32767;
7 LSYM 0 0 00000000 235 long:t(0,5)=@s64;r(0,5);01000000000000000000000;0777777777777777777777;
8 LSYM 0 0 00000000 307 unsigned byte:t(0,6)=@s8;r(0,6);0;255;
9 LSYM 0 0 00000000 346 unsigned short:t(0,7)=@s16;r(0,7);0;65535;
10 LSYM 0 0 00000000 389 unsigned int:t(0,8)=r(0,8);0000000000000;0037777777777;
11 LSYM 0 0 00000000 445 unsigned long:t(0,9)=@s64;r(0,9);0000000000000;01777777777777777777777;
12 LSYM 0 0 00000000 517 boolean:t(0,10)=@s8;-16;
13 LSYM 0 0 00000000 542 promoted_byte:t(0,11)=r(0,11);-2147483648;2147483647;
14 LSYM 0 0 00000000 596 promoted_short:t(0,12)=r(0,12);-2147483648;2147483647;
15 LSYM 0 0 00000000 651 promoted_char:t(0,13)=@s32;-20;
16 LSYM 0 0 00000000 683 promoted_boolean:t(0,14)=@s32;-16;
17 LSYM 0 0 00000000 718 float:t(0,15)=r(0,1);4;0;
18 LSYM 0 0 00000000 744 double:t(0,16)=r(0,1);8;0;
19 LSYM 0 0 00000000 771
java.lang.Object:T(0,17)=s8vtable:/0(0,18)=*(0,19)=s12class:(0,20)=*(0,21)=xsjava.lang.Class:,0,32;methods:(0,22)=ar(0,23)=r(0,23);0000000000000;0037777777777;;0;1;(0,24)=*(0,25)=(0,25),32,64;;,0,32;sync_info:/0(0,26)=*(0,17),32,32;;
20 LSYM 0 0 00000000 1005 java.lang.Object:Tt(0,17)
21 LSYM 0 0 00000000 1031
java.lang.Class:Tt(0,21)=s92!1,020,(0,17);next:/0(0,20),64,32;name:/0(0,27)=*(0,28)=s4hash:(0,7),0,16;length:(0,7),16,16;;,96,32;accflags:/0(0,7),128,16;superclass:/0(0,20),160,32;constants:/0(0,29)=s12size:(0,8),0,32;tags:(0,24),32,32;data:(0,24),64,32;;,192,96;methods:/0(0,30)=*(0,31)=s16name:(0,27),0,32;signature:(0,27),32,32;accflags:(0,7),64,16;ncode:(0,24),96,32;;,288,32;method_count:/0(0,4),320,16;vtable_method_count:/0(0,4),336,16;fields:/0(0,32)=*(0,33)=s16name:(0,27),0,32;type:(0,20),32,32;accflags:(0,7),64,16;bsize:(0,7),80,16;info:(0,34)=u4boffset:(0,1),0,32;addr:(0,24),0,32;;,96,32;;,352,32;size_in_bytes:/0(0,1),384,32;field_count:/0(0,4),416,16;static_field_count:/0(0,4),432,16;vtable:/0(0,18),448,32;interfaces:/0(0,35)=*(0,20),480,32;loader:/0(0,24),512,32;interface_count:/0(0,4),544,16;state:/0(0,3),560,8;thread:/0(0,24),576,32;depth:/0(0,4),608,16;ancestors:/0(0,24),640,32;idt:/0(0,24),672,32;arrayclass:/0(0,24),704,32;;
22 FUN 0 16 00000000 1983 _ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionE:F(0,25)
23 PSYM 0 16 00000008 2060 this:p(0,36)=*(0,37)=xsjavax.management.ReflectionException:
24 PSYM 0 16 0000000c 2121 exception1:p(0,38)=*(0,39)=xsjava.lang.Exception:
25 SLINE 0 16 00000000 0
26 SLINE 0 17 00000014 0
27 SLINE 0 18 0000001d 0
28 FUN 0 0 00000021 0
29 FUN 0 21 00000000 2171 _ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionEPNS3_6StringE:F(0,25)
30 PSYM 0 21 00000008 2261 this:p(0,36)
31 PSYM 0 21 0000000c 2274 exception1:p(0,38)
32 PSYM 0 21 00000010 2293 s:p(0,40)=*(0,41)=xsjava.lang.String:
33 SLINE 0 21 00000000 0
34 SLINE 0 22 00000006 0
35 SLINE 0 23 00000017 0
36 SLINE 0 24 00000020 0
37 FUN 0 0 00000024 0
38 FUN 0 27 00000000 2331 _ZN5javax10management19ReflectionException18getTargetExceptionEv:F(0,38)
39 PSYM 0 27 00000008 2404 this:p(0,36)
40 SLINE 0 27 00000000 0
41 SLINE 0 28 00000003 0
42 SLINE 0 29 00000009 0
43 FUN 0 0 0000000b 0
44 LSYM 0 12 00000000 2417
javax.management.ReflectionException:Tt(0,37)=s20!1,020,(0,42)=xsjavax.management.JMException:;exception:/0(0,38),128,32;<init>::(0,43)=#(0,37),(0,25),(0,36),(0,38),(0,25);:_ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionE;2A.(0,44)=#(0,37),(0,25),(0,36),(0,38),(0,40),(0,25);:_ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionEPNS3_6StringE;2A.;getTargetException::(0,45)=#(0,37),(0,38),(0,36),(0,25);:_ZN5javax10management19ReflectionException18getTargetExceptionEv;2A*11;(0,37);;;
45 FUN 0 27 00000000 2937 _GLOBAL_.I._ZN5javax10management19ReflectionExceptionC1EPN4java4lang9ExceptionE:F(0,25)
46 FUN 0 0 0000001a 0
47 SO 0 0 0000008a 0


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /