|
|
@ -21,16 +21,16 @@
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
|
|
|
|
2. The origin of this software must not be misrepresented; you must
|
|
|
|
2. The origin of this software must not be misrepresented; you must
|
|
|
|
not claim that you wrote the original software. If you use this
|
|
|
|
not claim that you wrote the original software. If you use this
|
|
|
|
software in a product, an acknowledgment in the product
|
|
|
|
software in a product, an acknowledgment in the product
|
|
|
|
documentation would be appreciated but is not required.
|
|
|
|
documentation would be appreciated but is not required.
|
|
|
|
|
|
|
|
|
|
|
|
3. Altered source versions must be plainly marked as such, and must
|
|
|
|
3. Altered source versions must be plainly marked as such, and must
|
|
|
|
not be misrepresented as being the original software.
|
|
|
|
not be misrepresented as being the original software.
|
|
|
|
|
|
|
|
|
|
|
|
4. The name of the author may not be used to endorse or promote
|
|
|
|
4. The name of the author may not be used to endorse or promote
|
|
|
|
products derived from this software without specific prior written
|
|
|
|
products derived from this software without specific prior written
|
|
|
|
permission.
|
|
|
|
permission.
|
|
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
|
@ -52,13 +52,13 @@
|
|
|
|
the terms of the GNU General Public License, version 2. See the
|
|
|
|
the terms of the GNU General Public License, version 2. See the
|
|
|
|
COPYING file in the source distribution for details.
|
|
|
|
COPYING file in the source distribution for details.
|
|
|
|
|
|
|
|
|
|
|
|
----------------------------------------------------------------
|
|
|
|
----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* This file is for inclusion into client (your!) code.
|
|
|
|
/* This file is for inclusion into client (your!) code.
|
|
|
|
|
|
|
|
|
|
|
|
You can use these macros to manipulate and query Valgrind's
|
|
|
|
You can use these macros to manipulate and query Valgrind's
|
|
|
|
execution inside your own programs.
|
|
|
|
execution inside your own programs.
|
|
|
|
|
|
|
|
|
|
|
|
The resulting executables will still run without Valgrind, just a
|
|
|
|
The resulting executables will still run without Valgrind, just a
|
|
|
@ -228,8 +228,8 @@
|
|
|
|
this is executed not under Valgrind. Args are passed in a memory
|
|
|
|
this is executed not under Valgrind. Args are passed in a memory
|
|
|
|
block, and so there's no intrinsic limit to the number that could
|
|
|
|
block, and so there's no intrinsic limit to the number that could
|
|
|
|
be passed, but it's currently five.
|
|
|
|
be passed, but it's currently five.
|
|
|
|
|
|
|
|
|
|
|
|
The macro args are:
|
|
|
|
The macro args are:
|
|
|
|
_zzq_rlval result lvalue
|
|
|
|
_zzq_rlval result lvalue
|
|
|
|
_zzq_default default value (result returned when running on real CPU)
|
|
|
|
_zzq_default default value (result returned when running on real CPU)
|
|
|
|
_zzq_request request code
|
|
|
|
_zzq_request request code
|
|
|
@ -257,7 +257,7 @@
|
|
|
|
|| defined(PLAT_x86_solaris)
|
|
|
|
|| defined(PLAT_x86_solaris)
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrigFn;
|
|
|
|
OrigFn;
|
|
|
@ -322,7 +322,7 @@ typedef
|
|
|
|
#if defined(PLAT_x86_win32) && !defined(__GNUC__)
|
|
|
|
#if defined(PLAT_x86_win32) && !defined(__GNUC__)
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrigFn;
|
|
|
|
OrigFn;
|
|
|
@ -397,7 +397,7 @@ valgrind_do_client_request_expr(uintptr_t _zzq_default, uintptr_t _zzq_request,
|
|
|
|
|| (defined(PLAT_amd64_win64) && defined(__GNUC__))
|
|
|
|
|| (defined(PLAT_amd64_win64) && defined(__GNUC__))
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
unsigned long int nraddr; /* where's the code? */
|
|
|
|
unsigned long int nraddr; /* where's the code? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrigFn;
|
|
|
|
OrigFn;
|
|
|
@ -469,7 +469,7 @@ typedef
|
|
|
|
#if defined(PLAT_ppc32_linux)
|
|
|
|
#if defined(PLAT_ppc32_linux)
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrigFn;
|
|
|
|
OrigFn;
|
|
|
@ -538,7 +538,7 @@ typedef
|
|
|
|
#if defined(PLAT_ppc64be_linux)
|
|
|
|
#if defined(PLAT_ppc64be_linux)
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
unsigned long int nraddr; /* where's the code? */
|
|
|
|
unsigned long int nraddr; /* where's the code? */
|
|
|
|
unsigned long int r2; /* what tocptr do we need? */
|
|
|
|
unsigned long int r2; /* what tocptr do we need? */
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -694,7 +694,7 @@ typedef
|
|
|
|
#if defined(PLAT_arm_linux)
|
|
|
|
#if defined(PLAT_arm_linux)
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrigFn;
|
|
|
|
OrigFn;
|
|
|
@ -762,7 +762,7 @@ typedef
|
|
|
|
#if defined(PLAT_arm64_linux)
|
|
|
|
#if defined(PLAT_arm64_linux)
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
unsigned long int nraddr; /* where's the code? */
|
|
|
|
unsigned long int nraddr; /* where's the code? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrigFn;
|
|
|
|
OrigFn;
|
|
|
@ -908,7 +908,7 @@ typedef
|
|
|
|
#if defined(PLAT_mips32_linux)
|
|
|
|
#if defined(PLAT_mips32_linux)
|
|
|
|
|
|
|
|
|
|
|
|
typedef
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
unsigned int nraddr; /* where's the code? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrigFn;
|
|
|
|
OrigFn;
|
|
|
@ -922,7 +922,7 @@ typedef
|
|
|
|
"srl $0, $0, 29\n\t" \
|
|
|
|
"srl $0, $0, 29\n\t" \
|
|
|
|
"srl $0, $0, 3\n\t" \
|
|
|
|
"srl $0, $0, 3\n\t" \
|
|
|
|
"srl $0, $0, 19\n\t"
|
|
|
|
"srl $0, $0, 19\n\t"
|
|
|
|
|
|
|
|
|
|
|
|
#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
|
|
|
|
#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
|
|
|
|
_zzq_default, _zzq_request, \
|
|
|
|
_zzq_default, _zzq_request, \
|
|
|
|
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
|
|
|
|
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
|
|
|
@ -2173,7 +2173,7 @@ typedef
|
|
|
|
#define VALGRIND_RESTORE_STACK \
|
|
|
|
#define VALGRIND_RESTORE_STACK \
|
|
|
|
"mr 1,28\n\t"
|
|
|
|
"mr 1,28\n\t"
|
|
|
|
|
|
|
|
|
|
|
|
/* These CALL_FN_ macros assume that on ppc32-linux,
|
|
|
|
/* These CALL_FN_ macros assume that on ppc32-linux,
|
|
|
|
sizeof(unsigned long) == 4. */
|
|
|
|
sizeof(unsigned long) == 4. */
|
|
|
|
|
|
|
|
|
|
|
|
#define CALL_FN_W_v(lval, orig) \
|
|
|
|
#define CALL_FN_W_v(lval, orig) \
|
|
|
@ -4690,7 +4690,7 @@ typedef
|
|
|
|
#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
|
|
|
|
#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
|
|
|
|
"f0","f1","f2","f3","f4","f5","f6","f7"
|
|
|
|
"f0","f1","f2","f3","f4","f5","f6","f7"
|
|
|
|
|
|
|
|
|
|
|
|
/* Nb: Although r11 is modified in the asm snippets below (inside
|
|
|
|
/* Nb: Although r11 is modified in the asm snippets below (inside
|
|
|
|
VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for
|
|
|
|
VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for
|
|
|
|
two reasons:
|
|
|
|
two reasons:
|
|
|
|
(1) r11 is restored in VALGRIND_CFI_EPILOGUE, so effectively it is not
|
|
|
|
(1) r11 is restored in VALGRIND_CFI_EPILOGUE, so effectively it is not
|
|
|
@ -5140,7 +5140,7 @@ typedef
|
|
|
|
#endif /* PLAT_s390x_linux */
|
|
|
|
#endif /* PLAT_s390x_linux */
|
|
|
|
|
|
|
|
|
|
|
|
/* ------------------------- mips32-linux ----------------------- */
|
|
|
|
/* ------------------------- mips32-linux ----------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(PLAT_mips32_linux)
|
|
|
|
#if defined(PLAT_mips32_linux)
|
|
|
|
|
|
|
|
|
|
|
|
/* These regs are trashed by the hidden call. */
|
|
|
|
/* These regs are trashed by the hidden call. */
|
|
|
@ -6115,7 +6115,7 @@ typedef
|
|
|
|
#define VG_IS_TOOL_USERREQ(a, b, v) \
|
|
|
|
#define VG_IS_TOOL_USERREQ(a, b, v) \
|
|
|
|
(VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000))
|
|
|
|
(VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000))
|
|
|
|
|
|
|
|
|
|
|
|
/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !!
|
|
|
|
/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !!
|
|
|
|
This enum comprises an ABI exported by Valgrind to programs
|
|
|
|
This enum comprises an ABI exported by Valgrind to programs
|
|
|
|
which use client requests. DO NOT CHANGE THE NUMERIC VALUES OF THESE
|
|
|
|
which use client requests. DO NOT CHANGE THE NUMERIC VALUES OF THESE
|
|
|
|
ENTRIES, NOR DELETE ANY -- add new ones at the end of the most
|
|
|
|
ENTRIES, NOR DELETE ANY -- add new ones at the end of the most
|
|
|
@ -6264,7 +6264,7 @@ VALGRIND_PRINTF(const char *format, ...)
|
|
|
|
_qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
|
|
|
|
_qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
|
|
|
|
VG_USERREQ__PRINTF_VALIST_BY_REF,
|
|
|
|
VG_USERREQ__PRINTF_VALIST_BY_REF,
|
|
|
|
(unsigned long)format,
|
|
|
|
(unsigned long)format,
|
|
|
|
(unsigned long)&vargs,
|
|
|
|
(unsigned long)&vargs,
|
|
|
|
0, 0, 0);
|
|
|
|
0, 0, 0);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
va_end(vargs);
|
|
|
|
va_end(vargs);
|
|
|
@ -6303,7 +6303,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
|
|
|
|
_qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
|
|
|
|
_qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
|
|
|
|
VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
|
|
|
|
VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
|
|
|
|
(unsigned long)format,
|
|
|
|
(unsigned long)format,
|
|
|
|
(unsigned long)&vargs,
|
|
|
|
(unsigned long)&vargs,
|
|
|
|
0, 0, 0);
|
|
|
|
0, 0, 0);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
va_end(vargs);
|
|
|
|
va_end(vargs);
|
|
|
@ -6314,7 +6314,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
|
|
|
|
|
|
|
|
|
|
|
|
/* These requests allow control to move from the simulated CPU to the
|
|
|
|
/* These requests allow control to move from the simulated CPU to the
|
|
|
|
real CPU, calling an arbitrary function.
|
|
|
|
real CPU, calling an arbitrary function.
|
|
|
|
|
|
|
|
|
|
|
|
Note that the current ThreadId is inserted as the first argument.
|
|
|
|
Note that the current ThreadId is inserted as the first argument.
|
|
|
|
So this call:
|
|
|
|
So this call:
|
|
|
|
|
|
|
|
|
|
|
@ -6400,7 +6400,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
|
|
|
|
- It marks the block as being addressable and undefined (if 'is_zeroed' is
|
|
|
|
- It marks the block as being addressable and undefined (if 'is_zeroed' is
|
|
|
|
not set), or addressable and defined (if 'is_zeroed' is set). This
|
|
|
|
not set), or addressable and defined (if 'is_zeroed' is set). This
|
|
|
|
controls how accesses to the block by the program are handled.
|
|
|
|
controls how accesses to the block by the program are handled.
|
|
|
|
|
|
|
|
|
|
|
|
'addr' is the start of the usable block (ie. after any
|
|
|
|
'addr' is the start of the usable block (ie. after any
|
|
|
|
redzone), 'sizeB' is its size. 'rzB' is the redzone size if the allocator
|
|
|
|
redzone), 'sizeB' is its size. 'rzB' is the redzone size if the allocator
|
|
|
|
can apply redzones -- these are blocks of padding at the start and end of
|
|
|
|
can apply redzones -- these are blocks of padding at the start and end of
|
|
|
@ -6408,7 +6408,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
|
|
|
|
Valgrind will spot block overruns. `is_zeroed' indicates if the memory is
|
|
|
|
Valgrind will spot block overruns. `is_zeroed' indicates if the memory is
|
|
|
|
zeroed (or filled with another predictable value), as is the case for
|
|
|
|
zeroed (or filled with another predictable value), as is the case for
|
|
|
|
calloc().
|
|
|
|
calloc().
|
|
|
|
|
|
|
|
|
|
|
|
VALGRIND_MALLOCLIKE_BLOCK should be put immediately after the point where a
|
|
|
|
VALGRIND_MALLOCLIKE_BLOCK should be put immediately after the point where a
|
|
|
|
heap block -- that will be used by the client program -- is allocated.
|
|
|
|
heap block -- that will be used by the client program -- is allocated.
|
|
|
|
It's best to put it at the outermost level of the allocator if possible;
|
|
|
|
It's best to put it at the outermost level of the allocator if possible;
|
|
|
@ -6496,8 +6496,8 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a memory pool with some flags specifying extended behaviour.
|
|
|
|
/* Create a memory pool with some flags specifying extended behaviour.
|
|
|
|
When flags is zero, the behaviour is identical to VALGRIND_CREATE_MEMPOOL.
|
|
|
|
When flags is zero, the behaviour is identical to VALGRIND_CREATE_MEMPOOL.
|
|
|
|
|
|
|
|
|
|
|
|
The flag VALGRIND_MEMPOOL_METAPOOL specifies that the pieces of memory
|
|
|
|
The flag VALGRIND_MEMPOOL_METAPOOL specifies that the pieces of memory
|
|
|
|
associated with the pool using VALGRIND_MEMPOOL_ALLOC will be used
|
|
|
|
associated with the pool using VALGRIND_MEMPOOL_ALLOC will be used
|
|
|
|
by the application as superblocks to dole out MALLOC_LIKE blocks using
|
|
|
|
by the application as superblocks to dole out MALLOC_LIKE blocks using
|
|
|
|
VALGRIND_MALLOCLIKE_BLOCK. In other words, a meta pool is a "2 levels"
|
|
|
|
VALGRIND_MALLOCLIKE_BLOCK. In other words, a meta pool is a "2 levels"
|
|
|
|