Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/TestParser.java @ 3962:cb315dc80374
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
Reviewed-by: kvn
author | never |
---|---|
date | Thu, 29 Sep 2011 09:53:56 -0700 |
parents | d6cd0d55d0b5 |
children |
rev | line source |
---|---|
0 | 1 /* |
2072
d6cd0d55d0b5
6987812: 2/3 SAJDI: "gHotSpotVMTypes was not initialized properly in the remote process"
dcubed
parents:
1552
diff
changeset
|
2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.debugger.win32.coff; | |
26 | |
27 public class TestParser { | |
28 public static void main(String[] args) { | |
29 if (args.length != 1) { | |
30 System.err.println("usage: java TestParser [file name]"); | |
31 System.err.println("File name may be an .exe, .dll or .obj"); | |
32 System.exit(1); | |
33 } | |
34 | |
35 try { | |
36 COFFFile file = COFFFileParser.getParser().parse(args[0]); | |
37 if (file.isImage()) { | |
38 System.out.println("PE Image detected."); | |
39 } else { | |
40 System.out.println("PE Image NOT detected, assuming object file."); | |
41 } | |
42 COFFHeader header = file.getHeader(); | |
43 int numSections = header.getNumberOfSections(); | |
44 System.out.println(numSections + " sections detected."); | |
2072
d6cd0d55d0b5
6987812: 2/3 SAJDI: "gHotSpotVMTypes was not initialized properly in the remote process"
dcubed
parents:
1552
diff
changeset
|
45 for (int i = 1; i <= numSections; i++) { |
d6cd0d55d0b5
6987812: 2/3 SAJDI: "gHotSpotVMTypes was not initialized properly in the remote process"
dcubed
parents:
1552
diff
changeset
|
46 SectionHeader secHeader = header.getSectionHeader(i); |
0 | 47 System.out.println(secHeader.getName()); |
48 } | |
49 | |
50 // FIXME: the DLL exports are not contained in the COFF symbol | |
51 // table. Instead, they are in the Export Table, one of the | |
52 // Optional Header Data Directories available from the Optional | |
53 // Header. Must implement that next. | |
54 | |
55 /* | |
56 int numSymbols = header.getNumberOfSymbols(); | |
57 System.out.println(numSymbols + " symbols detected."); | |
58 System.out.println("Symbol dump:"); | |
59 for (int i = 0; i < header.getNumberOfSymbols(); i++) { | |
60 COFFSymbol sym = header.getCOFFSymbol(i); | |
61 System.out.println(" " + sym.getName()); | |
62 } | |
63 */ | |
64 | |
65 // OK, let's give the exported symbols a shot | |
66 OptionalHeader optHdr = header.getOptionalHeader(); | |
67 OptionalHeaderDataDirectories ddirs = optHdr.getDataDirectories(); | |
68 ExportDirectoryTable exports = ddirs.getExportDirectoryTable(); | |
69 System.out.println("Export flags (should be 0): " + exports.getExportFlags()); | |
70 System.out.println("DLL name (from export directory table): " + | |
71 exports.getDLLName()); | |
72 int numSymbols = exports.getNumberOfNamePointers(); | |
73 System.out.println(numSymbols + " exported symbols detected:"); | |
74 for (int i = 0; i < numSymbols; i++) { | |
75 System.out.println(" " + exports.getExportName(i)); | |
76 } | |
77 } catch (Exception e) { | |
78 e.printStackTrace(); | |
79 } | |
80 } | |
81 } |