Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/debugtools/DDR_VM/testsrc/PrintBlob.java
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2010, 2018 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
import java.io.File;
24
import java.nio.ByteOrder;
25
import java.util.ArrayList;
26
import java.util.Collections;
27
import java.util.Comparator;
28
import java.util.List;
29
30
import javax.imageio.stream.FileImageInputStream;
31
import javax.imageio.stream.ImageInputStream;
32
33
import com.ibm.j9ddr.StructureReader;
34
import com.ibm.j9ddr.StructureReader.StructureDescriptor;
35
36
/**
37
* @author andhall
38
*
39
*/
40
public class PrintBlob
41
{
42
43
/**
44
* @param args
45
*/
46
public static void main(String[] args) throws Exception
47
{
48
if (args.length != 1) {
49
System.err.println("Expected 1 argument. Got " + args.length);
50
System.exit(1);
51
}
52
53
File blobFile = new File(args[0]);
54
55
ImageInputStream iis = new FileImageInputStream(blobFile);
56
iis.setByteOrder(ByteOrder.LITTLE_ENDIAN);
57
58
StructureReader structReader = new StructureReader(iis);
59
60
List<StructureDescriptor> structures = new ArrayList<StructureDescriptor>(structReader.getStructures());
61
62
Collections.sort(structures, new Comparator<StructureDescriptor>(){
63
64
public int compare(StructureDescriptor o1, StructureDescriptor o2)
65
{
66
return o1.getName().compareTo(o2.getName());
67
}});
68
69
for (StructureDescriptor thisStruct : structures)
70
{
71
String superClass = thisStruct.getSuperName();
72
if (superClass != null && superClass.length() > 0) {
73
System.out.println("Structure: " + thisStruct.getName() + " extends " + superClass);
74
} else {
75
System.out.println("Structure: " + thisStruct.getName());
76
}
77
78
79
// List<FieldDescriptor> fields = new ArrayList<FieldDescriptor>(thisStruct.getFields());
80
//
81
// Collections.sort(fields, new Comparator<FieldDescriptor>(){
82
//
83
// public int compare(FieldDescriptor o1, FieldDescriptor o2)
84
// {
85
// return o1.getName().compareTo(o2.getName());
86
// }});
87
//
88
// System.out.println("\tFields");
89
//
90
// for (FieldDescriptor thisField : fields) {
91
// System.out.println("\t\t" + thisField.getName() + " - " + thisField.getType());
92
// }
93
//
94
// List<ConstantDescriptor> constants = new ArrayList<ConstantDescriptor>(thisStruct.getConstants());
95
//
96
// Collections.sort(constants, new Comparator<ConstantDescriptor>(){
97
//
98
// public int compare(ConstantDescriptor o1, ConstantDescriptor o2)
99
// {
100
// return o1.getName().compareTo(o2.getName());
101
// }});
102
//
103
// System.out.println("\tConstants:");
104
// for (ConstantDescriptor thisConstant : constants) {
105
// System.out.println("\t\t" + thisConstant.getName());
106
// }
107
}
108
}
109
110
}
111
112