Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Debugging not working on Eclipse 4.5 Mars #44

Closed
fduch-stranger opened this issue Jul 7, 2015 · 10 comments
Closed

Debugging not working on Eclipse 4.5 Mars #44

fduch-stranger opened this issue Jul 7, 2015 · 10 comments

Comments

@fduch-stranger
Copy link

Install:
Windows 7 x64
Eclipse 4.5 x64
Cygwin x64 with gdb 7.8
Add cygwin bin folder to PATH

Steps

  1. Create hello world project 'rust1' (C:\Users\okushnir\Desktop\workspace_tst\rust1):
  2. Add file src/main.rs with code:
// This code is editable and runnable!
fn main() {
    // A simple integer calculator:
    // `+` or `-` means add or subtract by 1
    // `*` or `/` means multiply or divide by 2

    let program = "+ + * - /";
    let mut accumulator = 0;

    for token in program.chars() {
        match token {
            '+' => accumulator += 1,
            '-' => accumulator -= 1,
            '*' => accumulator *= 2,
            '/' => accumulator /= 2,
            _ => { /* ignore everything else */ }
        }
    }

    println!("The program \"{}\" calculates the value {}",
              program, accumulator);
}

  1. Build project, add breakpoint to line 8
  2. Run application in the debug mode

Actual result:

In Console view:

GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word".
No source file named C:\Users\okushnir\Desktop\workspace_tst\rust1\src\main.rs.
[New Thread 1152.0x3fb8]

Temporary breakpoint 2, 0x0000000000401dc8 in main ()

In Debug view:

  1. Threads tree is closed
  2. When I'm clicking on app node 'rust1' then error appear:

An internal error has occurred.
org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbRestartCommand.>(Lorg/eclipse/cdt/dsf/service/DsfSession;Lorg/eclipse/cdt/dsf/gdb/launching/GdbLaunch;)V

In GDB traces console view:

467,885 2-gdb-version
467,887 ~"GNU gdb (GDB) 7.8\n"
467,887 ~"Copyright (C) 2014 Free Software Foundation, Inc.\n"
467,887 ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is fre\
e software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitt\
ed by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
467,887 ~"This GDB was configured as \"x86_64-pc-cygwin\".\nType \"show configuration\" for configur\
ation details."
467,887 ~"\nFor bug reporting instructions, please see:\n"
467,888 ~"<http://www.gnu.org/software/gdb/bugs/>.\n"
467,888 ~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/soft\
ware/gdb/documentation/>.\n"
467,888 ~"For help, type \"help\".\n"
467,888 ~"Type \"apropos word\" to search for commands related to \"word\".\n"
467,888 2^done
467,888 (gdb) 
467,889 3-environment-cd C:/Users/okushnir/Desktop/workspace_tst/rust1
467,890 3^done
467,890 (gdb) 
467,890 4-gdb-set breakpoint pending on
467,891 4^done
467,891 (gdb) 
467,891 5-gdb-set detach-on-fork on
467,892 5^done
467,892 (gdb) 
467,892 6-enable-pretty-printing
467,893 6^done
467,893 (gdb) 
467,893 7-gdb-set python print-stack none
467,894 7^done
467,894 (gdb) 
467,894 8-gdb-set print object on
467,895 8^done
467,895 (gdb) 
467,895 9-gdb-set print sevenbit-strings on
467,896 9^done
467,896 (gdb) 
467,896 10-gdb-set host-charset UTF-8
467,897 10^done
467,897 (gdb) 
467,897 11-gdb-set target-charset WINDOWS-1251
467,898 11^done
467,898 (gdb) 
467,898 12-gdb-set target-wide-charset UTF-16
467,899 12^done
467,899 (gdb) 
467,899 13-gdb-set dprintf-style call
467,900 13^done
467,900 (gdb) 
467,900 14source .gdbinit
467,901 &"source .gdbinit\n"
467,901 &".gdbinit: No such file or directory.\n"
467,901 14^error,msg=".gdbinit: No such file or directory."
467,901 (gdb) 
467,902 15-gdb-set target-async off
467,903 15^done
467,903 (gdb) 
467,903 16-gdb-set auto-solib-add on
467,904 16^done
467,904 (gdb) 
467,904 17-file-exec-and-symbols --thread-group i1 C:/Users/okushnir/Desktop/workspace_tst/rust1/tar\
get/debug/calc.exe
467,952 17^done
467,952 (gdb) 
467,953 18-gdb-show --thread-group i1 language
467,954 18^done,value="auto"
467,954 (gdb) 
467,954 19-gdb-set --thread-group i1 language c
467,955 19^done
467,955 (gdb) 
467,955 20-interpreter-exec --thread-group i1 console "p/x (char)-1"
467,956 ~"$1 = 0xff\n"
467,957 20^done
467,957 (gdb) 
467,957 21-data-evaluate-expression --thread-group i1 "sizeof (void*)"
467,958 21^done,value="8"
467,958 (gdb) 
467,958 22-gdb-set --thread-group i1 language auto
467,959 22^done
467,959 (gdb) 
467,959 23-interpreter-exec --thread-group i1 console "show endian"
467,960 ~"The target endianness is set automatically (currently little endian)\n"
467,960 23^done
467,960 (gdb) 
467,961 24-list-thread-groups
467,962 24^done,groups=[{id="i1",type="process",executable="/cygdrive/c/Users/okushnir/Desktop/works\
pace_tst/rust1/target/debug/calc.exe"}]
467,962 (gdb) 
467,962 25-break-insert -f C:\\Users\\okushnir\\Desktop\\workspace_tst\\rust1\\src\\main.rs:7
467,965 &"No source file named C:\\\\Users\\\\okushnir\\\\Desktop\\\\workspace_tst\\\\rust1\\\\src\\\
\\main.rs.\n"
467,965 25^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending=\
"C:\\\\Users\\\\okushnir\\\\Desktop\\\\workspace_tst\\\\rust1\\\\src\\\\main.rs:7",times="0",origina\
l-location="C:\\\\Users\\\\okushnir\\\\Desktop\\\\workspace_tst\\\\rust1\\\\src\\\\main.rs:7"}
467,965 (gdb) 
467,966 26-break-insert -t -f main
467,967 26^done,bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x0000000000401dc8",\
at="<main+8>",thread-groups=["i1"],times="0",original-location="main"}
467,967 (gdb) 
467,970 27-exec-run --thread-group i1
467,975 =thread-group-started,id="i1",pid="2244"
467,976 28-list-thread-groups --available
467,976 =thread-created,id="1",group-id="i1"
467,976 ~"[New Thread 2244.0x5394]\n"
467,976 27^running
467,976 *running,thread-id="all"
467,976 (gdb) 
467,996 =library-loaded,id="/cygdrive/c/Windows/SYSTEM32/ntdll.dll",target-name="/cygdrive/c/Windows\
/SYSTEM32/ntdll.dll",host-name="/cygdrive/c/Windows/SYSTEM32/ntdll.dll",symbols-loaded="0",thread-gr\
oup="i1"
467,997 =library-loaded,id="/cygdrive/c/Windows/system32/kernel32.dll",target-name="/cygdrive/c/Wind\
ows/system32/kernel32.dll",host-name="/cygdrive/c/Windows/system32/kernel32.dll",symbols-loaded="0",\
thread-group="i1"
467,998 =library-loaded,id="/cygdrive/c/Windows/system32/KERNELBASE.dll",target-name="/cygdrive/c/Wi\
ndows/system32/KERNELBASE.dll",host-name="/cygdrive/c/Windows/system32/KERNELBASE.dll",symbols-loade\
d="0",thread-group="i1"
467,998 =library-loaded,id="/cygdrive/c/Windows/system32/ADVAPI32.dll",target-name="/cygdrive/c/Wind\
ows/system32/ADVAPI32.dll",host-name="/cygdrive/c/Windows/system32/ADVAPI32.dll",symbols-loaded="0",\
thread-group="i1"
467,998 =library-loaded,id="/cygdrive/c/Windows/system32/msvcrt.dll",target-name="/cygdrive/c/Window\
s/system32/msvcrt.dll",host-name="/cygdrive/c/Windows/system32/msvcrt.dll",symbols-loaded="0",thread\
-group="i1"
467,998 =library-loaded,id="/cygdrive/c/Windows/SYSTEM32/sechost.dll",target-name="/cygdrive/c/Windo\
ws/SYSTEM32/sechost.dll",host-name="/cygdrive/c/Windows/SYSTEM32/sechost.dll",symbols-loaded="0",thr\
ead-group="i1"
467,999 =library-loaded,id="/cygdrive/c/Windows/system32/RPCRT4.dll",target-name="/cygdrive/c/Window\
s/system32/RPCRT4.dll",host-name="/cygdrive/c/Windows/system32/RPCRT4.dll",symbols-loaded="0",thread\
-group="i1"
467,999 =library-loaded,id="/cygdrive/c/Windows/system32/SHELL32.dll",target-name="/cygdrive/c/Windo\
ws/system32/SHELL32.dll",host-name="/cygdrive/c/Windows/system32/SHELL32.dll",symbols-loaded="0",thr\
ead-group="i1"
467,999 =library-loaded,id="/cygdrive/c/Windows/system32/SHLWAPI.dll",target-name="/cygdrive/c/Windo\
ws/system32/SHLWAPI.dll",host-name="/cygdrive/c/Windows/system32/SHLWAPI.dll",symbols-loaded="0",thr\
ead-group="i1"
468,000 =library-loaded,id="/cygdrive/c/Windows/system32/GDI32.dll",target-name="/cygdrive/c/Windows\
/system32/GDI32.dll",host-name="/cygdrive/c/Windows/system32/GDI32.dll",symbols-loaded="0",thread-gr\
oup="i1"
468,000 =library-loaded,id="/cygdrive/c/Windows/system32/USER32.dll",target-name="/cygdrive/c/Window\
s/system32/USER32.dll",host-name="/cygdrive/c/Windows/system32/USER32.dll",symbols-loaded="0",thread\
-group="i1"
468,001 =library-loaded,id="/cygdrive/c/Windows/system32/LPK.dll",target-name="/cygdrive/c/Windows/s\
ystem32/LPK.dll",host-name="/cygdrive/c/Windows/system32/LPK.dll",symbols-loaded="0",thread-group="i\
1"
468,001 =library-loaded,id="/cygdrive/c/Windows/system32/USP10.dll",target-name="/cygdrive/c/Windows\
/system32/USP10.dll",host-name="/cygdrive/c/Windows/system32/USP10.dll",symbols-loaded="0",thread-gr\
oup="i1"
468,002 =library-loaded,id="/cygdrive/c/Windows/system32/USERENV.dll",target-name="/cygdrive/c/Windo\
ws/system32/USERENV.dll",host-name="/cygdrive/c/Windows/system32/USERENV.dll",symbols-loaded="0",thr\
ead-group="i1"
468,002 =library-loaded,id="/cygdrive/c/Windows/system32/profapi.dll",target-name="/cygdrive/c/Windo\
ws/system32/profapi.dll",host-name="/cygdrive/c/Windows/system32/profapi.dll",symbols-loaded="0",thr\
ead-group="i1"
468,002 =library-loaded,id="/cygdrive/c/Windows/system32/WS2_32.dll",target-name="/cygdrive/c/Window\
s/system32/WS2_32.dll",host-name="/cygdrive/c/Windows/system32/WS2_32.dll",symbols-loaded="0",thread\
-group="i1"
468,003 =library-loaded,id="/cygdrive/c/Windows/system32/NSI.dll",target-name="/cygdrive/c/Windows/s\
ystem32/NSI.dll",host-name="/cygdrive/c/Windows/system32/NSI.dll",symbols-loaded="0",thread-group="i\
1"
468,085 =library-loaded,id="/cygdrive/c/Windows/system32/IMM32.DLL",target-name="/cygdrive/c/Windows\
/system32/IMM32.DLL",host-name="/cygdrive/c/Windows/system32/IMM32.DLL",symbols-loaded="0",thread-gr\
oup="i1"
468,095 =library-loaded,id="/cygdrive/c/Windows/system32/MSCTF.dll",target-name="/cygdrive/c/Windows\
/system32/MSCTF.dll",host-name="/cygdrive/c/Windows/system32/MSCTF.dll",symbols-loaded="0",thread-gr\
oup="i1"
468,100 =breakpoint-modified,bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x00000\
00000401dc8",at="<main+8>",thread-groups=["i1"],times="1",original-location="main"}
468,100 ~"\nTemporary breakpoint "
468,100 ~"2, 0x0000000000401dc8 in main ()\n"
468,100 *stopped,reason="breakpoint-hit",disp="del",bkptno="2",frame={addr="0x0000000000401dc8",func\
="main",args=[]},thread-id="1",stopped-threads="all"
468,100 =breakpoint-deleted,id="2"
468,100 (gdb) 
468,100 28^error,msg="Can not fetch data now."
468,100 (gdb) 
@fduch-stranger fduch-stranger changed the title Debugging not working with Cygwin on Eclipse 4.5 Mars, Window 7 Debugging not working with Cygwin on Eclipse 4.5 Mars, Windows 7 Jul 7, 2015
@bruno-medeiros
Copy link
Contributor

I don't think Cygwin's GDB works well in Windows, when run under the control of IDEs. The recommended way to debug in Windows (and perhaps the only way that RustDT will support) is to use the GDB of mingw-w64, or the one in TDM-GCC

The UserGuide should be updated to reflect this though!

@pvginkel
Copy link

pvginkel commented Jul 8, 2015

I've been using that, but i had the same problem. I had to switch back to
Luna to get debugging back. It's probably the gdb version but I had enough
trouble finding a gdb version that worked that in fine with sticking to
Luna for now. Btw this is vertu l very likely not a RustDT issue but a
gdb/Eclipse issue.

On Wed, Jul 8, 2015, 02:06 Bruno Medeiros notifications@github.com wrote:

I don't think Cygwin's GDB works well in Windows, when run under the
control of IDEs. The recommended way to debug in Windows (and perhaps the
only way that RustDT will support) is to use the GDB of mingw-w64
http://mingw-w64.org/, or the one in TDM-GCC
http://tdm-gcc.tdragon.net/

The UserGuide should be updated to reflect this though!


Reply to this email directly or view it on GitHub
#44 (comment).

@fduch-stranger
Copy link
Author

I've just checked Eclipse 4.4 Luna with RustDT and Cygwin GDB 7.8. It works better but still has issues. In the Debug view I am able to expand threads without errors but unfortunately GDB is unable to find sources.

No source file named C:\Users\okushnir\Desktop\workspace_tst\rust1\src\main.rs.

I think this problem relates to the dot symbol at the on of file path. Probably string splitting issue.

BTW, I agree that GDB over Cygwin is not a good idea. I will check mingw.

@fduch-stranger
Copy link
Author

Results for gdb 7.8 "x86_64-w64-mingw32" from mingw package.

For Eclipse 4.4 Luna all works perfect. At least with hello world app.

For Eclipse 4.5 Mars same issue as for gdb from cygwin:

Status:
Plugin: org.eclipse.debug.core 3.10.0.v20150303-1130
Message: An exception occurred during launch change notification.
Exception:
java.lang.NoSuchMethodError: org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbRestartCommand.<init>(Lorg/eclipse/cdt/dsf/service/DsfSession;Lorg/eclipse/cdt/dsf/gdb/launching/GdbLaunch;)V
at HIDDEN.HIDDEN(HIDDEN:-1)
at HIDDEN.HIDDEN(HIDDEN:-1)
at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:333)
at org.eclipse.core.internal.runtime.AdapterManager.loadAdapter(AdapterManager.java:366)
at org.eclipse.cdt.dsf.gdb.launching.GdbLaunch.getAdapter(GdbLaunch.java:372)
at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager.launchAdded(PerspectiveManager.java:342)
at org.eclipse.debug.internal.core.LaunchManager$LaunchNotifier.run(LaunchManager.java:451)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.debug.internal.core.LaunchManager$LaunchNotifier.notify(LaunchManager.java:438)
at org.eclipse.debug.internal.core.LaunchManager.fireUpdate(LaunchManager.java:1048)
at org.eclipse.debug.internal.core.LaunchManager.addLaunch(LaunchManager.java:708)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:834)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

@bruno-medeiros
Copy link
Contributor

Ah, I see, there are two different issues then. The first one is the breakpoint missing source file path:
No source file named C:\Users\okushnir\Desktop\workspace_tst\rust1\src\main.rs.
That one I already knew about, and it's specific to Cygwin (it's not because the dot at end, the dot is just part of the message. It's because it's a Windows path)

The second issue, specific to Eclipse 4.5 Mars, is new to me. I reckon it's because 4.5 Mars is installing CDT 8.7, whereas Luna has CDT 8.6. RustDT debugging is very sensitive to which CDT version is installed. The RustDT version in master is already updated to require 4.5 (and CDT 8.7), I will check if that solves the problem.

@fduch-stranger
Copy link
Author

Ok. Thank you

@bruno-medeiros
Copy link
Contributor

I've verified that with CDT 8.7 this bug occurs with latest RustDT release.
But it has been fixed with RustDT in master

@bruno-medeiros bruno-medeiros changed the title Debugging not working with Cygwin on Eclipse 4.5 Mars, Windows 7 Debugging not working on Eclipse 4.5 Mars Jul 10, 2015
bruno-medeiros added a commit that referenced this issue Jul 10, 2015
Conflicts:
	documentation/ChangeLog.md
@ghost
Copy link

ghost commented Aug 31, 2015

Hi Bruno,
I tried to follow these instructions but I'm not getting any results.
First I tried using Luna, but when installing RustDT it updates to Mars (so that doesn't work).
Then I compiled RustDT and ran it using "Run Configurations..." but I'm getting the same results.
I cloned RustDT from here: https://github.com/RustDT/RustDT.git
Debugging was working when I first installed RustDT about 2 months ago. Then trying to get the autocomplete stuff using Racer working i must have messed up something so debugging didn't work anymore.
I installed msys2 and compiled GDB but that only gives me the error message that main.rs is not available.
Cheers,
Matthias

@ghost
Copy link

ghost commented Sep 1, 2015

I found a workaround.
started Msys2 and called eclipse from there.
GDB works fine in that environment.
I didn't have to set any path variable.

@RustDT RustDT locked and limited conversation to collaborators Sep 14, 2015
@bruno-medeiros
Copy link
Contributor

There's too many different issues and situations going on here, it's getting confusing. Best to open an new issue if you still have an problems with the latest RustDT version.

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

No branches or pull requests

3 participants