Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/serviceability/sa/ClhsdbPmap.java
41149 views
1
/*
2
* Copyright (c) 2017, 2021, 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
*/
23
24
import java.util.HashMap;
25
import java.util.List;
26
import java.util.Map;
27
28
import jdk.test.lib.apps.LingeredApp;
29
import jdk.test.lib.util.CoreUtils;
30
import jdk.test.lib.Platform;
31
import jtreg.SkippedException;
32
33
/**
34
* @test
35
* @bug 8190198
36
* @summary Test clhsdb pmap command on a live process
37
* @requires vm.hasSA
38
* @library /test/lib
39
* @run main/othervm ClhsdbPmap false
40
*/
41
42
/**
43
* @test
44
* @bug 8190198
45
* @summary Test clhsdb pmap command on a core file
46
* @requires vm.hasSA
47
* @library /test/lib
48
* @run main/othervm/timeout=480 ClhsdbPmap true
49
*/
50
51
public class ClhsdbPmap {
52
53
public static void main(String[] args) throws Exception {
54
boolean withCore = Boolean.parseBoolean(args[0]);
55
System.out.println("Starting ClhsdbPmap test: withCore==" + withCore);
56
57
LingeredApp theApp = null;
58
String coreFileName = null;
59
try {
60
ClhsdbLauncher test = new ClhsdbLauncher();
61
theApp = new LingeredApp();
62
theApp.setForceCrash(withCore);
63
LingeredApp.startApp(theApp);
64
System.out.println("Started LingeredApp with pid " + theApp.getPid());
65
66
if (withCore) {
67
String crashOutput = theApp.getOutput().getStdout();
68
coreFileName = CoreUtils.getCoreFileLocation(crashOutput, theApp.getPid());
69
}
70
71
List<String> cmds = List.of("pmap");
72
73
Map<String, List<String>> expStrMap = new HashMap<>();
74
if (!withCore && Platform.isOSX()) {
75
expStrMap.put("pmap", List.of("Not available for Mac OS X processes"));
76
} else {
77
expStrMap.put("pmap", List.of("jvm", "java", "jli", "jimage"));
78
}
79
80
if (withCore) {
81
test.runOnCore(coreFileName, cmds, expStrMap, null);
82
} else {
83
test.run(theApp.getPid(), cmds, expStrMap, null);
84
}
85
} catch (SkippedException se) {
86
throw se;
87
} catch (Exception ex) {
88
throw new RuntimeException("Test ERROR " + ex, ex);
89
} finally {
90
if (!withCore) {
91
LingeredApp.stopApp(theApp);
92
}
93
}
94
System.out.println("Test PASSED");
95
}
96
}
97
98