So i've been using Rascal for a while now, but I was wondering if there is support debugging without using println and the terminal?
So like with c# in Visual Studio, stepping through the code, into functions and so on.
For me this would be a big help and can save time.
Just like visual studio, we have breakpoints and stepping through code. Since Rascal runs in eclipse, it might look slightly differently.
Remember to start your rascal console in debug mode, else it won't work.
You start it in debugging mode:
by selecting a .rsc file and right clicking Debug as > Rascal application.
or, if you select start console from a navigator or editor context-menu, it is a "Debug" console by default.
Adding breakpoints is done by clicking in the margin of an editor.
Any function you call from the console will activate the debug mode of Eclipse as soon as it hits the breakpoint.
Structured statements such as if and for act a little different in the debugger than what you might expect from Java or C#. Namely you have to "step into" them, otherwise if you press "step over" you will jump over their bodies.
Related
I'm running dart with this command:
dart run --pause-isolates-on-start --observe --enable-vm-service=8181/0.0.0.0
With this command, can open on browser the dart native user interface to debug on
http://<ip>:8181/<authentication-code>
On debug page, is possible to set breakpoints and use them. But I don't find a way to save the break point to use on a future loading of dart debug.
Every time that I start the debug i have to set this breakpoints?
There is a way to save this break points to use on the future?
Not necessarily the answer you are looking for but could be seen as a workaround.
I have not tested this with VS Code, but if you are using IntelliJ (or Android Studio) with Dart plugin, you can essentially do remote debugging. So instead of using observatory to insert breakpoints, you can set them in your IDE which will then remember them and resend them to the Dart process when start debugging again.
If you go into "Run/Debug Configuration" and click + (Add), you can find "Dart Remote Debug":
As described in the dialog, when you are starting this "Run profile", you will be asked for the address to the Dart service protocol which your application should print out when started with Observatory / Dart DevTools enabled:
Unrelated notes
I have spend some time look at vm_service package which does provide ways to fetch breakpoints and adding breakpoints. But it is not really easy to map the breakpoints into something that can easily be persisted and later resent again. Some links you can use if you want to go for that journey:
https://pub.dev/documentation/vm_service/latest/vm_service/Isolate/breakpoints.html
https://pub.dev/documentation/vm_service/latest/vm_service/Breakpoint-class.html
https://pub.dev/documentation/vm_service/latest/vm_service/VmService/addBreakpoint.html
https://pub.dev/documentation/vm_service/latest/vm_service/VmService/addBreakpointAtEntry.html
https://pub.dev/documentation/vm_service/latest/vm_service/VmService/addBreakpointWithScriptUri.html
I have a following setup:
LuaJIT 64bit in .NET managed, 64bit LuaSocket dll
ZeroBrane 1.80; MobDebug 0.705
Then I have several Lua scripts that are to be launched on specific events and I m trying to debug it.
First script - scripts/OnCreateInstance.lua also starts the MobDebug.
Debugging is working fine in this first script - debugger gets connected on require('mobdebug').start() and also following breakpoints work as expected, but breakpoints in other scripts are never hit.
I've went through the https://studio.zerobrane.com/doc-faq#why-breakpoints-are-not-triggered and haven't found anything suspicious.
debug.getinfo(1,"S").source returns scripts/onstartinstance.lua and scripts/onpushbutton.lua for the second script, which is correct. I am on Windows, so case sensitivity should not apply, and when I've switched the debugger verbose, I've still never seen any info about hitting the breakpoint.
I've also tried listing all the breakpoints in the second script, and all the breakpoints are listed, they just don't hit.
Do someone have any idea, what could be the problem? My only idea is, that it could be because of the second script is run from a different thread that the first script, but that is a thing I cannot avoid and have no idea how to work it around...
Thanks for any help
If the project directory is set correctly and the breakpoints are not triggered from other threads (not individual Lua states), then try adding require('mobdebug').on() calls to those threads/coroutines to enable breakpoints (as described in the first option in the documentation).
I'm trying to learn Fsharp.data with the example of JsonProvider, but I can not understand why I'm still running the program while compiling the error.
You may have clicked "Yes" when VS asked you if it should run the last successful build when compilation fails.
See here for how to change the setting.
There are plenty of issues like this with F# in Visual Studio, but the situation also improves all the time in VS 2017. I believe one possible workaround for this particular issue is to restart VS.
But there is also another way, which works better to avoid an inconsistent Error list pane in general. Change from "Build + Intellisense" to just "Build" in the dropdown in the Error list pane, and see how that works for you. It means you have to compile to refresh the Error list pane, but you still get (sometimes inconsistent) Intellisense help in the editor panes without having to recompile.
If you want to know more about F# issues in VS, this is where to look:
https://github.com/Microsoft/visualfsharp
Somehow, debugging rascal in eclipse doesnt work for me.
I'm running rascal in eclipse Luna.
Everyting works, debug Start.rsc as application starts the rascal console in debug.
But clicking in the marging does not add a breakpoint no matter what.
Do I have to use a specific editor? (now using the java editor)
cheers, Ibanezje
The answer is: upgrade to Eclipse Mars.
Then with the 'impulse editor' you will be able to debug.
Sometimes Visual Studio does not allow me to set breakpoints in MVC views. This has happened to me scores of times, but it doesn't happen for every view and I don't know why.
When you click on the left-hand bar to place a breakpoint, it places a white circle instead of the normal red circle. The message when you hover over it is "The breakpoint will not currently be hit. The source code is different from the original version." It goes on to describe how to allow breakpoints to be hit, but that produces strange results and I don't want that anyways.
If the error is correct, then I want to run the original source code. I don't know what's going on behind the scenes in VS; I try rebuilding and all that but it doesn't help. I'm running in Debug mode in VS 2012.
This could be caused by many things, but a few items to check which I've helped people with recently:
First step: there must be a PDB file alongside the DLL to enable debugging. (see: What is a PDB file?) Make sure you have the PDB in the executing directory.
Clean to remove all the old DLLs from your bin folders.
Ensure that your application is running a build of your current code (the same version you have in Visual Studio). Don't assume that it is just because you clicked 'build' or 'deploy'. If no changes were detected then things often don't happen. Check the build time of the assembly, or change something and rebuild to see the file size change.
If you're running something web-related, make sure a browser isn't caching code, or IIS isn't holding a long running process.
Kill any running Visual Studio Development Server instances (you can do this from task manager, or more simply from the system tray - they look like an IE logo and when you hover over them they'll tell you which port they run on).
Restart IIS using iisreset from a command prompt.
Check the settings for Debugging in Visual Studio (Tools > Options > Debugging > Symbols) You want to automatically load symbols, and if you're linking other assemblies you need to reference their PDB files here.
So I had this issue this morning and the fix for me was related to razor syntax.
I was setting a variable inside an if statement
#If (my condition)
{
myVar1 = "blah blah blah"
#myVar2 = 1 <== This line here was causing my razor to crap out on render
}
So all of the other things are good things however, improper razor syntax can also cause the breakpoint issue. In this case it was the # symbol on myVar2 inside the code block... Just an FYI
The simplest solution I've found to work around this problem is:
Set a breakpoint in the controller code that is right before the View is called. Then, when that breakpoint is hit, step through (using F10) several times. It will go through _ViewStart.cshtml and maybe another thing or two. But soon it will get to the view.
Once you are in the view, then hitting F5 (continue) will take you to the breakpoint in the view.
Fom the answer nothing worked for me to set a breakpoint in the javascript code.
I moved the javascript code inside to file Scripts\myscript.js and replaced the script block to
<script src="#Url.Content("~/Scripts/myscript.js")"></script>
To add to #kirk-broadhurst answer, (please amend if possible), double check your web.config, specifically the compilation flag under system.web. Even if you are building for debug, if the debug attribute is set to false, you will run into issues debugging Razor.
<system.web>
<compilation debug="true" targetFramework="4.6" />
</system.web>
Make sure that "debug" is set and Voila ... debug is working again:-)
Make sure your Solution configuration set to Debug not on release.
Thanks