149 }
150 int compiledJavaFrames = (int) frames.stream().filter(f -> f.startsWith("J ")).count();
151
152 Matcher matcherDisasm = Pattern.compile("\\[Disassembly\\].*\\[/Disassembly\\]", Pattern.DOTALL).matcher(hsErr);
153 if (matcherDisasm.find()) {
154 // Real disassembly is present, no MachCode is expected.
155 return;
156 }
157
158 String preCodeBlobSectionHeader = "Stack slot to memory mapping:";
159 if (!hsErr.contains(preCodeBlobSectionHeader) &&
160 System.getProperty("os.arch").equals("aarch64") &&
161 System.getProperty("os.name").toLowerCase().startsWith("mac")) {
162 // JDK-8282607: hs_err can be truncated. If the section preceding
163 // code blob dumping is missing, exit successfully.
164 System.out.println("Could not find \"" + preCodeBlobSectionHeader + "\" in " + hsErrPath);
165 System.out.println("Looks like hs-err is truncated - exiting with success");
166 return;
167 }
168
169 Matcher matcher = Pattern.compile("\\[MachCode\\]\\s*\\[Verified Entry Point\\]\\s* # \\{method\\} \\{[^}]*\\} '([^']+)' '([^']+)' in '([^']+)'", Pattern.DOTALL).matcher(hsErr);
170 List<String> machCodeHeaders = matcher.results().map(mr -> String.format("'%s' '%s' in '%s'", mr.group(1), mr.group(2), mr.group(3))).collect(Collectors.toList());
171 int minExpectedMachCodeSections = Math.max(1, compiledJavaFrames);
172 if ((hsErr.contains("stop reattempt (retry printing native stack (no source info))") || hsErr.contains("reason: Step time limit reached"))) {
173 // In this case, the vm only prints the crashing frame.
174 minExpectedMachCodeSections = 1;
175 }
176 if (machCodeHeaders.size() < minExpectedMachCodeSections) {
177 Asserts.fail(machCodeHeaders.size() + " < " + minExpectedMachCodeSections);
178 }
179 }
180
181 /**
182 * Extracts the lines in {@code hsErr} below the line starting with
183 * "Native frame" or "Java frame" up to the next blank line
184 * and adds them to {@code frames}.
185 */
186 private static void extractFrames(String hsErr, Set<String> frames, boolean nativeStack) {
187 String marker = (nativeStack ? "Native" : "Java") + " frame";
188
189 boolean seenMarker = false;
|
149 }
150 int compiledJavaFrames = (int) frames.stream().filter(f -> f.startsWith("J ")).count();
151
152 Matcher matcherDisasm = Pattern.compile("\\[Disassembly\\].*\\[/Disassembly\\]", Pattern.DOTALL).matcher(hsErr);
153 if (matcherDisasm.find()) {
154 // Real disassembly is present, no MachCode is expected.
155 return;
156 }
157
158 String preCodeBlobSectionHeader = "Stack slot to memory mapping:";
159 if (!hsErr.contains(preCodeBlobSectionHeader) &&
160 System.getProperty("os.arch").equals("aarch64") &&
161 System.getProperty("os.name").toLowerCase().startsWith("mac")) {
162 // JDK-8282607: hs_err can be truncated. If the section preceding
163 // code blob dumping is missing, exit successfully.
164 System.out.println("Could not find \"" + preCodeBlobSectionHeader + "\" in " + hsErrPath);
165 System.out.println("Looks like hs-err is truncated - exiting with success");
166 return;
167 }
168
169 Matcher matcher = Pattern.compile("\\[MachCode\\]\\s[^{]+\\{method\\} \\{[^}]*\\} '([^']+)' '([^']+)' in '([^']+)'", Pattern.DOTALL).matcher(hsErr);
170 List<String> machCodeHeaders = matcher.results().map(mr -> String.format("'%s' '%s' in '%s'", mr.group(1), mr.group(2), mr.group(3))).collect(Collectors.toList());
171 int minExpectedMachCodeSections = Math.max(1, compiledJavaFrames);
172 if ((hsErr.contains("stop reattempt (retry printing native stack (no source info))") || hsErr.contains("reason: Step time limit reached"))) {
173 // In this case, the vm only prints the crashing frame.
174 minExpectedMachCodeSections = 1;
175 }
176 if (machCodeHeaders.size() < minExpectedMachCodeSections) {
177 Asserts.fail(machCodeHeaders.size() + " < " + minExpectedMachCodeSections);
178 }
179 }
180
181 /**
182 * Extracts the lines in {@code hsErr} below the line starting with
183 * "Native frame" or "Java frame" up to the next blank line
184 * and adds them to {@code frames}.
185 */
186 private static void extractFrames(String hsErr, Set<String> frames, boolean nativeStack) {
187 String marker = (nativeStack ? "Native" : "Java") + " frame";
188
189 boolean seenMarker = false;
|