Maxbox Starter146 Debugging
Maxbox Starter146 Debugging
////////////////////////////////////////////////////////////////////////////
Debugging デバッグ
____________________________________________________________________________
maXbox Starter 146 – Get a Debugger.
1
“Se contentus est sapiens. – Seneca.
Source: 1413_services5jcl_1.pas
1190_Continued_fraction64_python3.12.4debug30.txt
https://sourceforge.net/projects/maxbox5/files/examples/1413_services5jcl
.pas/download
https://sourceforge.net/projects/maxbox5/files/
EKON29/1190_Continued_fraction64_python3.12.4debug30.txt/download
1406_U_Go3_1form2.pas
1413_services5jcl.pas
Every programmer spends a lot of time fixing bugs. Whether it’s a small
typo or a tricky logic error, knowing how to debug efficiently is an
important skill.
But debugging isn’t just about fixing mistakes—it’s also about
understanding what went wrong and learning how to avoid similar problems
in the future.
In maXbox or Delphi we had to connect one event from TPSScript to the
cdebugAfterExecute Event:
The debug engine (DE) typically sends one of the following events as the
last startup event:
1/9
• The load complete event, if attaching to a program that is already
running.
1406_livedebugger1_Screenshot2025-06-19_093305.png
If the user elects to step into F7, over F8, or out of a function Ctrl+
F9, the IDE prompts the debug session to call the program's Step method.
The IDE then passes the unit of step (instruction, statement, or line)
and the type of step (whether to step into, over, or out of the
function). When the step is complete, the DE sends a step complete event
to the debug session, which is a stopping event.
If with F8 as step over goes into a loop it works like a live debugger in
the script and you can feel where to code is running!
2/9
When you set a breakpoint with F5 (you can set more than one) then you
start the debug session with Debug Run till the breakpoint it waits, then
you step further with Debug Run or Ctrl+ F9 like continue. If the debug
session is to ignore a particular stopping event, the debug session calls
the program's Continue method. If the program was stepping into, over, or
out of a function when it encountered the stopping condition, then it
continues the step.
1413_services2_mx5_screenshot.png //1406_1_GoScreenshot2025-06-162815.png
For the advanced setting of the debugger we take a look to the component
TPSScriptDebugger with the corresponding events.
3/9
OnIdle = cedebugIdle
OnLineInfo = cedebugLineInfo
OnBreakpoint = cedebugBreakpoint
Left = 344
Top = 136
end
CloseServiceHandle(ServiceHandle);
finally
CloseServiceHandle(SCMHandle);
end;
end;
if StartServiceByName('DESKTOP-BTLKHKF','ALG') then
writ('ALG started...');
writ('stat of ALG '+
itoa(ord(GetServiceStatusByName('DESKTOP-BTLKHKF','ALG'))));
sleep(500)
writ('stat of ALG '+
itoa(ord(GetServiceStatusByName('DESKTOP-BTLKHKF','ALG'))));
//toogle 2___________
//StopServiceByName('DESKTOP-BTLKHKF','ALG');
sleep(500)
Between the two sleeps you can see two different states, namely 2 and 4:
4/9
Besides using the previous methods, if you need more control in a
debugger way you can use WMI. With Win32_Service class you have access to
all information of the services installed on the machine and you can has
access to methods: Start, Stop, Pause, Resume, Interrogate, Create,
Delete, Change, ChangeStartMode…
1406_livedebugger2_Screenshot2025-06-19_093052.png
1413_services_mx5_screenshot.png
5/9
• Script Execution: The compiled bytecode is then executed by the
TPSExec class. If runtime errors occur, they are captured and
reported, typically using methods like PSErrorToString to convert
error codes to readable messages12.
Debugging Support
• Debugger Integration: TPSScriptDebugger works by hooking into the
script execution process. It allows you to:
• Set breakpoints in your script code.
• Step through script execution line by line.
• Inspect and modify variable values at runtime.
• Monitor the call stack and execution flow.
• Usage Pattern:
• You typically associate a TPSScriptDebugger instance with your
TPSScript or TPSExec instance.
• The debugger listens for execution events (such as line
changes or exceptions) and provides callbacks or events that
your host application can use to update the UI (e.g.,
highlighting the current line, showing variable values).
• When a breakpoint is hit, execution is paused, and control is
returned to the host application, allowing inspection and step
operations.
• Implementation Details:
• TPSScriptDebugger interacts closely with the script engine,
receiving notifications about instruction pointer changes,
exceptions, and variable state.
• The component exposes methods and events for common debugging
actions: continue, step over, step into, step out, and stop.
• It maintains a mapping between script source lines and
bytecode instructions, enabling accurate breakpoints and
stepping.
Example Usage
While the search results do not include a full code example for
TPSScriptDebugger, the general approach is as follows (pseudocode):
text
var Script: TPSScript;
Debugger: TPSScriptDebugger;
begin
Script := TPSScript.Create(nil);
Debugger := TPSScriptDebugger.Create(nil);
Script.Debugger := Debugger;
// Load and compile script
// Set breakpoints via Debugger.Breakpoints.Add(lineNumber)
// Start execution; Debugger events will handle breakpoints and
stepping
end;
6/9
Key Features
• Breakpoints: Set and remove breakpoints at specific source lines.
• Stepping: Step into, over, or out of script code.
• Variable Inspection: View and modify script variables during paused
execution.
• Call Stack: Inspect the current call stack to understand the
execution context.
References
• For a general overview of Pascal Script compilation and exe: 12
• For integration and debugging capabilities: 12
If you need more detailed, code-level documentation for
TPSScriptDebugger, consulting the official RemObjects Pascal Script
documentation or the source code itself is recommended, as community
resources often provide only high-level overviews12.
1.https://lawrencebarsanti.wordpress.com/2009/11/28/introduction-to-
pascal-script/
2.https://wiki.freepascal.org/Pascal_Script_Examples
3.https://talk.remobjects.com/t/pascal-script-set-var-question/10074
4.https://stackoverflow.com/questions/17101532/loading-pre-compiled-
script-in-remobjects-pascal-script-delphi
5.https://doc.tmssoftware.com/biz/scripter/scripter-user-guide.pdf
6.https://doc.tmssoftware.com/biz/scripter/guide/scripter.html
7.https://www.pascalgamedevelopment.com/showthread.php?32620-
Scripting-with-remote-debugger
8.https://www.youtube.com/watch?v=9dnGDI8qHsY
A last and interesting call concerns the shell with a kind of debug. If
you are familiar with the console just do an external console call from
the script:
7/9
The sc config command is a powerful tool in Windows that allows you to
modify the configuration of a service. This command can change various
parameters of a service, such as its start type, error control, binary
path, dependencies, and more. It is particularly useful for system
administrators who need to manage services on local or remote machines.
MaxMatrix Time/Space:
The multiplication of past x future is a vector with the function:= known
= f(changeable) [y=f(x)] as distance over time, so distance is a function
of time: d=f(t).
8/9
Conclusion
While the search results do not mention TPSScriptDebugger specifically,
standard script debuggers—including those for Pascal Script—share core
features that facilitate tracing the execution flow of scripts. These
features, as seen in various script debuggers, typically include:
Step Over: Executes the current line and moves to the next, skipping over
function calls.
Step Into: Dives into the details of a function call, allowing you to
trace execution inside called functions or procedures.
Step Out: Runs the rest of the current function and pauses execution when
control returns to the caller.
Script:
https://sourceforge.net/projects/maxbox5/files/examples/
1413_services5jcl_1.pas/download
References:
🐞
How to use the command 'sc' (with examples)
圍棋.
Doc and Tool: maXbox5 - Manage Files at SourceForge.net
Digitally signed by
maXbox4exe maXbox4exe
Date: 2025.06.19 15:29:08
+02'00'
9/9