Midas is a debug adapter that utilizes the GDB/MI interface while also integrating into the experience an ease of use of rr. It also aims to be as fast as GDB/rr allows for non-trivial applications and as such uses GDB's great Python integration to be faster than some debug adapters, where possible. Be sure to check out non-self documenting Midas-features if this document doesn't interest you! It explains how to use things like subscript operators, find first operators, debug console, hexadecimal formatting, etc! Midas defines a set of debug sessions. A "normal debug session" is launching a new session with a specified program to debug. The "attach debug session" launches a debug session that attaches to currently running program. A "replayable debug session" consists of launching a RR replay and debug that. All of these debug sessions also come with the additional "remote session" flavor which consists of connecting to a remote target machine to debug there. Contents
NEWSRemoved the old "GDB Machine Interface" implementation and made the repository substantially more lean. To track new things, read the changelog here Q & AJoin the matrix room https://chat.mozilla.org/#/room/#midas:mozilla.org for questions. Office hours are every waking moment of the day ;) RequirementsMidas is developed exclusively for GDB with Python integration in mind. If you are running a GDB which does not support it, or hasn't been built with Python functionality, Midas will not work, at all. And as it's developed with rr in mind, Linux is also a requirement. To check whether or not GDB has been built with Python, from a terminal write
This will give you a list of GDB features built in. In this list, something like this should be shown:
Midas has been tested with the following GDB versions
Currently Midas will only work for GDB versions above 9.1 due to the nature of the Python implementation of earlier GDB versions. There might be some work put into getting earlier versions to work. But it might not be possible depending on how far back Python support exists in GDB. Toolchain managementMidas aims to be able to support full toolchain management for debugging. At the moment, it currently only supports management of RR. If you don't have RR installed, Midas provides 3 ways of installing it for you. You execute the midas function
This will install RR and also make it available from the VSCode terminal by simply entering Currently, all three ways require that you run a Linux system that uses either N.B! You will be required to input your sudo password for all three of these to work. A message box will ask you if this is OK. Midas does not store your password nor any other information about you. In the future, the idea is that GDB should also be managed to be able to keep up with all the new features and optimization work that is being put into GDB by the great developers who are working on GDB. The justification for this, is that just in version 12 of GDB, debug symbol parsing was greatly optimized making life a lot better for people working on non-trivial applications of millions of lines of code. Midas wants to be able to make the process of staying on "current" as much as possible, as an opt-in feature. Launch configurationMidas defines different debug sessions; "normal", "attach", and "replayable" and all three also come with an additional "remote" flavor, where the actual program is being run on a remote target. The quickest way to configure is to open up the Normal debug sessionExample gdb session:
Required values are
Default values for non-required (or non-set) properties:
All stop mode, means that all stop / continue actions halt or start threads in unison. Trace has the following settings:
The log files will be found where the extension is installed (typically at $HOME/.vscode/extensions/...). These are currently very bare bones though. To "run" the inferior (debugged program) in an external console, add the
rr:
Since the rr debug session relies on rr running, closing the terminal where it's running externally, will end the debug session. These fields are described in the UI when setting up a launch.json. However, currently this is only tested on Ubuntu, thus it uses
Replayable RR debug sessionA minimum required launch config for RR is really simple as Midas will query RR for it's traces in
This requires that Configuration example, for a rr debug session of for example a
However, you shouldn't have to fill out a placeholder for yourself, VSCode should be able to provide auto-completion like it normally does (default trigger usually is Attach sessionAttaching to a running process is basically done and setup the same way. Midas will provide a default setting:
Leave PID field as is (or remove the field entirely) and you will be asked for it at debug session launch where you can type either the PID directly or the process name and get a list of PID's to choose from (if only 1 exists, it automatically gets picked). Remote debug sessionsTo use Midas to debug an application running on a remote target, the user must have first started a gdbserver that is running the application and listening for connections on some address. To connect to a gdbserver at address
If the remote session is an RR replay, just replace ContributeTo contribute, pop in to the matrix channel, say Hi, tell us why you want X and send a PR for it. Or send a PR with detailed information about why/what/how. Before requesting a PR, run the command Setup commandsAnother field that can be added is the
Midas NativeThere's a mode for a 3rd debugger which is being natively developed to work in Midas extension. As the debugger is in an alpha version, it won't be provided here, so it will have to be built manually from sources from here. UsageSince VSCode is aimed to be as general as possible, some functionality might never be represented in the UI - as such it might appear unintuitive. Describing such functionality is found here, like setting watch points, formatting displayed values etc. It's recommended to skim through, to get to know useful Midas features. If Midas behaves strangely, there exists a midas command ( DevelopmentTo package extension, run the alias
ChangelogCan be found here Known bugsCan be found here |