www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ide - Can't start to debug an app in any IDE

reply Wusiki Jeronii <wusikijeronii gmail.com> writes:
Hello. I can't start the debugging process. I've tried VS code, 
VS studio 2010, VS studio 2015, VS Studio 2019, IntelliJ IDEA and 
dlang IDE.  I've tried different OSs (Windows and Linux) and 
different machines. For now, I prefer windows. Also, I've tried 
different compilers: DMD and ldc2.
In VS code I've tried native Debug by WebFreak and cpptools. 
Using by native Debug I've tried gdb and mago-mi compiler. Using 
Mago-mi I get the error: "Could not start debugger process, does 
the program exist in filesystem?
Error: spawn mago-mi ENOENT"
Mago-mi exists in my PATH.
Using gdb in VS code I get the error: DBG: Breakpoint binding 
error: No symbols have been loaded for this document. Then I also 
see: "warning: Can not parse XML library list; XML support was 
disabled at compile time".
Using cpptools in VS code I don't get nonstandard error. My app 
just runs in simple mode (without pause of the program when it 
needs).
In VS studio 2010 I can't even run my app without debugging 
tools. When I try to build project I get error "cannot monitor 
32-bit exetuable dmd (or ldc2 if I use ldc2 compiler), no 
suitable tracker.exe found". Visual D, NetFixTools 4, DMD, and 
ldc2 exist in my PATH.
In VS studio 2015 I also can't build the project. I get the 
error: "core.exception.RangeError ..\tools\pipedmd.d(577): Range 
violation"
In VS studio 2019 I can't create a project at all. Looks like it 
is IDE issue.
In IntelliJ IDEA I could run my app before . But if I try to 
debug the program, the program just stopped without any error in 
the debugger log. If I use gdb. If I use mago-mi I get the error 
"Caused by: java.lang.IllegalArgumentException: Argument for 
 NotNull parameter 'module' of 
com/intellij/openapi/roots/ModuleRootManager.getInstance must not 
be null" and the program can't run at all (Fatal error).
In dlang IDE I get the error: " Breakpoint binding error: No 
symbols have been loaded for this document."
Can you help me with this? What do I do wrong?
Sep 20 2019
parent reply WebFreak001 <d.forum webfreak.org> writes:
On Saturday, 21 September 2019 at 06:49:13 UTC, Wusiki Jeronii 
wrote:
 Hello. I can't start the debugging process. I've tried VS code, 
 VS studio 2010, VS studio 2015, VS Studio 2019, IntelliJ IDEA 
 and dlang IDE.  I've tried different OSs (Windows and Linux) 
 and different machines. For now, I prefer windows. Also, I've 
 tried different compilers: DMD and ldc2.
 In VS code I've tried native Debug by WebFreak and cpptools. 
 Using by native Debug I've tried gdb and mago-mi compiler. 
 Using Mago-mi I get the error: "Could not start debugger 
 process, does the program exist in filesystem?
 Error: spawn mago-mi ENOENT"
 Mago-mi exists in my PATH.
 Using gdb in VS code I get the error: DBG: Breakpoint binding 
 error: No symbols have been loaded for this document. Then I 
 also see: "warning: Can not parse XML library list; XML support 
 was disabled at compile time".
 Using cpptools in VS code I don't get nonstandard error. My app 
 just runs in simple mode (without pause of the program when it 
 needs).
 In VS studio 2010 I can't even run my app without debugging 
 tools. When I try to build project I get error "cannot monitor 
 32-bit exetuable dmd (or ldc2 if I use ldc2 compiler), no 
 suitable tracker.exe found". Visual D, NetFixTools 4, DMD, and 
 ldc2 exist in my PATH.
 In VS studio 2015 I also can't build the project. I get the 
 error: "core.exception.RangeError ..\tools\pipedmd.d(577): 
 Range violation"
 In VS studio 2019 I can't create a project at all. Looks like 
 it is IDE issue.
 In IntelliJ IDEA I could run my app before . But if I try to 
 debug the program, the program just stopped without any error 
 in the debugger log. If I use gdb. If I use mago-mi I get the 
 error "Caused by: java.lang.IllegalArgumentException: Argument 
 for  NotNull parameter 'module' of 
 com/intellij/openapi/roots/ModuleRootManager.getInstance must 
 not be null" and the program can't run at all (Fatal error).
 In dlang IDE I get the error: " Breakpoint binding error: No 
 symbols have been loaded for this document."
 Can you help me with this? What do I do wrong?
How did you compile your programs? Using dub there should be no problem because it defaults to emitting debug symbols. If you manually invoke LDC/DMD you have to pass the -g flag to output debug symbols. In dub you can additionally add "lflags": ["/PDB:my_program_name.pdb"] to your dub.json to make it emit a .pdb file which in my experience improved debug experience when it before didn't work. It might be generated in the .dub folder and you can copy it if it still doesn't work
Sep 21 2019
parent reply Wusiki Jeronii <wusikijeronii gmail.com> writes:
On Saturday, 21 September 2019 at 10:47:23 UTC, WebFreak001 wrote:
 How did you compile your programs? Using dub there should be no 
 problem because it defaults to emitting debug symbols.

 If you manually invoke LDC/DMD you have to pass the -g flag to 
 output debug symbols.

 In dub you can additionally add "lflags": 
 ["/PDB:my_program_name.pdb"] to your dub.json to make it emit a 
 .pdb file which in my experience improved debug experience when 
 it before didn't work. It might be generated in the .dub folder 
 and you can copy it if it still doesn't work
So far I compile code using terminal via ldc2. I compiled the app using '-g' flag and then compiler created a .pdb file. When I started debug I've got the same error. I decided to change debuggers for one more test (mago, gdb and cpp). I got the same errors. Then I return debugger to gdb and now I get the error "Failed to load MI Debugger". Not inexecutable format. Just app's launch works. These errors I got in the VS code. In IntelliJ IDEA now I get the error 'No symbol table is loaded. Use the "file" command.' What's the right path for dub.json?
Sep 21 2019
next sibling parent reply WebFreak001 <d.forum webfreak.org> writes:
On Saturday, 21 September 2019 at 22:13:59 UTC, Wusiki Jeronii 
wrote:
 On Saturday, 21 September 2019 at 10:47:23 UTC, WebFreak001 
 wrote:
 [...]
[...] What's the right path for dub.json?
I think all paths should work but I would always call it exactly the same as the executable. So helloworld.exe + helloworld.pdb GDB/LLDB/vscppdbg will automagically find the pdb when you just specify the exe.
Sep 21 2019
parent reply Wusiki Jeronii <wusikijeronii gmail.com> writes:
On Saturday, 21 September 2019 at 22:17:49 UTC, WebFreak001 wrote:
 On Saturday, 21 September 2019 at 22:13:59 UTC, Wusiki Jeronii 
 wrote:
 On Saturday, 21 September 2019 at 10:47:23 UTC, WebFreak001 
 wrote:
 [...]
[...] What's the right path for dub.json?
I think all paths should work but I would always call it exactly the same as the executable. So helloworld.exe + helloworld.pdb GDB/LLDB/vscppdbg will automagically find the pdb when you just specify the exe.
My structure: (VS Code) main.d main.exe main.obj main.pdb "main.exe" is the target. Before it worked so. I also tried to add workspaceRoot but it didn't help.
Sep 21 2019
parent reply Wusiki Jeronii <wusikijeronii gmail.com> writes:
On Saturday, 21 September 2019 at 22:30:42 UTC, Wusiki Jeronii 
wrote:
 On Saturday, 21 September 2019 at 22:17:49 UTC, WebFreak001 
 wrote:
 On Saturday, 21 September 2019 at 22:13:59 UTC, Wusiki Jeronii 
 wrote:
 On Saturday, 21 September 2019 at 10:47:23 UTC, WebFreak001 
 wrote:
 [...]
[...] What's the right path for dub.json?
I think all paths should work but I would always call it exactly the same as the executable. So helloworld.exe + helloworld.pdb GDB/LLDB/vscppdbg will automagically find the pdb when you just specify the exe.
My structure: (VS Code) main.d main.exe main.obj main.pdb "main.exe" is the target. Before it worked so. I also tried to add workspaceRoot but it didn't help.
Wow. cpptools (windows launch) started to work. But I hear cpprools has a lot of limitations for D debugging (associative array and etc). Need to use other debuggers (gdb or Mago-Mi).
Sep 21 2019
parent reply Wusiki Jeronii <wusikijeronii gmail.com> writes:
On Saturday, 21 September 2019 at 22:38:47 UTC, Wusiki Jeronii 
wrote:
 On Saturday, 21 September 2019 at 22:30:42 UTC, Wusiki Jeronii 
 wrote:
 On Saturday, 21 September 2019 at 22:17:49 UTC, WebFreak001 
 wrote:
 On Saturday, 21 September 2019 at 22:13:59 UTC, Wusiki 
 Jeronii wrote:
 On Saturday, 21 September 2019 at 10:47:23 UTC, WebFreak001 
 wrote:
 [...]
[...] What's the right path for dub.json?
I think all paths should work but I would always call it exactly the same as the executable. So helloworld.exe + helloworld.pdb GDB/LLDB/vscppdbg will automagically find the pdb when you just specify the exe.
My structure: (VS Code) main.d main.exe main.obj main.pdb "main.exe" is the target. Before it worked so. I also tried to add workspaceRoot but it didn't help.
Wow. cpptools (windows launch) started to work. But I hear cpprools has a lot of limitations for D debugging (associative array and etc). Need to use other debuggers (gdb or Mago-Mi).
For Mago-mi I also tried to add mago-mi path. I have two versions: from github and another source. If I add path to mago-mi to version from Github I get the error: Invalid breakpoint parameters. If I add path to mago-mi to version from another source my app is running but anything doesn't happen. Just black console window. I reinstalled gdb (MinGw) and also added gdbpath. Module window with error is disappeared but I still get message in debug log: No symbol table is loaded. Use the "file" command.
Sep 21 2019
parent Paul <paultjeadriaanse gmail.com> writes:
On Saturday, 21 September 2019 at 23:03:36 UTC, Wusiki Jeronii 
wrote:
 No symbol table is loaded.  Use the "file" command.
I am getting the same issue, with the same message when I try to use native debug on vscode, however my breakpoints are also ignored when using gdb in the commandline. Have you found a solution to your problem? I'm not sure what is wrong & can't find a solution elsewhere (I have tried several dflags & lflags as well) :/
Jan 07 2021
prev sibling parent Wusiki Jeronii <wusikijeronii gmail.com> writes:
On Saturday, 21 September 2019 at 22:13:59 UTC, Wusiki Jeronii 
wrote:
 So far I compile code using terminal via ldc2. I compiled the 
 app using '-g' flag and then compiler created a .pdb file. When 
 I started debug I've got the same error. I decided to change 
 debuggers for one more test (mago, gdb and cpp). I got the same 
 errors. Then I return debugger to gdb and now I get the error 
 "Failed to load MI Debugger". Not inexecutable format. Just 
 app's launch works. These errors I got in the VS code. In 
 IntelliJ IDEA now I get the error 'No symbol table is loaded.  
 Use the "file" command.'
 What's the right path for dub.json?
And in Idea IDE I get error [immediate] error: [msg: "C:UsershomeIdeaProjectsTestoutproductionTestTest.exe: No such file or directory."]. (without /) And I have decided maybe issue is in a compilator. ldc2 works fine but dmd works only without -g flag. If I add -g flag I get the error: OPTLINK : Error 118: Filename Expected
Sep 21 2019