From 2d32a807054602cab04c9297a92c82a480438355 Mon Sep 17 00:00:00 2001 From: William Bourque Date: Fri, 22 Jan 2010 19:24:01 +0000 Subject: [PATCH] Some changes in TextTrace parsing, needed fixes for unittests (bug 299715). Also fixes some glitch in Control Flow View output --- .../lttng/trace/LTTngTextTrace.java | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java index eca38184a6..5b98fab1b3 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTextTrace.java @@ -200,6 +200,7 @@ public class LTTngTextTrace extends TmfTrace implements ITmfTrace, ITmfRequestHa } } + @Override public TmfTraceContext seekLocation(Object location) { if (location == null) { location = 0L; @@ -468,7 +469,8 @@ public class LTTngTextTrace extends TmfTrace implements ITmfTrace, ITmfRequestHa // Look like : // SYSCALL { ip = 0xb7f05422, syscall_id = 221 [sys_fcntl64+0x0/0x79] } // - // NOTE : it seems some state system events do not respect this format as they have no payload. Skip them! + // NOTE : it seems some state system events do not respect this format as they have no payload. + // We will create empty payload then. int tmpIndex = tmpContent.indexOf("{", tmpPrevIndex); if ( tmpIndex != -1 ) { tmpPrevIndex = tmpCurIndex+1; @@ -507,18 +509,28 @@ public class LTTngTextTrace extends TmfTrace implements ITmfTrace, ITmfRequestHa tmpIndexBegin = tmpIndexEnd+1; } - eventContent = new TextLttngEventContent(currentLttngEvent, fieldsMap); - - // We now have what we need for the type - String tmpTypeKey = tracefile + "/" + tmpCpu + "/" + marker; - if ( traceTypes.get(tmpTypeKey) == null ) { - traceTypes.put(tmpTypeKey, new LttngEventType(tracefile, tmpCpu, marker, fieldsMap.keySet().toArray(new String[fieldsMap.size()] )) ); - } + } + else { + fieldsMap = new HashMap(); - currentLttngEvent.setContent(eventContent); - currentLttngEvent.setType(traceTypes.get(tmpTypeKey)); + markerName = ""; + payload = ""; + + LttngEventField tmpField = new LttngEventField(eventContent, markerName, payload); + fieldsMap.put(markerName, tmpField); } + eventContent = new TextLttngEventContent(currentLttngEvent, fieldsMap); + + // We now have what we need for the type + String tmpTypeKey = tracefile + "/" + tmpCpu + "/" + marker; + if ( traceTypes.get(tmpTypeKey) == null ) { + traceTypes.put(tmpTypeKey, new LttngEventType(tracefile, tmpCpu, marker, fieldsMap.keySet().toArray(new String[fieldsMap.size()] )) ); + } + + currentLttngEvent.setContent(eventContent); + currentLttngEvent.setType(traceTypes.get(tmpTypeKey)); + context.setTimestamp(eventTimestamp); context.setLocation(nbCharRead); @@ -527,16 +539,18 @@ public class LTTngTextTrace extends TmfTrace implements ITmfTrace, ITmfRequestHa else if ( showDebug == true ) { System.out.println("NULL READING"); System.out.println(); + returnedEvent = null; } } catch (Exception e) { + System.out.println("Pos is :" + nbCharRead); if ( tmpContent != null ) { - System.out.println("Pos is :" + nbCharRead); System.out.println("Erroneous content is :" + tmpContent); } tmpContent = null; e.printStackTrace(); + returnedEvent = null; } return returnedEvent; -- 2.34.1