sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 3 | /*--- A header file for various private parts of Valgrind's core. ---*/ |
rjwalsh | 7109a8c | 2004-09-02 00:31:02 +0000 | [diff] [blame] | 4 | /*--- core.h ---*/ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 5 | /*--------------------------------------------------------------------*/ |
njn | ed6b824 | 2005-06-01 00:03:17 +0000 | [diff] [blame] | 6 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 7 | /* |
njn | b9c427c | 2004-12-01 14:14:42 +0000 | [diff] [blame] | 8 | This file is part of Valgrind, a dynamic binary instrumentation |
| 9 | framework. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 10 | |
njn | 5361242 | 2005-03-12 16:22:54 +0000 | [diff] [blame] | 11 | Copyright (C) 2000-2005 Julian Seward |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 12 | jseward@acm.org |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 13 | |
| 14 | This program is free software; you can redistribute it and/or |
| 15 | modify it under the terms of the GNU General Public License as |
| 16 | published by the Free Software Foundation; either version 2 of the |
| 17 | License, or (at your option) any later version. |
| 18 | |
| 19 | This program is distributed in the hope that it will be useful, but |
| 20 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | General Public License for more details. |
| 23 | |
| 24 | You should have received a copy of the GNU General Public License |
| 25 | along with this program; if not, write to the Free Software |
| 26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 27 | 02111-1307, USA. |
| 28 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 29 | The GNU General Public License is contained in the file COPYING. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 30 | */ |
| 31 | |
rjwalsh | 7109a8c | 2004-09-02 00:31:02 +0000 | [diff] [blame] | 32 | #ifndef __CORE_H |
| 33 | #define __CORE_H |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 34 | |
nethercote | 1334313 | 2004-09-02 15:49:09 +0000 | [diff] [blame] | 35 | #include "tool.h" // tool stuff |
nethercote | bb4222b | 2004-09-10 17:42:11 +0000 | [diff] [blame] | 36 | #include "core_arch.h" // arch-specific stuff, eg. x86/core_arch.h |
nethercote | 8ff888f | 2004-11-17 17:11:45 +0000 | [diff] [blame] | 37 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 38 | #include "core_os.h" // OS-specific stuff, eg. linux/core_os.h |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 39 | |
njn | 278b3d6 | 2005-05-30 23:20:51 +0000 | [diff] [blame] | 40 | #include <setjmp.h> // for jmp_buf |
njn | d01fef7 | 2005-03-25 23:35:48 +0000 | [diff] [blame] | 41 | |
njn | 278b3d6 | 2005-05-30 23:20:51 +0000 | [diff] [blame] | 42 | #include "pub_core_mallocfree.h" // for type 'ArenaId' |
| 43 | #include "pub_core_scheduler.h" // for types 'ThreadState', 'ThreadArchState' |
njn | 4f6e370 | 2005-05-16 20:50:52 +0000 | [diff] [blame] | 44 | |
nethercote | 7be4725 | 2004-09-02 16:02:58 +0000 | [diff] [blame] | 45 | /* --------------------------------------------------------------------- |
njn | 14319cc | 2005-03-13 06:26:22 +0000 | [diff] [blame] | 46 | Global macros. |
nethercote | 7be4725 | 2004-09-02 16:02:58 +0000 | [diff] [blame] | 47 | ------------------------------------------------------------------ */ |
| 48 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 49 | /* Max length of a text fragment used to construct error messages. */ |
njn | 47b209a | 2005-03-25 23:47:16 +0000 | [diff] [blame] | 50 | #define VG_ERRTXT_LEN 4096 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 51 | |
nethercote | 80013e9 | 2004-09-05 20:39:51 +0000 | [diff] [blame] | 52 | /* --------------------------------------------------------------------- |
| 53 | Environment variables |
| 54 | ------------------------------------------------------------------ */ |
| 55 | |
| 56 | /* The directory we look for all our auxillary files in */ |
| 57 | #define VALGRINDLIB "VALGRINDLIB" |
| 58 | |
thughes | ad1c956 | 2004-06-26 11:27:52 +0000 | [diff] [blame] | 59 | /* Application-visible file descriptor limits */ |
| 60 | extern Int VG_(fd_soft_limit); |
| 61 | extern Int VG_(fd_hard_limit); |
fitzhardinge | f0046f2 | 2003-12-18 02:39:22 +0000 | [diff] [blame] | 62 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 63 | /* --------------------------------------------------------------------- |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 64 | Exports of vg_intercept.c |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 65 | ------------------------------------------------------------------ */ |
| 66 | |
njn | a91498f | 2005-05-11 22:32:39 +0000 | [diff] [blame] | 67 | /* These are the internal client request codes. The publically-visible |
| 68 | request codes are also defined in valgrind.h, and similar headers for |
| 69 | some tools. */ |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 70 | |
njn | a91498f | 2005-05-11 22:32:39 +0000 | [diff] [blame] | 71 | /* Get the tool's malloc-wrapping functions */ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 72 | #define VG_USERREQ__GET_MALLOCFUNCS 0x3030 |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 73 | |
fitzhardinge | 39de4b4 | 2003-10-31 07:12:21 +0000 | [diff] [blame] | 74 | /* Internal equivalent of VALGRIND_PRINTF . */ |
| 75 | #define VG_USERREQ__INTERNAL_PRINTF 0x3103 |
sewardj | 45b4b37 | 2002-04-16 22:50:32 +0000 | [diff] [blame] | 76 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 77 | /* Denote the finish of __libc_freeres_wrapper(). |
| 78 | A synonym for exit. */ |
| 79 | #define VG_USERREQ__LIBC_FREERES_DONE 0x3029 |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 80 | |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 81 | /* Intercept prefix stuff. See |
| 82 | coregrind/m_replace_malloc/vg_replace_malloc.c for details. |
| 83 | Unfortunately the "_vgi_" literal is also hardcoded in that file, so if |
| 84 | you change this one you must also change the other one. */ |
sewardj | 9ee81f5 | 2005-04-02 17:38:59 +0000 | [diff] [blame] | 85 | #define VG_INTERCEPT_PREFIX "_vgi_" |
| 86 | #define VG_INTERCEPT_PREFIX_LEN 5 |
rjwalsh | e4e779d | 2004-04-16 23:02:29 +0000 | [diff] [blame] | 87 | |
sewardj | 9ee81f5 | 2005-04-02 17:38:59 +0000 | [diff] [blame] | 88 | /* Not sure what these are for. Todo: clarify */ |
| 89 | #define VG_WRAPPER_PREFIX "_vgw_" |
| 90 | #define VG_WRAPPER_PREFIX_LEN 5 |
| 91 | #define VG_WRAPPER(name) _vgw_##name |
| 92 | #define VG_WRAPPER_ALIAS(name) "_vgw_" #name |
rjwalsh | e4e779d | 2004-04-16 23:02:29 +0000 | [diff] [blame] | 93 | |
njn | 4c79121 | 2003-05-02 17:53:54 +0000 | [diff] [blame] | 94 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 95 | /* --------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 96 | Exports of vg_mylibc.c |
| 97 | ------------------------------------------------------------------ */ |
| 98 | |
njn | ca0518d | 2004-11-26 19:34:36 +0000 | [diff] [blame] | 99 | // Useful for making failing stubs, when certain things haven't yet been |
| 100 | // implemented. |
njn | 50ae1a7 | 2005-04-08 23:28:23 +0000 | [diff] [blame] | 101 | #define I_die_here \ |
sewardj | 0ab10c4 | 2005-05-12 08:26:36 +0000 | [diff] [blame] | 102 | VG_(assert_fail) (/*isCore*//*BOGUS*/True, \ |
| 103 | "Unimplemented functionality", \ |
njn | 50ae1a7 | 2005-04-08 23:28:23 +0000 | [diff] [blame] | 104 | __FILE__, __LINE__, __PRETTY_FUNCTION__, \ |
| 105 | "valgrind", VG_BUGS_TO, "") |
njn | ca0518d | 2004-11-26 19:34:36 +0000 | [diff] [blame] | 106 | |
njn | 50ae1a7 | 2005-04-08 23:28:23 +0000 | [diff] [blame] | 107 | #define vg_assert(expr) \ |
| 108 | ((void) ((expr) ? 0 : \ |
| 109 | (VG_(assert_fail) (/*isCore*/True, VG_STRINGIFY(expr), \ |
| 110 | __FILE__, __LINE__, __PRETTY_FUNCTION__, \ |
| 111 | ""), \ |
| 112 | 0))) |
| 113 | |
| 114 | #define vg_assert2(expr, format, args...) \ |
| 115 | ((void) ((expr) ? 0 : \ |
| 116 | (VG_(assert_fail) (/*isCore*/True, VG_STRINGIFY(expr), \ |
| 117 | __FILE__, __LINE__, __PRETTY_FUNCTION__, \ |
| 118 | format, ##args), \ |
| 119 | 0))) |
| 120 | |
njn | e427a66 | 2002-10-02 11:08:25 +0000 | [diff] [blame] | 121 | __attribute__ ((__noreturn__)) |
| 122 | extern void VG_(core_panic) ( Char* str ); |
thughes | 5876d55 | 2004-09-26 18:44:06 +0000 | [diff] [blame] | 123 | __attribute__ ((__noreturn__)) |
njn | db13c4f | 2005-06-01 00:00:46 +0000 | [diff] [blame] | 124 | extern void VG_(core_panic_at) ( Char* str, Addr ip, Addr sp, Addr fp ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 125 | |
njn | 04e1698 | 2005-05-31 00:23:43 +0000 | [diff] [blame] | 126 | /* Called when some unhandleable client behaviour is detected. |
| 127 | Prints a msg and aborts. */ |
| 128 | extern void VG_(unimplemented) ( Char* msg ) |
| 129 | __attribute__((__noreturn__)); |
| 130 | |
| 131 | /* Tell the logging mechanism whether we are logging to a file |
| 132 | descriptor or a socket descriptor. */ |
| 133 | extern Bool VG_(logging_to_socket); |
| 134 | |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 135 | /* Tools use VG_(strdup)() which doesn't expose ArenaId */ |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 136 | extern Char* VG_(arena_strdup) ( ArenaId aid, const Char* s); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 137 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 138 | extern Int VG_(fcntl) ( Int fd, Int cmd, Int arg ); |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 139 | extern Int VG_(poll)( struct vki_pollfd *, UInt nfds, Int timeout); |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 140 | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 141 | /* system/mman.h */ |
njn | 7df470b | 2005-05-29 18:46:38 +0000 | [diff] [blame] | 142 | extern void* VG_(mmap) ( void* start, SizeT length, UInt prot, UInt flags, |
| 143 | UInt sf_flags, UInt fd, OffT offset ); |
| 144 | extern void* VG_(mmap_native)( void* start, SizeT length, UInt prot, UInt flags, |
| 145 | UInt fd, OffT offset ); |
| 146 | extern Int VG_(munmap) ( void* start, SizeT length ); |
| 147 | extern Int VG_(mprotect) ( void *start, SizeT length, UInt prot ); |
sewardj | 79048ce | 2005-02-18 08:28:32 +0000 | [diff] [blame] | 148 | extern Int VG_(mprotect_native)( void *start, SizeT length, UInt prot ); |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 149 | |
| 150 | |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 151 | /* Move an fd into the Valgrind-safe range */ |
| 152 | Int VG_(safe_fd)(Int oldfd); |
| 153 | |
sewardj | 570f890 | 2002-11-03 11:44:36 +0000 | [diff] [blame] | 154 | extern Int VG_(write_socket)( Int sd, void *msg, Int count ); |
sewardj | 73cf3bc | 2002-11-03 03:20:15 +0000 | [diff] [blame] | 155 | |
| 156 | /* --- Connecting over the network --- */ |
| 157 | extern Int VG_(connect_via_socket)( UChar* str ); |
| 158 | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 159 | /* Environment manipulations */ |
nethercote | 60a96c5 | 2004-08-03 13:08:31 +0000 | [diff] [blame] | 160 | extern Char **VG_(env_setenv) ( Char ***envp, const Char* varname, |
| 161 | const Char *val ); |
| 162 | extern void VG_(env_unsetenv) ( Char **env, const Char *varname ); |
| 163 | extern void VG_(env_remove_valgrind_env_stuff) ( Char** env ); |
sewardj | 570f890 | 2002-11-03 11:44:36 +0000 | [diff] [blame] | 164 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 165 | extern void VG_(nanosleep)(struct vki_timespec *); |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 166 | |
sewardj | 570f890 | 2002-11-03 11:44:36 +0000 | [diff] [blame] | 167 | /* --------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 168 | Exports of vg_syscall.S |
| 169 | ------------------------------------------------------------------ */ |
| 170 | |
njn | ca6fef0 | 2004-11-29 16:49:18 +0000 | [diff] [blame] | 171 | // We use a full prototype rather than "..." here to ensure that all |
| 172 | // arguments get converted to a UWord appropriately. Not doing so can |
| 173 | // cause problems when passing 32-bit integers on 64-bit platforms, because |
| 174 | // the top 32-bits might not be zeroed appropriately, eg. as would happen |
| 175 | // with the 6th arg on AMD64 which is passed on the stack. |
njn | f4aeaea | 2004-11-29 17:33:31 +0000 | [diff] [blame] | 176 | extern Word VG_(do_syscall) ( UInt, UWord, UWord, UWord, UWord, UWord, UWord ); |
njn | ca6fef0 | 2004-11-29 16:49:18 +0000 | [diff] [blame] | 177 | |
| 178 | // Macros make life easier. |
| 179 | #define vgPlain_do_syscall0(s) VG_(do_syscall)((s),0,0,0,0,0,0) |
| 180 | #define vgPlain_do_syscall1(s,a) VG_(do_syscall)((s),(a),0,0,0,0,0) |
| 181 | #define vgPlain_do_syscall2(s,a,b) VG_(do_syscall)((s),(a),(b),0,0,0,0) |
| 182 | #define vgPlain_do_syscall3(s,a,b,c) VG_(do_syscall)((s),(a),(b),(c),0,0,0) |
| 183 | #define vgPlain_do_syscall4(s,a,b,c,d) VG_(do_syscall)((s),(a),(b),(c),(d),0,0) |
| 184 | #define vgPlain_do_syscall5(s,a,b,c,d,e) VG_(do_syscall)((s),(a),(b),(c),(d),(e),0) |
| 185 | #define vgPlain_do_syscall6(s,a,b,c,d,e,f) VG_(do_syscall)((s),(a),(b),(c),(d),(e),(f)) |
| 186 | |
fitzhardinge | 4f10ada | 2004-06-03 10:00:42 +0000 | [diff] [blame] | 187 | extern void VG_(sigreturn)(void); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 188 | |
| 189 | /* --------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 190 | Exports of vg_helpers.S |
| 191 | ------------------------------------------------------------------ */ |
| 192 | |
fitzhardinge | 9236079 | 2003-12-24 10:11:11 +0000 | [diff] [blame] | 193 | /* Information about trampoline code (for signal return and syscalls) */ |
| 194 | extern const Char VG_(trampoline_code_start); |
| 195 | extern const Int VG_(trampoline_code_length); |
| 196 | extern const Int VG_(tramp_sigreturn_offset); |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 197 | extern const Int VG_(tramp_rt_sigreturn_offset); |
fitzhardinge | 9236079 | 2003-12-24 10:11:11 +0000 | [diff] [blame] | 198 | extern const Int VG_(tramp_syscall_offset); |
tom | ee0bcbf | 2005-05-02 10:28:42 +0000 | [diff] [blame] | 199 | extern const Int VG_(tramp_gettimeofday_offset); |
| 200 | extern const Int VG_(tramp_time_offset); |
njn | 3c00878 | 2005-05-31 22:15:14 +0000 | [diff] [blame] | 201 | |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 202 | // --------------------------------------------------------------------- |
| 203 | // Architecture-specific things defined in eg. x86/*.c |
| 204 | // --------------------------------------------------------------------- |
| 205 | |
sewardj | 51ac087 | 2004-12-21 01:20:49 +0000 | [diff] [blame] | 206 | // Returns the architecture and subarchitecture, or indicates |
| 207 | // that this subarchitecture is unable to run Valgrind |
| 208 | // Returns False to indicate we cannot proceed further. |
sewardj | 51ac087 | 2004-12-21 01:20:49 +0000 | [diff] [blame] | 209 | extern Bool VGA_(getArchAndSubArch)( /*OUT*/VexArch*, |
| 210 | /*OUT*/VexSubArch* ); |
njn | cf45fd4 | 2004-11-24 16:30:22 +0000 | [diff] [blame] | 211 | // Accessors for the ThreadArchState |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 212 | #define INSTR_PTR(regs) ((regs).vex.VGA_INSTR_PTR) |
| 213 | #define STACK_PTR(regs) ((regs).vex.VGA_STACK_PTR) |
| 214 | #define FRAME_PTR(regs) ((regs).vex.VGA_FRAME_PTR) |
| 215 | #define CLREQ_ARGS(regs) ((regs).vex.VGA_CLREQ_ARGS) |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 216 | #define CLREQ_RET(regs) ((regs).vex.VGA_CLREQ_RET) |
njn | 16de557 | 2004-11-27 14:27:21 +0000 | [diff] [blame] | 217 | // Offsets for the Vex state |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 218 | #define O_STACK_PTR (offsetof(VexGuestArchState, VGA_STACK_PTR)) |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 219 | #define O_CLREQ_RET (offsetof(VexGuestArchState, VGA_CLREQ_RET)) |
njn | cf45fd4 | 2004-11-24 16:30:22 +0000 | [diff] [blame] | 220 | |
| 221 | |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 222 | // Setting up the initial thread (1) state |
| 223 | extern void |
| 224 | VGA_(init_thread1state) ( Addr client_eip, |
| 225 | Addr esp_at_startup, |
| 226 | /*MOD*/ ThreadArchState* arch ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 227 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 228 | // OS/Platform-specific thread clear (after thread exit) |
sewardj | 1d88711 | 2005-05-30 21:44:08 +0000 | [diff] [blame] | 229 | extern void VGO_(os_state_clear)(ThreadState *); |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 230 | |
| 231 | // OS/Platform-specific thread init (at scheduler init time) |
sewardj | 1d88711 | 2005-05-30 21:44:08 +0000 | [diff] [blame] | 232 | extern void VGO_(os_state_init)(ThreadState *); |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 233 | |
sewardj | 1d88711 | 2005-05-30 21:44:08 +0000 | [diff] [blame] | 234 | // Run a thread from beginning to end. |
| 235 | extern VgSchedReturnCode VGO_(thread_wrapper)(Word /*ThreadId*/ tid); |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 236 | |
sewardj | 1d88711 | 2005-05-30 21:44:08 +0000 | [diff] [blame] | 237 | // Call here to exit the entire Valgrind system. |
| 238 | extern void VGO_(terminate_NORETURN)(ThreadId tid, VgSchedReturnCode src); |
| 239 | |
| 240 | // Allocates a stack for the first thread, then runs it, |
| 241 | // as if the thread had been set up by clone() |
| 242 | extern void VGP_(main_thread_wrapper_NORETURN)(ThreadId tid); |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 243 | |
| 244 | // Return how many bytes of a thread's Valgrind stack are unused |
sewardj | 1d88711 | 2005-05-30 21:44:08 +0000 | [diff] [blame] | 245 | extern SSizeT VGA_(stack_unused)(ThreadId tid); |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 246 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 247 | // wait until all other threads are dead |
| 248 | extern void VGA_(reap_threads)(ThreadId self); |
| 249 | |
| 250 | // handle an arch-specific client request |
| 251 | extern Bool VGA_(client_request)(ThreadId tid, UWord *args); |
| 252 | |
nethercote | fedd810 | 2004-09-13 15:19:34 +0000 | [diff] [blame] | 253 | // For attaching the debugger |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 254 | extern Int VGA_(ptrace_setregs_from_tst) ( Int pid, ThreadArchState* arch ); |
nethercote | fedd810 | 2004-09-13 15:19:34 +0000 | [diff] [blame] | 255 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 256 | // Used by leakcheck |
| 257 | extern void VGA_(mark_from_registers)(ThreadId tid, void (*marker)(Addr)); |
| 258 | |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 259 | // Set up the libc freeres wrapper |
| 260 | extern void VGA_(intercept_libc_freeres_wrapper)(Addr); |
| 261 | |
| 262 | // Clean up the client by calling before the final reports |
| 263 | extern void VGA_(final_tidyup)(ThreadId tid); |
| 264 | |
| 265 | // Arch-specific client requests |
| 266 | extern Bool VGA_(client_requests)(ThreadId tid, UWord *args); |
| 267 | |
nethercote | 9b3c765 | 2004-10-19 13:18:00 +0000 | [diff] [blame] | 268 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 269 | ///* --------------------------------------------------------------------- |
| 270 | // Thread modelling |
| 271 | // ------------------------------------------------------------------ */ |
| 272 | //extern void VG_(tm_thread_create) (ThreadId creator, ThreadId tid, Bool detached); |
| 273 | //extern void VG_(tm_thread_exit) (ThreadId tid); |
| 274 | //extern Bool VG_(tm_thread_exists) (ThreadId tid); |
| 275 | //extern void VG_(tm_thread_detach) (ThreadId tid); |
| 276 | //extern void VG_(tm_thread_join) (ThreadId joiner, ThreadId joinee); |
| 277 | //extern void VG_(tm_thread_switchto)(ThreadId tid); |
| 278 | // |
| 279 | //extern void VG_(tm_mutex_init) (ThreadId tid, Addr mutexp); |
| 280 | //extern void VG_(tm_mutex_destroy)(ThreadId tid, Addr mutexp); |
| 281 | //extern void VG_(tm_mutex_trylock)(ThreadId tid, Addr mutexp); |
| 282 | //extern void VG_(tm_mutex_giveup) (ThreadId tid, Addr mutexp); |
| 283 | //extern void VG_(tm_mutex_acquire)(ThreadId tid, Addr mutexp); |
| 284 | //extern void VG_(tm_mutex_tryunlock)(ThreadId tid, Addr mutexp); |
| 285 | //extern void VG_(tm_mutex_unlock) (ThreadId tid, Addr mutexp); |
| 286 | //extern Bool VG_(tm_mutex_exists) (Addr mutexp); |
| 287 | // |
| 288 | //extern UInt VG_(tm_error_update_extra) (Error *err); |
| 289 | //extern Bool VG_(tm_error_equal) (VgRes res, Error *e1, Error *e2); |
| 290 | //extern void VG_(tm_error_print) (Error *err); |
| 291 | // |
| 292 | //extern void VG_(tm_init) (); |
| 293 | // |
| 294 | //extern void VG_(tm_cond_init) (ThreadId tid, Addr condp); |
| 295 | //extern void VG_(tm_cond_destroy) (ThreadId tid, Addr condp); |
| 296 | //extern void VG_(tm_cond_wait) (ThreadId tid, Addr condp, Addr mutexp); |
| 297 | //extern void VG_(tm_cond_wakeup) (ThreadId tid, Addr condp, Addr mutexp); |
| 298 | //extern void VG_(tm_cond_signal) (ThreadId tid, Addr condp); |
| 299 | // |
| 300 | ///* ----- pthreads ----- */ |
| 301 | //extern void VG_(pthread_init) (); |
| 302 | //extern void VG_(pthread_startfunc_wrapper)(Addr wrapper); |
| 303 | // |
| 304 | //struct vg_pthread_newthread_data { |
| 305 | // void *(*startfunc)(void *arg); |
| 306 | // void *arg; |
| 307 | //}; |
sewardj | 3b2736a | 2002-03-24 12:18:35 +0000 | [diff] [blame] | 308 | |
| 309 | /* --------------------------------------------------------------------- |
| 310 | Finally - autoconf-generated settings |
| 311 | ------------------------------------------------------------------ */ |
| 312 | |
| 313 | #include "config.h" |
| 314 | |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 315 | #endif /* ndef __CORE_H */ |
| 316 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 317 | /*--------------------------------------------------------------------*/ |
nethercote | 109d0df | 2004-09-02 08:10:13 +0000 | [diff] [blame] | 318 | /*--- end ---*/ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 319 | /*--------------------------------------------------------------------*/ |