Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger do not stops on breakpoints. #17

Closed
nulld opened this issue Mar 4, 2017 · 9 comments
Closed

Debugger do not stops on breakpoints. #17

nulld opened this issue Mar 4, 2017 · 9 comments

Comments

@nulld
Copy link

nulld commented Mar 4, 2017

My test file:
Test.hx

class Point
{
    public var x:Int;
    public var y:Int;
    public function new() {}
}

class Test {
    static var s1:{x:Int, y:Int};
    
    static function main() {
        new debugger.Local(true);

        trace("Haxe is great!");
        var p = new Point();
        s(p);
    }
    
    static function s (s:{x:Int, y:Int})
    {
        s1 = s;
        trace( s1.x);
	}
}

build.hxml

-main Test
-cpp bin
-lib hxcpp-debugger
-debug
-D HXCPP_DEBUGGER

debugger cli output
After c command, program executes until the end (see the trace from Test.hx:22)

-=- hxcpp built-in debugger in command line mode -=-
-=-      Use 'help' for help if you need it.     -=-
-=-                  Have fun!                   -=-

Thread 0 stopped in Test.main() at Test.hx:14.

1> b Test.hx:21

Breakpoint 1 set and enabled.

2> c


3> Test.hx:14: Haxe is great!
Test.hx:22: 0
@Simn
Copy link
Member

Simn commented Mar 6, 2017

I confirm that this doesn't work, even in hello world:

class Main {
	@:analyzer(ignore)
	static function main() {
		new debugger.Local(true);
		var a = 1;
		a = 2;
	}
}
main-debug.exe
-=- hxcpp built-in debugger in command line mode -=-
-=-      Use 'help' for help if you need it.     -=-
-=-                  Have fun!                   -=-
Thread 0 stopped in Main.main() at Main.hx:5.
1> b Main.hx:5
Breakpoint 1 set and enabled.
2> b Main.hx:6
Breakpoint 2 set and enabled.
3> c
4>

The generated .cpp looks fine to me:

HX_LOCAL_STACK_FRAME(_hx_pos_e47a9afac0942eb9_3_main,"Main","main",0xed0e206e,"Main.main","Main.hx",3,0x087e5c05)

void Main_obj::main(){
            	HX_GC_STACKFRAME(&_hx_pos_e47a9afac0942eb9_3_main)
HXLINE(   4)		 ::debugger::Local_obj::__alloc( HX_CTX ,true);
HXLINE(   5)		HX_VARI( int,a) = (int)1;
HXLINE(   6)		a = (int)2;
            	}

@Simn
Copy link
Member

Simn commented Mar 15, 2017

@hughsando: If at all possible, could you check if this is a problem with Haxe or hxcpp(-debugger)? It's not so urgent if it's the latter, but if it's related to Haxe we should really try to get it fixed for 3.4.1.

@hughsando
Copy link
Member

There was a problem with HXCPP_DEBUG_HASHES was not set. Should be fixed now.
Function breakpoints needed a little tweak in the haxe compiler.
Not sure about a hang though.

@jcward
Copy link

jcward commented Mar 17, 2017

My vscode-hxcpp-debug adapter seems to have breakpoints working again in hxcpp 3.4.64! Thanks @hughsando!

I'm still having issues with the "Step Over" / (aka Next command) functionality, but that could easily be on my end.

@jcward
Copy link

jcward commented Mar 17, 2017

Hmm, no, if my understanding of the Next command is correct, next is not working in hxcpp 3.4.64. It's behaving like continue.

For example, with this local debugger testcase:

class Main {
  @:analyzer(ignore)
  static function main() {
    new debugger.Local(true);
    trace("At line 5");
    var a = 1;
    trace("At line 7");
    a = 2;
    trace("At line 9... goodbye!");
  }
}

Here's what happens, next appears to be acting like continue:

>haxe -debug -D HXCPP_DEBUGGER -cp . -lib hxcpp-debugger -main Main -cpp out
...
>./out/Main-debug
-=- hxcpp built-in debugger in command line mode -=-
-=-      Use 'help' for help if you need it.     -=-
-=-                  Have fun!                   -=-

Thread 0 stopped in Main.main() at Main.hx:5.

1> next


2> Main.hx:5: At line 5
Main.hx:7: At line 7
Main.hx:9: At line 9... goodbye!

>

I would expect it to print "At line 5" and then stop at line 6. Is this correct?

I could file a new bug if you'd like, though it seems highly related to this one.

Best,
-Jeff

@hughsando
Copy link
Member

The step-over issue should be fixed with HaxeFoundation/hxcpp@4a2fbdb

There is still a minor issue where you sometimes have to step twice at the beginning of a function to get going, but this will require a slightly larger fix that I might wait a bit for.

@jcward
Copy link

jcward commented Mar 20, 2017

@hughsando - yes, I can confirm that 4a2fbdb / 3.4.69 fixed the step issue. And a debugger testcase too boot, nicely done!

@hughsando
Copy link
Member

hughsando commented Mar 20, 2017 via email

@nulld
Copy link
Author

nulld commented Mar 25, 2017

@hughsando, thanks for fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants