New options for Memcheck, --malloc-fill=<hexnumber> and
--fill-free=<hexnumber>, which cause malloc'd(etc) and free'd(etc)
blocks to be filled with the specified value.  This can apparently be
useful for shaking out hard-to-track-down memory corruption.  The
definedness/addressability of said areas is not affected -- only the
contents.  Documentation to follow.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7259 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h
index b2701e3..ed5c37e 100644
--- a/include/pub_tool_options.h
+++ b/include/pub_tool_options.h
@@ -72,6 +72,18 @@
       if ((qq_var) > (qq_hi)) (qq_var) = (qq_hi); \
    }
 
+/* Bounded hexadecimal arg */
+#define VG_BHEX_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
+   if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \
+      Char* s; \
+      Long n = VG_(strtoll16)( &qq_arg[ VG_(strlen)(qq_option)+1 ], &s );\
+      (qq_var) = n; \
+      /* Check for non-numeralness, or overflow */ \
+      if ('\0' != s[0] || (qq_var) != n) VG_(err_bad_option)(qq_arg); \
+      if ((qq_var) < (qq_lo)) (qq_var) = (qq_lo); \
+      if ((qq_var) > (qq_hi)) (qq_var) = (qq_hi); \
+   }
+
 /* Double arg */
 #define VG_DBL_CLO(qq_arg, qq_option, qq_var) \
    if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \