Getting involved
It’s time to get involved once you have the fork and all required software.
We assume you are working on Ubuntu (or WSL) with Visual Studio Code in this post.
Editor Plugins
Install plugins below:
Debugging with launch.json
Generally, you need to debug martin with specific arguments or a config file to fix issues or add features.
The most convenient way is to generate a launch.json and modify it.
Generate
Press F1
on your keyboard, and input “Generate Launch Configurations from Cargo.toml”. Execute it and save it to your .vscode
directory.
Modify
Let’s say you want to debugging Martin with this command:
martin postgres://postgres:postgres@localhost:5411/db
You could find Debug executable 'martin'
in your launch.json
, like below:
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'martin'",
"cargo": {
"args": [
"build",
"--bin=martin",
"--package=martin"
],
"filter": {
"name": "martin",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
Just copy and paste after it, and modify your pasted like this:
{
"type": "lldb",
"request": "launch",
"name": "my first debug", // name it any as you like
"cargo": {
"args": [
"build",
"--bin=martin",
"--package=martin"
],
"filter": {
"name": "martin",
"kind": "bin"
}
},
"args": ["postgres://postgres:postgres@localhost:5411/db"], // add your arguments here
"env": {
"DEFAULT_SRID": 4490, // add your env here
},
"cwd": "${workspaceFolder}"
},
Add a breakpoint
Go to any part you’re interested in of martin code and add a breakpoint.
We add a breakpoint here in the start of martin.
Debugging
Click Run and Debug
on the left panel of Visual Studio Code
. Choose my first debug
and press F5
on your keyboard.
Wait for the breakpoint to be hit.