OpenJDK / jdk / jdk12
changeset 45379:5e07cb61bff2
6760477: Update SA to include stack traces in the heap dump
Summary: Update SA to include HPROF_TRACE and HPROF_FRAME records in the heap dump
Reviewed-by: dsamersoff
Contributed-by: sharath.ballal@oracle.com
author | sballal |
---|---|
date | Fri, 02 Jun 2017 12:31:28 +0530 |
parents | 190ee25b6bef |
children | ba9e1e3dedf1 |
files | jdk/test/sun/tools/jhsdb/HeapDumpTest.java |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/test/sun/tools/jhsdb/HeapDumpTest.java Thu Jun 01 12:44:01 2017 -0700 +++ b/jdk/test/sun/tools/jhsdb/HeapDumpTest.java Fri Jun 02 12:31:28 2017 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,7 @@ import jdk.testlibrary.ProcessTools; import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.Platform; +import jdk.test.lib.hprof.parser.HprofReader; public class HeapDumpTest { @@ -93,6 +94,17 @@ launch(expectedMessage, Arrays.asList(toolArgs)); } + public static void printStackTraces(String file) throws IOException { + try { + String output = HprofReader.getStack(file, 0); + if (!output.contains("LingeredAppWithExtendedChars.main")) { + throw new RuntimeException("'LingeredAppWithExtendedChars.main' missing from stdout/stderr"); + } + } catch (Exception ex) { + throw new RuntimeException("Test ERROR " + ex, ex); + } + } + public static void testHeapDump() throws IOException { File dump = new File("jhsdb.jmap.heap." + System.currentTimeMillis() + ".hprof"); @@ -106,6 +118,8 @@ assertTrue(dump.exists() && dump.isFile(), "Could not create dump file " + dump.getAbsolutePath()); + printStackTraces(dump.getAbsolutePath()); + dump.delete(); }