|
From: Nicholas N. <nj...@cs...> - 2007-04-20 02:14:29
|
On Thu, 19 Apr 2007 sv...@va... wrote:
> Author: dirk
> Date: 2007-04-19 10:47:32 +0100 (Thu, 19 Apr 2007)
> New Revision: 6706
>
> Log:
> wrap env related functions to be able to track undefined
> values better
Hang on, didn't we decide that this wasn't the right thing to do? I can't
remember now...
Nick
> Modified:
> trunk/memcheck/mc_replace_strmem.c
>
>
> Modified: trunk/memcheck/mc_replace_strmem.c
> ===================================================================
> --- trunk/memcheck/mc_replace_strmem.c 2007-04-18 14:02:15 UTC (rev 6705)
> +++ trunk/memcheck/mc_replace_strmem.c 2007-04-19 09:47:32 UTC (rev 6706)
> @@ -671,6 +671,67 @@
>
>
> /*------------------------------------------------------------*/
> +/*--- Improve definedness checking of process environment ---*/
> +/*------------------------------------------------------------*/
> +
> +/* putenv */
> +int VG_WRAP_FUNCTION_ZU(m_libc_soname, putenv) (char* string);
> +int VG_WRAP_FUNCTION_ZU(m_libc_soname, putenv) (char* string)
> +{
> + OrigFn fn;
> + Word result;
> + const char* p = string;
> + VALGRIND_GET_ORIG_FN(fn);
> + /* Now by walking over the string we magically produce
> + traces when hitting undefined memory. */
> + if (p)
> + while (*p++)
> + ;
> + CALL_FN_W_W(result, fn, string);
> + return result;
> +}
> +
> +/* unsetenv */
> +int VG_WRAP_FUNCTION_ZU(m_libc_soname, unsetenv) (const char* name);
> +int VG_WRAP_FUNCTION_ZU(m_libc_soname, unsetenv) (const char* name)
> +{
> + OrigFn fn;
> + Word result;
> + const char* p = name;
> + VALGRIND_GET_ORIG_FN(fn);
> + /* Now by walking over the string we magically produce
> + traces when hitting undefined memory. */
> + if (p)
> + while (*p++)
> + ;
> + CALL_FN_W_W(result, fn, name);
> + return result;
> +}
> +
> +/* setenv */
> +int VG_WRAP_FUNCTION_ZU(m_libc_soname, setenv)
> + (const char* name, const char* value, int overwrite);
> +int VG_WRAP_FUNCTION_ZU(m_libc_soname, setenv)
> + (const char* name, const char* value, int overwrite)
> +{
> + OrigFn fn;
> + Word result;
> + const char* p;
> + VALGRIND_GET_ORIG_FN(fn);
> + /* Now by walking over the string we magically produce
> + traces when hitting undefined memory. */
> + if (name)
> + for (p = name; *p; p++)
> + ;
> + if (value)
> + for (p = value; *p; p++)
> + ;
> + VALGRIND_CHECK_VALUE_IS_DEFINED (overwrite);
> + CALL_FN_W_WWW(result, fn, name, value, overwrite);
> + return result;
> +}
> +
> +/*------------------------------------------------------------*/
> /*--- AIX stuff only after this point ---*/
> /*------------------------------------------------------------*/
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
|