SCI: Cleaned up the BreakpointType enum and documented the bpe command

This commit is contained in:
md5 2011-03-25 13:26:20 +02:00
parent 4ceb4838ed
commit d86504ef88
3 changed files with 9 additions and 11 deletions

View File

@ -3154,10 +3154,9 @@ bool Console::cmdBreakpointKernel(int argc, const char **argv) {
}
bool Console::cmdBreakpointFunction(int argc, const char **argv) {
// TODO/FIXME: Why does this accept 2 parameters (the high and the low part of the address)?"
if (argc != 3) {
DebugPrintf("Sets a breakpoint on the execution of the specified exported function.\n");
DebugPrintf("Usage: %s <addr1> <addr2>\n", argv[0]);
DebugPrintf("Usage: %s <script number> <export number\n", argv[0]);
return true;
}
@ -3166,6 +3165,7 @@ bool Console::cmdBreakpointFunction(int argc, const char **argv) {
A breakpoint set on an invalid method name will just never trigger. */
Breakpoint bp;
bp.type = BREAK_EXPORT;
// script number, export number
bp.address = (atoi(argv[1]) << 16 | atoi(argv[2]));
_debugState._breakpoints.push_back(bp);

View File

@ -34,18 +34,18 @@ namespace Sci {
// These types are used both as identifiers and as elements of bitfields
enum BreakpointType {
/**
* Break when selector is executed. data contains (char *) selector name
* Break when a selector is executed. Data contains (char *) selector name
* (in the format Object::Method)
*/
BREAK_SELECTOREXEC = 1 << 0, // break when selector gets executed
BREAK_SELECTORREAD = 1 << 1, // break when selector gets executed
BREAK_SELECTORWRITE = 1 << 2, // break when selector gets executed
BREAK_SELECTOREXEC = 1 << 0, // break when a function selector is executed
BREAK_SELECTORREAD = 1 << 1, // break when a variable selector is read
BREAK_SELECTORWRITE = 1 << 2, // break when a variable selector is written
/**
* Break when an exported function is called. data contains
* Break when an exported function is called. Data contains
* script_no << 16 | export_no.
*/
BREAK_EXPORT = 1 << 3
BREAK_EXPORT = 1 << 3
};
struct Breakpoint {

View File

@ -272,9 +272,7 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i
bool SciEngine::checkExportBreakpoint(uint16 script, uint16 pubfunct) {
if (_debugState._activeBreakpointTypes & BREAK_EXPORT) {
uint32 bpaddress;
bpaddress = (script << 16 | pubfunct);
uint32 bpaddress = (script << 16 | pubfunct);
Common::List<Breakpoint>::const_iterator bp;
for (bp = _debugState._breakpoints.begin(); bp != _debugState._breakpoints.end(); ++bp) {