digitalmars.D.learn - Better debugging?
- Tim (8/8) Oct 03 2021 Hi all,
- Imperatorn (9/17) Oct 03 2021 You don't say which operating system you are using.
- Tim (2/12) Oct 03 2021 Apologies. I use KDE linux
- Imperatorn (4/20) Oct 03 2021 Then I guess code-d extension + MS C++ extension in order to
- WebFreak001 (9/25) Oct 04 2021 On Linux I would recommend compiling with LDC (dub defaults to
- Adam Ruppe (4/5) Oct 03 2021 tried plain -g ?
- Basile B. (30/38) Oct 03 2021 1. LDC2 generate better debug infos, especially for classes,
- Imperatorn (2/8) Oct 09 2021 Btw, thanks for continuing to work on dexed :)
- max haughton (3/11) Oct 03 2021 Might be something for Iain to weigh in one when it comes to GDC
Hi all, I am currently using GDB within VScode with the -gc DMD2 compiler switch and my debugging is not amazing. Whenever I inspect a struct/object it just shows me the pointer rather than the object information and strings come up as a gross array of the characters. Does anybody happen to know whether LDB is better or how I can have a nicer debug environment? Thanks in advance
Oct 03 2021
On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote:Hi all, I am currently using GDB within VScode with the -gc DMD2 compiler switch and my debugging is not amazing. Whenever I inspect a struct/object it just shows me the pointer rather than the object information and strings come up as a gross array of the characters. Does anybody happen to know whether LDB is better or how I can have a nicer debug environment? Thanks in advanceYou don't say which operating system you are using. I usually use Visual D which works great imo. If I use vscode I use the C++ debug extension (don't remember what it's called). If I debug outside of the IDE I use WinDbg, also has source debug support if configured correctly. If you are on Linux I'm not sure, but I would go for the C++ thing probably.
Oct 03 2021
On Sunday, 3 October 2021 at 22:26:15 UTC, Imperatorn wrote:On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote:Apologies. I use KDE linux[...]You don't say which operating system you are using. I usually use Visual D which works great imo. If I use vscode I use the C++ debug extension (don't remember what it's called). If I debug outside of the IDE I use WinDbg, also has source debug support if configured correctly. If you are on Linux I'm not sure, but I would go for the C++ thing probably.
Oct 03 2021
On Sunday, 3 October 2021 at 22:27:20 UTC, Tim wrote:On Sunday, 3 October 2021 at 22:26:15 UTC, Imperatorn wrote:Then I guess code-d extension + MS C++ extension in order to debug, and webfreak's NativeDebug extension (https://marketplace.visualstudio.com/items?itemName=webfreak.debug)On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote:Apologies. I use KDE linux[...]You don't say which operating system you are using. I usually use Visual D which works great imo. If I use vscode I use the C++ debug extension (don't remember what it's called). If I debug outside of the IDE I use WinDbg, also has source debug support if configured correctly. If you are on Linux I'm not sure, but I would go for the C++ thing probably.
Oct 03 2021
On Sunday, 3 October 2021 at 22:27:20 UTC, Tim wrote:On Sunday, 3 October 2021 at 22:26:15 UTC, Imperatorn wrote:On Linux I would recommend compiling with LDC (dub defaults to debug mode, otherwise use `-g`) and using LLDB. Additionally for string, array and AA support use https://github.com/Pure-D/dlang-debug/#lldb (code-d section in README is for upcoming release, you need to follow the manual install procedures) For VSCode I recommend using the [CodeLLDB](https://marketplace.visualstudio.com/items?itemName= adimcn.vscode-lldb) extension, it works pretty well.On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote:Apologies. I use KDE linux[...]You don't say which operating system you are using. I usually use Visual D which works great imo. If I use vscode I use the C++ debug extension (don't remember what it's called). If I debug outside of the IDE I use WinDbg, also has source debug support if configured correctly. If you are on Linux I'm not sure, but I would go for the C++ thing probably.
Oct 04 2021
On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote:-gc DMD2 compiler switchtried plain -g ? -gc is a compatibility debug thing for things with zero D support. p oboslete now
Oct 03 2021
On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote:Hi all, I am currently using GDB within VScode with the -gc DMD2 compiler switch and my debugging is not amazing. Whenever I inspect a struct/object it just shows me the pointer rather than the object information and strings come up as a gross array of the characters. Does anybody happen to know whether LDB is better or how I can have a nicer debug environment? Thanks in advance1. LDC2 generate better debug infos, especially for classes, although this might change from the next DMD version (it will include the inherited fields, just like LDC2). 2. to inspect objects you must evluate the dereference of an instance. for example for a project, if i eval `d`, a class instance VS `*d`, the pointed chunk of memory. | name| value | ---| --- d | 0x7ffff7b4b480 s | 0x7ffff7b506c0 locParentAggr | 0x0 symParentAggr | 0x0 thisParentAggr | 0x0 needInheritance | false this | 0x7ffff7b506c0 loc | 0x7ffff7b43ea0 evaluation of `d` | 0x7ffff7b4b480 evaluation of `*d` | {<styx.ast.base.AstNode> = {<object.Object> = {<No data fields>}, startPos = {line = 18, column = 1}, ir = 0x0}, name = 0x7ffff7b4e5e0, symbol = 0x7ffff7b506c0, attributes = 0x0, asTypeDeclared = 0x7ffff7b50720, kind = 34 '\"', protection = 0 '\\000', progress = 0 '\\000'} I don't know how the debugger gui you use works, here this is just a paste of dexed-ide table for locals and custom expressions. More often I use a debug popup: ![](https://i.imgur.com/cGdQfOr.png) [A similar feature seems possible in vscode](https://github.com/microsoft/vscode-java-debug/issues/444), maybe post a feature request to the extension developpers, as the debug popup is often very handy (no need to type expressions, as they are already there in the code !)
Oct 03 2021
On Sunday, 3 October 2021 at 23:17:25 UTC, Basile B. wrote:On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote:Btw, thanks for continuing to work on dexed :)[...]1. LDC2 generate better debug infos, especially for classes, although this might change from the next DMD version (it will include the inherited fields, just like LDC2). [...]
Oct 09 2021
On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote:Hi all, I am currently using GDB within VScode with the -gc DMD2 compiler switch and my debugging is not amazing. Whenever I inspect a struct/object it just shows me the pointer rather than the object information and strings come up as a gross array of the characters. Does anybody happen to know whether LDB is better or how I can have a nicer debug environment? Thanks in advanceMight be something for Iain to weigh in one when it comes to GDC specifically but the non-dmd compilers generate better debug info.
Oct 03 2021