HaxeDevelop debug does not stop on breakpoint - haxe

I am new to HaxeDevelop (but experienced with FlashDevelop) and it has essentially no useful documentation that I can find via a Google search. I am trying to get a simple app up and running with OpenFL and Starling. It had an issue so I tried putting a breakpoint. However, it doesn't stop at the breakpoint. I even put several breakpoints in the main class code and it won't stop. I've even tried making a new project with just a main class and a dummy class and it won't breakpoint on this either. Do I have to tell it to use a special debug process or something? Do I need to install any more software? Should I just use VS Code?
I installed HaxeDevelop and haxe and lime and OpenFL. I made a new OpenFL project and did some simple work in the Main file (make some integer variables, prints some stuff etc.) and littered it with breakpoints. I run it and the output prints (but does not stop at any breakpoints):
Build succeeded
Done(0)
haxelib run lime run "project.xml" neko -debug
Running process: C:\HaxeToolkit\haxe\haxelib.exe run lime run "project.xml" neko -debug
Main.hx:17: Hello World!
Main.hx:21: Did some stuff... Did it stop?
Done(0)
I've tried it using neko, html5, and flash and none of them will stop at the breakpoints.
If anyone knows of a good tutorial for getting Haxe to run in debug mode in HaxeDevelop, FlashDevelop, or VS Code, I would super appreciate it.

HaxeDevelop / FlashDevelop only support breakpoint debugging on the Flash target. It can be a bit tricky to set up since it requires a 32 bit Java to be in your PATH (this limitation does not exist with Flash debugging in VSCode). You also need to make sure that a Flash Debug Player is associated with .swf files. You can find more details here and here.
VSCode on the other hand supports debugging a much wider range of targets:
JavaScript
HashLink
HXCPP
Eval (macros)
Flash
There is no debugging support for the Neko target in any IDE.
If you are using OpenFL, you should install the Lime extension, which handles all the configuration of the individual debug adapters for you (note: this requires Lime 7.3.0 or newer). In a fresh project, simply "Start Debugging" and select "Lime" from the dropdown:
This creates a Lime launch configuration in .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Lime",
"type": "lime",
"request": "launch"
}
]
}
Debugging should now work out of the box with the currently selected target (just make sure you have the "Debug" configuration of the target selected). You can click the status bar indicator to switch between configurations:
If you're missing a debug extension, the Lime extension should open a popup that offers to install it.

If you use HaxeDevelop and target JavaScript, you can make a debug build (add -debug to your HXML or select 'debug' dropdown), which provides source-maps. Then you can use the browsers devtools (F12) and step through all Haxe code.
You can easily place a debugger statements in your code using js.Lib.debug() to place a "breakpoint" at this position. From there you can also start stepping.
This isn't HaxeDevelop specific, but works very good when using HaxeDevelop + JavaScript target.
https://haxe.org/manual/debugging-javascript.html

Related

Compiling pascal program in Visual Studio Code for Linux

Recently, I switched my OS to Ubuntu. I just started with collage and I have to learn pascal for my finals. But a problem occurred.
I installed Visual Studio Code and Pascal extension for it, but I am unable to run even a simple Hello World code. I wrote code, it saved automatically as .pas, but when I enter debug & run option in VSC it displays a message that says 'Open a file which can be debugged or run.', followed by 'debug' and 'run' buttons that I am unable to click and another message that says 'To further configure Debug and Run create a launch.json file.'
I am not even sure am I supposed to post questions such as this one on stackoverflow, but I sincerelly hope that someone could give me a hint on what to do. Solve this within Visual Studio Code or switch to another IDE (and which one would you recommend for Linux user) and pretend that nothing happened?
Thanks in advance.
I know this isn't an answer to "how to debug with pascal with vscode" but, perhaps you would find it easier to just use FPC / Lazarus (IDE) to do your work. While it doesn't have a dark theme, contrary to popular belief, that's not necessary to program.
The IDE is feature packed and allows for full code completion, debugging, etc... (everything you really need to do the work for school).
Additionally, you can use this open source tool to install everything you need for your platform in just a few button clicks (also allows for installing common library packages)
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases
download release for your OS
under "FPC Version" & "Lazarus Version" select trunkgit (or stable for an older version)
click the "Install/Update FPC + Lazarus" button
Have you Installed Pascal extension which is available for code to smoothly run pascal code.
If you haven't then try installing this extension using,
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
ext install alefragnani.pascal
You can always check,
https://marketplace.visualstudio.com/items?itemName=alefragnani.pascal
to install and configure pascal in vscode.
I will direct you to the debugging page from the Visual Studio Code documentation that details how to use the debugger and configure a launch.json file. VSCode is a generic IDE so you need to give it some information about your project before it knows how to run the debugger. This is what launch.json is for.
If I could make a suggestion. When you're learning how to program, it's best to start with the basics. Write a small program in a text editor (VSCode is fine, or Vim, or Nano, or Notepad, or whatever). Save the file. Compile and run the program on the command line.
Once you put an IDE in the mix, you have to learn how to use that as well. If you're stuck on both parts, it can be hard to make progress. That said, it's good to learn how to use the IDE, and you should spend some time reading the documentation and working through some of the examples. It takes some time, but it will pay you back a thousand times when you can work more quickly.

"Run|Debug" Buttons Not Appearing on Visual Studio Code Java Programs

A couple days ago I tried to initialize Visual Studio Code to be able to code in C++ using online instructions. They ended up not working at all, but I had edited some settings files (such as a .json file) in Visual Studio Code that I thought were all C++ specific. Afterwards, however, I no longer have the convenient "run | debug" buttons appearing above any "main" functions that I make in java files. In the past I used to be able to just click run and my program would run in the terminal at the bottom of the screen, as opposed to manually compiling and running the program using a terminal. I am running Windows 10. Does anyone know of any way to get these buttons back?
This is an example of what the two buttons look like, appearing above any main functions in a java program.
I also found on the Visual Studio Code website a description of how to begin debugging, attached here, that describes that you need Language Support for Java(TM) by Redhat in order to get these two buttons. I have this extension downloaded, but it is still not working. Please help if you recognize this issue!
What worked for me:
Make sure you have Java extensions, Java Debugger and other basic Java packages installed.
Then making sure the main function is formatted properly like below allowed the Run|Debug buttons to be seen.
public static void main(String[] args) {}
First of all, for troubleshooting, actually we need to have a reproduce steps which can understand what happened in your environment. So can you tell us what you have done to your settings first?
Second, there is a setting under common setting tab, that is Java>Debug>Settings>Enable Run Debug Code Lens. Please check whether this option has been unchecked. Although I think it should not be changed by you.

Configuring VC++ for WxWidgets

I am trying to follow this guide
to configure VC++ for WxWidgets. I got stuck here.
So for Core wxWidgets libraries to include, I did include wxmsw31u[d]_core.lib and wxbase31u[d].lib under Linker>>Input>>Additional Depenedencies. That is all to it right?
As for Linking with correct runtime library, can someone tell me how that is done? I manage to get here but don't know how to set the indicated settings.
Please help. I really appreciate it.
When you want to debug your app the debugger must know where in the compiled code is each function used. In jargon, the "debugging symbols". Windows puts these symbols in the compiled executable, while Linux uses another, .devfile.
When you compile code (your app or wxWidgets library) you must tell the compiler whether you want a "Debug" version or a "Release" one.
If you want the debugger to be able to step into wxWidgets code, then you must compile wxWidgets in "debug" mode, which will add the character d to the library files built. So, you must add, for example, wxmsw31ud_core.lib to your app dependencies. Notice the d between u and _. Use the file explorer to see all files generated by wxWidgets compilation process.
Perhaps you don't want all this wxWidgets "debug". Then use another wxWidgets compilation route and add wxmsw31u_core.lib instead of the d'd version. Still you can compile your own app in debug mode, but not being able to step through wxWidgets internals.
Now for your app, a) do you want a single executable file also containing wxWidgets code? or b) let your app in a .exe file which uses as needed external .dll files?
a) is called "static linkage" while b) is called "dynamic linkage"
As you can see, there are four combinations of debug/release & static/dynamic. You must choose one "runtime library" to link to your app.
The table in the wiki shows the switch and MSVC lib (select the desired combination in the 'properties' page) to use in your app; and macro definition required to build wxWidgets if you use nmake instead of the already provided configurations in VS.
Take a look at docs\msw\install.txt for more info.
The best advice I give is that you look into "minimal" sample project. Load it into VS and read every option. You can even make a copy, change some file names and use it for your own app.
I recommend using the official instructions instead of the wiki, they're simpler and, if you look at the last paragraph, you can see that you don't even have to link the libraries manually with MSVC.
You also don't need to do anything special to link with the correct version of the CRT, the defaults are just fine.

node-debug: why can't I set a breakpoint?

I'm using node-debug and know which file and line for which I want to set a breakpoint.
Here's what happens:
debug> setBreakpoint('./services/search.js', 359)
Warning: script './services/search.js' was not loaded yet.
You can't list source code right now
Why can't I "list source code"? How can I add a breakpoint dynamically (without editing the source code to add debugger)?
I tried other tools for debugging, and would love to use Chrome Dev Tools, but don't think it's possible since our project is stuck on v0.12.3.
Also, some options are limited/tricky because I'm using Vagrant with a headless VM.
This is still a problem in node 6.
There is precious little information about it on the net, which is a shame.
However, node --inspect and then using Chrome does work.

Eclipse haml/sass editing + html /css generation

I've been playing with haml and sass and generating a flat site with staticmatic from the command line.
Has anyone been using an ide for this?
I have the Apatana studio (RadRails) plugin installed and it has haml & sass highlighting out of the box. For this site I just want a lightweight script project (no rails).
What type of project would I use, and how would i add something so i could for example, right click the project folder in order to run
staticmatic build [my-project]
(or other) to generate the site from the haml + sass?
I like staticmatic as I can use ruby libraries as helpers.
Happy to take suggestions about any editor. But i am also keen to stick with one editor for everything. (also WTB auto complete).
Cheers
You can run rake tasks from the RadRails IDE, though I didn't manage to get it work. Ruby is probably right choice for the project type. I don't like IDEs because they complicate and slow things down. So my choice is normally Textmate + terminal.
Take a look at Rakefile in this project: https://github.com/adamstac/staticmatic-bootstrap
This isn't exactly what you're asking for...but take a look at a tiny script that I wrote. It will watch directories of your choosing for changes in SCSS and HAML and compile them to html and css. You could make some minor edits to watch.rb if desired, run this in a terminal, and have the site generated without even having to run a command.
PS - if you decide to try this out, you'll need the fssm gem from github or rubygems.org.
A Ruby or Web project type would be most fitting, though I don't think it would matter which in this case.
You can achieve custom commands a number of ways...
You can write up a Rake task in the project Rakefile as Heikki suggested, and then right click and use the Rake menu (as of Studio 3.0.2) to launch that task, or run it inside the embedded Terminal view.
You can write/edit a custom ruble and add a command for launching staticmatic. See http://wiki.appcelerator.org/display/tis/Executing+an+External+Command
You can go the Eclipse route and create an "External Tool Launch configuration" under Run > External Tools. External Tools configuration... > Program. There you can set up a launch to execute some program (say the ruby interpreter or staticmatic script itself) and pass in the argument. Then you can use the run drop-down menu.

Resources