| 1 | #ifdef RCSID |
| 2 | static char RCSid[] = |
| 3 | "$Header$"; |
| 4 | #endif |
| 5 | |
| 6 | /* |
| 7 | * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved. |
| 8 | * |
| 9 | * Please see the accompanying license file, LICENSE.TXT, for information |
| 10 | * on using and copying this software. |
| 11 | */ |
| 12 | /* |
| 13 | Name |
| 14 | vmini_d.cpp - T3 VM - debugger-related initialization |
| 15 | Function |
| 16 | Isolates initialization required only for debugger-enabled versions. |
| 17 | This module can be replaced with a stub module when linking a |
| 18 | stand-alone, non-debug version of the VM interpreter, to avoid |
| 19 | dragging in lots of debugger-related modules. |
| 20 | Notes |
| 21 | |
| 22 | Modified |
| 23 | 12/03/99 MJRoberts - Creation |
| 24 | */ |
| 25 | |
| 26 | #include "t3std.h" |
| 27 | #include "vminit.h" |
| 28 | #include "vmparam.h" |
| 29 | #include "vmdbg.h" |
| 30 | |
| 31 | /* |
| 32 | * Initialize the debugger |
| 33 | */ |
| 34 | void vm_init_debugger(VMG0_) |
| 35 | { |
| 36 | /* create the debugger interface object */ |
| 37 | G_debugger = new CVmDebug(vmg0_); |
| 38 | } |
| 39 | |
| 40 | /* |
| 41 | * Initialization, phase 2: just before loading image file |
| 42 | */ |
| 43 | void vm_init_before_load(VMG_ const char *image_filename) |
| 44 | { |
| 45 | /* initialize the debugger */ |
| 46 | G_debugger->init(vmg_ image_filename); |
| 47 | } |
| 48 | |
| 49 | /* |
| 50 | * Initialization, phase 3: just after loading the image file |
| 51 | */ |
| 52 | void vm_init_after_load(VMG0_) |
| 53 | { |
| 54 | /* finish initializing the debugger */ |
| 55 | G_debugger->init_after_load(vmg0_); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | /* |
| 60 | * Termination - shut down the debugger |
| 61 | */ |
| 62 | void vm_terminate_debug_shutdown(VMG0_) |
| 63 | { |
| 64 | /* if the debugger is present, tell it to shut down */ |
| 65 | G_debugger->terminate(vmg0_); |
| 66 | } |
| 67 | |
| 68 | /* |
| 69 | * Termination - delete debugger objects |
| 70 | */ |
| 71 | void vm_terminate_debug_delete(VMG0_) |
| 72 | { |
| 73 | /* delete the debugger interface */ |
| 74 | delete G_debugger; |
| 75 | } |
| 76 | |
| 77 | /* |
| 78 | * Use a stack-overflow reserve in the debug version |
| 79 | */ |
| 80 | size_t vm_init_stack_reserve() |
| 81 | { |
| 82 | return VM_STACK_DBG_RESERVE; |
| 83 | } |