mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
drd: Add stpcpy() intercept (#326436)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13694
This commit is contained in:
parent
50b6a83ce8
commit
1b09dba092
@ -37,6 +37,8 @@
|
||||
#include "pub_tool_clreq.h"
|
||||
|
||||
|
||||
/*---------------------- strchr ----------------------*/
|
||||
|
||||
#define STRCHR(soname, fnname) \
|
||||
char* VG_REPLACE_FUNCTION_ZU(soname,fnname)(const char* s, int c); \
|
||||
char* VG_REPLACE_FUNCTION_ZU(soname,fnname)(const char* s, int c) \
|
||||
@ -65,6 +67,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- strnlen ----------------------*/
|
||||
|
||||
#define STRNLEN(soname, fnname) \
|
||||
SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ); \
|
||||
SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ) \
|
||||
@ -81,6 +85,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- strlen ----------------------*/
|
||||
|
||||
// Note that this replacement often doesn't get used because gcc inlines
|
||||
// calls to strlen() with its own built-in version. This can be very
|
||||
// confusing if you aren't expecting it. Other small functions in this file
|
||||
@ -104,6 +110,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- strcpy ----------------------*/
|
||||
|
||||
#define STRCPY(soname, fnname) \
|
||||
char* VG_REPLACE_FUNCTION_ZU(soname, fnname)(char* dst, const char* src); \
|
||||
char* VG_REPLACE_FUNCTION_ZU(soname, fnname)(char* dst, const char* src) \
|
||||
@ -124,6 +132,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- strcmp ----------------------*/
|
||||
|
||||
#define STRCMP(soname, fnname) \
|
||||
int VG_REPLACE_FUNCTION_ZU(soname,fnname)(const char* s1, const char* s2); \
|
||||
int VG_REPLACE_FUNCTION_ZU(soname,fnname)(const char* s1, const char* s2) \
|
||||
@ -152,6 +162,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- memcpy ----------------------*/
|
||||
|
||||
#define MEMCPY(soname, fnname) \
|
||||
void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
|
||||
(void *dst, const void *src, SizeT len); \
|
||||
@ -246,6 +258,33 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- stpcpy ----------------------*/
|
||||
|
||||
/* Copy SRC to DEST, returning the address of the terminating '\0' in
|
||||
DEST. (minor variant of strcpy) */
|
||||
#define STPCPY(soname, fnname) \
|
||||
char* VG_REPLACE_FUNCTION_EZU(20200,soname,fnname) \
|
||||
(char* dst, const char* src); \
|
||||
char* VG_REPLACE_FUNCTION_EZU(20200,soname,fnname) \
|
||||
(char* dst, const char* src) \
|
||||
{ \
|
||||
while (*src) *dst++ = *src++; \
|
||||
*dst = 0; \
|
||||
\
|
||||
return dst; \
|
||||
}
|
||||
|
||||
#if defined(VGO_linux)
|
||||
STPCPY(VG_Z_LIBC_SONAME, stpcpy)
|
||||
STPCPY(VG_Z_LIBC_SONAME, __GI_stpcpy)
|
||||
STPCPY(VG_Z_LD_LINUX_SO_2, stpcpy)
|
||||
STPCPY(VG_Z_LD_LINUX_X86_64_SO_2, stpcpy)
|
||||
#elif defined(VGO_darwin)
|
||||
//STPCPY(VG_Z_LIBC_SONAME, stpcpy)
|
||||
//STPCPY(VG_Z_DYLD, stpcpy)
|
||||
#endif
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*--- end ---*/
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user