njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame^] | 1 | /*--------------------------------------------------------------------*/ |
| 2 | /*--- Default panicky definitions of template functions that skins ---*/ |
| 3 | /*--- should override. ---*/ |
| 4 | /*--- vg_defaults.c ---*/ |
| 5 | /*--------------------------------------------------------------------*/ |
| 6 | |
| 7 | /* |
| 8 | This file is part of Valgrind, an x86 protected-mode emulator |
| 9 | designed for debugging and profiling binaries on x86-Unixes. |
| 10 | |
| 11 | Copyright (C) 2000-2002 Nicholas Nethercote |
| 12 | njn25@cam.ac.uk |
| 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 | |
| 29 | The GNU General Public License is contained in the file COPYING. |
| 30 | */ |
| 31 | |
| 32 | |
| 33 | /* These functions aren't intended to be run. Replacement functions used by |
| 34 | * the chosen skin are substituted by compiling the skin into a .so and |
| 35 | * LD_PRELOADing it. Nasty :) */ |
| 36 | |
| 37 | #include "vg_include.h" |
| 38 | |
| 39 | /* --------------------------------------------------------------------- |
| 40 | Error messages (for malformed skins) |
| 41 | ------------------------------------------------------------------ */ |
| 42 | |
| 43 | /* If the skin fails to define one or more of the required functions, |
| 44 | * make it very clear what went wrong! */ |
| 45 | |
| 46 | static __attribute__ ((noreturn)) |
| 47 | void fund_panic ( Char* fn ) |
| 48 | { |
| 49 | VG_(printf)( |
| 50 | "\nSkin error:\n" |
| 51 | " The skin you have selected is missing the function `%s',\n" |
| 52 | " which is required.\n\n", |
| 53 | fn); |
| 54 | VG_(skin_error)("Missing skin function"); |
| 55 | } |
| 56 | |
| 57 | static __attribute__ ((noreturn)) |
| 58 | void non_fund_panic ( Char* fn ) |
| 59 | { |
| 60 | VG_(printf)( |
| 61 | "\nSkin error:\n" |
| 62 | " The skin you have selected is missing the function `%s'\n" |
| 63 | " required by one of its needs.\n\n", |
| 64 | fn); |
| 65 | VG_(skin_error)("Missing skin function"); |
| 66 | } |
| 67 | |
| 68 | /* --------------------------------------------------------------------- |
| 69 | Fundamental template functions |
| 70 | ------------------------------------------------------------------ */ |
| 71 | |
| 72 | void SK_(pre_clo_init)(VgNeeds* needs, VgTrackEvents* track) |
| 73 | { |
| 74 | fund_panic("SK_(pre_clo_init)"); |
| 75 | } |
| 76 | |
| 77 | void SK_(post_clo_init)(void) |
| 78 | { |
| 79 | fund_panic("SK_(post_clo_init)"); |
| 80 | } |
| 81 | |
| 82 | UCodeBlock* SK_(instrument)(UCodeBlock* cb, Addr not_used) |
| 83 | { |
| 84 | fund_panic("SK_(instrument)"); |
| 85 | } |
| 86 | |
| 87 | void SK_(fini)(void) |
| 88 | { |
| 89 | fund_panic("SK_(fini)"); |
| 90 | } |
| 91 | |
| 92 | /* --------------------------------------------------------------------- |
| 93 | For error reporting and suppression handling |
| 94 | ------------------------------------------------------------------ */ |
| 95 | |
| 96 | Bool SK_(eq_SkinError)(VgRes res, SkinError* e1, SkinError* e2) |
| 97 | { |
| 98 | non_fund_panic("SK_(eq_SkinError)"); |
| 99 | } |
| 100 | |
| 101 | void SK_(pp_SkinError)(SkinError* ec, void (*pp_ExeContext)(void)) |
| 102 | { |
| 103 | non_fund_panic("SK_(pp_SkinError)"); |
| 104 | } |
| 105 | |
| 106 | void SK_(dup_extra_and_update)(SkinError* ec) |
| 107 | { |
| 108 | non_fund_panic("SK_(dup_extra_and_update)"); |
| 109 | } |
| 110 | |
| 111 | Bool SK_(recognised_suppression)(Char* name, SuppKind* skind) |
| 112 | { |
| 113 | non_fund_panic("SK_(recognised_suppression)"); |
| 114 | } |
| 115 | |
| 116 | Bool SK_(read_extra_suppression_info)(Int fd, Char* buf, |
| 117 | Int nBuf, SkinSupp *s) |
| 118 | { |
| 119 | non_fund_panic("SK_(read_extra_suppression_info)"); |
| 120 | } |
| 121 | |
| 122 | Bool SK_(error_matches_suppression)(SkinError* ec, SkinSupp* su) |
| 123 | { |
| 124 | non_fund_panic("SK_(error_matches_suppression)"); |
| 125 | } |
| 126 | |
| 127 | |
| 128 | /* --------------------------------------------------------------------- |
| 129 | For throwing out basic block level info when code is invalidated |
| 130 | ------------------------------------------------------------------ */ |
| 131 | |
| 132 | void SK_(discard_basic_block_info)(Addr a, UInt size) |
| 133 | { |
| 134 | non_fund_panic("SK_(discard_basic_block_info)"); |
| 135 | } |
| 136 | |
| 137 | |
| 138 | /* --------------------------------------------------------------------- |
| 139 | For throwing out basic block level info when code is invalidated |
| 140 | ------------------------------------------------------------------ */ |
| 141 | |
| 142 | void SK_(written_shadow_regs_values)(UInt* gen_reg, UInt* eflags) |
| 143 | { |
| 144 | non_fund_panic("SK_(written_shadow_regs_values)"); |
| 145 | } |
| 146 | |
| 147 | |
| 148 | /* --------------------------------------------------------------------- |
| 149 | Command line arg template function |
| 150 | ------------------------------------------------------------------ */ |
| 151 | |
| 152 | Bool SK_(process_cmd_line_option)(Char* argv) |
| 153 | { |
| 154 | non_fund_panic("SK_(process_cmd_line_option)"); |
| 155 | } |
| 156 | |
| 157 | Char* SK_(usage)(void) |
| 158 | { |
| 159 | non_fund_panic("SK_(usage)"); |
| 160 | } |
| 161 | |
| 162 | /* --------------------------------------------------------------------- |
| 163 | Client request template function |
| 164 | ------------------------------------------------------------------ */ |
| 165 | |
| 166 | UInt SK_(handle_client_request)(ThreadState* tst, UInt* arg_block) |
| 167 | { |
| 168 | non_fund_panic("SK_(handle_client_request)"); |
| 169 | } |
| 170 | |
| 171 | /* --------------------------------------------------------------------- |
| 172 | UCode extension |
| 173 | ------------------------------------------------------------------ */ |
| 174 | |
| 175 | void SK_(emitExtUInstr)(UInstr* u, RRegSet regs_live_before) |
| 176 | { |
| 177 | non_fund_panic("SK_(emitExtUInstr)"); |
| 178 | } |
| 179 | |
| 180 | Bool SK_(saneExtUInstr)(Bool beforeRA, Bool beforeLiveness, UInstr* u) |
| 181 | { |
| 182 | non_fund_panic("SK_(saneExtUInstr)"); |
| 183 | } |
| 184 | |
| 185 | Char* SK_(nameExtUOpcode)(Opcode opc) |
| 186 | { |
| 187 | non_fund_panic("SK_(nameExtUOpcode)"); |
| 188 | } |
| 189 | |
| 190 | void SK_(ppExtUInstr)(UInstr* u) |
| 191 | { |
| 192 | non_fund_panic("SK_(ppExtUInstr)"); |
| 193 | } |
| 194 | |
| 195 | Int SK_(getExtRegUsage)(UInstr* u, Tag tag, RegUse* arr) |
| 196 | { |
| 197 | non_fund_panic("SK_(getExtTempUsage)"); |
| 198 | } |
| 199 | |
| 200 | /* --------------------------------------------------------------------- |
| 201 | Syscall wrapping |
| 202 | ------------------------------------------------------------------ */ |
| 203 | |
| 204 | void* SK_(pre_syscall)(ThreadId tid, UInt syscallno, Bool is_blocking) |
| 205 | { |
| 206 | non_fund_panic("SK_(pre_syscall)"); |
| 207 | } |
| 208 | |
| 209 | void SK_(post_syscall)(ThreadId tid, UInt syscallno, |
| 210 | void* pre_result, Int res, Bool is_blocking) |
| 211 | { |
| 212 | non_fund_panic("SK_(post_syscall)"); |
| 213 | } |
| 214 | |
| 215 | /* --------------------------------------------------------------------- |
| 216 | Shadow chunks |
| 217 | ------------------------------------------------------------------ */ |
| 218 | |
| 219 | void SK_(complete_shadow_chunk)( ShadowChunk* sc, ThreadState* tst ) |
| 220 | { |
| 221 | non_fund_panic("SK_(complete_shadow_chunk)"); |
| 222 | } |
| 223 | |
| 224 | /* --------------------------------------------------------------------- |
| 225 | Alternative free() |
| 226 | ------------------------------------------------------------------ */ |
| 227 | |
| 228 | void SK_(alt_free) ( ShadowChunk* sc, ThreadState* tst ) |
| 229 | { |
| 230 | non_fund_panic("SK_(alt_free)"); |
| 231 | } |
| 232 | |
| 233 | /* --------------------------------------------------------------------- |
| 234 | Sanity checks |
| 235 | ------------------------------------------------------------------ */ |
| 236 | |
| 237 | Bool SK_(cheap_sanity_check)(void) |
| 238 | { |
| 239 | non_fund_panic("SK_(cheap_sanity_check)"); |
| 240 | } |
| 241 | |
| 242 | Bool SK_(expensive_sanity_check)(void) |
| 243 | { |
| 244 | non_fund_panic("SK_(expensive_sanity_check)"); |
| 245 | } |
| 246 | |
| 247 | /*--------------------------------------------------------------------*/ |
| 248 | /*--- end vg_defaults.c ---*/ |
| 249 | /*--------------------------------------------------------------------*/ |