Cleanup
svn-id: r41727
This commit is contained in:
parent
b14fa66f9f
commit
245a2764fc
3 changed files with 14 additions and 32 deletions
|
@ -55,15 +55,6 @@ int g_debug_seeking = 0; // Stepping forward until some special condition is met
|
||||||
int g_debug_seek_special = 0; // Used for special seeks
|
int g_debug_seek_special = 0; // Used for special seeks
|
||||||
int g_debug_seek_level = 0; // Used for seekers that want to check their exec stack depth
|
int g_debug_seek_level = 0; // Used for seekers that want to check their exec stack depth
|
||||||
|
|
||||||
enum DebugSeeking {
|
|
||||||
kDebugSeekNothing = 0,
|
|
||||||
kDebugSeekCallk = 1, // Step forward until callk is found
|
|
||||||
kDebugSeekLevelRet = 2, // Step forward until returned from this level
|
|
||||||
kDebugSeekSpecialCallk = 3, // Step forward until a /special/ callk is found
|
|
||||||
kDebugSeekSO = 4, // Step forward until specified PC (after the send command) and stack depth
|
|
||||||
kDebugSeekGlobal = 5 // Step forward until one specified global variable is modified
|
|
||||||
};
|
|
||||||
|
|
||||||
Console::Console(SciEngine *vm) : GUI::Debugger() {
|
Console::Console(SciEngine *vm) : GUI::Debugger() {
|
||||||
_vm = vm;
|
_vm = vm;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,15 @@ namespace Sci {
|
||||||
class SciEngine;
|
class SciEngine;
|
||||||
struct List;
|
struct List;
|
||||||
|
|
||||||
|
enum DebugSeeking {
|
||||||
|
kDebugSeekNothing = 0,
|
||||||
|
kDebugSeekCallk = 1, // Step forward until callk is found
|
||||||
|
kDebugSeekLevelRet = 2, // Step forward until returned from this level
|
||||||
|
kDebugSeekSpecialCallk = 3, // Step forward until a /special/ callk is found
|
||||||
|
kDebugSeekSO = 4, // Step forward until specified PC (after the send command) and stack depth
|
||||||
|
kDebugSeekGlobal = 5 // Step forward until one specified global variable is modified
|
||||||
|
};
|
||||||
|
|
||||||
// Refer to the "addresses" command on how to pass address parameters
|
// Refer to the "addresses" command on how to pass address parameters
|
||||||
int parse_reg_t(EngineState *s, const char *str, reg_t *dest);
|
int parse_reg_t(EngineState *s, const char *str, reg_t *dest);
|
||||||
int printObject(EngineState *s, reg_t pos);
|
int printObject(EngineState *s, reg_t pos);
|
||||||
|
|
|
@ -26,24 +26,9 @@
|
||||||
// Script debugger functionality. Absolutely not threadsafe.
|
// Script debugger functionality. Absolutely not threadsafe.
|
||||||
|
|
||||||
#include "sci/sci.h"
|
#include "sci/sci.h"
|
||||||
|
#include "sci/console.h"
|
||||||
#include "sci/debug.h"
|
#include "sci/debug.h"
|
||||||
#include "sci/engine/state.h"
|
#include "sci/engine/state.h"
|
||||||
#include "sci/engine/gc.h"
|
|
||||||
#include "sci/engine/kernel_types.h"
|
|
||||||
#include "sci/engine/kernel.h"
|
|
||||||
#include "sci/engine/savegame.h"
|
|
||||||
#include "sci/gfx/gfx_widgets.h"
|
|
||||||
#include "sci/gfx/gfx_gui.h"
|
|
||||||
#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
|
|
||||||
#include "sci/resource.h"
|
|
||||||
#include "sci/vocabulary.h"
|
|
||||||
#include "sci/sfx/iterator.h"
|
|
||||||
#include "sci/sfx/sci_midi.h"
|
|
||||||
|
|
||||||
#include "common/util.h"
|
|
||||||
#include "common/savefile.h"
|
|
||||||
|
|
||||||
#include "sound/audiostream.h"
|
|
||||||
|
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
|
@ -63,13 +48,13 @@ static int *p_var_max; // May be NULL even in valid state!
|
||||||
|
|
||||||
extern const char *selector_name(EngineState *s, int selector);
|
extern const char *selector_name(EngineState *s, int selector);
|
||||||
|
|
||||||
int prop_ofs_to_id(EngineState *s, int prop_ofs, reg_t objp) {
|
int propertyOffsetToId(EngineState *s, int prop_ofs, reg_t objp) {
|
||||||
Object *obj = obj_get(s, objp);
|
Object *obj = obj_get(s, objp);
|
||||||
byte *selectoroffset;
|
byte *selectoroffset;
|
||||||
int selectors;
|
int selectors;
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
sciprintf("Applied prop_ofs_to_id on non-object at %04x:%04x\n", PRINT_REG(objp));
|
sciprintf("Applied propertyOffsetToId on non-object at %04x:%04x\n", PRINT_REG(objp));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +71,7 @@ int prop_ofs_to_id(EngineState *s, int prop_ofs, reg_t objp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop_ofs < 0 || (prop_ofs >> 1) >= selectors) {
|
if (prop_ofs < 0 || (prop_ofs >> 1) >= selectors) {
|
||||||
sciprintf("Applied prop_ofs_to_id to invalid property offset %x (property #%d not in [0..%d]) on object at %04x:%04x\n",
|
sciprintf("Applied propertyOffsetToId to invalid property offset %x (property #%d not in [0..%d]) on object at %04x:%04x\n",
|
||||||
prop_ofs, prop_ofs >> 1, selectors - 1, PRINT_REG(objp));
|
prop_ofs, prop_ofs >> 1, selectors - 1, PRINT_REG(objp));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +242,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
|
||||||
if ((opcode == op_pTos) || (opcode == op_sTop) || (opcode == op_pToa) || (opcode == op_aTop) ||
|
if ((opcode == op_pTos) || (opcode == op_sTop) || (opcode == op_pToa) || (opcode == op_aTop) ||
|
||||||
(opcode == op_dpToa) || (opcode == op_ipToa) || (opcode == op_dpTos) || (opcode == op_ipTos)) {
|
(opcode == op_dpToa) || (opcode == op_ipToa) || (opcode == op_dpTos) || (opcode == op_ipTos)) {
|
||||||
int prop_ofs = scr[pos.offset + 1];
|
int prop_ofs = scr[pos.offset + 1];
|
||||||
int prop_id = prop_ofs_to_id(s, prop_ofs, *p_objp);
|
int prop_id = propertyOffsetToId(s, prop_ofs, *p_objp);
|
||||||
|
|
||||||
sciprintf(" (%s)", selector_name(s, prop_id));
|
sciprintf(" (%s)", selector_name(s, prop_id));
|
||||||
}
|
}
|
||||||
|
@ -342,8 +327,6 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
|
||||||
|
|
||||||
void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *objp, int *restadjust,
|
void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *objp, int *restadjust,
|
||||||
SegmentId *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp) {
|
SegmentId *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp) {
|
||||||
// TODO: disabled till this is moved in console.cpp
|
|
||||||
#if 0
|
|
||||||
// Do we support a separate console?
|
// Do we support a separate console?
|
||||||
|
|
||||||
int old_debugstate = g_debugstate_valid;
|
int old_debugstate = g_debugstate_valid;
|
||||||
|
@ -412,7 +395,6 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *
|
||||||
// OK, found whatever we were looking for
|
// OK, found whatever we were looking for
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
g_debugstate_valid = (g_debug_step_running == 0);
|
g_debugstate_valid = (g_debug_step_running == 0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue