Yes – real debugging, using a debugger, run by CodeBot. This is magic.
We have an exciting update for CodeBot today: AI-driven debugging for your Delphi apps! This feature is available in the current release (build 77), but we consider it experimental/preview. With that caveat, it is available now.
CodeBot is AI designed for Delphi, which is more than 'just' knowing Delphi really well. It's designed with thinking for Delphi. And it is great at writing Delphi code. However, until now, if you asked it to solve a runtime problem it had to read the code and make an informed guess.
Now, CodeBot can drive a debugger. Just tell it 'debug this, I will repro a crash' (for example) and it will launch the app, wait for the exception, diagnose the cause, and fix it.
Of course, debugging involves using the debugger – reading the call stack, catching exceptions, evaluating variables, etc – plus analysis to find the cause:
Of course, it can also fix the problem:
The preview version of CodeBot supports:
- Win32 and Win64 apps, in Delphi 12 and 13 (ARM not yet tested) – however, it can debug Win32 and Win64 apps running on Windows ARM
- Static and dynamically linked apps (ie single EXEs, plus ones using packages or DLLs, including debugging those packages)
Our own debugger #
CodeBot has its own debugger, which can do all the things you expect: place breakpoints, see call stacks, evaluate and set properties, call methods, evaluate expressions, and more.
This is pretty major work. We are not using the in-IDE Delphi debugger or the debug ToolsAPIs; we are using our own debugger. This has taken a fair bit of development effort, as you can imagine :) In fact, counting unit tests, more than four hundred commits over three months. The main reason to do this is that Delphi's Win32 and Win64 debugging support is not useful for us: it does not provide its own separate tooling apps (ie command line debuggers for debugging Win32/Win64) nor does it use the platform standard PDB debug format. We do not want CodeBot to be constrained in its functionality, so we have essentially written a conversion to what we view as a more modern debug tooling system.
Bringing modernity to Delphi is a key theme here at RemObjects!
The CodeBot debugger converts debug info into PDB format, plus a second file for extra info that PDB does not natively express. We then use these (PDB+extra) to debug.
The second file contains things like info about properties (ie a Delphi-ism), sets, and Delphi calling conventions - things that a standard PDB stream does not support. One day we might put this as a custom stream into PDB itself.
It would be ideal if Embarcadero did this, and in fact the Modern C++ toolchain pioneered PDB for RAD Studio, and ARM may use it too, so maybe it's coming! If you're at Embarcadero reading this and would like to collaborate on an open modern debug stream using PDB for Delphi, please get it touch! You know how to reach us ;)
In addition, CodeBot has a new system for running command-line apps in a virtual terminal.
Finally, we provide multiple tools in the debugger for Delphi-isms, so when CodeBot drives the debugger it get more capabilities than it otherwise would. This should be invisible to you – you should, we hope, simply see CodeBot understanding your Delphi app as it solves runtime problems.
Through this, CodeBot can use the debugger to diagnose runtime behaviour and figure out both the the cause and a solution.
As well as solving issues autonomously, you can ask it anything you would do with a debugger manually.
Permissions #
CodeBot is careful about what it runs and has higher security than other agents as its default. In this release, we are now allowing CodeBot to run arbitrary applications - yours - and this is new.
By default, CodeBot is now allowed to run - without asking! - any of your projects it identifies as a unit test project. For others, it is prompted to ask for permission first. You can change this on the Permissions page of the settings.
You can choose to always allow this project so it won't ask for this one again:
Experimental / Preview #
We consider this feature to currently be experimental, or a preview. As such, you may encounter issues. If so, please let us know. We are still working on it; we consider it useful, working, more to come but that we'd love you to try it out.
For complex problems, we recommend turning up CodeBot's intelligence level; debugging is where reasoning skills are important! Core functionality, including Delphi specifics like interfaces, strings, properties, etc should work. One known area is resolving debug information for some types and methods; expect that to improve over the next release. Handling the non-platform-standard debug info and converting to PDB (as above) is an area of ongoing work. The CodeBot debugger has been tested on apps up to half a million lines of code, and we expect it to scale from there. Your feedback will be very welcome!
This is available for all subscriptions now. When you open a CodeBot chat, it should show you an update button within a few seconds, of build 77 or newer. If not, just download it.
Happy debugging!