1 /*
2 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
53 }
54 });
55 }
56
57 private static void initialize(TypeDataBase db) {
58 // FileMapInfo
59 Type type = db.lookupType("FileMapInfo");
60 AddressField currentInfoField = type.getAddressField("_current_info");
61 long headerFieldOffset = type.getField("_header").getOffset();
62 Address headerAddress = currentInfoField.getValue().addOffsetTo(headerFieldOffset);
63 headerValue = headerAddress.getAddressAt(0);
64
65 // FileMapHeader
66 type = db.lookupType("FileMapHeader");
67 AddressField spaceField = type.getAddressField("_space[0]");
68 Address spaceValue = headerValue.addOffsetTo(type.getField("_space[0]").getOffset());
69 mdSpaceValue = spaceValue.addOffsetTo(3 * spaceField.getSize());
70
71 // SpaceInfo
72 type = db.lookupType("CDSFileMapRegion");
73 long mdRegionBaseAddressOffset = type.getField("_addr._base").getOffset();
74 mdRegionBaseAddress = (mdSpaceValue.addOffsetTo(mdRegionBaseAddressOffset)).getAddressAt(0);
75 long mdRegionSizeOffset = type.getField("_used").getOffset();
76 long mdRegionSize = (mdSpaceValue.addOffsetTo(mdRegionSizeOffset)).getAddressAt(0).asLongValue();
77 mdRegionEndAddress = mdRegionBaseAddress.addOffsetTo(mdRegionSize);
78
79 populateMetadataTypeArray(db);
80 }
81
82 private static void populateMetadataTypeArray(TypeDataBase db) {
83 metadataTypeArray = new Type[8];
84
85 metadataTypeArray[0] = db.lookupType("ConstantPool");
86 metadataTypeArray[1] = db.lookupType("InstanceKlass");
87 metadataTypeArray[2] = db.lookupType("InstanceClassLoaderKlass");
88 metadataTypeArray[3] = db.lookupType("InstanceMirrorKlass");
89 metadataTypeArray[4] = db.lookupType("InstanceRefKlass");
90 metadataTypeArray[5] = db.lookupType("Method");
91 metadataTypeArray[6] = db.lookupType("ObjArrayKlass");
92 metadataTypeArray[7] = db.lookupType("TypeArrayKlass");
93 }
|
1 /*
2 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
53 }
54 });
55 }
56
57 private static void initialize(TypeDataBase db) {
58 // FileMapInfo
59 Type type = db.lookupType("FileMapInfo");
60 AddressField currentInfoField = type.getAddressField("_current_info");
61 long headerFieldOffset = type.getField("_header").getOffset();
62 Address headerAddress = currentInfoField.getValue().addOffsetTo(headerFieldOffset);
63 headerValue = headerAddress.getAddressAt(0);
64
65 // FileMapHeader
66 type = db.lookupType("FileMapHeader");
67 AddressField spaceField = type.getAddressField("_space[0]");
68 Address spaceValue = headerValue.addOffsetTo(type.getField("_space[0]").getOffset());
69 mdSpaceValue = spaceValue.addOffsetTo(3 * spaceField.getSize());
70
71 // SpaceInfo
72 type = db.lookupType("CDSFileMapRegion");
73 long mdRegionBaseAddressOffset = type.getField("_mapped_base").getOffset();
74 mdRegionBaseAddress = (mdSpaceValue.addOffsetTo(mdRegionBaseAddressOffset)).getAddressAt(0);
75 long mdRegionSizeOffset = type.getField("_used").getOffset();
76 long mdRegionSize = (mdSpaceValue.addOffsetTo(mdRegionSizeOffset)).getAddressAt(0).asLongValue();
77 mdRegionEndAddress = mdRegionBaseAddress.addOffsetTo(mdRegionSize);
78
79 populateMetadataTypeArray(db);
80 }
81
82 private static void populateMetadataTypeArray(TypeDataBase db) {
83 metadataTypeArray = new Type[8];
84
85 metadataTypeArray[0] = db.lookupType("ConstantPool");
86 metadataTypeArray[1] = db.lookupType("InstanceKlass");
87 metadataTypeArray[2] = db.lookupType("InstanceClassLoaderKlass");
88 metadataTypeArray[3] = db.lookupType("InstanceMirrorKlass");
89 metadataTypeArray[4] = db.lookupType("InstanceRefKlass");
90 metadataTypeArray[5] = db.lookupType("Method");
91 metadataTypeArray[6] = db.lookupType("ObjArrayKlass");
92 metadataTypeArray[7] = db.lookupType("TypeArrayKlass");
93 }
|