274 Commits

Author SHA1 Message Date
Willem Jan Palenstijn
fab43f0f71 SCI: Fix offsets in disasm for multi-param opcodes
This code was assuming that retval points to the start of the next
instruction, which is only true if the current parameter is the last
one. This fixes op_call printing.
2017-10-21 18:55:40 +02:00
Colin Snover
be37a62591 SCI: Fix printing of super calls on clones in debugger 2017-09-30 01:08:12 -05:00
Colin Snover
4bd31dae9b SCI: Fix use-after-free when kernel call debugging is active during a save game restore 2017-09-27 20:27:33 -05:00
Colin Snover
e4b3478d99 SCI: Show inherited methods when viewing an object in the debugger 2017-07-30 19:10:50 -05:00
Colin Snover
06686c09f0 SCI32: Fix breakpoints on reading/writing selectors in SCI3 2017-07-30 19:10:50 -05:00
Colin Snover
14907039fe SCI32: Fix lofsa/lofss of strings in SCI3 disassembly 2017-07-26 22:02:37 -05:00
Colin Snover
8bab5a3467 SCI: Resolve offset names when disassembling object methods 2017-07-23 10:35:13 -05:00
Willem Jan Palenstijn
c7d631cb66 SCI: Expand kernel breakpoint pattern matching for negative matches
See matchKernelBreakpointPattern() for samples. The main envisioned use is

DoSound*,!DoSoundUpdateCues

to match all DoSound sub-functions except DoSoundUpdateCues.
2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
4102a77964 SCI: Clean up breakpoint code (indentation, consistency) 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
e2e3f7c4c5 SCI: Move bpk/logkernel to main breakpoint infrastructure
This changes the syntax for bpk and logkernel:

Enable breakpoint on kernel call:

bpk FrameOut

Enable logging for kernel call:

bpk FrameOut log
For backward compatibility this has an alias: logkernel FrameOut

Removing a kernel call breakpoint is done with bp_del/bc now.
2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
b3866aa3d5 SCI: Allow multiple breakpoints with same trigger but different action 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
be84cfdb59 SCI: Add inspect, none breakpoint actions 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
423ecde8e0 SCI: Move printObject from console to scriptdebug 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
8e683db72b SCI: Add break/log/backtrace actions for triggered breakpoints
The action can be set using the new console command bp_action/bpact.
2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
cb69d10e96 SCI: Add underscores to Breakpoint member variables 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
b56a49c53e SCI: Move backtrace output to scriptdebug.cpp 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
e9867356f5 SCI: Handle selector read/write breakpoints from opcodes 2017-06-10 21:32:35 +02:00
Willem Jan Palenstijn
3554875c7a SCI: Fix wildcard selector breakpoints
0f9c33e02f1cb2c740c1eb0dcaad96dd22ec29e7 in 2011 broke selector
breakpoints of the type "ObjName::", which previously caught all
selector sends of the named object.

Thanks to TMM and snover for noticing.
2017-06-10 21:32:35 +02:00
Colin Snover
a2d7851e4d SCI32: Improve disassembly output of SCI3 property opcodes
Since SCI3 scripts use selectors instead of offsets as operands
to property-related opcodes, the disassembler can look up and
display property names everywhere (unlike SCI2.1 and earlier,
which need to know the object being operated on to look up the
correct selector for a given offset).
2017-04-23 13:07:25 -05:00
Colin Snover
eadf5d818f SCI: Fix support for 32-bit SCI3 script offsets 2017-04-23 13:07:25 -05:00
Colin Snover
0394fd44e8 SCI: Fix whitespace errors 2017-04-23 13:07:25 -05:00
Colin Snover
61fba94139 SCI: Remove dead code in Script_Offset disassembler
Script_Offset is only ever used for lofsa/lofss opcodes.
2017-04-23 13:07:25 -05:00
Colin Snover
0676e640db SCI: Fix bad offsets in disassembly for SCI3 lofsa/lofss 2017-04-23 13:07:25 -05:00
Colin Snover
9e7c75cc79 SCI: Avoid crashing when disassembling a call with a bad object
lookupSelector will raise an error if the passed object ID is
invalid.
2017-04-22 19:38:13 -05:00
Colin Snover
3ab1f5f4cc SCI: Display class names in disassembly 2017-04-22 19:28:35 -05:00
Colin Snover
f4d3664d3f SCI: Replace magic numbers in reg_t handling with symbols 2017-03-30 19:46:27 -05:00
Colin Snover
31daa956d6 SCI: Implement bounds-checked reads of game resources 2017-03-27 19:42:31 -05:00
Colin Snover
10d97ce379 SCI: Fix more unsafe C-string usage 2017-02-05 12:38:21 -06:00
Colin Snover
be14778b2b SCI: Ensure bytecode/BWT for "file" op is also printed
Learning the bytecode for file op is necessary when creating
workaround signatures, as the signature-finding mechanism does not
currently ignore line/file instructions.
2016-12-12 15:20:08 -06:00
Colin Snover
4814682d5f SCI: Improve disassembly output
1. pushi opcode now displays decimal value and selector value (if
   one exists) in-line
2. lofsa, lofss, and super opcodes now display resolved
   object/class names
3. Opcode arguments are visually aligned
2016-11-20 12:31:44 -06:00
Colin Snover
9380b54120 SCI: Add code-address breakpoints to debugger 2016-11-20 12:31:43 -06:00
Johannes Schickel
1c6112e121 SCI: Introduce accessors for SegmentObjTable entries.
This makes code not use _table directly whenever possible. An exception is the
save game code which is not easy to adapt due to design deficiencies.
2016-03-25 01:15:26 +01:00
Filippos Karapetis
cdbd7c8add SCI: Use uint32 instead of unsigned int 2016-03-01 01:12:58 +02:00
Johannes Schickel
daa8d57a86 ALL: Rename Debugger::DebugPrintf to Debugger::debugPrintf. 2014-05-27 02:04:07 +02:00
Johannes Schickel
8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Martin Kiewitz
07568931ce SCI: fix null pointer access in logKernelCall
method was/is used for debugging only
CID 1003612
2014-01-27 23:31:40 +01:00
Willem Jan Palenstijn
2d1fd3b554 ALL: Fix typo (existant->existent) 2013-02-23 22:07:32 +01:00
Willem Jan Palenstijn
e38d4f20e8 SCI: Fix dissect_script crash with invalid object types 2012-10-06 13:07:12 +02:00
Willem Jan Palenstijn
5f3f21e20e SCI: Fix some console output formatting 2012-10-06 13:07:12 +02:00
Filippos Karapetis
20b6770808 SCI: Change the program counter (PC) to be a 32-bit variable
This is needed for future support of large SCI3 scripts. The program
counter is isolated and does not interfere with other parts of the VM,
plus it does not get stored in saved games, so it's pretty straightforward
to convert
2012-06-23 21:45:26 +03:00
Filippos Karapetis
c075aafddb SCI: Add support for the debug opcode "file" in our script dissassembler
Also set the correct name for the debug opcode "line"
2012-06-23 21:45:22 +03:00
Filippos Karapetis
76f3f1b136 SCI: Fix warnings 2012-06-21 22:24:22 +03:00
Filippos Karapetis
065e83e44f SCI: Store script sizes in 32-bit integers
Since scripts can be larger than 64KB, and getBufSize() returns a 32-bit
integer, adapt variables that store script sizes accordingly
2012-06-18 12:20:07 +03:00
Filippos Karapetis
2b50824133 SCI: Add setter/getter methods to reg_t's
No functionality change has been made with this commit. This avoids
setting and getting the reg_t members directly, and is the basis of any
future work on large SCI3 scripts (larger than 64KB)
2012-06-18 05:24:06 +03:00
Tarek Soliman
a4798602d7 JANITORIAL: Fix missing whitespace in pointer cast
find -name '*.h' -or -name '*.cpp' | xargs sed -r -i 's@\(([A-Za-z0-9]+)\*\)@(\1 *)@g'

This seems to have caught some params as well which is not undesirable IMO.
It also caught some strings containing this which is undesirable so I
excluded them manually. (engines/sci/engine/kernel_tables.h)
2012-02-15 10:07:10 -06:00
Willem Jan Palenstijn
0192d2f2de SCI: Fix restarting SCI engine with different SCI version 2011-11-29 18:34:34 +01:00
Filippos Karapetis
381e92a576 SCI: Added handling of invalid jump offsets (e.g. QFG2, script 260) 2011-11-28 22:36:58 +02:00
Filippos Karapetis
7f675de855 SCI: Fixed compilation with VM_DEBUG_SEND defined 2011-09-22 04:18:11 +03:00
Max Horn
88913c0139 ALL: Remove trailing whitespaces
This tries to make our code a bit more compliant with our code formatting
conventions. For future use, this is the command I used:
  git ls-files "*.cpp" "*.h" | xargs sed -i -e 's/[ \t]*$//'
2011-06-20 00:59:48 +02:00
Willem Jan Palenstijn
4296ac6d15 SCI: Fix sign in disasm of relative jumps 2011-06-12 02:00:09 +02:00