blob: aadc697d2048ae3f2f095a84860f1c5d5456c2b8 [file] [log] [blame]
sewardjde4a1d02002-03-22 01:27:54 +00001
2/*--------------------------------------------------------------------*/
njn25e49d8e72002-09-23 09:36:25 +00003/*--- A header file for all private parts of Valgrind's core. ---*/
sewardjde4a1d02002-03-22 01:27:54 +00004/*--- Include no other! ---*/
5/*--- vg_include.h ---*/
6/*--------------------------------------------------------------------*/
7
8/*
9 This file is part of Valgrind, an x86 protected-mode emulator
10 designed for debugging and profiling binaries on x86-Unixes.
11
12 Copyright (C) 2000-2002 Julian Seward
13 jseward@acm.org
sewardjde4a1d02002-03-22 01:27:54 +000014
15 This program is free software; you can redistribute it and/or
16 modify it under the terms of the GNU General Public License as
17 published by the Free Software Foundation; either version 2 of the
18 License, or (at your option) any later version.
19
20 This program is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
28 02111-1307, USA.
29
njn25e49d8e72002-09-23 09:36:25 +000030 The GNU General Public License is contained in the file COPYING.
sewardjde4a1d02002-03-22 01:27:54 +000031*/
32
33#ifndef __VG_INCLUDE_H
34#define __VG_INCLUDE_H
35
sewardjde4a1d02002-03-22 01:27:54 +000036/* ---------------------------------------------------------------------
sewardj2d94c112002-06-03 01:25:54 +000037 Where to send bug reports to.
38 ------------------------------------------------------------------ */
39
40#define VG_EMAIL_ADDR "jseward@acm.org"
41
42
43/* ---------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +000044 Build options and table sizes. You should be able to change these
45 options or sizes, recompile, and still have a working system.
46 ------------------------------------------------------------------ */
47
48#include "vg_constants.h"
49
njn25e49d8e72002-09-23 09:36:25 +000050/* All stuff visible to core and skins goes in vg_skin.h. Things visible
51 * to core but private to skins go here. */
52#include "vg_skin.h"
sewardjde4a1d02002-03-22 01:27:54 +000053
54/* Total number of spill slots available for allocation, if a TempReg
55 doesn't make it into a RealReg. Just bomb the entire system if
56 this value is too small; we don't expect it will ever get
57 particularly high. */
58#define VG_MAX_SPILLSLOTS 24
59
60
61/* Constants for the slow translation lookup cache. */
62#define VG_TRANSTAB_SLOW_BITS 11
63#define VG_TRANSTAB_SLOW_SIZE (1 << VG_TRANSTAB_SLOW_BITS)
64#define VG_TRANSTAB_SLOW_MASK ((VG_TRANSTAB_SLOW_SIZE) - 1)
65
66/* Size of a buffer used for creating messages. */
67#define M_VG_MSGBUF 10000
68
69/* Size of a smallish table used to read /proc/self/map entries. */
sewardjebc82332002-04-24 14:44:23 +000070#define M_PROCMAP_BUF 50000
sewardjde4a1d02002-03-22 01:27:54 +000071
72/* Max length of pathname to a .so/executable file. */
73#define M_VG_LIBNAMESTR 100
74
75/* Max length of a text fragment used to construct error messages. */
76#define M_VG_ERRTXT 512
77
78/* Max length of the string copied from env var VG_ARGS at startup. */
79#define M_VG_CMDLINE_STRLEN 1000
80
81/* Max number of options for Valgrind which we can handle. */
82#define M_VG_CMDLINE_OPTS 100
83
84/* After this many different unsuppressed errors have been observed,
85 be more conservative about collecting new ones. */
86#define M_VG_COLLECT_ERRORS_SLOWLY_AFTER 50
87
88/* After this many different unsuppressed errors have been observed,
89 stop collecting errors at all, and tell the user their program is
90 evidently a steaming pile of camel dung. */
sewardj1bebcbf2002-04-24 21:24:18 +000091#define M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN 300
sewardjf2537be2002-04-24 21:03:47 +000092
93/* After this many total errors have been observed, stop collecting
94 errors at all. Counterpart to M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN. */
sewardj1bebcbf2002-04-24 21:24:18 +000095#define M_VG_COLLECT_NO_ERRORS_AFTER_FOUND 30000
sewardjde4a1d02002-03-22 01:27:54 +000096
sewardjde4a1d02002-03-22 01:27:54 +000097/* The maximum number of calls we're prepared to save in a
98 backtrace. */
99#define VG_DEEPEST_BACKTRACE 50
100
101/* Number of lists in which we keep track of malloc'd but not free'd
102 blocks. Should be prime. */
103#define VG_N_MALLOCLISTS 997
104
105/* Number of lists in which we keep track of ExeContexts. Should be
106 prime. */
107#define VG_N_EC_LISTS /*997*/ 4999
108
sewardj2e93c502002-04-12 11:12:52 +0000109/* Defines the thread-scheduling timeslice, in terms of the number of
110 basic blocks we attempt to run each thread for. Smaller values
111 give finer interleaving but much increased scheduling overheads. */
sewardj4505b9e2002-05-28 11:27:31 +0000112#define VG_SCHEDULING_QUANTUM 50000
sewardj2e93c502002-04-12 11:12:52 +0000113
sewardj2e93c502002-04-12 11:12:52 +0000114/* Number of file descriptors that can simultaneously be waited on for
115 I/O to complete. Perhaps this should be the same as VG_N_THREADS
116 (surely a thread can't wait on more than one fd at once?. Who
117 knows.) */
118#define VG_N_WAITING_FDS 10
119
sewardjbf290b92002-05-01 02:28:01 +0000120/* Stack size for a thread. We try and check that they do not go
121 beyond it. */
sewardjf0b06452002-06-04 08:38:04 +0000122#define VG_PTHREAD_STACK_SIZE (1 << 20)
sewardjbf290b92002-05-01 02:28:01 +0000123
sewardj20917d82002-05-28 01:36:45 +0000124/* Number of entries in the semaphore-remapping table. */
125#define VG_N_SEMAPHORES 50
126
127/* Number of entries in the rwlock-remapping table. */
sewardj89745a52002-09-27 01:04:29 +0000128#define VG_N_RWLOCKS 500
sewardj20917d82002-05-28 01:36:45 +0000129
sewardj8ad94e12002-05-29 00:10:20 +0000130/* Number of entries in each thread's cleanup stack. */
131#define VG_N_CLEANUPSTACK 8
132
sewardj2cb00342002-06-28 01:46:26 +0000133/* Number of entries in each thread's fork-handler stack. */
134#define VG_N_FORKHANDLERSTACK 2
135
njn25e49d8e72002-09-23 09:36:25 +0000136/* Max number of callers for context in a suppression. */
137#define VG_N_SUPP_CALLERS 4
138
sewardjde4a1d02002-03-22 01:27:54 +0000139
140/* ---------------------------------------------------------------------
141 Basic types
142 ------------------------------------------------------------------ */
143
sewardjde4a1d02002-03-22 01:27:54 +0000144/* Just pray that gcc's constant folding works properly ... */
145#define BITS(bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0) \
146 ( ((bit7) << 7) | ((bit6) << 6) | ((bit5) << 5) | ((bit4) << 4) \
147 | ((bit3) << 3) | ((bit2) << 2) | ((bit1) << 1) | (bit0))
148
sewardjde4a1d02002-03-22 01:27:54 +0000149/* ---------------------------------------------------------------------
150 Command-line-settable options
151 ------------------------------------------------------------------ */
152
sewardjde4a1d02002-03-22 01:27:54 +0000153#define VG_CLO_MAX_SFILES 10
154
sewardj72f98ff2002-06-13 17:23:38 +0000155/* Should we stop collecting errors if too many appear? default: YES */
sewardj2e432902002-06-13 20:44:00 +0000156extern Bool VG_(clo_error_limit);
sewardjde4a1d02002-03-22 01:27:54 +0000157/* Enquire about whether to attach to GDB at errors? default: NO */
158extern Bool VG_(clo_GDB_attach);
159/* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
160extern Int VG_(sanity_level);
sewardjde4a1d02002-03-22 01:27:54 +0000161/* Automatically attempt to demangle C++ names? default: YES */
162extern Bool VG_(clo_demangle);
sewardjde4a1d02002-03-22 01:27:54 +0000163/* Round malloc sizes upwards to integral number of words? default:
164 NO */
165extern Bool VG_(clo_sloppy_malloc);
sewardj246d4662002-06-14 10:17:05 +0000166/* Minimum alignment in functions that don't specify alignment explicitly.
167 default: 0, i.e. use default of the machine (== 4) */
168extern Int VG_(clo_alignment);
sewardjde4a1d02002-03-22 01:27:54 +0000169/* Simulate child processes? default: NO */
170extern Bool VG_(clo_trace_children);
171/* The file id on which we send all messages. default: 2 (stderr). */
172extern Int VG_(clo_logfile_fd);
sewardjde4a1d02002-03-22 01:27:54 +0000173
174/* The number of suppression files specified. */
175extern Int VG_(clo_n_suppressions);
176/* The names of the suppression files. */
177extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
178
179/* Single stepping? default: NO */
180extern Bool VG_(clo_single_step);
181/* Code improvement? default: YES */
182extern Bool VG_(clo_optimise);
njn25e49d8e72002-09-23 09:36:25 +0000183/* DEBUG: print generated code? default: 00000 ( == NO ) */
184extern Bool VG_(clo_trace_codegen);
sewardjde4a1d02002-03-22 01:27:54 +0000185/* DEBUG: print system calls? default: NO */
186extern Bool VG_(clo_trace_syscalls);
187/* DEBUG: print signal details? default: NO */
188extern Bool VG_(clo_trace_signals);
189/* DEBUG: print symtab details? default: NO */
190extern Bool VG_(clo_trace_symtab);
191/* DEBUG: print malloc details? default: NO */
192extern Bool VG_(clo_trace_malloc);
sewardj8937c812002-04-12 20:12:20 +0000193/* DEBUG: print thread scheduling events? default: NO */
194extern Bool VG_(clo_trace_sched);
sewardj45b4b372002-04-16 22:50:32 +0000195/* DEBUG: print pthread (mutex etc) events? default: 0 (none), 1
196 (some), 2 (all) */
197extern Int VG_(clo_trace_pthread_level);
sewardjde4a1d02002-03-22 01:27:54 +0000198/* Stop after this many basic blocks. default: Infinity. */
199extern ULong VG_(clo_stop_after);
200/* Display gory details for the k'th most popular error. default:
201 Infinity. */
202extern Int VG_(clo_dump_error);
203/* Number of parents of a backtrace. Default: 8. */
204extern Int VG_(clo_backtrace_size);
sewardj3984b852002-05-12 03:00:17 +0000205/* Engage miscellaneous wierd hacks needed for some progs. */
sewardj8d365b52002-05-12 10:52:16 +0000206extern Char* VG_(clo_weird_hacks);
sewardjde4a1d02002-03-22 01:27:54 +0000207
208
209/* ---------------------------------------------------------------------
210 Debugging and profiling stuff
211 ------------------------------------------------------------------ */
212
njn25e49d8e72002-09-23 09:36:25 +0000213/* Change to 1 to get more accurate but more expensive core profiling. */
214#if 0
215# define VGP_ACCURATE_PROFILING
216#endif
217
sewardjde4a1d02002-03-22 01:27:54 +0000218/* Create a logfile into which messages can be dumped. */
219extern void VG_(startup_logging) ( void );
njn25e49d8e72002-09-23 09:36:25 +0000220extern void VG_(shutdown_logging)( void );
sewardjde4a1d02002-03-22 01:27:54 +0000221
222extern void VGP_(init_profiling) ( void );
223extern void VGP_(done_profiling) ( void );
sewardjde4a1d02002-03-22 01:27:54 +0000224
njn25e49d8e72002-09-23 09:36:25 +0000225#undef VGP_PUSHCC
226#undef VGP_POPCC
227#define VGP_PUSHCC(x) if (VG_(clo_profile)) VGP_(pushcc)(x)
228#define VGP_POPCC(x) if (VG_(clo_profile)) VGP_(popcc)(x)
sewardjde4a1d02002-03-22 01:27:54 +0000229
njn25e49d8e72002-09-23 09:36:25 +0000230/* Use this for ones that happen a lot and thus we don't want to put in
231 all the time, eg. for %esp assignment. */
232#ifdef VGP_ACCURATE_PROFILING
233# define VGP_MAYBE_PUSHCC(x) if (VG_(clo_profile)) VGP_(pushcc)(x)
234# define VGP_MAYBE_POPCC(x) if (VG_(clo_profile)) VGP_(popcc)(x)
sewardjde4a1d02002-03-22 01:27:54 +0000235#else
njn25e49d8e72002-09-23 09:36:25 +0000236# define VGP_MAYBE_PUSHCC(x)
237# define VGP_MAYBE_POPCC(x)
238#endif
sewardjde4a1d02002-03-22 01:27:54 +0000239
240
241/* ---------------------------------------------------------------------
242 Exports of vg_malloc2.c
243 ------------------------------------------------------------------ */
244
245/* Allocation arenas.
njn25e49d8e72002-09-23 09:36:25 +0000246 CORE is for the core's general use.
247 SKIN is for the skin to use (and the only one it uses).
sewardjde4a1d02002-03-22 01:27:54 +0000248 SYMTAB is for Valgrind's symbol table storage.
njn25e49d8e72002-09-23 09:36:25 +0000249 JITTER is for small storage during translation.
sewardjde4a1d02002-03-22 01:27:54 +0000250 CLIENT is for the client's mallocs/frees.
251 DEMANGLE is for the C++ demangler.
252 EXECTXT is for storing ExeContexts.
njn25e49d8e72002-09-23 09:36:25 +0000253 ERRORS is for storing CoreErrors.
sewardjde4a1d02002-03-22 01:27:54 +0000254 TRANSIENT is for very short-term use. It should be empty
255 in between uses.
njn25e49d8e72002-09-23 09:36:25 +0000256 When adding a new arena, remember also to add it to ensure_mm_init().
sewardjde4a1d02002-03-22 01:27:54 +0000257*/
258typedef Int ArenaId;
259
njn25e49d8e72002-09-23 09:36:25 +0000260#define VG_N_ARENAS 9
sewardjde4a1d02002-03-22 01:27:54 +0000261
njn25e49d8e72002-09-23 09:36:25 +0000262#define VG_AR_CORE 0 /* :: ArenaId */
263#define VG_AR_SKIN 1 /* :: ArenaId */
264#define VG_AR_SYMTAB 2 /* :: ArenaId */
265#define VG_AR_JITTER 3 /* :: ArenaId */
266#define VG_AR_CLIENT 4 /* :: ArenaId */
267#define VG_AR_DEMANGLE 5 /* :: ArenaId */
268#define VG_AR_EXECTXT 6 /* :: ArenaId */
269#define VG_AR_ERRORS 7 /* :: ArenaId */
270#define VG_AR_TRANSIENT 8 /* :: ArenaId */
sewardjde4a1d02002-03-22 01:27:54 +0000271
njn25e49d8e72002-09-23 09:36:25 +0000272extern void* VG_(arena_malloc) ( ArenaId arena, Int nbytes );
273extern void VG_(arena_free) ( ArenaId arena, void* ptr );
274extern void* VG_(arena_calloc) ( ArenaId arena, Int nmemb, Int nbytes );
275extern void* VG_(arena_realloc) ( ArenaId arena, void* ptr, Int alignment,
276 Int size );
277extern void* VG_(arena_malloc_aligned) ( ArenaId aid, Int req_alignB,
sewardjde4a1d02002-03-22 01:27:54 +0000278 Int req_pszB );
279
sewardjde4a1d02002-03-22 01:27:54 +0000280extern void VG_(mallocSanityCheckAll) ( void );
281
282extern void VG_(show_all_arena_stats) ( void );
283extern Bool VG_(is_empty_arena) ( ArenaId aid );
284
285
286/* The red-zone size for the client. This can be arbitrary, but
287 unfortunately must be set at compile time. */
288#define VG_AR_CLIENT_REDZONE_SZW 4
289
290#define VG_AR_CLIENT_REDZONE_SZB \
291 (VG_AR_CLIENT_REDZONE_SZW * VKI_BYTES_PER_WORD)
292
293
294/* ---------------------------------------------------------------------
njn25e49d8e72002-09-23 09:36:25 +0000295 Exports of vg_clientfuncs.c
sewardj2e93c502002-04-12 11:12:52 +0000296 ------------------------------------------------------------------ */
297
298/* This doesn't export code or data that valgrind.so needs to link
299 against. However, the scheduler does need to know the following
300 request codes. A few, publically-visible, request codes are also
njn25e49d8e72002-09-23 09:36:25 +0000301 defined in valgrind.h, and similar headers for some skins. */
sewardj2e93c502002-04-12 11:12:52 +0000302
303#define VG_USERREQ__MALLOC 0x2001
304#define VG_USERREQ__BUILTIN_NEW 0x2002
305#define VG_USERREQ__BUILTIN_VEC_NEW 0x2003
306
307#define VG_USERREQ__FREE 0x2004
308#define VG_USERREQ__BUILTIN_DELETE 0x2005
309#define VG_USERREQ__BUILTIN_VEC_DELETE 0x2006
310
311#define VG_USERREQ__CALLOC 0x2007
312#define VG_USERREQ__REALLOC 0x2008
313#define VG_USERREQ__MEMALIGN 0x2009
314
315
sewardj20917d82002-05-28 01:36:45 +0000316/* (Fn, Arg): Create a new thread and run Fn applied to Arg in it. Fn
317 MUST NOT return -- ever. Eventually it will do either __QUIT or
318 __WAIT_JOINER. */
319#define VG_USERREQ__APPLY_IN_NEW_THREAD 0x3001
320
321/* ( no-args ): calling thread disappears from the system forever.
322 Reclaim resources. */
323#define VG_USERREQ__QUIT 0x3002
324
325/* ( void* ): calling thread waits for joiner and returns the void* to
326 it. */
327#define VG_USERREQ__WAIT_JOINER 0x3003
328
329/* ( ThreadId, void** ): wait to join a thread. */
330#define VG_USERREQ__PTHREAD_JOIN 0x3004
331
332/* Set cancellation state and type for this thread. */
333#define VG_USERREQ__SET_CANCELSTATE 0x3005
334#define VG_USERREQ__SET_CANCELTYPE 0x3006
335
336/* ( no-args ): Test if we are at a cancellation point. */
337#define VG_USERREQ__TESTCANCEL 0x3007
338
339/* ( ThreadId, &thread_exit_wrapper is the only allowable arg ): call
340 with this arg to indicate that a cancel is now pending for the
341 specified thread. */
342#define VG_USERREQ__SET_CANCELPEND 0x3008
343
344/* Set/get detach state for this thread. */
345#define VG_USERREQ__SET_OR_GET_DETACH 0x3009
346
347#define VG_USERREQ__PTHREAD_GET_THREADID 0x300B
348#define VG_USERREQ__PTHREAD_MUTEX_LOCK 0x300C
349#define VG_USERREQ__PTHREAD_MUTEX_TRYLOCK 0x300D
350#define VG_USERREQ__PTHREAD_MUTEX_UNLOCK 0x300E
351#define VG_USERREQ__PTHREAD_COND_WAIT 0x300F
352#define VG_USERREQ__PTHREAD_COND_TIMEDWAIT 0x3010
353#define VG_USERREQ__PTHREAD_COND_SIGNAL 0x3011
354#define VG_USERREQ__PTHREAD_COND_BROADCAST 0x3012
355#define VG_USERREQ__PTHREAD_KEY_CREATE 0x3013
356#define VG_USERREQ__PTHREAD_KEY_DELETE 0x3014
357#define VG_USERREQ__PTHREAD_SETSPECIFIC 0x3015
358#define VG_USERREQ__PTHREAD_GETSPECIFIC 0x3016
359#define VG_USERREQ__READ_MILLISECOND_TIMER 0x3017
360#define VG_USERREQ__PTHREAD_SIGMASK 0x3018
361#define VG_USERREQ__SIGWAIT 0x3019
362#define VG_USERREQ__PTHREAD_KILL 0x301A
363#define VG_USERREQ__PTHREAD_YIELD 0x301B
sewardj2e93c502002-04-12 11:12:52 +0000364
sewardj8ad94e12002-05-29 00:10:20 +0000365#define VG_USERREQ__CLEANUP_PUSH 0x3020
366#define VG_USERREQ__CLEANUP_POP 0x3021
sewardj870497a2002-05-29 01:06:47 +0000367#define VG_USERREQ__GET_KEY_D_AND_S 0x3022
sewardj8ad94e12002-05-29 00:10:20 +0000368
sewardjef037c72002-05-30 00:40:03 +0000369#define VG_USERREQ__NUKE_OTHER_THREADS 0x3023
sewardjefbfcdf2002-06-19 17:35:45 +0000370
371/* Ask how many signal handler returns have happened to this
372 thread. */
sewardj9a2224b2002-06-19 10:17:40 +0000373#define VG_USERREQ__GET_N_SIGS_RETURNED 0x3024
sewardjef037c72002-05-30 00:40:03 +0000374
sewardj2cb00342002-06-28 01:46:26 +0000375/* Get/set entries for a thread's pthread_atfork stack. */
376#define VG_USERREQ__SET_FHSTACK_USED 0x3025
377#define VG_USERREQ__GET_FHSTACK_USED 0x3026
378#define VG_USERREQ__SET_FHSTACK_ENTRY 0x3027
379#define VG_USERREQ__GET_FHSTACK_ENTRY 0x3028
sewardjefbfcdf2002-06-19 17:35:45 +0000380
sewardj1fe7b002002-07-16 01:43:15 +0000381/* Denote the finish of VG_(__libc_freeres_wrapper). */
382#define VG_USERREQ__LIBC_FREERES_DONE 0x3029
383
sewardj45b4b372002-04-16 22:50:32 +0000384/* Cosmetic ... */
385#define VG_USERREQ__GET_PTHREAD_TRACE_LEVEL 0x3101
sewardj4dced352002-06-04 22:54:20 +0000386/* Log a pthread error from client-space. Cosmetic. */
387#define VG_USERREQ__PTHREAD_ERROR 0x3102
sewardj45b4b372002-04-16 22:50:32 +0000388
sewardj54cacf02002-04-12 23:24:59 +0000389/*
390In vg_constants.h:
391#define VG_USERREQ__SIGNAL_RETURNS 0x4001
sewardj54cacf02002-04-12 23:24:59 +0000392*/
393
sewardj1fe7b002002-07-16 01:43:15 +0000394/* The scheduler does need to know the address of it so it can be
395 called at program exit. */
396extern void VG_(__libc_freeres_wrapper)( void );
397
sewardj54cacf02002-04-12 23:24:59 +0000398
sewardj2e93c502002-04-12 11:12:52 +0000399/* ---------------------------------------------------------------------
400 Constants pertaining to the simulated CPU state, VG_(baseBlock),
401 which need to go here to avoid ugly circularities.
402 ------------------------------------------------------------------ */
403
404/* How big is the saved FPU state? */
405#define VG_SIZE_OF_FPUSTATE 108
406/* ... and in words ... */
407#define VG_SIZE_OF_FPUSTATE_W ((VG_SIZE_OF_FPUSTATE+3)/4)
408
409
410/* ---------------------------------------------------------------------
411 Exports of vg_scheduler.c
412 ------------------------------------------------------------------ */
413
sewardj2e93c502002-04-12 11:12:52 +0000414typedef
415 enum {
416 VgTs_Empty, /* this slot is not in use */
417 VgTs_Runnable, /* waiting to be scheduled */
418 VgTs_WaitJoiner, /* waiting for someone to do join on me */
419 VgTs_WaitJoinee, /* waiting for the thread I did join on */
420 VgTs_WaitFD, /* waiting for I/O completion on a fd */
421 VgTs_WaitMX, /* waiting on a mutex */
sewardj3b5d8862002-04-20 13:53:23 +0000422 VgTs_WaitCV, /* waiting on a condition variable */
sewardjb48e5002002-05-13 00:16:03 +0000423 VgTs_WaitSIG, /* waiting due to sigwait() */
sewardj2e93c502002-04-12 11:12:52 +0000424 VgTs_Sleeping /* sleeping for a while */
425 }
426 ThreadStatus;
sewardj8ad94e12002-05-29 00:10:20 +0000427
428/* An entry in a threads's cleanup stack. */
429typedef
430 struct {
431 void (*fn)(void*);
432 void* arg;
433 }
434 CleanupEntry;
sewardj2cb00342002-06-28 01:46:26 +0000435
436/* An entry in a thread's fork-handler stack. */
437typedef
438 struct {
439 void (*prepare)(void);
440 void (*parent)(void);
441 void (*child)(void);
442 }
443 ForkHandlerEntry;
444
445
njn25e49d8e72002-09-23 09:36:25 +0000446struct _ThreadState {
447 /* ThreadId == 0 (and hence vg_threads[0]) is NEVER USED.
448 The thread identity is simply the index in vg_threads[].
449 ThreadId == 1 is the root thread and has the special property
450 that we don't try and allocate or deallocate its stack. For
451 convenience of generating error message, we also put the
452 ThreadId in this tid field, but be aware that it should
453 ALWAYS == the index in vg_threads[]. */
454 ThreadId tid;
sewardj2e93c502002-04-12 11:12:52 +0000455
njn25e49d8e72002-09-23 09:36:25 +0000456 /* Current scheduling status.
sewardj5f07b662002-04-23 16:52:51 +0000457
njn25e49d8e72002-09-23 09:36:25 +0000458 Complications: whenever this is set to VgTs_WaitMX, you
459 should also set .m_edx to whatever the required return value
460 is for pthread_mutex_lock / pthread_cond_timedwait for when
461 the mutex finally gets unblocked. */
462 ThreadStatus status;
sewardj2e93c502002-04-12 11:12:52 +0000463
njn25e49d8e72002-09-23 09:36:25 +0000464 /* When .status == WaitMX, points to the mutex I am waiting for.
465 When .status == WaitCV, points to the mutex associated with
466 the condition variable indicated by the .associated_cv field.
467 In all other cases, should be NULL. */
468 void* /*pthread_mutex_t* */ associated_mx;
sewardj3b5d8862002-04-20 13:53:23 +0000469
njn25e49d8e72002-09-23 09:36:25 +0000470 /* When .status == WaitCV, points to the condition variable I am
471 waiting for. In all other cases, should be NULL. */
472 void* /*pthread_cond_t* */ associated_cv;
sewardj2e93c502002-04-12 11:12:52 +0000473
njn25e49d8e72002-09-23 09:36:25 +0000474 /* If VgTs_Sleeping, this is when we should wake up, measured in
475 milliseconds as supplied by VG_(read_millisecond_counter).
sewardj2e93c502002-04-12 11:12:52 +0000476
njn25e49d8e72002-09-23 09:36:25 +0000477 If VgTs_WaitCV, this indicates the time at which
478 pthread_cond_timedwait should wake up. If == 0xFFFFFFFF,
479 this means infinitely far in the future, viz,
480 pthread_cond_wait. */
481 UInt awaken_at;
sewardj20917d82002-05-28 01:36:45 +0000482
njn25e49d8e72002-09-23 09:36:25 +0000483 /* If VgTs_WaitJoiner, return value, as generated by joinees. */
484 void* joinee_retval;
sewardj20917d82002-05-28 01:36:45 +0000485
njn25e49d8e72002-09-23 09:36:25 +0000486 /* If VgTs_WaitJoinee, place to copy the return value to, and
487 the identity of the thread we're waiting for. */
488 void** joiner_thread_return;
489 ThreadId joiner_jee_tid;
sewardj8ad94e12002-05-29 00:10:20 +0000490
njn25e49d8e72002-09-23 09:36:25 +0000491 /* Whether or not detached. */
492 Bool detached;
sewardj20917d82002-05-28 01:36:45 +0000493
njn25e49d8e72002-09-23 09:36:25 +0000494 /* Cancelability state and type. */
495 Bool cancel_st; /* False==PTH_CANCEL_DISABLE; True==.._ENABLE */
496 Bool cancel_ty; /* False==PTH_CANC_ASYNCH; True==..._DEFERRED */
497
498 /* Pointer to fn to call to do cancellation. Indicates whether
499 or not cancellation is pending. If NULL, not pending. Else
500 should be &thread_exit_wrapper(), indicating that
501 cancallation is pending. */
502 void (*cancel_pend)(void*);
sewardj2e93c502002-04-12 11:12:52 +0000503
njn25e49d8e72002-09-23 09:36:25 +0000504 /* The cleanup stack. */
505 Int custack_used;
506 CleanupEntry custack[VG_N_CLEANUPSTACK];
sewardj5f07b662002-04-23 16:52:51 +0000507
njn25e49d8e72002-09-23 09:36:25 +0000508 /* thread-specific data */
509 void* specifics[VG_N_THREAD_KEYS];
sewardjb48e5002002-05-13 00:16:03 +0000510
njn25e49d8e72002-09-23 09:36:25 +0000511 /* This thread's blocked-signals mask. Semantics is that for a
512 signal to be delivered to this thread, the signal must not be
513 blocked by either the process-wide signal mask nor by this
514 one. So, if this thread is prepared to handle any signal that
515 the process as a whole is prepared to handle, this mask should
516 be made empty -- and that it is its default, starting
517 state. */
518 vki_ksigset_t sig_mask;
sewardjb48e5002002-05-13 00:16:03 +0000519
njn25e49d8e72002-09-23 09:36:25 +0000520 /* When not VgTs_WaitSIG, has no meaning. When VgTs_WaitSIG,
521 is the set of signals for which we are sigwait()ing. */
522 vki_ksigset_t sigs_waited_for;
sewardj9a2224b2002-06-19 10:17:40 +0000523
njn25e49d8e72002-09-23 09:36:25 +0000524 /* Counts the number of times a signal handler for this thread
525 has returned. This makes it easy to implement pause(), by
526 polling this value, of course interspersed with nanosleeps,
527 and waiting till it changes. */
528 UInt n_signals_returned;
sewardj2e93c502002-04-12 11:12:52 +0000529
njn25e49d8e72002-09-23 09:36:25 +0000530 /* Stacks. When a thread slot is freed, we don't deallocate its
531 stack; we just leave it lying around for the next use of the
532 slot. If the next use of the slot requires a larger stack,
533 only then is the old one deallocated and a new one
534 allocated.
sewardj2e93c502002-04-12 11:12:52 +0000535
njn25e49d8e72002-09-23 09:36:25 +0000536 For the main thread (threadid == 0), this mechanism doesn't
537 apply. We don't know the size of the stack since we didn't
538 allocate it, and furthermore we never reallocate it. */
sewardj2e93c502002-04-12 11:12:52 +0000539
njn25e49d8e72002-09-23 09:36:25 +0000540 /* The allocated size of this thread's stack (permanently zero
541 if this is ThreadId == 0, since we didn't allocate its stack) */
542 UInt stack_size;
sewardj1e8cdc92002-04-18 11:37:52 +0000543
njn25e49d8e72002-09-23 09:36:25 +0000544 /* Address of the lowest word in this thread's stack. NULL means
545 not allocated yet.
546 */
547 Addr stack_base;
sewardj2e93c502002-04-12 11:12:52 +0000548
njn25e49d8e72002-09-23 09:36:25 +0000549 /* Address of the highest legitimate word in this stack. This is
550 used for error messages only -- not critical for execution
551 correctness. Is is set for all stacks, specifically including
552 ThreadId == 0 (the main thread). */
553 Addr stack_highest_word;
554
555 /* Saved machine context. */
556 UInt m_eax;
557 UInt m_ebx;
558 UInt m_ecx;
559 UInt m_edx;
560 UInt m_esi;
561 UInt m_edi;
562 UInt m_ebp;
563 UInt m_esp;
564 UInt m_eflags;
565 UInt m_eip;
566 UInt m_fpu[VG_SIZE_OF_FPUSTATE_W];
567
568 UInt sh_eax;
569 UInt sh_ebx;
570 UInt sh_ecx;
571 UInt sh_edx;
572 UInt sh_esi;
573 UInt sh_edi;
574 UInt sh_ebp;
575 UInt sh_esp;
576 UInt sh_eflags;
577};
sewardj2e93c502002-04-12 11:12:52 +0000578
579
sewardj018f7622002-05-15 21:13:39 +0000580/* The thread table. */
581extern ThreadState VG_(threads)[VG_N_THREADS];
582
583/* Check that tid is in range and denotes a non-Empty thread. */
sewardjb48e5002002-05-13 00:16:03 +0000584extern Bool VG_(is_valid_tid) ( ThreadId tid );
585
sewardj018f7622002-05-15 21:13:39 +0000586/* Check that tid is in range. */
587extern Bool VG_(is_valid_or_empty_tid) ( ThreadId tid );
588
sewardj2e93c502002-04-12 11:12:52 +0000589/* Copy the specified thread's state into VG_(baseBlock) in
590 preparation for running it. */
591extern void VG_(load_thread_state)( ThreadId );
592
593/* Save the specified thread's state back in VG_(baseBlock), and fill
594 VG_(baseBlock) with junk, for sanity-check reasons. */
595extern void VG_(save_thread_state)( ThreadId );
596
sewardj1e8cdc92002-04-18 11:37:52 +0000597/* And for the currently running one, if valid. */
598extern ThreadState* VG_(get_current_thread_state) ( void );
sewardj2e93c502002-04-12 11:12:52 +0000599
sewardj1e8cdc92002-04-18 11:37:52 +0000600/* Similarly ... */
601extern ThreadId VG_(get_current_tid) ( void );
602
sewardjccef2e62002-05-29 19:26:32 +0000603/* Nuke all threads except tid. */
604extern void VG_(nuke_all_threads_except) ( ThreadId me );
605
sewardj2e93c502002-04-12 11:12:52 +0000606
607/* Return codes from the scheduler. */
608typedef
sewardj7e87e382002-05-03 19:09:05 +0000609 enum {
610 VgSrc_Deadlock, /* no runnable threads and no prospect of any
611 even if we wait for a long time */
612 VgSrc_ExitSyscall, /* client called exit(). This is the normal
613 route out. */
614 VgSrc_BbsDone /* In a debugging run, the specified number of
615 bbs has been completed. */
616 }
sewardj2e93c502002-04-12 11:12:52 +0000617 VgSchedReturnCode;
618
sewardj7e87e382002-05-03 19:09:05 +0000619
sewardj2e93c502002-04-12 11:12:52 +0000620/* The scheduler. */
621extern VgSchedReturnCode VG_(scheduler) ( void );
622
623extern void VG_(scheduler_init) ( void );
624
sewardj15a43e12002-04-17 19:35:12 +0000625extern void VG_(pp_sched_status) ( void );
sewardj2e93c502002-04-12 11:12:52 +0000626
627/* vg_oursignalhandler() might longjmp(). Here's the jmp_buf. */
628extern jmp_buf VG_(scheduler_jmpbuf);
sewardj872051c2002-07-13 12:12:56 +0000629/* This says whether scheduler_jmpbuf is actually valid. Needed so
630 that our signal handler doesn't longjmp when the buffer isn't
631 actually valid. */
632extern Bool VG_(scheduler_jmpbuf_valid);
sewardj2e93c502002-04-12 11:12:52 +0000633/* ... and if so, here's the signal which caused it to do so. */
634extern Int VG_(longjmpd_on_signal);
635
636
sewardja1679dd2002-05-10 22:31:40 +0000637/* Possible places where the main stack might be based. We check that
638 the initial stack, which we can't move, is allocated here.
639 VG_(scheduler_init) checks this. Andrea Archelangi's 2.4 kernels
640 have been rumoured to start stacks at 0x80000000, so that too is
njn25e49d8e72002-09-23 09:36:25 +0000641 considered. It seems systems with longer uptimes tend to to use
642 stacks which start at 0x40000000 sometimes. JRS 2002-Aug-21: I
643 also have reports of stacks starting at 0xE0000000.*/
644
sewardja1679dd2002-05-10 22:31:40 +0000645#define VG_STARTUP_STACK_BASE_1 (Addr)0xC0000000
646#define VG_STARTUP_STACK_BASE_2 (Addr)0x80000000
daywalkera2562202002-07-15 19:39:51 +0000647#define VG_STARTUP_STACK_BASE_3 (Addr)0x40000000
njn25e49d8e72002-09-23 09:36:25 +0000648#define VG_STARTUP_STACK_BASE_4 (Addr)0xE0000000
sewardja1679dd2002-05-10 22:31:40 +0000649#define VG_STARTUP_STACK_SMALLERTHAN 0x100000 /* 1024k */
650
651#define VG_STACK_MATCHES_BASE(zzstack, zzbase) \
652 ( \
653 ((zzstack) & ((zzbase) - VG_STARTUP_STACK_SMALLERTHAN)) \
654 == \
655 ((zzbase) - VG_STARTUP_STACK_SMALLERTHAN) \
656 )
sewardj2e93c502002-04-12 11:12:52 +0000657
658
659/* The red-zone size which we put at the bottom (highest address) of
660 thread stacks, for paranoia reasons. This can be arbitrary, and
661 doesn't really need to be set at compile time. */
662#define VG_AR_CLIENT_STACKBASE_REDZONE_SZW 4
663
664#define VG_AR_CLIENT_STACKBASE_REDZONE_SZB \
665 (VG_AR_CLIENT_STACKBASE_REDZONE_SZW * VKI_BYTES_PER_WORD)
666
njn25e49d8e72002-09-23 09:36:25 +0000667/* Junk to fill up a thread's shadow regs with when shadow regs aren't
668 * being used. */
669#define VG_UNUSED_SHADOW_REG_VALUE 0x27182818
670
671/* What we set a shadow register to when written by SET_EAX and similar
672 * things. */
673extern UInt VG_(written_shadow_reg);
sewardj2e93c502002-04-12 11:12:52 +0000674
sewardj018f7622002-05-15 21:13:39 +0000675/* Write a value to the client's %EDX (request return value register)
676 and set the shadow to indicate it is defined. */
njn25e49d8e72002-09-23 09:36:25 +0000677#define SET_EDX(zztid, zzval) \
678 do { VG_(threads)[zztid].m_edx = (zzval); \
679 VG_(threads)[zztid].sh_edx = VG_(written_shadow_reg); \
sewardj018f7622002-05-15 21:13:39 +0000680 } while (0)
681
njn25e49d8e72002-09-23 09:36:25 +0000682#define SET_EAX(zztid, zzval) \
683 do { VG_(threads)[zztid].m_eax = (zzval); \
684 VG_(threads)[zztid].sh_eax = VG_(written_shadow_reg); \
sewardj018f7622002-05-15 21:13:39 +0000685 } while (0)
686
sewardj2e93c502002-04-12 11:12:52 +0000687
688/* ---------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +0000689 Exports of vg_signals.c
690 ------------------------------------------------------------------ */
691
sewardjde4a1d02002-03-22 01:27:54 +0000692extern void VG_(sigstartup_actions) ( void );
693
sewardjb48e5002002-05-13 00:16:03 +0000694extern Bool VG_(deliver_signals) ( void );
sewardjde4a1d02002-03-22 01:27:54 +0000695extern void VG_(unblock_host_signal) ( Int sigNo );
sewardj018f7622002-05-15 21:13:39 +0000696extern void VG_(handle_SCSS_change) ( Bool force_update );
697
sewardjde4a1d02002-03-22 01:27:54 +0000698
699/* Fake system calls for signal handling. */
sewardj2342c972002-05-22 23:34:20 +0000700extern void VG_(do__NR_sigaltstack) ( ThreadId tid );
sewardj2e93c502002-04-12 11:12:52 +0000701extern void VG_(do__NR_sigaction) ( ThreadId tid );
sewardj018f7622002-05-15 21:13:39 +0000702extern void VG_(do__NR_sigprocmask) ( ThreadId tid,
703 Int how,
704 vki_ksigset_t* set,
705 vki_ksigset_t* oldset );
706extern void VG_(do_pthread_sigmask_SCSS_upd) ( ThreadId tid,
707 Int how,
708 vki_ksigset_t* set,
709 vki_ksigset_t* oldset );
710extern void VG_(send_signal_to_thread) ( ThreadId thread,
711 Int signo );
sewardjde4a1d02002-03-22 01:27:54 +0000712
sewardjefbfcdf2002-06-19 17:35:45 +0000713extern void VG_(do_sigpending) ( ThreadId tid, vki_ksigset_t* set );
714
715
sewardj2e93c502002-04-12 11:12:52 +0000716/* Modify the current thread's state once we have detected it is
717 returning from a signal handler. */
sewardj77e466c2002-04-14 02:29:29 +0000718extern Bool VG_(signal_returns) ( ThreadId );
sewardjde4a1d02002-03-22 01:27:54 +0000719
sewardj2e93c502002-04-12 11:12:52 +0000720/* Handy utilities to block/restore all host signals. */
721extern void VG_(block_all_host_signals)
722 ( /* OUT */ vki_ksigset_t* saved_mask );
sewardj018f7622002-05-15 21:13:39 +0000723extern void VG_(restore_all_host_signals)
sewardj2e93c502002-04-12 11:12:52 +0000724 ( /* IN */ vki_ksigset_t* saved_mask );
sewardjde4a1d02002-03-22 01:27:54 +0000725
726/* ---------------------------------------------------------------------
727 Exports of vg_mylibc.c
728 ------------------------------------------------------------------ */
729
njn25e49d8e72002-09-23 09:36:25 +0000730__attribute__((noreturn))
731extern void VG_(skin_error) ( Char* s );
sewardjde4a1d02002-03-22 01:27:54 +0000732
njn25e49d8e72002-09-23 09:36:25 +0000733/* VG_(brk) not public so skins cannot screw with curr_dataseg_end */
734extern void* VG_(brk) ( void* end_data_segment );
sewardjde4a1d02002-03-22 01:27:54 +0000735
njn25e49d8e72002-09-23 09:36:25 +0000736/* Skins use VG_(strdup)() which doesn't expose ArenaId */
737extern Char* VG_(arena_strdup) ( ArenaId aid, const Char* s);
sewardjde4a1d02002-03-22 01:27:54 +0000738
njn25e49d8e72002-09-23 09:36:25 +0000739/* Skins shouldn't need these...(?) */
sewardj5f07b662002-04-23 16:52:51 +0000740extern void VG_(start_rdtsc_calibration) ( void );
741extern void VG_(end_rdtsc_calibration) ( void );
742extern UInt VG_(read_millisecond_timer) ( void );
sewardjde4a1d02002-03-22 01:27:54 +0000743
njn25e49d8e72002-09-23 09:36:25 +0000744extern Int VG_(fcntl) ( Int fd, Int cmd, Int arg );
sewardj2e93c502002-04-12 11:12:52 +0000745extern Int VG_(select)( Int n,
746 vki_fd_set* readfds,
747 vki_fd_set* writefds,
748 vki_fd_set* exceptfds,
749 struct vki_timeval * timeout );
750extern Int VG_(nanosleep)( const struct vki_timespec *req,
751 struct vki_timespec *rem );
752
sewardjde4a1d02002-03-22 01:27:54 +0000753/* ---------------------------------------------------------------------
754 Definitions for the JITter (vg_translate.c, vg_to_ucode.c,
755 vg_from_ucode.c).
756 ------------------------------------------------------------------ */
757
sewardjde4a1d02002-03-22 01:27:54 +0000758#define VG_IS_FLAG_SUBSET(set1,set2) \
759 (( ((FlagSet)set1) & ((FlagSet)set2) ) == ((FlagSet)set1) )
760
761#define VG_UNION_FLAG_SETS(set1,set2) \
762 ( ((FlagSet)set1) | ((FlagSet)set2) )
763
sewardjde4a1d02002-03-22 01:27:54 +0000764/* ---------------------------------------------------------------------
765 Exports of vg_demangle.c
766 ------------------------------------------------------------------ */
767
768extern void VG_(demangle) ( Char* orig, Char* result, Int result_size );
769
sewardjde4a1d02002-03-22 01:27:54 +0000770/* ---------------------------------------------------------------------
771 Exports of vg_from_ucode.c
772 ------------------------------------------------------------------ */
773
774extern UChar* VG_(emit_code) ( UCodeBlock* cb, Int* nbytes );
775
njn25e49d8e72002-09-23 09:36:25 +0000776extern void VG_(print_ccall_stats) ( void );
777extern void VG_(print_UInstr_histogram) ( void );
sewardjde4a1d02002-03-22 01:27:54 +0000778
779/* ---------------------------------------------------------------------
780 Exports of vg_to_ucode.c
781 ------------------------------------------------------------------ */
782
783extern Int VG_(disBB) ( UCodeBlock* cb, Addr eip0 );
sewardjde4a1d02002-03-22 01:27:54 +0000784
785/* ---------------------------------------------------------------------
786 Exports of vg_translate.c
787 ------------------------------------------------------------------ */
788
sewardj1e8cdc92002-04-18 11:37:52 +0000789extern void VG_(translate) ( ThreadState* tst,
790 Addr orig_addr,
sewardjde4a1d02002-03-22 01:27:54 +0000791 UInt* orig_size,
792 Addr* trans_addr,
793 UInt* trans_size );
794
njn25e49d8e72002-09-23 09:36:25 +0000795extern Char* VG_(nameCondcode) ( Condcode cond );
796extern Bool VG_(saneUInstr) ( Bool beforeRA, Bool beforeLiveness,
797 UInstr* u );
798extern void VG_(saneUCodeBlock) ( UCodeBlock* cb );
799extern Bool VG_(saneUCodeBlockCalls) ( UCodeBlock* cb );
sewardjde4a1d02002-03-22 01:27:54 +0000800
801/* ---------------------------------------------------------------------
802 Exports of vg_execontext.c.
803 ------------------------------------------------------------------ */
804
805/* Records the PC and a bit of the call chain. The first 4 %eip
806 values are used in comparisons do remove duplicate errors, and for
807 comparing against suppression specifications. The rest are purely
808 informational (but often important). */
809
njn25e49d8e72002-09-23 09:36:25 +0000810struct _ExeContext {
811 struct _ExeContext * next;
812 /* Variable-length array. The size is VG_(clo_backtrace_size); at
813 least 2, at most VG_DEEPEST_BACKTRACE. [0] is the current %eip,
814 [1] is its caller, [2] is the caller of [1], etc. */
815 Addr eips[0];
816};
sewardjde4a1d02002-03-22 01:27:54 +0000817
818
819/* Initialise the ExeContext storage mechanism. */
820extern void VG_(init_ExeContext_storage) ( void );
821
822/* Print stats (informational only). */
823extern void VG_(show_ExeContext_stats) ( void );
824
njn25e49d8e72002-09-23 09:36:25 +0000825/* Like VG_(get_ExeContext), but with a slightly different type */
826extern ExeContext* VG_(get_ExeContext2) ( Addr eip, Addr ebp,
827 Addr ebp_min, Addr ebp_max );
sewardjde4a1d02002-03-22 01:27:54 +0000828
829
830/* ---------------------------------------------------------------------
831 Exports of vg_errcontext.c.
832 ------------------------------------------------------------------ */
833
njn25e49d8e72002-09-23 09:36:25 +0000834/* Note: it is imperative this doesn't overlap with (0..) at all, as skins
835 * effectively extend it by defining their own enums in the (0..) range. */
sewardjde4a1d02002-03-22 01:27:54 +0000836typedef
njn25e49d8e72002-09-23 09:36:25 +0000837 enum {
838 PThreadSupp = -1, /* Matches PThreadErr */
sewardjde4a1d02002-03-22 01:27:54 +0000839 }
njn25e49d8e72002-09-23 09:36:25 +0000840 CoreSuppKind;
841
842/* For each caller specified for a suppression, record the nature of
843 the caller name. Not of interest to skins. */
844typedef
845 enum {
846 ObjName, /* Name is of an shared object file. */
847 FunName /* Name is of a function. */
848 }
849 SuppLocTy;
850
851/* Suppressions. Skin part `SkinSupp' (which is all skins have to deal
852 with) is in vg_skin.h */
853typedef
854 struct _CoreSupp {
855 struct _CoreSupp* next;
856 /* The number of times this error has been suppressed. */
857 Int count;
858 /* The name by which the suppression is referred to. */
859 Char* sname;
860 /* First two (name of fn where err occurs, and immediate caller)
861 * are mandatory; extra two are optional. */
862 SuppLocTy caller_ty[VG_N_SUPP_CALLERS];
863 Char* caller [VG_N_SUPP_CALLERS];
864 /* The skin-specific part */
865 SkinSupp skin_supp;
866 }
867 CoreSupp;
868
869/* Note: it is imperative this doesn't overlap with (0..) at all, as skins
870 * effectively extend it by defining their own enums in the (0..) range. */
871typedef
872 enum {
873 PThreadErr = -1, /* Pthreading error */
874 }
875 CoreErrorKind;
876
877/* Errors. Skin part `SkinError' (which is all skins have to deal
878 with) is in vg_skin.h */
879typedef
880 struct _CoreErrContext {
881 struct _CoreErrContext* next;
882 /* NULL if unsuppressed; or ptr to suppression record. */
883 CoreSupp* supp;
884 Int count;
885 ExeContext* where;
886 ThreadId tid;
887 /* These record %EIP, %ESP and %EBP at the error point. They
888 are only used to make GDB-attaching convenient; there is no
889 other purpose; specifically they are not used to do
890 comparisons between errors. */
891 UInt m_eip;
892 UInt m_esp;
893 UInt m_ebp;
894 /* The skin-specific part */
895 SkinError skin_err;
896 }
897 CoreError;
sewardjde4a1d02002-03-22 01:27:54 +0000898
899
njn25e49d8e72002-09-23 09:36:25 +0000900extern void VG_(load_suppressions) ( void );
sewardjde4a1d02002-03-22 01:27:54 +0000901
njn25e49d8e72002-09-23 09:36:25 +0000902extern void VG_(record_pthread_error) ( ThreadId tid, Char* msg );
sewardjde4a1d02002-03-22 01:27:54 +0000903
njn25e49d8e72002-09-23 09:36:25 +0000904extern void VG_(show_all_errors) ( void );
sewardjde4a1d02002-03-22 01:27:54 +0000905
906/* ---------------------------------------------------------------------
907 Exports of vg_procselfmaps.c
908 ------------------------------------------------------------------ */
909
910extern
911void VG_(read_procselfmaps) (
912 void (*record_mapping)( Addr, UInt, Char, Char, Char, UInt, UChar* )
913);
914
915
916/* ---------------------------------------------------------------------
917 Exports of vg_symtab2.c
918 ------------------------------------------------------------------ */
919
920/* We assume the executable is loaded here ... can't really find
njn25e49d8e72002-09-23 09:36:25 +0000921 out. There is a hacky sanity check in VG_(init_memory)()
sewardjde4a1d02002-03-22 01:27:54 +0000922 which should trip up most stupidities.
923*/
924#define VG_ASSUMED_EXE_BASE (Addr)0x8048000
925
njn25e49d8e72002-09-23 09:36:25 +0000926extern void VG_(maybe_read_symbols) ( void );
927extern void VG_(read_symtab_callback) ( Addr start, UInt size,
928 Char rr, Char ww, Char xx,
929 UInt foffset, UChar* filename );
930extern void VG_(maybe_unload_symbols) ( Addr start, UInt length );
sewardjde4a1d02002-03-22 01:27:54 +0000931
njn25e49d8e72002-09-23 09:36:25 +0000932extern Bool VG_(get_fnname_nodemangle)( Addr a, Char* fnname, Int n_fnname );
933extern void VG_(mini_stack_dump) ( ExeContext* ec );
sewardjde4a1d02002-03-22 01:27:54 +0000934
935
936/* ---------------------------------------------------------------------
937 Exports of vg_clientmalloc.c
938 ------------------------------------------------------------------ */
939
njn25e49d8e72002-09-23 09:36:25 +0000940extern void VG_(client_malloc_init)();
sewardjde4a1d02002-03-22 01:27:54 +0000941
sewardj2e93c502002-04-12 11:12:52 +0000942/* These are called from the scheduler, when it intercepts a user
943 request. */
sewardj8c824512002-04-14 04:16:48 +0000944extern void* VG_(client_malloc) ( ThreadState* tst,
945 UInt size, VgAllocKind kind );
946extern void* VG_(client_memalign) ( ThreadState* tst,
947 UInt align, UInt size );
948extern void VG_(client_free) ( ThreadState* tst,
949 void* ptrV, VgAllocKind kind );
950extern void* VG_(client_calloc) ( ThreadState* tst,
951 UInt nmemb, UInt size1 );
952extern void* VG_(client_realloc) ( ThreadState* tst,
953 void* ptrV, UInt size_new );
sewardjde4a1d02002-03-22 01:27:54 +0000954
955
956/* ---------------------------------------------------------------------
957 Exports of vg_main.c
958 ------------------------------------------------------------------ */
959
njn25e49d8e72002-09-23 09:36:25 +0000960/* Sanity checks which may be done at any time. The scheduler decides when. */
961extern void VG_(do_sanity_checks) ( Bool force_expensive );
962
sewardjde4a1d02002-03-22 01:27:54 +0000963/* A structure used as an intermediary when passing the simulated
964 CPU's state to some assembly fragments, particularly system calls.
965 Stuff is copied from baseBlock to here, the assembly magic runs,
njn25e49d8e72002-09-23 09:36:25 +0000966 and then the inverse copy is done.
967 */
sewardjde4a1d02002-03-22 01:27:54 +0000968extern UInt VG_(m_state_static) [8 /* int regs, in Intel order */
969 + 1 /* %eflags */
970 + 1 /* %eip */
971 + VG_SIZE_OF_FPUSTATE_W /* FPU state */
972 ];
973
974/* Handy fns for doing the copy back and forth. */
975extern void VG_(copy_baseBlock_to_m_state_static) ( void );
976extern void VG_(copy_m_state_static_to_baseBlock) ( void );
977
sewardjde4a1d02002-03-22 01:27:54 +0000978/* Called when some unhandleable client behaviour is detected.
979 Prints a msg and aborts. */
njn25e49d8e72002-09-23 09:36:25 +0000980extern void VG_(unimplemented) ( Char* msg )
981 __attribute__((__noreturn__));
sewardjcfc39b22002-05-08 01:58:18 +0000982extern void VG_(nvidia_moan) ( void );
sewardjde4a1d02002-03-22 01:27:54 +0000983
984/* The stack on which Valgrind runs. We can't use the same stack as the
985 simulatee -- that's an important design decision. */
986extern UInt VG_(stack)[10000];
987
njn25e49d8e72002-09-23 09:36:25 +0000988/* Similarly, we have to ask for signals to be delivered on an alternative
989 stack, since it is possible, although unlikely, that we'll have to run
990 client code from inside the Valgrind-installed signal handler. If this
991 happens it will be done by vg_deliver_signal_immediately(). */
sewardjde4a1d02002-03-22 01:27:54 +0000992extern UInt VG_(sigstack)[10000];
993
sewardjde4a1d02002-03-22 01:27:54 +0000994/* Holds client's %esp at the point we gained control. From this the
995 client's argc, argv and envp are deduced. */
996extern Addr VG_(esp_at_startup);
sewardjde4a1d02002-03-22 01:27:54 +0000997
njn25e49d8e72002-09-23 09:36:25 +0000998/* Remove valgrind.so and skin's .so from a LD_PRELOAD=... string so child
999 processes don't get traced into. Also mess up $libdir/valgrind so that
1000 our libpthread.so disappears from view. */
sewardj3e1eb1f2002-05-18 13:14:17 +00001001void VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) ( Char* ld_preload_str,
1002 Char* ld_library_path_str );
sewardjde4a1d02002-03-22 01:27:54 +00001003
1004/* Something of a function looking for a home ... start up GDB. This
1005 is called from VG_(swizzle_esp_then_start_GDB) and so runs on the
1006 *client's* stack. This is necessary to give GDB the illusion that
1007 the client program really was running on the real cpu. */
1008extern void VG_(start_GDB_whilst_on_client_stack) ( void );
1009
sewardjde4a1d02002-03-22 01:27:54 +00001010/* 64-bit counter for the number of basic blocks done. */
1011extern ULong VG_(bbs_done);
1012/* 64-bit counter for the number of bbs to go before a debug exit. */
1013extern ULong VG_(bbs_to_go);
1014
1015/* Counts downwards in vg_run_innerloop. */
1016extern UInt VG_(dispatch_ctr);
1017
sewardjde4a1d02002-03-22 01:27:54 +00001018/* Is the client running on the simulated CPU or the real one? */
1019extern Bool VG_(running_on_simd_CPU); /* Initially False */
1020
1021/* The current LRU epoch. */
1022extern UInt VG_(current_epoch);
1023
sewardj7e87e382002-05-03 19:09:05 +00001024/* This is the ThreadId of the last thread the scheduler ran. */
1025extern ThreadId VG_(last_run_tid);
1026
njn25e49d8e72002-09-23 09:36:25 +00001027/* This is the argument to __NR_exit() supplied by the first thread to
1028 call that syscall. We eventually pass that to __NR_exit() for
1029 real. */
1030extern UInt VG_(exitcode);
1031
sewardjde4a1d02002-03-22 01:27:54 +00001032
1033/* --- Counters, for informational purposes only. --- */
1034
1035/* Number of lookups which miss the fast tt helper. */
1036extern UInt VG_(tt_fast_misses);
1037
1038/* Counts for LRU informational messages. */
1039
1040/* Number and total o/t size of new translations this epoch. */
1041extern UInt VG_(this_epoch_in_count);
1042extern UInt VG_(this_epoch_in_osize);
1043extern UInt VG_(this_epoch_in_tsize);
1044/* Number and total o/t size of discarded translations this epoch. */
1045extern UInt VG_(this_epoch_out_count);
1046extern UInt VG_(this_epoch_out_osize);
1047extern UInt VG_(this_epoch_out_tsize);
1048/* Number and total o/t size of translations overall. */
1049extern UInt VG_(overall_in_count);
1050extern UInt VG_(overall_in_osize);
1051extern UInt VG_(overall_in_tsize);
1052/* Number and total o/t size of discards overall. */
1053extern UInt VG_(overall_out_count);
1054extern UInt VG_(overall_out_osize);
1055extern UInt VG_(overall_out_tsize);
1056
1057/* The number of LRU-clearings of TT/TC. */
1058extern UInt VG_(number_of_lrus);
1059
1060/* Counts pertaining to the register allocator. */
1061
1062/* total number of uinstrs input to reg-alloc */
1063extern UInt VG_(uinstrs_prealloc);
1064
1065/* total number of uinstrs added due to spill code */
1066extern UInt VG_(uinstrs_spill);
1067
1068/* number of bbs requiring spill code */
1069extern UInt VG_(translations_needing_spill);
1070
1071/* total of register ranks over all translations */
1072extern UInt VG_(total_reg_rank);
1073
sewardjde4a1d02002-03-22 01:27:54 +00001074/* Counts pertaining to internal sanity checking. */
1075extern UInt VG_(sanity_fast_count);
1076extern UInt VG_(sanity_slow_count);
1077
sewardj2e93c502002-04-12 11:12:52 +00001078/* Counts pertaining to the scheduler. */
1079extern UInt VG_(num_scheduling_events_MINOR);
1080extern UInt VG_(num_scheduling_events_MAJOR);
1081
sewardjde4a1d02002-03-22 01:27:54 +00001082
1083/* ---------------------------------------------------------------------
1084 Exports of vg_memory.c
1085 ------------------------------------------------------------------ */
1086
njn25e49d8e72002-09-23 09:36:25 +00001087extern void VG_(init_memory) ( void );
1088extern void VG_(new_exe_segment) ( Addr a, UInt len );
1089extern void VG_(remove_if_exe_segment) ( Addr a, UInt len );
sewardjde4a1d02002-03-22 01:27:54 +00001090
njn25e49d8e72002-09-23 09:36:25 +00001091/* Called from generated code. */
1092extern void VG_(handle_esp_assignment) ( Addr new_espA );
sewardjde4a1d02002-03-22 01:27:54 +00001093
1094/* Nasty kludgery to deal with applications which switch stacks,
1095 like netscape. */
sewardjde4a1d02002-03-22 01:27:54 +00001096#define VG_PLAUSIBLE_STACK_SIZE 8000000
1097
sewardjde4a1d02002-03-22 01:27:54 +00001098/* ---------------------------------------------------------------------
njn25e49d8e72002-09-23 09:36:25 +00001099 Exports of vg_syscalls.c
sewardjde4a1d02002-03-22 01:27:54 +00001100 ------------------------------------------------------------------ */
1101
njn25e49d8e72002-09-23 09:36:25 +00001102extern void VG_(init_dataseg_end_for_brk) ( void );
1103
sewardj2e93c502002-04-12 11:12:52 +00001104extern void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid );
sewardjde4a1d02002-03-22 01:27:54 +00001105
njn25e49d8e72002-09-23 09:36:25 +00001106extern void* VG_(pre_known_blocking_syscall) ( ThreadId tid, Int syscallno );
1107extern void VG_(post_known_blocking_syscall)( ThreadId tid, Int syscallno,
1108 void* pre_res, Int res );
sewardjde4a1d02002-03-22 01:27:54 +00001109
1110extern Bool VG_(is_kerror) ( Int res );
1111
njn25e49d8e72002-09-23 09:36:25 +00001112#define KERNEL_DO_SYSCALL(thread_id, result_lvalue) \
1113 VG_(load_thread_state)(thread_id); \
1114 VG_(copy_baseBlock_to_m_state_static)(); \
1115 VG_(do_syscall)(); \
1116 VG_(copy_m_state_static_to_baseBlock)(); \
1117 VG_(save_thread_state)(thread_id); \
1118 VG_(threads)[thread_id].sh_eax = VG_(written_shadow_reg);\
sewardj018f7622002-05-15 21:13:39 +00001119 result_lvalue = VG_(threads)[thread_id].m_eax;
sewardjde4a1d02002-03-22 01:27:54 +00001120
1121
1122/* ---------------------------------------------------------------------
1123 Exports of vg_transtab.c
1124 ------------------------------------------------------------------ */
1125
1126/* An entry in the translation table (TT). */
1127typedef
1128 struct {
1129 /* +0 */ Addr orig_addr;
1130 /* +4 */ Addr trans_addr;
1131 /* +8 */ UInt mru_epoch;
1132 /* +12 */ UShort orig_size;
1133 /* +14 */ UShort trans_size;
1134 }
1135 TTEntry;
1136
1137/* The number of basic blocks in an epoch (one age-step). */
1138#define VG_BBS_PER_EPOCH 20000
1139
njn25e49d8e72002-09-23 09:36:25 +00001140/* The fast-cache for tt-lookup. */
1141extern Addr VG_(tt_fast)[VG_TT_FAST_SIZE];
1142
sewardjde4a1d02002-03-22 01:27:54 +00001143extern void VG_(get_tt_tc_used) ( UInt* tt_used, UInt* tc_used );
1144extern void VG_(maybe_do_lru_pass) ( void );
1145extern void VG_(flush_transtab) ( void );
1146extern Addr VG_(copy_to_transcache) ( Addr trans_addr, Int trans_size );
1147extern void VG_(add_to_trans_tab) ( TTEntry* tte );
sewardj18d75132002-05-16 11:06:21 +00001148extern void VG_(invalidate_translations) ( Addr start, UInt range );
sewardjde4a1d02002-03-22 01:27:54 +00001149
sewardj18d75132002-05-16 11:06:21 +00001150extern void VG_(init_tt_tc) ( void );
sewardjde4a1d02002-03-22 01:27:54 +00001151
1152extern void VG_(sanity_check_tc_tt) ( void );
1153extern Addr VG_(search_transtab) ( Addr original_addr );
1154
1155extern void VG_(invalidate_tt_fast)( void );
1156
1157
1158/* ---------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001159 Exports of vg_syscall.S
1160 ------------------------------------------------------------------ */
1161
1162extern void VG_(do_syscall) ( void );
1163
1164
1165/* ---------------------------------------------------------------------
1166 Exports of vg_startup.S
1167 ------------------------------------------------------------------ */
1168
sewardjde4a1d02002-03-22 01:27:54 +00001169extern void VG_(switch_to_real_CPU) ( void );
1170
sewardj35805422002-04-21 13:05:34 +00001171extern void VG_(swizzle_esp_then_start_GDB) ( Addr m_eip_at_error,
1172 Addr m_esp_at_error,
1173 Addr m_ebp_at_error );
sewardjde4a1d02002-03-22 01:27:54 +00001174
1175
1176/* ---------------------------------------------------------------------
1177 Exports of vg_dispatch.S
1178 ------------------------------------------------------------------ */
1179
sewardj2e93c502002-04-12 11:12:52 +00001180/* Run a thread for a (very short) while, until some event happens
1181 which means we need to defer to the scheduler. */
1182extern UInt VG_(run_innerloop) ( void );
sewardjde4a1d02002-03-22 01:27:54 +00001183
1184
1185/* ---------------------------------------------------------------------
1186 Exports of vg_helpers.S
1187 ------------------------------------------------------------------ */
1188
sewardjde4a1d02002-03-22 01:27:54 +00001189/* Mul, div, etc, -- we don't codegen these directly. */
1190extern void VG_(helper_idiv_64_32);
1191extern void VG_(helper_div_64_32);
1192extern void VG_(helper_idiv_32_16);
1193extern void VG_(helper_div_32_16);
1194extern void VG_(helper_idiv_16_8);
1195extern void VG_(helper_div_16_8);
1196
1197extern void VG_(helper_imul_32_64);
1198extern void VG_(helper_mul_32_64);
1199extern void VG_(helper_imul_16_32);
1200extern void VG_(helper_mul_16_32);
1201extern void VG_(helper_imul_8_16);
1202extern void VG_(helper_mul_8_16);
1203
1204extern void VG_(helper_CLD);
1205extern void VG_(helper_STD);
1206extern void VG_(helper_get_dirflag);
1207
sewardj7d78e782002-06-02 00:04:00 +00001208extern void VG_(helper_CLC);
1209extern void VG_(helper_STC);
1210
sewardjde4a1d02002-03-22 01:27:54 +00001211extern void VG_(helper_shldl);
1212extern void VG_(helper_shldw);
1213extern void VG_(helper_shrdl);
1214extern void VG_(helper_shrdw);
1215
1216extern void VG_(helper_RDTSC);
1217extern void VG_(helper_CPUID);
1218
sewardjde4a1d02002-03-22 01:27:54 +00001219extern void VG_(helper_bsf);
1220extern void VG_(helper_bsr);
1221
1222extern void VG_(helper_fstsw_AX);
1223extern void VG_(helper_SAHF);
sewardj4d0ab1f2002-03-24 10:00:09 +00001224extern void VG_(helper_DAS);
sewardjfe8a1662002-03-24 11:54:07 +00001225extern void VG_(helper_DAA);
sewardjde4a1d02002-03-22 01:27:54 +00001226
sewardj20917d82002-05-28 01:36:45 +00001227/* NOT A FUNCTION; this is a bogus RETURN ADDRESS. */
sewardj54cacf02002-04-12 23:24:59 +00001228extern void VG_(signalreturn_bogusRA)( void );
sewardj20917d82002-05-28 01:36:45 +00001229
njn4f9c9342002-04-29 16:03:24 +00001230/* ---------------------------------------------------------------------
njn25e49d8e72002-09-23 09:36:25 +00001231 Things relating to the used skin
njn4f9c9342002-04-29 16:03:24 +00001232 ------------------------------------------------------------------ */
1233
njn25e49d8e72002-09-23 09:36:25 +00001234#define VG_TRACK(fn, args...) \
1235 do { \
1236 if (VG_(track_events).fn) \
1237 VG_(track_events).fn(args); \
1238 } while (0)
sewardj18d75132002-05-16 11:06:21 +00001239
1240
sewardjde4a1d02002-03-22 01:27:54 +00001241/* ---------------------------------------------------------------------
1242 The state of the simulated CPU.
1243 ------------------------------------------------------------------ */
1244
sewardjde4a1d02002-03-22 01:27:54 +00001245/* ---------------------------------------------------------------------
1246 Offsets into baseBlock for everything which needs to referred to
1247 from generated code. The order of these decls does not imply
1248 what the order of the actual offsets is. The latter is important
1249 and is set up in vg_main.c.
1250 ------------------------------------------------------------------ */
1251
1252/* An array of words. In generated code, %ebp always points to the
1253 start of this array. Useful stuff, like the simulated CPU state,
1254 and the addresses of helper functions, can then be found by
1255 indexing off %ebp. The following declares variables which, at
1256 startup time, are given values denoting offsets into baseBlock.
1257 These offsets are in *words* from the start of baseBlock. */
1258
1259#define VG_BASEBLOCK_WORDS 200
1260
1261extern UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS];
1262
1263
1264/* -----------------------------------------------------
1265 Read-write parts of baseBlock.
1266 -------------------------------------------------- */
1267
1268/* State of the simulated CPU. */
1269extern Int VGOFF_(m_eax);
1270extern Int VGOFF_(m_ecx);
1271extern Int VGOFF_(m_edx);
1272extern Int VGOFF_(m_ebx);
1273extern Int VGOFF_(m_esp);
1274extern Int VGOFF_(m_ebp);
1275extern Int VGOFF_(m_esi);
1276extern Int VGOFF_(m_edi);
1277extern Int VGOFF_(m_eflags);
1278extern Int VGOFF_(m_fpustate);
1279extern Int VGOFF_(m_eip);
1280
1281/* Reg-alloc spill area (VG_MAX_SPILLSLOTS words long). */
1282extern Int VGOFF_(spillslots);
1283
1284/* Records the valid bits for the 8 integer regs & flags reg. */
1285extern Int VGOFF_(sh_eax);
1286extern Int VGOFF_(sh_ecx);
1287extern Int VGOFF_(sh_edx);
1288extern Int VGOFF_(sh_ebx);
1289extern Int VGOFF_(sh_esp);
1290extern Int VGOFF_(sh_ebp);
1291extern Int VGOFF_(sh_esi);
1292extern Int VGOFF_(sh_edi);
1293extern Int VGOFF_(sh_eflags);
1294
sewardjde4a1d02002-03-22 01:27:54 +00001295/* -----------------------------------------------------
1296 Read-only parts of baseBlock.
1297 -------------------------------------------------- */
1298
1299/* Offsets of addresses of helper functions. A "helper" function is
1300 one which is called from generated code. */
1301
1302extern Int VGOFF_(helper_idiv_64_32);
1303extern Int VGOFF_(helper_div_64_32);
1304extern Int VGOFF_(helper_idiv_32_16);
1305extern Int VGOFF_(helper_div_32_16);
1306extern Int VGOFF_(helper_idiv_16_8);
1307extern Int VGOFF_(helper_div_16_8);
1308
1309extern Int VGOFF_(helper_imul_32_64);
1310extern Int VGOFF_(helper_mul_32_64);
1311extern Int VGOFF_(helper_imul_16_32);
1312extern Int VGOFF_(helper_mul_16_32);
1313extern Int VGOFF_(helper_imul_8_16);
1314extern Int VGOFF_(helper_mul_8_16);
1315
1316extern Int VGOFF_(helper_CLD);
1317extern Int VGOFF_(helper_STD);
1318extern Int VGOFF_(helper_get_dirflag);
1319
sewardj7d78e782002-06-02 00:04:00 +00001320extern Int VGOFF_(helper_CLC);
1321extern Int VGOFF_(helper_STC);
1322
sewardjde4a1d02002-03-22 01:27:54 +00001323extern Int VGOFF_(helper_shldl);
1324extern Int VGOFF_(helper_shldw);
1325extern Int VGOFF_(helper_shrdl);
1326extern Int VGOFF_(helper_shrdw);
1327
1328extern Int VGOFF_(helper_RDTSC);
1329extern Int VGOFF_(helper_CPUID);
1330
sewardjde4a1d02002-03-22 01:27:54 +00001331extern Int VGOFF_(helper_bsf);
1332extern Int VGOFF_(helper_bsr);
1333
1334extern Int VGOFF_(helper_fstsw_AX);
1335extern Int VGOFF_(helper_SAHF);
sewardj4d0ab1f2002-03-24 10:00:09 +00001336extern Int VGOFF_(helper_DAS);
sewardjfe8a1662002-03-24 11:54:07 +00001337extern Int VGOFF_(helper_DAA);
sewardjde4a1d02002-03-22 01:27:54 +00001338
sewardjde4a1d02002-03-22 01:27:54 +00001339extern Int VGOFF_(handle_esp_assignment); /* :: Addr -> void */
sewardjde4a1d02002-03-22 01:27:54 +00001340
njn25e49d8e72002-09-23 09:36:25 +00001341/* For storing extension-specific helpers, determined at runtime. The addr
1342 * and offset arrays together form a (addr, offset) map that allows a
1343 * helper's baseBlock offset to be computed from its address. It's done
1344 * like this so CCALL_M_Ns and other helper calls can use the function
1345 * address rather than having to much around with offsets. */
1346extern UInt VG_(n_compact_helpers);
1347extern UInt VG_(n_noncompact_helpers);
1348
1349extern Addr VG_(compact_helper_addrs) [];
1350extern Int VG_(compact_helper_offsets)[];
1351
1352extern Addr VG_(noncompact_helper_addrs) [];
1353extern Int VG_(noncompact_helper_offsets)[];
1354
sewardjde4a1d02002-03-22 01:27:54 +00001355
1356#endif /* ndef __VG_INCLUDE_H */
1357
sewardj3b2736a2002-03-24 12:18:35 +00001358
1359/* ---------------------------------------------------------------------
1360 Finally - autoconf-generated settings
1361 ------------------------------------------------------------------ */
1362
1363#include "config.h"
1364
sewardjde4a1d02002-03-22 01:27:54 +00001365/*--------------------------------------------------------------------*/
1366/*--- end vg_include.h ---*/
1367/*--------------------------------------------------------------------*/