Skip to contentSkip to conversation

xentrace_format: use low 32 bit of 'event' field

PATCH New Thomas Friebel 1 participant 1 message Feb 6, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xentrace_format: use low 32 bit of 'event' field

xentrace and/or xentrace_format does not handle the 'event' field of trace entries correctly.

'event' is a 32 bit field:
xen/include/public/trace.h:90: uint32_t event;

When compiling for 64 bit 'event' gets 64 bit aligned by gcc (I use gcc 4.1.2 by openSUSE 10.2 x86-64). xentrace dumps the data into the trace file like it is in memory. xentrace_format reads the 'event' field as a 'long' value. So in a 64 bit environment the highest 32 bit contain bogus data. This patch masks these highest 32 bit in xentrace_format. I chose to fix this in xentrace_format because it is not on the performance critical path Xen -> ... -> file.

Cheers
Thomas

tools/xentrace/xentrace_format Tue Feb 06 17:13:15 2007 +0100 renamed from tools/xentrace/xentrace_format Tue Feb 06 13:51:29 2007 +0100 +4 -0
diff -r 07455edbf4f7 tools/xentrace/xentrace_format
@@ -107,6 +107,10 @@ while not interrupted:
 
         (tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)
 
+        # gcc aligns struct members when compiling for 64 bit
+        # so only use the lowest 32 bit of event
+        event &= 0xffffffff
+
        #tsc = (tscH<<32) | tscL
 
        #print i, tsc

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel