blob: 8f3b9847be00721ca7392f55caae3c939d165b41 [file] [log] [blame]
njn12771092005-06-18 02:18:04 +00001
2/*--------------------------------------------------------------------*/
3/*--- Internal client requests. coregrind.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
9
10 Copyright (C) 2000-2005 Julian Seward
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
31#ifndef __COREGRIND_H
32#define __COREGRIND_H
33
34//--------------------------------------------------------------------
35// PURPOSE: This file is the counterpart to valgrind.h. It contains
36// the client requests that are internal to Valgrind, and not to be seen
37// by client programs.
38//--------------------------------------------------------------------
39
40#include <stdarg.h>
41
42// The strange choice of values here is due to historical reasons -- there
43// used to be many more internal client requests.
44typedef
45 enum {
46 /* Denote the finish of __libc_freeres_wrapper(). Also causes exit. */
47 VG_USERREQ__LIBC_FREERES_DONE = 0x3029,
48
49 /* Get the tool's malloc-wrapping functions */
50 VG_USERREQ__GET_MALLOCFUNCS = 0x3030,
51
52 /* Internal equivalent of VALGRIND_PRINTF . */
53 VG_USERREQ__INTERNAL_PRINTF = 0x3103,
54
55 } Vg_InternalClientRequest;
56
57// Function for printing from code within Valgrind, but which runs on the
58// sim'd CPU. Must be a function rather than macros so that va_list can
59// be used.
60
61int VALGRIND_INTERNAL_PRINTF(char *format, ...);
62__attribute__((format(__printf__, 1, 2)))
63__attribute__((weak))
64int VALGRIND_INTERNAL_PRINTF(char *format, ...)
65{
66 unsigned long _qzz_res = 0;
67 va_list vargs;
68 va_start(vargs, format);
69 VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__INTERNAL_PRINTF,
70 (unsigned long)format, (unsigned long)vargs, 0, 0);
71 va_end(vargs);
72 return _qzz_res;
73}
74
75
76#endif // __COREGRIND_H
77
78/*--------------------------------------------------------------------*/
79/*--- end ---*/
80/*--------------------------------------------------------------------*/