String[] ret = new String[depth];
for (int i = 0; i < depth; i++) {
int quark = ss.getQuarkRelative(stackAttribute, String.valueOf(i + 1));
- ret[i] = state.get(quark).getStateValue().unboxStr();
+ ret[i] = Long.toHexString(state.get(quark).getStateValue().unboxLong());
}
return ret;
import org.eclipse.tracecompass.internal.lttng2.ust.core.trace.layout.LttngUst20EventLayout;
import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
+import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
+import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
import org.eclipse.tracecompass.tmf.core.callstack.CallStackStateProvider;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
}
@Override
- public @Nullable String functionEntry(ITmfEvent event) {
+ public @Nullable ITmfStateValue functionEntry(ITmfEvent event) {
String eventName = event.getName();
if (!funcEntryEvents.contains(eventName)) {
return null;
}
Long address = (Long) event.getContent().getField(fLayout.fieldAddr()).getValue();
- return Long.toHexString(address);
+ return TmfStateValue.newValueLong(address);
}
@Override
- public @Nullable String functionExit(ITmfEvent event) {
+ public @Nullable ITmfStateValue functionExit(ITmfEvent event) {
String eventName = event.getName();
if (!funcExitEvents.contains(eventName)) {
return null;
*/
ITmfEventField field = event.getContent().getField(fLayout.fieldAddr());
if (field == null) {
- return CallStackStateProvider.UNDEFINED;
+ return TmfStateValue.nullValue();
}
Long address = (Long) field.getValue();
- return Long.toHexString(address);
+ return TmfStateValue.newValueLong(address);
}
@Override
* Stack frames of consecutive events in the trace
*/
private static final String[] STACK_FRAMES[] = new String[][] {
- {"40472b", "4045c8", "404412", "", ""},
- {"40472b", "4045c8", "404412", "40392b", ""},
- {"40472b", "4045c8", "404412", "", ""},
- {"40472b", "4045c8", "", "", ""},
- {"40472b", "4045c8", "404412", "", ""},
- {"40472b", "4045c8", "404412", "40392b", ""},
- {"40472b", "4045c8", "404412", "", ""},
- {"40472b", "4045c8", "", "", ""},
- {"40472b", "4045c8", "404412", "", ""},
- {"40472b", "4045c8", "404412", "40392b", ""},
- {"40472b", "4045c8", "404412", "", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "0x40392b", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "", ""},
+ {"0x40472b", "0x4045c8", "", "", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "0x40392b", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "", ""},
+ {"0x40472b", "0x4045c8", "", "", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "0x40392b", ""},
+ {"0x40472b", "0x4045c8", "0x404412", "", ""},
};
/** Tooltips of the toolbar buttons */
String node = "glxgears-cyg-profile";
String pid = "-1";
String childName = "glxgears-16073";
- List<String> expected = ImmutableList.of("40472b", "", "", "", "");
+ List<String> expected = ImmutableList.of("0x40472b", "", "", "", "");
SWTBotView viewBot = fBot.viewById(CallStackView.ID);
viewBot.setFocus();
@NonNullByDefault
public abstract class CallStackStateProvider extends AbstractTmfStateProvider {
- /** Thread attribute
- * @since 2.0 */
+ /**
+ * Thread attribute
+ *
+ * @since 2.0
+ */
public static final String PROCESSES = "Processes"; //$NON-NLS-1$
/** CallStack stack-attribute */
public static final String CALL_STACK = "CallStack"; //$NON-NLS-1$
- /** Undefined process ID
- * @since 2.0 */
+ /**
+ * Undefined process ID
+ *
+ * @since 2.0
+ */
protected static final int UNDEFINED_PID = -1;
/** Undefined function exit name */
/** CallStack state system ID */
private static final String ID = "org.eclipse.linuxtools.tmf.callstack"; //$NON-NLS-1$
- /** Dummy function name for when no function is expected */
- private static final String NO_FUNCTION = "no function"; //$NON-NLS-1$
-
/**
* Default constructor
*
try {
/* Check if the event is a function entry */
- String functionEntryName = functionEntry(event);
+ ITmfStateValue functionEntryName = functionEntry(event);
if (functionEntryName != null) {
long timestamp = event.getTimestamp().toNanos();
int pid = getProcessId(event);
ss.updateOngoingState(TmfStateValue.newValueLong(threadId), threadQuark);
int callStackQuark = ss.getQuarkRelativeAndAdd(threadQuark, CALL_STACK);
- ITmfStateValue value = TmfStateValue.newValueString(functionEntryName);
+ ITmfStateValue value = functionEntryName;
ss.pushAttribute(timestamp, value, callStackQuark);
return;
}
/* Check if the event is a function exit */
- String functionExitName = functionExit(event);
- if (functionExitName != null) {
+ ITmfStateValue functionExitState = functionExit(event);
+ if (functionExitState != null) {
long timestamp = event.getTimestamp().toNanos();
int pid = getProcessId(event);
String thread = getThreadName(event);
int quark = ss.getQuarkAbsoluteAndAdd(PROCESSES, Integer.toString(pid), thread, CALL_STACK);
ITmfStateValue poppedValue = ss.popAttribute(timestamp, quark);
- String poppedName = (poppedValue == null ? NO_FUNCTION : poppedValue.unboxStr());
-
/*
* Verify that the value we are popping matches the one in the
* event field, unless the latter is undefined.
*/
- if (!functionExitName.equals(UNDEFINED) &&
- !functionExitName.equals(poppedName)) {
+ if (!functionExitState.isNull() && !functionExitState.equals(poppedValue)) {
Activator.logWarning(NLS.bind(
Messages.CallStackStateProvider_UnmatchedPoppedValue,
- functionExitName,
- poppedName));
+ functionExitState,
+ poppedValue));
}
}
*
* @param event
* An event to check for function entry
- * @return The function name of the function entry, or null if not a
- * function entry.
+ * @return The state value representing the function being entered, or null
+ * if not a function entry
+ * @since 2.0
*/
- protected abstract @Nullable String functionEntry(ITmfEvent event);
+ protected abstract @Nullable ITmfStateValue functionEntry(ITmfEvent event);
/**
* Check an event if it indicates a function exit.
*
* @param event
* An event to check for function exit
- * @return The function name, or UNDEFINED, for a function exit, or null if
- * not a function exit.
+ * @return The state value representing the function being exited, or
+ * TmfStateValue#nullValue() if the exited function is undefined,
+ * or null if not a function exit.
+ * @since 2.0
*/
- protected abstract @Nullable String functionExit(ITmfEvent event);
+ protected abstract @Nullable ITmfStateValue functionExit(ITmfEvent event);
/**
* Return the process ID of a function entry event.
// ignore
}
} else if (nameValue.getType() == Type.INTEGER) {
- name = "0x" + Integer.toHexString(nameValue.unboxInt()); //$NON-NLS-1$
+ name = "0x" + Integer.toUnsignedString(nameValue.unboxInt(), 16); //$NON-NLS-1$
address = nameValue.unboxInt();
} else if (nameValue.getType() == Type.LONG) {
- name = "0x" + Long.toHexString(nameValue.unboxLong()); //$NON-NLS-1$
+ name = "0x" + Long.toUnsignedString(nameValue.unboxLong(), 16); //$NON-NLS-1$
address = nameValue.unboxLong();
}
} catch (StateValueTypeException e) {