Heaps with HashLink Debugger Issue


#1

I’ve been using heaps and hashlink for the past couple of months, just building normally.
Because when I try the debugger it never works for me.
I followed “Hello HashLink” on the github wiki and it still doesn’t work.
I’ve updated all my drivers.

I’m using Haxe 4.0.0-preview.4 and HashLink 1.7

These are the libs I have installed:
format: [3.4.1]
heaps: 1.3.0 [1.4.0]
hldx: [1.7.0]
hlopenal: [1.5.0]
hlsdl: [1.7.0]
hscript: [2.2.0]
hxbit: [1.4.1]

With hldx the debugger usually catches it.

But with hlsdl I just get a blank unresponsive window.

Am I missing something?


#2

Could you confirm that with HLDX everything works as intended and that you only have issues with HLSDL ?

Also, does the “Debug Console” tab in VSCode prints something ? Can you pause the debugger and see where it is ? What if you put a breakpoint in main() before the App is created ?


#3

Neither hldx or hlsdl work when I use the debugger, they just break differently.
It is just that with hldx the debugger does something.

With hldx, when clicking through the call stack, the Debug Console prints this

16.7> src/HLAdapter.hx:526: Failed to read @0x1C:4
16.7> src/HLAdapter.hx:546: Failed to read @0x1C:4

Nothing prints for hlsdl

When I put a break point before the app is made, hldx stop at either dx.Driver.create or h3d.impl.DirectXDriver.reset

Call Stack

dx.Driver.create (c:\HaxeToolkit\haxe\lib\hldx\1,7,0\dx\Driver.hx:479)
h3d.impl.DirectXDriver.reset (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\h3d\impl\DirectXDriver.hx:165)
h3d.impl.DirectXDriver.reset (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\h3d\impl\DirectXDriver.hx:164)
h3d.impl.DirectXDriver.new (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\h3d\impl\DirectXDriver.hx:131)
h3d.Engine.new (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\h3d\Engine.hx:71)
<local function> (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\hxd\App.hx:47)
hxd.System.start (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\hxd\System.hl.hx:105)
hxd.App.new (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\hxd\App.hx:46)
Main.new (c:\Users\Me\Desktop\HelloHL\Main.hx:2)
Main.main (c:\Users\Me\Desktop\HelloHL\Main.hx:9)
<local function> (?:1)

with hlsdl it goes unresponsive at Sdl.hx Line 15
f( !initOnce() ) throw "Failed to init SDL";

Call Stack

sdl.Sdl.init (c:\HaxeToolkit\haxe\lib\hlsdl\1,7,0\sdl\Sdl.hx:13)
hxd.System.start (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\hxd\System.hl.hx:99)
hxd.App.new (c:\HaxeToolkit\haxe\lib\heaps\1,4,0\hxd\App.hx:46)
Main.new (c:\Users\Me\Desktop\HelloHL\Main.hx:2)
Main.main (c:\Users\Me\Desktop\HelloHL\Main.hx:9)
<local function> (?:1)

#4

@AFlyer : I have not idea what could be the cause of this… One way would be to try using the MSVC debugger + HL/C generated code to see if you get the same errors.

Anyone else having similar issue with HL debugger?


#5

One thing that could help understand is to know what kind of error is triggered by the dxCreate call. For this you can checkout the hashlink debugger here : https://github.com/vshaxe/hashlink-debugger/

Then compile it using haxe debugger/node_debug.hxml
Then run it using node debugger.js --cwd path/to/my/app myapp.hl

Then the commands are similar to gdb: b to put a breakpoint etc. see https://github.com/vshaxe/hashlink-debugger/blob/master/hld/Main.hx#L193

You can add a trace in hld/NodeDebugApi.hx (wait) line 132 to check what kind of debugEventCode/exceptionCode you get.


#6

I’ve also tried to follow the Hello HashLink tutorial and getting an exception on a different line than @AFlyer.

DXError 8007000E line 184
Called from h3d.impl.DirectXDriver.onDXError (h3d/impl/DirectXDriver.hx line 193)
Called from h3d.impl.DirectXDriver.present (h3d/impl/DirectXDriver.hx line 283)
Called from hxd.$System.mainLoop (hxd/System.hl.hx line 74)
Called from hxd.$System.runMainLoop (hxd/System.hl.hx line 125)
Called from hxd.$System.runMainLoop (hxd/System.hl.hx line 122)
Called from local function #3052 (C:\HaxeToolkit\haxe\std/haxe/Timer.hx line 140)
Called from local function #3053 (C:\HaxeToolkit\haxe\std/haxe/Timer.hx line 74)
Called from haxe.$MainLoop.tick (C:\HaxeToolkit\haxe\std/haxe/MainLoop.hx line 166)
Called from haxe.$EntryPoint.processEvents (C:\HaxeToolkit\haxe\std/haxe/EntryPoint.hx line 104)
Called from haxe.$EntryPoint.run (C:\HaxeToolkit\haxe\std/haxe/EntryPoint.hx line 136)

That means out of memory? https://docs.microsoft.com/en-us/windows/desktop/com/com-error-codes-1

running the hl file without debugging works fine


#7

@ncannasse Could you give me an example of the breakpoint command like, b filename:linenumber.
I’ve been trying to get the breakpoint work for awhile.
When I use r in the debugger it does run.


#8

This would work I guess:

break MyClass.hx:55


#9

I tried to dig into the debugger issue with hashLink.

  • Windows10
  • Haxe 4 preview 5
  • heaps 1.5.0

compile.hxml:

-lib heaps
-lib hlsdl
# -lib hldx
-hl hello.hl
-main Main

launch.json:

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "HashLink",
			"request": "launch",
			"type": "hl",
			"hxml": "compile.hxml",
			"cwd": "${workspaceRoot}",
			"preLaunchTask": {
				"type" : "haxe",
				"args" : "active configuration"
			}
		}
	]
}

after pressing F5 the debugger pauses on error:

commenting out winSwapWindow(win); in Window.hx makes the pause on error go away and produces a blank white window. the traces show that it now loops as intended:


#10

@BalazsBuri It’s strange that you get a crash in both HLDX and HLSDL present().
Do you happen to have 3rd party GPU monitoring software running on your system ?
Can you run from the commandline with hl hello.hl without debugger ?


#11

I “fixed” my issues with the debugger by reinstalling Windows 10. Now the debugger works fine with both hlsdl and hldx. I haven’t installed the Nvidia drivers yet, so I wonder if it has anything to do with that?


#12

@ncannasse hl hello.hl works as expected. I have latest Nvidia drivers.


#13

Try installing the NVidia Driver, I have them installed without a problem. I’m quite sure there’s a third party program causing issues here, although not sure which one.


#14

It isn’t the Nvidia drivers.
I’ll pay attention to what i installed if it breaks again


#15

Well it’s an Asus gaming laptop with additional driver to bridge the integrated chipset with the Nvidia card. Maybe that’s causing it. I’ll try on a “real” pc :slight_smile:


#16

It works on my wife’s laptop :smiley:


#17

So the directx error is thrown here for me if that helps: https://github.com/HaxeFoundation/hashlink/blob/6491a6d76a429d145dd683f91f58480ff5e106e0/libs/directx/directx.cpp#L184


#18

@ncannasse I can now confirm that the issue in my case is caused be the
Intel® UHD Graphics 630 driver
on a
ASUS TUF Gaming FX504GE
sorry for spamming the thread. Anyways, it’s not a hashlink or heaps issue.


#19

I have exactly the same problem. I’m using a Surface Book 2 which has an integrated Intel card and a dedicated Nvidia Geforce card.

I can run my program from the console with hl hello.hl but as soon as I’m using the debugger I get a blank window when using hlsdl and an exception when using hldx. Did anyone find a workaround around this problem? I would like to use the debugger with HashLink.