From: Godmar Back (gback@cs.utah.edu)
Date: Thu Feb 11 1999 - 18:21:55 EST
I asked Pat to provide some of the perl5 scripts he's written for our
collection of developer tools.
One of them is dumpClass.pl, and here's an example of how it works:
./dumpClass.pl ~/kaffe/test/regression/SoTimeout.class
shows:
public
Constant Pool Entries: 96
1] Class: .name @ 39 (java/net/ServerSocket);
2] Integer: .value = 45054
3] Method: .class @ 1; .name&type @ 40;
4] Class: .name @ 41 (SoTimeout$1$$anonymous_class0);
5] String: .string @ 44 (foo);
6] Method: .class @ 4; .name&type @ 45;
7] Method: .class @ 1; .name&type @ 46;
8] Method: .class @ 1; .name&type @ 47;
9] Class: .name @ 48 (java/io/InterruptedIOException);
10] Field: .class @ 49; .name&type @ 50;
11] String: .string @ 51 (Success 1.);
12] Method: .class @ 52; .name&type @ 53;
13] Method: .class @ 54; .name&type @ 55;
14] String: .string @ 56 (Success 2.);
15] Method: .class @ 57; .name&type @ 58;
16] Method: .class @ 57; .name&type @ 59;
17] Class: .name @ 60 (java/io/LineNumberReader);
18] Class: .name @ 61 (java/io/InputStreamReader);
19] Method: .class @ 18; .name&type @ 62;
20] Method: .class @ 17; .name&type @ 63;
21] Method: .class @ 17; .name&type @ 64;
22] String: .string @ 65 (Success 3.);
23] Method: .class @ 66; .name&type @ 67;
24] String: .string @ 68 (Success 4.);
25] Method: .class @ 27; .name&type @ 69;
26] Class: .name @ 70 (SoTimeout);
27] Class: .name @ 71 (java/lang/Object);
28] Utf8: .length=4; .val=main;
29] Utf8: .length=22; .val=([Ljava/lang/String;)V;
30] Utf8: .length=4; .val=Code;
31] Utf8: .length=15; .val=LineNumberTable;
32] Utf8: .length=10; .val=Exceptions;
33] Class: .name @ 72 (java/lang/Exception);
34] Utf8: .length=6; .val=<init>;
35] Utf8: .length=3; .val=()V;
36] Utf8: .length=10; .val=SourceFile;
37] Utf8: .length=14; .val=SoTimeout.java;
38] Utf8: .length=9; .val=Synthetic;
39] Utf8: .length=21; .val=java/net/ServerSocket;
40] Name&Type: .name @ 34 (<init>); .descriptor @ 73 ((I)V);
41] Utf8: .length=29; .val=SoTimeout$1$$anonymous_class0;
42] Utf8: .length=12; .val=InnerClasses;
43] Utf8: .length=17; .val=$anonymous_class0;
44] Utf8: .length=3; .val=foo;
45] Name&Type: .name @ 34 (<init>); .descriptor @ 74 ((ILjava/lang/String;)V);
46] Name&Type: .name @ 75 (setSoTimeout); .descriptor @ 73 ((I)V);
47] Name&Type: .name @ 76 (accept); .descriptor @ 77 (()Ljava/net/Socket;);
48] Utf8: .length=30; .val=java/io/InterruptedIOException;
49] Class: .name @ 78 (java/lang/System);
50] Name&Type: .name @ 79 (out); .descriptor @ 80 (Ljava/io/PrintStream;);
51] Utf8: .length=10; .val=Success 1.;
52] Class: .name @ 81 (java/io/PrintStream);
53] Name&Type: .name @ 82 (println); .descriptor @ 83 ((Ljava/lang/String;)V);
54] Class: .name @ 84 (java/lang/Thread);
55] Name&Type: .name @ 85 (start); .descriptor @ 35 (()V);
56] Utf8: .length=10; .val=Success 2.;
57] Class: .name @ 86 (java/net/Socket);
58] Name&Type: .name @ 75 (setSoTimeout); .descriptor @ 73 ((I)V);
59] Name&Type: .name @ 87 (getInputStream); .descriptor @ 88 (()Ljava/io/InputStream;);
60] Utf8: .length=24; .val=java/io/LineNumberReader;
61] Utf8: .length=25; .val=java/io/InputStreamReader;
62] Name&Type: .name @ 34 (<init>); .descriptor @ 89 ((Ljava/io/InputStream;)V);
63] Name&Type: .name @ 34 (<init>); .descriptor @ 90 ((Ljava/io/Reader;)V);
64] Name&Type: .name @ 91 (readLine); .descriptor @ 92 (()Ljava/lang/String;);
65] Utf8: .length=10; .val=Success 3.;
66] Class: .name @ 93 (java/lang/String);
67] Name&Type: .name @ 94 (equals); .descriptor @ 95 ((Ljava/lang/Object;)Z);
68] Utf8: .length=10; .val=Success 4.;
69] Name&Type: .name @ 34 (<init>); .descriptor @ 35 (()V);
70] Utf8: .length=9; .val=SoTimeout;
71] Utf8: .length=16; .val=java/lang/Object;
72] Utf8: .length=19; .val=java/lang/Exception;
73] Utf8: .length=4; .val=(I)V;
74] Utf8: .length=22; .val=(ILjava/lang/String;)V;
75] Utf8: .length=12; .val=setSoTimeout;
76] Utf8: .length=6; .val=accept;
77] Utf8: .length=19; .val=()Ljava/net/Socket;;
78] Utf8: .length=16; .val=java/lang/System;
79] Utf8: .length=3; .val=out;
80] Utf8: .length=21; .val=Ljava/io/PrintStream;;
81] Utf8: .length=19; .val=java/io/PrintStream;
82] Utf8: .length=7; .val=println;
83] Utf8: .length=21; .val=(Ljava/lang/String;)V;
84] Utf8: .length=16; .val=java/lang/Thread;
85] Utf8: .length=5; .val=start;
86] Utf8: .length=15; .val=java/net/Socket;
87] Utf8: .length=14; .val=getInputStream;
88] Utf8: .length=23; .val=()Ljava/io/InputStream;;
89] Utf8: .length=24; .val=(Ljava/io/InputStream;)V;
90] Utf8: .length=19; .val=(Ljava/io/Reader;)V;
91] Utf8: .length=8; .val=readLine;
92] Utf8: .length=20; .val=()Ljava/lang/String;;
93] Utf8: .length=16; .val=java/lang/String;
94] Utf8: .length=6; .val=equals;
95] Utf8: .length=21; .val=(Ljava/lang/Object;)Z;
this_class @ 26 (SoTimeout)
super_class @ 27 (java/lang/Object)
No interfaces.
No fields.
Methods:
public,static main ([Ljava/lang/String;)V
public <init> ()V
Attributes:
.name=SourceFile; .length=2; @ 37 ("SoTimeout.java")
.name=Synthetic; .length=0;
.name=InnerClasses; .length=10;
There's also utf8munge to change utf8constants in the constant pool.
Enjoy,
- Godmar
This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:58:06 EDT