Re: debugging in vs code on Windows
On Saturday, 14 October 2017 at 13:12:51 UTC, Jerry wrote: On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote: (...) If you use generate a 32-bit binary using DMD, it generates it in a format that the C/C++ extension doesn't understand. You need to compile -m32mscoff or -m64, and you need to make sure the /DEBUG is passed to the linker, as I don't think dmd passes it that. You can do that by passing "-L/DEBUG" to DMD (when using -m32mscoff or -m64). There should be a .pdb file that gets generated, when you start the debugger it should say that symbols were loaded for the exe. I also can't say for certain if debug information is even generated for the unittests, so that might be something worth looking into to make sure it does. I have added this to dub.json: "dmd-flags":[ "-g", "-m64", "-L/DEBUG" ] but I don't see a pdb file generated when I build. What am I doing wrong?
Re: debugging in vs code on Windows
On Saturday, 14 October 2017 at 13:20:27 UTC, Jerry wrote: On Saturday, 14 October 2017 at 10:15:53 UTC, evilrat wrote: webfreak's NativeDebug extension to be able to click to set breakpoint on lines(only for that). You can just use VS Code setting, put the following into your settings.json: "debug.allowBreakpointsEverywhere": true But I can already click on the edge of editor and red bubble appears. Its just that the execution doesn't stop on those.
Re: debugging in vs code on Windows
On Friday, 13 October 2017 at 17:04:00 UTC, kerdemdemir wrote: On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote: (...) I am using VisualD(https://github.com/dlang/visuald/releases) with vs2015 community version(free) and I can debug. I highly recommend it if you haven't tried yet. Those options like "-g" is presented to you with interfaces. Forexample "-g" is automatically is being added if you are selecting debug builds(like Debug DMD or Debug LDC). I will consider that, but I really like VS Code because I often switch between Linux and Windows machine, so I can have the same thing on both. Does VisualD play well with dub?
debugging in vs code on Windows
I have windows 10, VS Code with code-d and C/C++ language extensions. I try to debug but it doesn't work. In particular, the debugging doesn't stop on breakpoints. It exits immediately. I recompile with -m64 and -g. I use dub to build the project. I use unit-threaded and I'm trying to debug a unittest build. Has anyone been able to debug in VS code on Windows? What am I doing wrong? (Rhetorical) Why is dlang community provide so many options (see https://wiki.dlang.org/Debuggers) and **every single one** of them is faulty in some way? I tried windbg and mago-mi but didn't gen anywhere.
need to emulate scope(failure) with struct destructor
I need to perform an action, in multiple separate functions, if scope exits with an exception. The trouble is I don't want to litter my code with scope(failure) everywhere. I already create an instance of a struct at each location, with the sole purpose of doing things at the end of scope. So my code looks like: function1() { RAIIType transactionHandler; scope(failure) action; //code } function2() { RAIIType transactionHandler; scope(failure) action; //code } function3() { RAIIType transactionHandler; scope(failure) action; //code } etc. Ideally I would put the statement from scope(failure) in the struct's destructor and delete the scope(failure) statements. I would need something like c++'s std::uncaught_exceptions() to check if an exception is in flight. Is there something like this in D? PS I think that we have here a more general problem, because dlang is missing a feature for composition of scope(...) statements.