aboutsummaryrefslogtreecommitdiffstats
path: root/epan/emem.h
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2008-08-05 02:23:35 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2008-08-05 02:23:35 +0000
commit230d917776d73a08b0e4dc11d2fc04a5678fc792 (patch)
tree02407e766260b6514816a5b3c0e51ab2f6a2c0ed /epan/emem.h
parent6916eaf58779ba194d63a86200001f5523b790e1 (diff)
Add a debug helper for EP memory corruption
if compiled in and the env var WIRESHARK_DEBUG_EP_CANARY is set: will check for canary integrity at every call to EP_CHECK_CANARY() if corruption is found it exits pronting the prior location and the location in which corruption was found. Hopefully it stops running while the corruptor is still in the stack. see EP_CHECK_CANARY() calls in packet.c as an example. svn path=/trunk/; revision=25927
Diffstat (limited to 'epan/emem.h')
-rw-r--r--epan/emem.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/epan/emem.h b/epan/emem.h
index c9ea0d83c0..aaf1e0ac83 100644
--- a/epan/emem.h
+++ b/epan/emem.h
@@ -365,7 +365,22 @@ gboolean emem_tree_foreach(emem_tree_t* emem_tree, tree_foreach_func callback, v
+/* #define DEBUG_INTENSE_CANARY_CHECKS */
+/* Helper to troubleshoot ep memory corruption
+ * if compiled and the environment variable WIRESHARK_DEBUG_EP_CANARY exists
+ * it will check the canaries and when found corrupt stop there in the hope
+ * the corruptor is still there in the stack.
+ * Some checkpoints are already set in packet.c in strategic points
+ * before and after dissection of a frame or a dissector call.
+ */
+#ifdef DEBUG_INTENSE_CANARY_CHECKS
+void ep_check_canary_integrity(const char* fmt, ...);
+#define EP_CHECK_CANARY(sprintf_args) ep_check_canary_integrity sprintf_args
+#else
+#define EP_CHECK_CANARY(dummy)
+#endif
+
void emem_print_tree(emem_tree_t* emem_tree);