Skip to content

Commit

Permalink
uftrace: demangle c++ names
Browse files Browse the repository at this point in the history
Use CDT's cppFilt to demange c++ names if available.

Signed-off-by: Matthew Khouzam <[email protected]>
  • Loading branch information
MatthewKhouzam committed Nov 28, 2024
1 parent cacb172 commit 85c5dd2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ Export-Package: org.eclipse.tracecompass.incubator.internal.uftrace.core;x-frien
org.eclipse.tracecompass.incubator.internal.uftrace.core.trace;x-friends:="org.eclipse.tracecompass.incubator.uftrace.core.tests"
Import-Package: com.google.common.collect,
org.apache.commons.io,
org.apache.commons.lang3.math
org.apache.commons.lang3.math,
org.eclipse.cdt.utils
Automatic-Module-Name: org.eclipse.tracecompass.incubator.uftrace.core
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Set;

import org.apache.commons.io.FilenameUtils;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
Expand All @@ -39,6 +40,7 @@
import org.eclipse.tracecompass.incubator.analysis.core.aspects.ProcessNameAspect;
import org.eclipse.tracecompass.incubator.internal.uftrace.core.Activator;
import org.eclipse.tracecompass.incubator.internal.uftrace.core.trace.SymParser.Symbol;
import org.eclipse.tracecompass.internal.tmf.core.callstack.FunctionNameMapper;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
Expand Down Expand Up @@ -491,9 +493,15 @@ private Map<Long, MapParser> getMap() {
private static class UfTraceSymbolProvider implements ISymbolProvider {

private Uftrace fTrace;
private CPPFilt fCppFilt;

public UfTraceSymbolProvider(Uftrace trace) {
fTrace = trace;
try {
fCppFilt = new CPPFilt();
} catch (IOException e) {
Activator.getInstance().logError("Could not load CPP Filt, C++ functions will be mangled." , e); //$NON-NLS-1$
}
}

@Override
Expand Down Expand Up @@ -526,6 +534,9 @@ public TmfResolvedSymbol getSymbol(int tid, long timestamp, long address) {
Symbol value = floorEntry.getValue();
if (value != null) {
String name = String.valueOf(value.getName());
if(fCppFilt != null) {
name = FunctionNameMapper.nameFromCppFilt(fCppFilt, name);
}
return new TmfResolvedSymbol(address, name);
}
}
Expand Down

0 comments on commit 85c5dd2

Please sign in to comment.