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

[Windows 10] Attach to process doesn't fetch source or any stats; fetching manually produces error #180

Open
N4rki opened this issue Mar 6, 2018 · 2 comments

Comments

@N4rki
Copy link

N4rki commented Mar 6, 2018

OS is Windows 10

When attaching to a process, the process is stopped as it should but the box where the code goes and all stats on the right hand side are left blank. So the behavior is different that in this video.
My code is a simple c++ programm that prints "Hello World!" every 3 seconds. I compiled with -g.
When I now try to point gdbgui to the source code by putting in the path to my helloworld.cpp on the left hand side, the command box prints out some odd error each time I 1)put in any letter 2)hit enter or 3)click "fetch source files"
Here's the error:

c/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S"},{file="../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S"},{file="../../mingwrt/dllcrt1.c",fullname="/home/keith/src/mingw/mingw-wsl-outgoing/build/mingwrt/../../mingwrt/dllcrt1.c"}]

Also, the first time I git enter with the right path and file in the fetch source files textbox (C:\Users\jcj-vb\C_helloworld\helloworld.cpp) the command promt prints File not found: C in red letters. Although the path is definitely correct. Afterwards each enter produces that first error.

Describe your environment
  • Operating system and version: Windows 10 Pro
  • gdbgui version (gdbgui -v): 0.11.1.2
  • gdb version (gdb -v): 7.6.1
  • browser: Firefox
  • I use normal MinGW
  • python packages (pip freeze):
    click==6.7
    Flask==0.12.2
    Flask-Compress==1.4.0
    Flask-SocketIO==2.9.4
    gdbgui==0.11.1.2
    gevent==1.2.2
    greenlet==0.4.13
    itsdangerous==0.24
    Jinja2==2.10
    MarkupSafe==1.0
    pygdbmi==0.8.2.0
    Pygments==2.2.0
    python-engineio==2.0.3
    python-socketio==1.8.4
    six==1.11.0
    Werkzeug==0.14.1
@cs01
Copy link
Owner

cs01 commented Mar 8, 2018

Thanks for the detailed report. For some reason the lower level library pygdbmi is messing up when it tries to parse the output of gdb. The long line at the beginning

c/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/libgcc2.c",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/libgcc2.c"},{file="../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S"},{file="../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S",fullname="/home/keith/src/mingw/gcc-build/gcc-6.3.0-mingw32-cross-native/mingw32/libgcc/../../../src/gcc-6.3.0/libgcc/config/i386/cygwin.S"},{file="../../mingwrt/dllcrt1.c",fullname="/home/keith/src/mingw/mingw-wsl-outgoing/build/mingwrt/../../mingwrt/dllcrt1.c"}]

is actually gdb's "machine interface" output that is meant to be parsed by gdbgui and translated into a friendly webpage. If you could get me the original output, I could fix the parser. To get the original output, you'd need to run gdb with the -i=mi2 flag (this would be done in a normal terminal outside of gdbgui).

gdb -i=mi2

Then you'd run all the same commands gdbgui runs. You can see these commands by clicking the gear icon in the top right and clicking Print all sent commands in console, including those sent automatically by gdbgui. Then you could copy and paste the entire session and paste it back in this issue, and I could use that to debug the issue.

Just to be sure I understand though: You are able to debug the program, but are having trouble looking at a particular source file and loading the list of source files, correct?

@sabbay
Copy link

sabbay commented May 24, 2018

Hi, I`m having the problem that you are talking about when I run example for rust.

Just to be sure I understand though: You are able to debug the program, but are having trouble looking at a particular source file and loading the list of source files, correct?

First error on startup is:
File not found: main

I can than start debugging manually via GDB console. Next thing im served disassembled code.

When i press "fetch source files" Im seeing in GDB console

},{file="libstd\\sys\\windows/thread_local.rs",fullname="C:\\projects\\rust\\src/libstd\\sys\\windows/thread_local.rs"},{file="libstd\ hread/local.rs",fullname="C:\\projects\\rust\\src/libstd\ hread/local.rs"},{file="libstd\\sys_common/thread_local.rs",fullname="C:\\projects\\rust\\src/libstd\\sys_common/thread_local.rs"},{file="libstd\\sys_common/at_exit_imp.rs",fullname="C:\\projects\\rust\\src/libstd\\sys_common/at_exit_imp.rs"},{file="libstd\\lib.rs",fullname="C:\\projects\\rust\\src/libstd\\lib.rs"},{file="C:\\projects\\rust\\src\\libcore/ptr.rs",fullname="C:\\projects\\rust\\src\\libcore/ptr.rs"},{file="src\\main.rs",fullname="C:\\Users\\msabb\\Documents\\coding\\rust\\rust\\src\\main.rs"},{file="C:\\projects\\rust\\src\\libcore\\fmt/mod.rs",fullname="C:\\projects\\rust\\src\\libcore\\fmt/mod.rs"},{file="C:\\projects\\rust\\src\\libcore/mem.rs",fullname="C:\\projects\\rust\\src\\libcore/mem.rs"},{file="src\\main.rs",fullname="C:\\Users\\msabb\\Documents\\coding\\rust\\rust\\src\\main.rs"},{file="C:\\projects\\rust\\src\\libcore\\fmt/mod.rs",fullname="C:\\projects\\rust\\src\\libcore\\fmt/mod.rs"},{file="src\\main.rs",fullname="C:\\Users\\msabb\\Documents\\coding\\rust\\rust\\src\\main.rs"},{file="C:\\projects\\rust\\src\\liballoc/slice.rs",fullname="C:\\projects\\rust\\src\\liballoc/slice.rs"},{file="src\\main.rs",fullname="C:\\Users\\msabb\\Documents\\coding\\rust\\rust\\src\\main.rs"},{file="C:\\projects\\rust\\src\\libcore\\slice/mod.rs",fullname="C:\\projects\\rust\\src\\libcore\\slice/mod.rs"},{file="src\\main.rs",fullname="C:\\Users\\msabb\\Documents\\coding\\rust\\rust\\src\\main.rs"},{file="C:\\projects\\rust\\src\\libstd/rt.rs",fullname="C:\\projects\\rust\\src\\libstd/rt.rs"},{file="C:\\projects\\rust\\src\\libcore\\slice/mod.rs",fullname="C:\\projects\\rust\\src\\libcore\\slice/mod.rs"},{file="src\\main.rs",fullname="C:\\Users\\msabb\\Documents\\coding\\rust\\rust\\src\\main.rs"},{file="C:\\projects\\rust\\src\\libcore/ptr.rs",fullname="C:\\projects\\rust\\src\\libcore/ptr.rs"},{file="C:\\projects\\rust\\src\\libcore\\ops/function.rs",fullname="C:\\projects\\rust\\src\\libcore\\ops/function.rs"},{file="src\\main.rs",fullname="C:\\Users\\msabb\\Documents\\coding\\rust\\rust\\src\\main.rs"}]

Although if I load "./src/main.rs" manually(drop down doesn`t show anything) everything seems to work. Problem occurs when source file being debugged changes, all I can see is disassembled code again.

The session from running
gdb -i=mi2
and pasting commands from gdbgui console is pasted here: https://pastebin.com/ZqUwPe4Q

Describe your environment:

  • Windows 10 Pro
  • gdbgui version (gdbgui -v): 0.11.3.1
  • gdb version (gdb -v): 7.10.1
  • browser: Firefox
  • rust toolchain(rustup show): stable-x86_64-pc-windows-gnu
  • cargo: 1.26.0
  • python packages (pip freeze):
    astroid==1.6.3
    cffi==1.11.5
    click==6.7
    colorama==0.3.9
    Flask==0.12.4
    Flask-Compress==1.4.0
    Flask-SocketIO==3.0.0
    gdbgui==0.11.3.1
    gevent==1.3.1
    greenlet==0.4.13
    isort==4.3.4
    itsdangerous==0.24
    Jinja2==2.10
    lazy-object-proxy==1.3.1
    MarkupSafe==1.0
    mccabe==0.6.1
    pycparser==2.18
    pygdbmi==0.8.2.0
    Pygments==2.2.0
    pylint==1.8.4
    python-engineio==2.1.1
    python-socketio==1.9.0
    six==1.11.0
    Werkzeug==0.14.1
    wrapt==1.10.11

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

3 participants