From c6cf2455b1fe5cc0929ded1bc581cb74ce770c72 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Tue, 5 Apr 2016 15:44:37 -0400 Subject: [PATCH] tmf: Add the notions of timestamp and PID to ISymbolProvider To support completely generic symbol resolution, the methods in ISymbolProvider needs to consider two new concepts: the timestamp of the query, and the process ID. Process ID: One trace can contain events from multiple processes. Even if they all execute the same executable, the memory addresses, being virtual, are specific to each process. The provider may need to know the query is for which process in particular. Timestamp: Since libraries can be loaded and unloaded at runtime, with calls to dlopen() and dlclose() for example, one address may refer to different libraries at different moments in a trace. The provider then needs to know the timestamp of the query, so it can refer to the correct library if needed. To ease the transition, we can introduce the new method as default methods that will ignore the new parameters by default. Change-Id: I6ec8aa5d97c690d84a9864af15f99a3ec9f4aa3d Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/69969 Reviewed-by: Hudson CI --- .../tmf/ui/symbols/ISymbolProvider.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/symbols/ISymbolProvider.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/symbols/ISymbolProvider.java index cd19ef4daf..f3311a0cb2 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/symbols/ISymbolProvider.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/symbols/ISymbolProvider.java @@ -24,7 +24,6 @@ import org.eclipse.tracecompass.tmf.core.trace.TmfTrace; * @author Robert Kiss * @since 2.0 * @see ISymbolProviderFactory - * */ public interface ISymbolProvider { @@ -66,6 +65,39 @@ public interface ISymbolProvider { */ @Nullable ITmfCallsite getSymbolInfo(long address); + /** + * Return the symbol text corresponding to the given pid/timestamp/address + * tuple, or null if there is no such symbol. + * + * @param pid + * The process Id for which to query + * @param timestamp + * The timestamp of the query + * @param address + * the address of the symbol + * @return the symbol text or null if the symbol cannot be found + */ + default @Nullable String getSymbolText(int pid, long timestamp, long address) { + return getSymbolText(address); + } + + /** + * Return additional information regarding the symbol from the given + * pid/timestamp/address tuple, or null if the symbol cannot be found. + * + * @param pid + * The process Id for which to query + * @param timestamp + * The timestamp of the query + * @param address + * the address of the symbol + * @return the symbol {@link ITmfCallsite} information or null if the symbol + * cannot be found + */ + default @Nullable ITmfCallsite getSymbolInfo(int pid, long timestamp, long address) { + return getSymbolInfo(address); + } + /** * Create the {@link ISymbolProviderPreferencePage} that can be used to * configure this {@link ISymbolProvider} -- 2.34.1