fix 32-bits lttv for kprobes
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 16 Feb 2009 01:58:27 +0000 (01:58 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 16 Feb 2009 01:58:27 +0000 (01:58 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@3320 04897980-b3bd-0310-b5e0-8ef037075253

trunk/lttv/lttv/lttv/print.c
trunk/lttv/lttv/lttv/state.c

index 68661d7cac106cf742a7f2dbcdb57dc0ef5f9108..b303900a216b7328761bd7bc6e02d90e1c1c72e8 100644 (file)
@@ -64,8 +64,13 @@ static inline void print_enum_events(LttEvent *e, struct marker_field *f,
         g_quark_to_string(ts->soft_irq_names[value]));
     } else if (info->name == LTT_EVENT_KPROBE
                && f->name == LTT_FIELD_IP) {
-      GQuark symbol = g_hash_table_lookup(ts->kprobe_hash,
+#if (__SIZEOF_LONG__ == 4)
+      GQuark symbol = (GQuark)g_hash_table_lookup(ts->kprobe_hash,
+                                          (gconstpointer)&value);
+#else
+      GQuark symbol = (GQuark)g_hash_table_lookup(ts->kprobe_hash,
                                           (gconstpointer)value);
+#endif
       if (symbol)
         g_string_append_printf(s, " [%s]", g_quark_to_string(symbol));
     }
index a3c6c9f14e2f6b011654d4a43676651322ba6299..52c8ea6b963bec3e0a983b23173849a14db1b89f 100644 (file)
@@ -227,6 +227,23 @@ static void bdevstate_free_cb(gpointer key, gpointer value, gpointer user_data);
 static LttvBdevState *bdevstate_copy(LttvBdevState *bds);
 
 
+#if (__SIZEOF_LONG__ == 4)
+guint guint64_hash(gconstpointer key)
+{
+       guint64 ukey = *(const guint64 *)key;
+
+       return (guint)ukey ^ (guint)(ukey >> 32);
+}
+
+gboolean guint64_equal(gconstpointer a, gconstpointer b)
+{
+       guint64 ua = *(const guint64 *)a;
+       guint64 ub = *(const guint64 *)b;
+
+       return ua == ub;
+}
+#endif
+
 void lttv_state_save(LttvTraceState *self, LttvAttribute *container)
 {
   LTTV_TRACE_STATE_GET_CLASS(self)->state_save(self, container);
@@ -328,8 +345,14 @@ static void expand_syscall_table(LttvTraceState *ts, int id)
 
 static void expand_kprobe_table(LttvTraceState *ts, guint64 ip, char *symbol)
 {
+#if (__SIZEOF_LONG__ == 4)
+  guint64 *ip_ptr = g_new(guint64, 1);
+  g_hash_table_insert(ts->kprobe_hash, ip_ptr,
+    (gpointer)(glong)g_quark_from_string(symbol));
+#else
   g_hash_table_insert(ts->kprobe_hash, (gpointer)ip,
     (gpointer)(glong)g_quark_from_string(symbol));
+#endif
 }
 
 static void expand_trap_table(LttvTraceState *ts, int id)
@@ -2006,7 +2029,12 @@ create_name_tables(LttvTraceState *tcs)
 
   g_string_free(fe_name, TRUE);
 
+#if (__SIZEOF_LONG__ == 4)
+  name_tables->kprobe_hash = g_hash_table_new_full(guint64_hash, guint64_equal,
+    g_free, NULL);
+#else
   name_tables->kprobe_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
+#endif
 }
 
 
This page took 0.026144 seconds and 4 git commands to generate.