-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 581644 - Allow stack frames as pseudo-objects for HPROF snapshots
Initial code drop, including common name resolver for DTFJ and HPROF stack frames. Change-Id: I6ba5ddaafed610b7501856bc24dfd21e787e137c
- Loading branch information
Showing
22 changed files
with
825 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
plugins/org.eclipse.mat.api/src/org/eclipse/mat/inspections/threads/StackFrameResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 IBM Corporation. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Andrew Johnson - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.mat.inspections.threads; | ||
|
||
import org.eclipse.mat.SnapshotException; | ||
import org.eclipse.mat.internal.Messages; | ||
import org.eclipse.mat.snapshot.extension.IClassSpecificNameResolver; | ||
import org.eclipse.mat.snapshot.extension.Subjects; | ||
import org.eclipse.mat.snapshot.model.IObject; | ||
import org.eclipse.mat.util.MessageUtil; | ||
|
||
@Subjects({"<method>", "<stack frame>"}) | ||
public class StackFrameResolver implements IClassSpecificNameResolver | ||
{ | ||
|
||
public StackFrameResolver() | ||
{} | ||
|
||
public String resolve(IObject object) throws SnapshotException | ||
{ | ||
String methodName = (String) object.resolveValue("methodName"); | ||
String fileName = (String) object.resolveValue("fileName"); | ||
if (fileName == null) | ||
fileName = (String) object.getClazz().resolveValue("fileName"); | ||
Integer lineNumber = (Integer) object.resolveValue("lineNumber"); | ||
Integer compLevel = (Integer) object.resolveValue("compilationLevel"); | ||
Boolean nativ = (Boolean) object.resolveValue("native"); | ||
String ret; | ||
if (fileName != null && lineNumber != null && lineNumber > 0) | ||
{ | ||
if (methodName == null) | ||
if (Boolean.TRUE.equals(nativ)) | ||
ret = MessageUtil.format(Messages.StackFrameResolver_file_line_native, fileName, lineNumber); | ||
else if (compLevel != null && compLevel > 0) | ||
ret = MessageUtil.format(Messages.StackFrameResolver_file_line_compiled, fileName, lineNumber); | ||
else | ||
ret = MessageUtil.format(Messages.StackFrameResolver_file_line, fileName, lineNumber); | ||
else | ||
if (Boolean.TRUE.equals(nativ)) | ||
ret = MessageUtil.format(Messages.StackFrameResolver_method_file_line_native, methodName, fileName, lineNumber); | ||
else if (compLevel != null && compLevel > 0) | ||
ret = MessageUtil.format(Messages.StackFrameResolver_method_file_line_compiled, methodName, fileName, lineNumber); | ||
else | ||
ret = MessageUtil.format(Messages.StackFrameResolver_method_file_line, methodName, fileName, lineNumber); | ||
} | ||
else if (fileName != null) { | ||
if (methodName == null) | ||
if (Boolean.TRUE.equals(nativ)) | ||
ret = MessageUtil.format(Messages.StackFrameResolver_file_native, fileName); | ||
else if (compLevel != null && compLevel > 0) | ||
ret = MessageUtil.format(Messages.StackFrameResolver_file_compiled, fileName); | ||
else | ||
ret = MessageUtil.format(Messages.StackFrameResolver_file, fileName); | ||
else | ||
if (Boolean.TRUE.equals(nativ)) | ||
ret = MessageUtil.format(Messages.StackFrameResolver_method_file_native, methodName, fileName); | ||
else if (compLevel != null && compLevel > 0) | ||
ret = MessageUtil.format(Messages.StackFrameResolver_method_file_compiled, methodName, fileName); | ||
else | ||
ret = MessageUtil.format(Messages.StackFrameResolver_method_file, methodName, fileName); | ||
} else if (methodName != null) { | ||
ret = MessageUtil.format(Messages.StackFrameResolver_method, methodName); | ||
} else { | ||
ret = ""; //$NON-NLS-1$ | ||
} | ||
return ret; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.