-> 3.17.0 final.
[valgrind.git] / coregrind / pub_core_clreq.h
blob23b402a092bc0e6eca72ba90645f3b40257285f0
2 /*--------------------------------------------------------------------*/
3 /*--- Internal client requests. pub_core_clreq.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2000-2017 Julian Seward
11 jseward@acm.org
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __PUB_CORE_CLREQ_H
30 #define __PUB_CORE_CLREQ_H
32 //--------------------------------------------------------------------
33 // PURPOSE: This module defined client requests.
34 //--------------------------------------------------------------------
36 #include "pub_tool_clreq.h"
38 // The strange choice of values here is due to historical reasons -- there
39 // used to be many more internal client requests.
40 typedef
41 enum {
42 /* Denote the finish of freeres_wrapper(). Also causes exit. */
43 VG_USERREQ__FREERES_DONE = 0x3029,
45 /* Get the tool's malloc-wrapping functions */
46 VG_USERREQ__GET_MALLOCFUNCS = 0x3030,
48 /* Internal equivalent of VALGRIND_PRINTF_VALIST_BY_REF . */
49 VG_USERREQ__INTERNAL_PRINTF_VALIST_BY_REF = 0x3103,
51 /* Add a target for an indirect function redirection. */
52 VG_USERREQ__ADD_IFUNC_TARGET = 0x3104,
54 } Vg_InternalClientRequest;
57 /* Which freeres functions to run in the freeres_wrapper().
58 It is possible to run both. */
59 typedef enum {
60 /* Run __gnu_cxx::__freeres(). */
61 VG_RUN__GNU_CXX__FREERES = 1,
63 /* Run __libc_freeres(). */
64 VG_RUN__LIBC_FREERES = 2
66 } Vg_FreeresToRun;
68 // Function for printing from code within Valgrind, but which runs on the
69 // sim'd CPU. Must be a function rather than macros so that va_list can
70 // be used.
72 static int VALGRIND_INTERNAL_PRINTF(const char *format, ...)
73 __attribute__((format(__printf__, 1, 2), __unused__));
74 static int VALGRIND_INTERNAL_PRINTF(const char *format, ...)
76 unsigned long _qzz_res = 0;
77 va_list vargs;
78 va_start(vargs, format);
79 VALGRIND_DO_CLIENT_REQUEST(
80 _qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF_VALIST_BY_REF,
81 (unsigned long)format, (unsigned long)&vargs, 0, 0, 0
83 va_end(vargs);
84 return _qzz_res;
88 #endif // __PUB_CORE_CLREQ_H
90 /*--------------------------------------------------------------------*/
91 /*--- end ---*/
92 /*--------------------------------------------------------------------*/