Re: Debugging D applications from VS code with webfreak.debug
On Friday, 24 February 2017 at 03:15:11 UTC, Jerry wrote: You can use the C++ plugin, which provides a debugger. Just make sure you aren't using optlink, I don't think it generates compatible files. Also you might need to use "-gc" which generates debug names to be in C format. https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools You might also need to enable breakpoints anywhere in VS code user setting file. Awesome! After finding the right combination of flags (-g and -m64 fed to dmd via dflags-dmd in my dub.json) this works quite nicely. Thanks a lot! Is there anywhere I can contribute this as documentation?
Re: Debugging D applications from VS code with webfreak.debug
On Thursday, 23 February 2017 at 17:54:09 UTC, FR wrote: gdb is in my path, I can run it from the command line. When I run 'gdb test.exe' (test.exe being the binary placed in my workspace folder), I get the error message "not in executable format: File format not recognized", whether I build as x86 or x86_64. Any further tips on where I could get a working gdb? Nevermind on this one. Turns out something was off with the gdb from my MinGW installation. Got a new one from http://www.equation.com/servlet/equation.cmd?fa=gdb , placed it where it can be found and it runs. Yay! However: I cannot seem to get breakpoints to work. When my executable is launched, the debug output says "No symbol table is loaded. Use the "file" command.". Is there any special flag I need to set in my dub.json? Should I point the "target" and "cwd" in the launch.json anywhere but the executable that pops up in my ${workspaceRoot} (e.g. one of the sub-folders of .dub/build)?
Re: Debugging D applications from VS code with webfreak.debug
On Thursday, 23 February 2017 at 16:30:08 UTC, WebFreak001 wrote: I don't know how to build mago-mi either, but you can obtain it from the bundle with dlangide https://github.com/buggins/dlangide/releases/download/v0.6.11/dlangide-v0_6_11-bin-win32_x86-magomi-v0_3_1.zip Thanks, that got me somewhere. However, this executable stops working as soon as I run it from the command line. Double-clicking it from the explorer opens a gdb console. I added it to my path anyyhow, but clicking on debug in vscode with a launch.json with "type": "mago-mi" doesn't do anything. With GDB it should just work though, if you can run `gdb` from the command line. If you can only run it through some MinGW command line version, try running vscode over the command line there gdb is in my path, I can run it from the command line. When I run 'gdb test.exe' (test.exe being the binary placed in my workspace folder), I get the error message "not in executable format: File format not recognized", whether I build as x86 or x86_64. Any further tips on where I could get a working gdb?
Debugging D applications from VS code with webfreak.debug
Hi everyone, as the subject says, I'm trying to get a debugger running with visual studio code on windows. I have installed WebFreak001's code-d and debug extensions but fail to figure out how to install a working debugger. The gdb I have installed is part of a MinGW installation and complains about the file format of the executable, I'm unsure if there's soemthing wrong there. I could not figure out how to obtain mago-mi to try that one, either. I'd appreciate any help or pointers to resources on how to get this running, as I otherwise really like the workflow with code-d. Cheers, FR
Re: Ranges & containers : is it possible to get a SortedRange from a RedBlackTree ?
On Monday, 7 July 2014 at 16:58:51 UTC, anonymous wrote: No array is created in the example. Where do you think an array is created? It's in the example above : SortedRange!(MyObject[]) opSlice() { sequence[].array.assumeSorted; } I thought that that using ".array" would lead to instantiating something. Oh, must be a restriction that's going to be lifted in 2.066. I'm using git head, so I didn't realize that it doesn't work in 2.065. OK that's what I was suspecting... Thanks for checking that. Looks like you can't get binary search through SortedRange over a Range of a RedBlackTree. If you don't need that, you can just drop SortedRange (and assumeSorted) and use InputRange directly. Yes it seems this is the way to go in my case. As far as I know, true (efficient) random access on a RB tree is not a "natural" thing and I would nto have expected that ranges coming from those trees would support it. However it's curious that random access was required by SortedSet, but as far as I understand, this constraint has been recently dropped. RandomAccessFinite is in the same family as InputRange [...] SortedRange is a different kind of template. The template parameter is a range type (e.g. MyObject[] or RedBlackTree!MyObject.Range). Replacing the one with the other doesn't make sense, and doesn't work. Of course ! I'm sorry I retyped it incorrectly, I tested so many things... The actual code was the following, which seems to make sense if SortedRange expects random access: SortedRange!(RandomAccessFinite!MyObject) opSlice(); But then I have this error on assumeSorted() : template std.range.assumeSorted cannot deduce function from argument types !()(InputRange!int), candidates are: [...] [...] Now, if you'd want to go the static-duck-typing route, you'd ditch the MyObjectSet interface. Instead, you'd pass RedBlackTree!MyObject or just RedBlackTree around as a template argument, possibly implicitly. Maybe you could give an example of how you would use MyObjectSet. Then we could think about a template-based alternative. For various reasons I'm very attached to interface-oriented design, and although I understand that this is not very "D"-like, I'll try a little bit more in this way ;) I really like the D language itself but for me it's almost mandatory to manipulate abstract interface such as "ordered set" and then to be able to switch easily between particular implementations. Note that `sequence` is declared as RedBlackTree!MyObject, not just RedBlackTree. There is no RedBlackTree.Range, but there is RedBlackTree!MyObject.Range. Yes, of course, stupid question, sorry... Thank you very much for your help !! Best regards, Frédérik
Re: Ranges & containers : is it possible to get a SortedRange from a RedBlackTree ?
Hi again, The solution of making an array from the range works, but I'm concerned about the cost of instantiating a (potentially very large) array each time I need to walk across the set. Unless doing that is costless in D for any reason, it does not seem practical in my case. And when trying to compile the above example I got the following error: Error: template instance std.range.SortedRange!(InputRange!int) does not match template declaration SortedRange(Range, alias pred = "a < b") if (isRandomAccessRange!Range && hasLength!Range) I tried to replace SortedRange!InputRange thing with the following : RandomAccessFinite!(InputRange!MyObject) opSlice(); But then I got the folowing error: Error: template std.range.assumeSorted cannot deduce function from argument types !()(InputRange!int), candidates are: [...] And I must admit that I'm stuck on that... Beside that I understand that range interfaces like SorteRange are not idiomatic at all in D. So I don't mind using something else, but I can't see how a could make an "abstract" range from a RedBlackTree.Range struct. I wouldn't mind encapsulating it in another struct or class I would define myself, but it seems I cannot access the RedBlackTree.Range struct from outside... For exemple with: RedBlackTree.Range rbtRange = this.sequence[]; I get: Error: identifier 'Range' of 'RedBlackTree.Range' is not defined Or is it a syntax-related problem ? Thanks again for your help ! Fred