blob: 8778b846857746e1f1f7c4876d080564b159bb67 [file] [log] [blame]
njnc9539842002-10-02 13:26:35 +00001
njn25e49d8e72002-09-23 09:36:25 +00002/*--------------------------------------------------------------------*/
3/*--- Default panicky definitions of template functions that skins ---*/
4/*--- should override. ---*/
5/*--- vg_defaults.c ---*/
6/*--------------------------------------------------------------------*/
7
8/*
njnc9539842002-10-02 13:26:35 +00009 This file is part of Valgrind, an extensible x86 protected-mode
10 emulator for monitoring program execution on x86-Unixes.
njn25e49d8e72002-09-23 09:36:25 +000011
12 Copyright (C) 2000-2002 Nicholas Nethercote
13 njn25@cam.ac.uk
14
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
30 The GNU General Public License is contained in the file COPYING.
31*/
32
33
34/* These functions aren't intended to be run. Replacement functions used by
35 * the chosen skin are substituted by compiling the skin into a .so and
36 * LD_PRELOADing it. Nasty :) */
37
38#include "vg_include.h"
39
40/* ---------------------------------------------------------------------
41 Error messages (for malformed skins)
42 ------------------------------------------------------------------ */
43
44/* If the skin fails to define one or more of the required functions,
45 * make it very clear what went wrong! */
46
47static __attribute__ ((noreturn))
48void fund_panic ( Char* fn )
49{
50 VG_(printf)(
51 "\nSkin error:\n"
52 " The skin you have selected is missing the function `%s',\n"
53 " which is required.\n\n",
54 fn);
njne427a662002-10-02 11:08:25 +000055 VG_(skin_panic)("Missing skin function");
njn25e49d8e72002-09-23 09:36:25 +000056}
57
58static __attribute__ ((noreturn))
59void non_fund_panic ( Char* fn )
60{
61 VG_(printf)(
62 "\nSkin error:\n"
63 " The skin you have selected is missing the function `%s'\n"
64 " required by one of its needs.\n\n",
65 fn);
njne427a662002-10-02 11:08:25 +000066 VG_(skin_panic)("Missing skin function");
njn25e49d8e72002-09-23 09:36:25 +000067}
68
69/* ---------------------------------------------------------------------
70 Fundamental template functions
71 ------------------------------------------------------------------ */
72
sewardjc9b82522002-09-30 23:17:49 +000073__attribute__ ((weak))
njn810086f2002-11-14 12:42:47 +000074void SK_(pre_clo_init)( void )
njn25e49d8e72002-09-23 09:36:25 +000075{
76 fund_panic("SK_(pre_clo_init)");
77}
78
sewardjc9b82522002-09-30 23:17:49 +000079__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +000080void SK_(post_clo_init)(void)
81{
82 fund_panic("SK_(post_clo_init)");
83}
84
sewardjc9b82522002-09-30 23:17:49 +000085__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +000086UCodeBlock* SK_(instrument)(UCodeBlock* cb, Addr not_used)
87{
88 fund_panic("SK_(instrument)");
89}
90
sewardjc9b82522002-09-30 23:17:49 +000091__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +000092void SK_(fini)(void)
93{
94 fund_panic("SK_(fini)");
95}
96
97/* ---------------------------------------------------------------------
98 For error reporting and suppression handling
99 ------------------------------------------------------------------ */
100
sewardjc9b82522002-09-30 23:17:49 +0000101__attribute__ ((weak))
njn810086f2002-11-14 12:42:47 +0000102Bool SK_(eq_SkinError)(VgRes res, Error* e1, Error* e2)
njn25e49d8e72002-09-23 09:36:25 +0000103{
104 non_fund_panic("SK_(eq_SkinError)");
105}
106
sewardjc9b82522002-09-30 23:17:49 +0000107__attribute__ ((weak))
njn810086f2002-11-14 12:42:47 +0000108void SK_(pp_SkinError)(Error* err, void (*pp_ExeContext)(void))
njn25e49d8e72002-09-23 09:36:25 +0000109{
110 non_fund_panic("SK_(pp_SkinError)");
111}
112
sewardjc9b82522002-09-30 23:17:49 +0000113__attribute__ ((weak))
njn810086f2002-11-14 12:42:47 +0000114void* SK_(dup_extra_and_update)(Error* err)
njn25e49d8e72002-09-23 09:36:25 +0000115{
116 non_fund_panic("SK_(dup_extra_and_update)");
117}
118
sewardjc9b82522002-09-30 23:17:49 +0000119__attribute__ ((weak))
njn810086f2002-11-14 12:42:47 +0000120Bool SK_(recognised_suppression)(Char* name, Supp* su)
njn25e49d8e72002-09-23 09:36:25 +0000121{
122 non_fund_panic("SK_(recognised_suppression)");
123}
124
sewardjc9b82522002-09-30 23:17:49 +0000125__attribute__ ((weak))
njn810086f2002-11-14 12:42:47 +0000126Bool SK_(read_extra_suppression_info)(Int fd, Char* buf, Int nBuf, Supp* su)
njn25e49d8e72002-09-23 09:36:25 +0000127{
128 non_fund_panic("SK_(read_extra_suppression_info)");
129}
130
sewardjc9b82522002-09-30 23:17:49 +0000131__attribute__ ((weak))
njn810086f2002-11-14 12:42:47 +0000132Bool SK_(error_matches_suppression)(Error* err, Supp* su)
njn25e49d8e72002-09-23 09:36:25 +0000133{
134 non_fund_panic("SK_(error_matches_suppression)");
135}
136
137
138/* ---------------------------------------------------------------------
139 For throwing out basic block level info when code is invalidated
140 ------------------------------------------------------------------ */
141
sewardjc9b82522002-09-30 23:17:49 +0000142__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000143void SK_(discard_basic_block_info)(Addr a, UInt size)
144{
145 non_fund_panic("SK_(discard_basic_block_info)");
146}
147
148
149/* ---------------------------------------------------------------------
150 For throwing out basic block level info when code is invalidated
151 ------------------------------------------------------------------ */
152
sewardjc9b82522002-09-30 23:17:49 +0000153__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000154void SK_(written_shadow_regs_values)(UInt* gen_reg, UInt* eflags)
155{
156 non_fund_panic("SK_(written_shadow_regs_values)");
157}
158
159
160/* ---------------------------------------------------------------------
161 Command line arg template function
162 ------------------------------------------------------------------ */
163
sewardjc9b82522002-09-30 23:17:49 +0000164__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000165Bool SK_(process_cmd_line_option)(Char* argv)
166{
167 non_fund_panic("SK_(process_cmd_line_option)");
168}
169
sewardjc9b82522002-09-30 23:17:49 +0000170__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000171Char* SK_(usage)(void)
172{
173 non_fund_panic("SK_(usage)");
174}
175
176/* ---------------------------------------------------------------------
177 Client request template function
178 ------------------------------------------------------------------ */
179
sewardjc9b82522002-09-30 23:17:49 +0000180__attribute__ ((weak))
sewardj34042512002-10-22 04:14:35 +0000181Bool SK_(handle_client_request)(ThreadState* tst, UInt* arg_block, UInt *ret)
njn25e49d8e72002-09-23 09:36:25 +0000182{
183 non_fund_panic("SK_(handle_client_request)");
184}
185
186/* ---------------------------------------------------------------------
187 UCode extension
188 ------------------------------------------------------------------ */
189
sewardjc9b82522002-09-30 23:17:49 +0000190__attribute__ ((weak))
njn4ba5a792002-09-30 10:23:54 +0000191void SK_(emit_XUInstr)(UInstr* u, RRegSet regs_live_before)
njn25e49d8e72002-09-23 09:36:25 +0000192{
njn4ba5a792002-09-30 10:23:54 +0000193 non_fund_panic("SK_(emit_XUInstr)");
njn25e49d8e72002-09-23 09:36:25 +0000194}
195
sewardjc9b82522002-09-30 23:17:49 +0000196__attribute__ ((weak))
njn4ba5a792002-09-30 10:23:54 +0000197Bool SK_(sane_XUInstr)(Bool beforeRA, Bool beforeLiveness, UInstr* u)
njn25e49d8e72002-09-23 09:36:25 +0000198{
njn4ba5a792002-09-30 10:23:54 +0000199 non_fund_panic("SK_(sane_XUInstr)");
njn25e49d8e72002-09-23 09:36:25 +0000200}
201
sewardjc9b82522002-09-30 23:17:49 +0000202__attribute__ ((weak))
njn4ba5a792002-09-30 10:23:54 +0000203Char* SK_(name_XUOpcode)(Opcode opc)
njn25e49d8e72002-09-23 09:36:25 +0000204{
njn4ba5a792002-09-30 10:23:54 +0000205 non_fund_panic("SK_(name_XUOpcode)");
njn25e49d8e72002-09-23 09:36:25 +0000206}
207
sewardjc9b82522002-09-30 23:17:49 +0000208__attribute__ ((weak))
njn4ba5a792002-09-30 10:23:54 +0000209void SK_(pp_XUInstr)(UInstr* u)
njn25e49d8e72002-09-23 09:36:25 +0000210{
njn4ba5a792002-09-30 10:23:54 +0000211 non_fund_panic("SK_(pp_XUInstr)");
njn25e49d8e72002-09-23 09:36:25 +0000212}
213
sewardjc9b82522002-09-30 23:17:49 +0000214__attribute__ ((weak))
njn810086f2002-11-14 12:42:47 +0000215Int SK_(get_Xreg_usage)(UInstr* u, Tag tag, Int* regs, Bool* isWrites)
njn25e49d8e72002-09-23 09:36:25 +0000216{
njn4ba5a792002-09-30 10:23:54 +0000217 non_fund_panic("SK_(get_Xreg_usage)");
njn25e49d8e72002-09-23 09:36:25 +0000218}
219
220/* ---------------------------------------------------------------------
221 Syscall wrapping
222 ------------------------------------------------------------------ */
223
sewardjc9b82522002-09-30 23:17:49 +0000224__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000225void* SK_(pre_syscall)(ThreadId tid, UInt syscallno, Bool is_blocking)
226{
227 non_fund_panic("SK_(pre_syscall)");
228}
229
sewardjc9b82522002-09-30 23:17:49 +0000230__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000231void SK_(post_syscall)(ThreadId tid, UInt syscallno,
232 void* pre_result, Int res, Bool is_blocking)
233{
234 non_fund_panic("SK_(post_syscall)");
235}
236
237/* ---------------------------------------------------------------------
238 Shadow chunks
239 ------------------------------------------------------------------ */
240
sewardjc9b82522002-09-30 23:17:49 +0000241__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000242void SK_(complete_shadow_chunk)( ShadowChunk* sc, ThreadState* tst )
243{
244 non_fund_panic("SK_(complete_shadow_chunk)");
245}
246
247/* ---------------------------------------------------------------------
248 Alternative free()
249 ------------------------------------------------------------------ */
250
sewardjc9b82522002-09-30 23:17:49 +0000251__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000252void SK_(alt_free) ( ShadowChunk* sc, ThreadState* tst )
253{
254 non_fund_panic("SK_(alt_free)");
255}
256
257/* ---------------------------------------------------------------------
258 Sanity checks
259 ------------------------------------------------------------------ */
260
sewardjc9b82522002-09-30 23:17:49 +0000261__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000262Bool SK_(cheap_sanity_check)(void)
263{
264 non_fund_panic("SK_(cheap_sanity_check)");
265}
266
sewardjc9b82522002-09-30 23:17:49 +0000267__attribute__ ((weak))
njn25e49d8e72002-09-23 09:36:25 +0000268Bool SK_(expensive_sanity_check)(void)
269{
270 non_fund_panic("SK_(expensive_sanity_check)");
271}
272
273/*--------------------------------------------------------------------*/
274/*--- end vg_defaults.c ---*/
275/*--------------------------------------------------------------------*/