Commit | Line | Data |
---|---|---|
99d7adc6 | 1 | /******************************************************************************* |
0fca9497 | 2 | * Copyright (c) 2014, 2015 Ericsson |
99d7adc6 AM |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Alexandre Montplaisir - Initial API and implementation | |
0fca9497 | 11 | * Bernd Hufmann - Add Content aspect |
99d7adc6 AM |
12 | *******************************************************************************/ |
13 | ||
b04903a2 | 14 | package org.eclipse.tracecompass.internal.gdbtrace.core.trace; |
99d7adc6 AM |
15 | |
16 | import org.eclipse.jdt.annotation.NonNull; | |
e1de2fd4 | 17 | import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent; |
04c0d7d3 | 18 | import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent; |
2bdf0193 | 19 | import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; |
d187a29b | 20 | import org.eclipse.tracecompass.tmf.core.event.aspect.TmfBaseAspects; |
9447c7ee | 21 | import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect; |
40dfafb3 | 22 | import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect; |
99d7adc6 AM |
23 | |
24 | import com.google.common.collect.ImmutableList; | |
25 | ||
26 | /** | |
27 | * Event table column definition for GDB traces. | |
28 | * | |
29 | * @author Alexandre Montplaisir | |
30 | */ | |
b04903a2 | 31 | public final class GdbEventAspects { |
99d7adc6 | 32 | |
b04903a2 | 33 | private GdbEventAspects() {} |
99d7adc6 | 34 | |
ec48d248 | 35 | private static final @NonNull Iterable<ITmfEventAspect<?>> GDB_ASPECTS = |
0e4f957e | 36 | ImmutableList.of( |
40dfafb3 PT |
37 | new TmfContentFieldAspect(GdbTraceEventContent.TRACE_FRAME, GdbTraceEventContent.TRACE_FRAME), |
38 | new TmfContentFieldAspect(GdbTraceEventContent.TRACEPOINT, GdbTraceEventContent.TRACEPOINT), | |
0fca9497 | 39 | new GdbFileAspect(), |
d187a29b | 40 | TmfBaseAspects.getContentsAspect() |
0e4f957e | 41 | ); |
99d7adc6 | 42 | |
ec48d248 | 43 | private static class GdbFileAspect implements ITmfEventAspect<String> { |
99d7adc6 | 44 | |
9447c7ee AM |
45 | @Override |
46 | public String getName() { | |
47 | return "File"; //$NON-NLS-1$ | |
48 | } | |
49 | ||
50 | @Override | |
51 | public String getHelpText() { | |
52 | return EMPTY_STRING; | |
99d7adc6 AM |
53 | } |
54 | ||
55 | @Override | |
9447c7ee | 56 | public String resolve(ITmfEvent event) { |
e1de2fd4 AM |
57 | if (!(event instanceof GdbTraceEvent)) { |
58 | return EMPTY_STRING; | |
59 | } | |
60 | String ret = ((GdbTraceEvent) event).getReference(); | |
99d7adc6 AM |
61 | return (ret == null ? EMPTY_STRING : ret); |
62 | } | |
99d7adc6 AM |
63 | } |
64 | ||
b04903a2 AM |
65 | /** |
66 | * Get the event aspects specific to GDB traces. | |
67 | * | |
68 | * @return The set of aspects | |
69 | */ | |
ec48d248 | 70 | public static @NonNull Iterable<ITmfEventAspect<?>> getAspects() { |
b04903a2 | 71 | return GDB_ASPECTS; |
99d7adc6 AM |
72 | } |
73 | } |