digitalmars.D.announce - Debugging improvements - Visual Studio Natvis, GDB, LLDB
- WebFreak001 (22/22) Apr 06 2021 I have created editor independent pretty printers / visualization
- Dennis (23/28) Apr 23 2021 This is great. Pretty-printing of associative arrays is a pretty
- WebFreak001 (9/40) Apr 23 2021 yeah the readme is already written assuming I release the new
- mw (8/13) Apr 23 2021 where to input this command? from gdb command line? or in
- WebFreak001 (7/22) Apr 24 2021 those are GDB-MI commands. If you can only run GDB console
- mw (11/17) Apr 24 2021 Thanks, I put these 2 lines into .gdbinit, and it seems loaded.
- WebFreak001 (3/22) Apr 24 2021 I haven't modified the expression parsing behavior (I don't know
- mw (4/34) Apr 24 2021 The implementations are different? or there are fundamental
- WebFreak001 (4/16) Apr 24 2021 the pretty printer implements summary & children (which are keys
- Gavin Ray (5/9) Apr 24 2021 Incredible -- below in VS Code (with launch.json and dub.json
I have created editor independent pretty printers / visualization files for Visual Studio's debugger\*, GDB and LLDB. The script and setup guide are available here: https://github.com/Pure-D/dlang-debug If you want to, please try them out, they make each of the debuggers a lot more capable at debugging D! If you find any bugs or tested what is untested in the README, please consider opening issues / making PRs. The files all add support for: - string/wstring/dstring (GDB and VSDBG take length as max length, LLDB can actually read over null bytes) - arrays (LDC, partially with DMD) - associative arrays (LDC, very partially with DMD) These debug configurations have been tested with VSCode and will all be bundled with next code-d release. An alpha can be found on Discord. Other editors will also work, Visual Studio can also use the Natvis file. Additionally these scripts could be used to add debugging support to standard library types / popular data types. If you have ideas for some you commonly use and want to debug, post a reply here or make an issue. \*: only when program is compiled with -gc
Apr 06 2021
On Tuesday, 6 April 2021 at 21:04:47 UTC, WebFreak001 wrote:I have created editor independent pretty printers / visualization files for Visual Studio's debugger\*, GDB and LLDB. The script and setup guide are available here: https://github.com/Pure-D/dlang-debugThis is great. Pretty-printing of associative arrays is a pretty big deal! I'm having problems setting it up though. You say the configuration is bundled since code-d 0.23.0 but the newest version VSCode lets me select is `0.22.0 (1 year ago)`. When manually adding the script in `setupCommands` of my cppdbg configuration: ``` { "description": "Load D GDB type extensions", "ignoreFailures": false, "text": "-interpreter-exec console \"source /path/to/gdb_dlang.py\"" } ``` It said `Undefined command: "import"` referring to line 1 `import gdb.printing`. It looks like it's interpreting `gdb_dlang.py` as a shell script, so I changed `source` to `python`, which gives the error "Python scripting is not supported in this copy of GDB". I have `GNU gdb (Debian 8.2.1-2+b3) 8.2.1`. Maybe my version is too old (I'm used to that on Debian), or I need to install some other module. I'll look into it later.
Apr 23 2021
On Friday, 23 April 2021 at 20:05:30 UTC, Dennis wrote:On Tuesday, 6 April 2021 at 21:04:47 UTC, WebFreak001 wrote:yeah the readme is already written assuming I release the new code-d release finally. Currently you still need to do it manually.I have created editor independent pretty printers / visualization files for Visual Studio's debugger\*, GDB and LLDB. The script and setup guide are available here: https://github.com/Pure-D/dlang-debugThis is great. Pretty-printing of associative arrays is a pretty big deal! I'm having problems setting it up though. You say the configuration is bundled since code-d 0.23.0 but the newest version VSCode lets me select is `0.22.0 (1 year ago)`.When manually adding the script in `setupCommands` of my cppdbg configuration: ``` { "description": "Load D GDB type extensions", "ignoreFailures": false, "text": "-interpreter-exec console \"source /path/to/gdb_dlang.py\"" } ``` It said `Undefined command: "import"` referring to line 1 `import gdb.printing`. It looks like it's interpreting `gdb_dlang.py` as a shell script, so I changed `source` to `python`, which gives the error "Python scripting is not supported in this copy of GDB". I have `GNU gdb (Debian 8.2.1-2+b3) 8.2.1`. Maybe my version is too old (I'm used to that on Debian), or I need to install some other module. I'll look into it later.oh that's not good, I just saw it's only enabled when built with python support, so some package maintainers might not choose to do so. Considering this is the only real way to get this working however I don't think I have another choice than assume the user has a GDB with python enabled.
Apr 23 2021
On Tuesday, 6 April 2021 at 21:04:47 UTC, WebFreak001 wrote:I have created editor independent pretty printers / visualization files for Visual Studio's debugger\*, GDB and LLDB. The script and setup guide are available here: https://github.com/Pure-D/dlang-debugwhere to input this command? from gdb command line? or in .gdbinit? ``` -enable-pretty-printing -interpreter-exec console "source /path/to/gdb_dlang.py" ``` (sorry, I googled a bit, but didn't find the answer).
Apr 23 2021
On Friday, 23 April 2021 at 23:54:21 UTC, mw wrote:On Tuesday, 6 April 2021 at 21:04:47 UTC, WebFreak001 wrote:those are GDB-MI commands. If you can only run GDB console commands you can use ``` source /path/to/gdb_dlang.py enable pretty-printer ```I have created editor independent pretty printers / visualization files for Visual Studio's debugger\*, GDB and LLDB. The script and setup guide are available here: https://github.com/Pure-D/dlang-debugwhere to input this command? from gdb command line? or in .gdbinit? ``` -enable-pretty-printing -interpreter-exec console "source /path/to/gdb_dlang.py" ``` (sorry, I googled a bit, but didn't find the answer).
Apr 24 2021
On Saturday, 24 April 2021 at 16:08:07 UTC, WebFreak001 wrote:those are GDB-MI commands. If you can only run GDB console commands you can use ``` source /path/to/gdb_dlang.py enable pretty-printer ```Thanks, I put these 2 lines into .gdbinit, and it seems loaded. I have a question about print AA: it only print values? ``` 11 int[int] aa = [1:2, 2:4]; (gdb) p aa $1 = [2] = {4, 2} (gdb) p aa[1] Invalid binary operation specified. ``` I tried both dmd -g and ldc2 -g on Linux, both the same behavior.
Apr 24 2021
On Saturday, 24 April 2021 at 17:16:48 UTC, mw wrote:On Saturday, 24 April 2021 at 16:08:07 UTC, WebFreak001 wrote:I haven't modified the expression parsing behavior (I don't know if I can even do that), it's only pretty printersthose are GDB-MI commands. If you can only run GDB console commands you can use ``` source /path/to/gdb_dlang.py enable pretty-printer ```Thanks, I put these 2 lines into .gdbinit, and it seems loaded. I have a question about print AA: it only print values? ``` 11 int[int] aa = [1:2, 2:4]; (gdb) p aa $1 = [2] = {4, 2} (gdb) p aa[1] Invalid binary operation specified. ``` I tried both dmd -g and ldc2 -g on Linux, both the same behavior.
Apr 24 2021
On Saturday, 24 April 2021 at 17:44:39 UTC, WebFreak001 wrote:On Saturday, 24 April 2021 at 17:16:48 UTC, mw wrote:Why they (keys & values) are showing below in VS code?On Saturday, 24 April 2021 at 16:08:07 UTC, WebFreak001 wrote:I haven't modified the expression parsing behavior (I don't know if I can even do that), it's only pretty printersthose are GDB-MI commands. If you can only run GDB console commands you can use ``` source /path/to/gdb_dlang.py enable pretty-printer ```Thanks, I put these 2 lines into .gdbinit, and it seems loaded. I have a question about print AA: it only print values? ``` 11 int[int] aa = [1:2, 2:4]; (gdb) p aa $1 = [2] = {4, 2} (gdb) p aa[1] Invalid binary operation specified. ``` I tried both dmd -g and ldc2 -g on Linux, both the same behavior.Incredible -- below in VS Code (with launch.json and dub.json config as shown on right) I am able to see arrays, strings, and associative arrays keys/values!The implementations are different? or there are fundamental obstacles that cannot be done for GDB console?
Apr 24 2021
On Saturday, 24 April 2021 at 18:59:29 UTC, mw wrote:On Saturday, 24 April 2021 at 17:44:39 UTC, WebFreak001 wrote:the pretty printer implements summary & children (which are keys and values) If you can't find a command in the console for listing children then it will only be able to show a summary.On Saturday, 24 April 2021 at 17:16:48 UTC, mw wrote:Why they (keys & values) are showing below in VS code?[...]I haven't modified the expression parsing behavior (I don't know if I can even do that), it's only pretty printersIncredible -- below in VS Code (with launch.json and dub.json config as shown on right) I am able to see arrays, strings, and associative arrays keys/values!The implementations are different? or there are fundamental obstacles that cannot be done for GDB console?
Apr 24 2021
On Tuesday, 6 April 2021 at 21:04:47 UTC, WebFreak001 wrote:I have created editor independent pretty printers / visualization files for Visual Studio's debugger\*, GDB and LLDB. [...]Incredible -- below in VS Code (with launch.json and dub.json config as shown on right) I am able to see arrays, strings, and associative arrays keys/values! 
Apr 24 2021
On Saturday, 24 April 2021 at 18:32:42 UTC, Gavin Ray wrote:On Tuesday, 6 April 2021 at 21:04:47 UTC, WebFreak001 wrote:It seems that the forum CSS decides to display images without `display: auto` or `display: scroll` for showing a scrollbar when it's larger than the container dimensions. So it's cropped the image and made the config on the right not visible. **Here's a direct link to full image:** https://i.imgur.com/FvcR9B9.pngI have created editor independent pretty printers / visualization files for Visual Studio's debugger\*, GDB and LLDB. [...]Incredible -- below in VS Code (with launch.json and dub.json config as shown on right) I am able to see arrays, strings, and associative arrays keys/values!
Apr 24 2021
On Saturday, 24 April 2021 at 18:32:42 UTC, Gavin Ray wrote:On Tuesday, 6 April 2021 at 21:04:47 UTC, WebFreak001 wrote:Are you running on Windows or Linux?I have created editor independent pretty printers / visualization files for Visual Studio's debugger\*, GDB and LLDB. [...]Incredible -- below in VS Code (with launch.json and dub.json config as shown on right) I am able to see arrays, strings, and associative arrays keys/values!
Apr 24 2021