njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
njn | 93fe3b2 | 2005-12-21 20:22:52 +0000 | [diff] [blame] | 3 | /*--- Internal client requests. pub_core_clreq.h ---*/ |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 4 | /*--------------------------------------------------------------------*/ |
| 5 | |
| 6 | /* |
| 7 | This file is part of Valgrind, a dynamic binary instrumentation |
| 8 | framework. |
| 9 | |
sewardj | 0f157dd | 2013-10-18 14:27:36 +0000 | [diff] [blame] | 10 | Copyright (C) 2000-2013 Julian Seward |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 11 | jseward@acm.org |
| 12 | |
| 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. |
| 17 | |
| 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. |
| 22 | |
| 23 | You should have received a copy of the GNU General Public License |
| 24 | along with this program; if not, write to the Free Software |
| 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 26 | 02111-1307, USA. |
| 27 | |
| 28 | The GNU General Public License is contained in the file COPYING. |
| 29 | */ |
| 30 | |
njn | 93fe3b2 | 2005-12-21 20:22:52 +0000 | [diff] [blame] | 31 | #ifndef __PUB_CORE_CLREQ_H |
| 32 | #define __PUB_CORE_CLREQ_H |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 33 | |
| 34 | //-------------------------------------------------------------------- |
njn | 93fe3b2 | 2005-12-21 20:22:52 +0000 | [diff] [blame] | 35 | // PURPOSE: This module defined client requests. |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 36 | //-------------------------------------------------------------------- |
| 37 | |
njn | 93fe3b2 | 2005-12-21 20:22:52 +0000 | [diff] [blame] | 38 | #include "pub_tool_clreq.h" |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 39 | |
| 40 | // The strange choice of values here is due to historical reasons -- there |
| 41 | // used to be many more internal client requests. |
| 42 | typedef |
| 43 | enum { |
| 44 | /* Denote the finish of __libc_freeres_wrapper(). Also causes exit. */ |
| 45 | VG_USERREQ__LIBC_FREERES_DONE = 0x3029, |
| 46 | |
| 47 | /* Get the tool's malloc-wrapping functions */ |
| 48 | VG_USERREQ__GET_MALLOCFUNCS = 0x3030, |
| 49 | |
sewardj | c560fb3 | 2010-01-28 15:23:54 +0000 | [diff] [blame] | 50 | /* Internal equivalent of VALGRIND_PRINTF_VALIST_BY_REF . */ |
| 51 | VG_USERREQ__INTERNAL_PRINTF_VALIST_BY_REF = 0x3103, |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 52 | |
tom | d264514 | 2009-10-29 09:27:11 +0000 | [diff] [blame] | 53 | /* Add a target for an indirect function redirection. */ |
| 54 | VG_USERREQ__ADD_IFUNC_TARGET = 0x3104, |
| 55 | |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 56 | } Vg_InternalClientRequest; |
| 57 | |
| 58 | // Function for printing from code within Valgrind, but which runs on the |
| 59 | // sim'd CPU. Must be a function rather than macros so that va_list can |
| 60 | // be used. |
| 61 | |
njn | 325bf10 | 2009-05-21 04:10:38 +0000 | [diff] [blame] | 62 | static int VALGRIND_INTERNAL_PRINTF(const char *format, ...) |
| 63 | __attribute__((format(__printf__, 1, 2), __unused__)); |
| 64 | static int VALGRIND_INTERNAL_PRINTF(const char *format, ...) |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 65 | { |
| 66 | unsigned long _qzz_res = 0; |
sewardj | c560fb3 | 2010-01-28 15:23:54 +0000 | [diff] [blame] | 67 | va_list vargs; |
| 68 | va_start(vargs, format); |
sewardj | 0ec07f3 | 2006-01-12 12:32:32 +0000 | [diff] [blame] | 69 | VALGRIND_DO_CLIENT_REQUEST( |
sewardj | c560fb3 | 2010-01-28 15:23:54 +0000 | [diff] [blame] | 70 | _qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF_VALIST_BY_REF, |
| 71 | (unsigned long)format, (unsigned long)&vargs, 0, 0, 0 |
sewardj | 0ec07f3 | 2006-01-12 12:32:32 +0000 | [diff] [blame] | 72 | ); |
sewardj | c560fb3 | 2010-01-28 15:23:54 +0000 | [diff] [blame] | 73 | va_end(vargs); |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 74 | return _qzz_res; |
| 75 | } |
| 76 | |
| 77 | |
njn | 93fe3b2 | 2005-12-21 20:22:52 +0000 | [diff] [blame] | 78 | #endif // __PUB_CORE_CLREQ_H |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 79 | |
| 80 | /*--------------------------------------------------------------------*/ |
| 81 | /*--- end ---*/ |
| 82 | /*--------------------------------------------------------------------*/ |