[Scummvm-git-logs] scummvm master -> 3fc12a6a0ee0a4d38afeb64ea2457b7f0ba02ea6
sluicebox
noreply at scummvm.org
Thu Sep 25 03:15:39 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
3fc12a6a0e SCI: Initialize `Breakpoint` members
Commit: 3fc12a6a0ee0a4d38afeb64ea2457b7f0ba02ea6
https://github.com/scummvm/scummvm/commit/3fc12a6a0ee0a4d38afeb64ea2457b7f0ba02ea6
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-09-24T20:14:41-07:00
Commit Message:
SCI: Initialize `Breakpoint` members
Resolves several Coverity issues
Changed paths:
engines/sci/console.cpp
engines/sci/debug.h
engines/sci/engine/scriptdebug.cpp
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index f1444977668..16c929df588 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -4263,8 +4263,7 @@ bool Console::cmdBreakpointMethod(int argc, const char **argv) {
/* Note: We can set a breakpoint on a method that has not been loaded yet.
Thus, we can't check whether the command argument is a valid method name.
A breakpoint set on an invalid method name will just never trigger. */
- Breakpoint bp;
- bp._type = BREAK_SELECTOREXEC;
+ Breakpoint bp(BREAK_SELECTOREXEC);
bp._name = argv[1];
bp._action = action;
@@ -4297,8 +4296,7 @@ bool Console::cmdBreakpointRead(int argc, const char **argv) {
}
}
- Breakpoint bp;
- bp._type = BREAK_SELECTORREAD;
+ Breakpoint bp(BREAK_SELECTORREAD);
bp._name = argv[1];
bp._action = action;
@@ -4331,8 +4329,7 @@ bool Console::cmdBreakpointWrite(int argc, const char **argv) {
}
}
- Breakpoint bp;
- bp._type = BREAK_SELECTORWRITE;
+ Breakpoint bp(BREAK_SELECTORWRITE);
bp._name = argv[1];
bp._action = action;
@@ -4397,8 +4394,7 @@ bool Console::cmdBreakpointKernel(int argc, const char **argv) {
return true;
}
- Breakpoint bp;
- bp._type = BREAK_KERNEL;
+ Breakpoint bp(BREAK_KERNEL);
bp._name = pattern;
bp._action = action;
@@ -4429,11 +4425,7 @@ bool Console::cmdBreakpointFunction(int argc, const char **argv) {
}
}
- /* Note: We can set a breakpoint on a method that has not been loaded yet.
- Thus, we can't check whether the command argument is a valid method name.
- A breakpoint set on an invalid method name will just never trigger. */
- Breakpoint bp;
- bp._type = BREAK_EXPORT;
+ Breakpoint bp(BREAK_EXPORT);
// script number, export number
bp._address = (atoi(argv[1]) << 16 | atoi(argv[2]));
bp._action = action;
@@ -4471,8 +4463,7 @@ bool Console::cmdBreakpointAddress(int argc, const char **argv) {
}
}
- Breakpoint bp;
- bp._type = BREAK_ADDRESS;
+ Breakpoint bp(BREAK_ADDRESS);
bp._regAddress = make_reg32(addr.getSegment(), addr.getOffset());
bp._action = action;
diff --git a/engines/sci/debug.h b/engines/sci/debug.h
index aff6c9a8042..81945d1575b 100644
--- a/engines/sci/debug.h
+++ b/engines/sci/debug.h
@@ -60,6 +60,12 @@ struct Breakpoint {
reg_t _regAddress; ///< Breakpoints on addresses
Common::String _name; ///< Breakpoints on selector names
BreakpointAction _action;
+
+ Breakpoint(BreakpointType type) :
+ _type(type),
+ _address(0),
+ _regAddress(NULL_REG),
+ _action(BREAK_NONE) { }
};
enum DebugSeeking {
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index c3d4ba319e2..27370d837c5 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -70,13 +70,12 @@ const char *opcodeNames[] = {
#endif // REDUCE_MEMORY_USAGE
void DebugState::updateActiveBreakpointTypes() {
- int type = 0;
+ _activeBreakpointTypes = 0;
for (Common::List<Breakpoint>::iterator bp = _breakpoints.begin(); bp != _breakpoints.end(); ++bp) {
- if (bp->_action != BREAK_NONE)
- type |= bp->_type;
+ if (bp->_action != BREAK_NONE) {
+ _activeBreakpointTypes |= bp->_type;
+ }
}
-
- _activeBreakpointTypes = type;
}
// Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered.
@@ -449,7 +448,6 @@ bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpTarget) {
}
}
-
void SciEngine::scriptDebug() {
EngineState *s = _gamestate;
if (_debugState.seeking && !_debugState.breakpointWasHit) { // Are we looking for something special?
@@ -719,7 +717,6 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
debugN("Unsupported!\n");
return;
}
-
}
debugN("Script ends without terminator\n");
@@ -891,7 +888,6 @@ bool SciEngine::checkKernelBreakpoint(const Common::String &name) {
return found;
}
-
void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr argp, ObjVarRef &varp, reg_t funcp, SegManager *segMan, SelectorType selectorType) {
int activeBreakpointTypes = g_sci->_debugState._activeBreakpointTypes;
const char *objectName = segMan->getObjectName(send_obj);
@@ -1265,9 +1261,4 @@ bool printObject(reg_t pos) {
return true;
}
-
-
-
-
-
} // End of namespace Sci
More information about the Scummvm-git-logs
mailing list