How can I set the current line of execution in the eclipse java debugger?

前端 未结 5 1860
野性不改
野性不改 2020-12-25 12:34

I want to force the current execution line to a specific line in the same function, possibly skipping intermediate lines. All my old school debuggers had this feature, but I

5条回答
  •  不知归路
    2020-12-25 13:00

    Feature request saying it is not possible

    In https://bugs.eclipse.org/bugs/show_bug.cgi?id=287795 (credits to Amitd) Darin Wright says it is a limitation of the underlying Java debugger:

    Currently, this is not possible with the Java debugger as the native debug interface does not provide the ability to move/set the program counter arbitrarily.

    C / C++

    CDT supports it however (tested on Neon, Ubuntu 14.04). Right click on the line you want to go to, and select either:

    • "Move to line": jump to line and break there
    • "Resume at line": jump to line and continue execution from there

    This also serves as further evidence that there is an underlying Java limitation, as Java tends to be more feature rich in Eclipse, and those menu entries are not present in Java next to "Run to line" (which does not skip execution of lines).

    This test program prints 0 if you jump the line i = 1:

    #include 
    
    int main(void) {
        int i;
        i = 0; /* Break here. */
        i = 1;
        printf("%d\n", i); /* Jump to here. */
    }
    

提交回复
热议问题