2025-11-16 08:17:02 +00:00
|
|
|
# simstr Objects in Debuggers
|
2025-11-17 14:06:26 +00:00
|
|
|
[On Russian | По-русски](readme_ru.md)
|
2025-04-05 14:21:11 +00:00
|
|
|
|
2025-11-16 08:17:02 +00:00
|
|
|
Two files have been prepared for more convenient display of simstr objects in msvc and gdb debuggers:
|
2025-11-17 14:06:26 +00:00
|
|
|
`simstr.natvis` - for use in the MSVC debugger, and `simstr_pretty_print.py` for working with gdb.
|
2025-04-05 14:21:11 +00:00
|
|
|
|
2025-11-16 08:17:02 +00:00
|
|
|
# simstr Objects in Debuggers
|
2025-11-17 14:06:26 +00:00
|
|
|
### Visual Studio
|
2025-11-16 08:17:02 +00:00
|
|
|
If you are working in MS Visual Studio, simstr.natvis is automatically added to the pdb file,
|
|
|
|
|
and provides convenient viewing of simstr string objects wherever this library is used.
|
|
|
|
|
|
2025-11-17 14:06:26 +00:00
|
|
|

|
|
|
|
|
|
2025-11-16 08:17:02 +00:00
|
|
|
# simstr Objects in Visual Studio Code
|
|
|
|
|
## When working in gdb
|
|
|
|
|
In the debugger configuration, you need to add the following lines:
|
2025-04-05 14:21:11 +00:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
"setupCommands": [
|
|
|
|
|
{
|
|
|
|
|
"description": "Enable pretty-printing for gdb",
|
|
|
|
|
"text": "-enable-pretty-printing",
|
|
|
|
|
"ignoreFailures": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"description": "Enable pretty-printing for simstr",
|
|
|
|
|
"text": "source ${workspaceFolder}/for_debug/simstr_pretty_print.py",
|
|
|
|
|
"ignoreFailures": true
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
2025-11-16 08:17:02 +00:00
|
|
|
After that, simstr objects will be conveniently displayed in the debugger.
|
|
|
|
|
The script inspects variables of these types and provides a textual description for them, displaying their
|
|
|
|
|
content in a convenient form. The first line displays the basic information visible in the
|
|
|
|
|
variable inspection window. When you hover the mouse over a variable in the source code window
|
|
|
|
|
or over a value in the variable inspection window, the remaining information will be shown in the pop-up tooltip.
|
2025-04-05 14:21:11 +00:00
|
|
|
|
2025-11-16 08:17:02 +00:00
|
|
|
Debugger configurations are located in the `.vscode/launch.json` file.
|
|
|
|
|
You may also have the `CMake Tools` extension installed, which allows you to select the target project to run.
|
|
|
|
|
In this case, the settings for connecting the script are written in `.vscode/settings.json`:
|
2025-04-05 14:21:11 +00:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
"cmake.debugConfig": {
|
|
|
|
|
"MIMode": "gdb",
|
|
|
|
|
"environment": [],
|
|
|
|
|
"setupCommands": [
|
|
|
|
|
{
|
|
|
|
|
"description": "Enable pretty-printing for gdb",
|
|
|
|
|
"text": "-enable-pretty-printing",
|
|
|
|
|
"ignoreFailures": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"text": "source ${workspaceFolder}/for_debug/simstr_pretty_print.py",
|
|
|
|
|
"description": "pretty print simstr",
|
|
|
|
|
"ignoreFailures": true
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2025-11-17 14:06:26 +00:00
|
|
|
### Result
|
|
|
|
|

|
|
|
|
|
|
2025-11-16 08:17:02 +00:00
|
|
|
If you are working with the MSVC debugger in Visual Studio Code, that is, in launch.json `"type": "cppvsdbg"`, then the setting is different:
|
2025-04-05 14:21:11 +00:00
|
|
|
```
|
|
|
|
|
"configurations": [
|
|
|
|
|
{
|
|
|
|
|
.....
|
|
|
|
|
"type": "cppvsdbg",
|
|
|
|
|
....
|
|
|
|
|
"visualizerFile": "${workspaceFolder}/for_debug/simstr.natvis"
|
|
|
|
|
},
|
|
|
|
|
...
|
|
|
|
|
```
|