From 59c014d73032dd2e8bc96c0f1d2d11ca4fac3301 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Tue, 12 Jul 2016 16:26:24 -0400 Subject: [PATCH] lttng.ust: Update lib load/unload events for LTTng 2.9 LTTng 2.9 adds new "lttng_ust_lib:{load|unload|build_id|debug_link}" events, which should be used instead of the lttng_ust_dl:* events to track library loading and unloading. See https://bugs.lttng.org/issues/1035 Bug: 497351 Change-Id: I3a7631afd1ea6701e5bc7e2a5b24919a4ec7eee6 Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/77177 Reviewed-by: Hudson CI Reviewed-by: Marc-Andre Laperle Tested-by: Marc-Andre Laperle --- .../debuginfo/UstDebugInfoStateProvider.java | 2 +- .../trace/layout/LttngUst29EventLayout.java | 69 +++++++++++++++++++ .../lttng2/ust/core/trace/LttngUstTrace.java | 5 +- 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/trace/layout/LttngUst29EventLayout.java diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/UstDebugInfoStateProvider.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/UstDebugInfoStateProvider.java index de04196fd9..67ea2bd18b 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/UstDebugInfoStateProvider.java +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/UstDebugInfoStateProvider.java @@ -80,7 +80,7 @@ public class UstDebugInfoStateProvider extends AbstractTmfStateProvider { public static final String DEBUG_LINK_ATTRIB = "debug_link"; //$NON-NLS-1$ /** Version of this state provider */ - private static final int VERSION = 3; + private static final int VERSION = 4; private static final Logger LOGGER = TraceCompassLog.getLogger(UstDebugInfoStateProvider.class); diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/trace/layout/LttngUst29EventLayout.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/trace/layout/LttngUst29EventLayout.java new file mode 100644 index 0000000000..f5dde428f7 --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/trace/layout/LttngUst29EventLayout.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v1.0 which + * accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ + +package org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout; + +/** + * Updated event definitions for LTTng-UST 2.9. + * + * @author Alexandre Montplaisir + */ +@SuppressWarnings("nls") +public class LttngUst29EventLayout extends LttngUst28EventLayout { + + /** + * Constructor + */ + protected LttngUst29EventLayout() {} + + private static final LttngUst29EventLayout INSTANCE = new LttngUst29EventLayout(); + + /** + * Get a singleton instance. + * + * @return The instance + */ + public static LttngUst29EventLayout getInstance() { + return INSTANCE; + } + + // ------------------------------------------------------------------------ + // Library load/unload events + // ------------------------------------------------------------------------ + + /* + * With LTTng 2.9, it is now recommended to use the load/unload events + * instead of the dlopen/dlclose ones to track libraries loading and + * unloading into the process space. The library now does the reference + * counting for us. The event fields are exactly the same. + * + * See https://bugs.lttng.org/issues/1035 and related commits. + */ + + @Override + public String eventDlOpen() { + return "lttng_ust_lib:load"; + } + + @Override + public String eventDlClose() { + return "lttng_ust_lib:unload"; + } + + @Override + public String eventDlBuildId() { + return "lttng_ust_lib:build_id"; + } + + @Override + public String eventDlDebugLink() { + return "lttng_ust_lib:debug_link"; + } + +} diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstTrace.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstTrace.java index 03fe86ed9f..8660c255d3 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstTrace.java +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstTrace.java @@ -27,6 +27,7 @@ import org.eclipse.tracecompass.internal.lttng2.ust.core.Activator; import org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout.LttngUst20EventLayout; import org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout.LttngUst27EventLayout; import org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout.LttngUst28EventLayout; +import org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout.LttngUst29EventLayout; import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryAspect; import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoFunctionAspect; import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoSourceAspect; @@ -109,7 +110,9 @@ public class LttngUstTrace extends CtfTmfTrace { if (TRACER_NAME.equals(tracerName)) { if (tracerMajor >= 2) { - if (tracerMinor >= 8) { + if (tracerMinor >= 9) { + return LttngUst29EventLayout.getInstance(); + } else if (tracerMinor >= 8) { return LttngUst28EventLayout.getInstance(); } else if (tracerMinor >= 7) { return LttngUst27EventLayout.getInstance(); -- 2.34.1