31i73 / atom-dbg

An Atom package - An interactive debugger frontend
https://atom.io/packages/dbg
MIT License
30 stars 4 forks source link

Cannot pause execution or trigger breakpoints #23

Closed johannesstricker closed 7 years ago

johannesstricker commented 7 years ago

Hi, I'm using this on Windows 10 with an executable created with the Visual Studio 15 compiler. My program ist just a simple main function. I can start the debugging process and I get console output ('[New Thread XXX.XXX]' for example), however there is no way to pause execution. If I hit the pause button nothing happens and my breakpoints don't trigger.

GDB version is 7.11.1 configured as i686-w64-mingw32

ProPuke commented 7 years ago

Breakpoints won't work if your executable isn't compiled with debug symbols (that gdb understands). So it could be a case of not compiling in debug mode (or perhaps needing a special flag to support gdb with vs). I do believe pausing should still work if the executable is active, though, with or without debug info. So I'm not sure there.

Could you enable logging for dbg-gdb and paste the output here so I can see what's going wrong?

To do so..

johannesstricker commented 7 years ago

Hi, sorry this took me so long. So I have a very basic project:

int main(int argc, char** argv)
{
  std::cout << "Hello world." << std::endl; // breakpoint on this line
  return 0;
}

I use cmake to create and build the project files with -DCMAKE_BUILD_TYPE=Debug and -DCMAKE_GENERATOR="Visual Studio 14 2015".

Below is the console output for a single debug run.

dbg-gdb >  -file-exec-and-symbols C:/Users/johan/Desktop/test/build/Debug/example.exe
main.coffee:220 dbg-gdb <  = thread-group-added Object {id: "i1"}
main.coffee:220 dbg-gdb <  ^ done Object {}
main.coffee:446 dbg-gdb >  -gdb-set mi-async on
main.coffee:220 dbg-gdb <  ^ done Object {}
main.coffee:446 dbg-gdb >  -break-insert C:/Users/johan/Desktop/test/main.cpp:7
main.coffee:220 dbg-gdb <  ^ error Object {msg: "No symbol table is loaded.  Use the "file" command."}
main.coffee:446 dbg-gdb >  -exec-arguments 
main.coffee:220 dbg-gdb <  ^ done Object {}
main.coffee:446 dbg-gdb >  -exec-run
main.coffee:220 dbg-gdb <  = thread-group-started Object {id: "i1", pid: "20624"}
main.coffee:220 dbg-gdb <  = thread-created Object {id: "1", group-id: "i1"}
main.coffee:232 dbg-gdb <  ~ [New Thread 20624.0x3988]

main.coffee:220 dbg-gdb <  = thread-created Object {id: "2", group-id: "i1"}
main.coffee:232 dbg-gdb <  ~ [New Thread 20624.0x4748]

main.coffee:220 dbg-gdb <  = thread-created Object {id: "3", group-id: "i1"}
main.coffee:232 dbg-gdb <  ~ [New Thread 20624.0x57f4]

main.coffee:220 dbg-gdb <  = thread-created Object {id: "4", group-id: "i1"}
main.coffee:232 dbg-gdb <  ~ [New Thread 20624.0x1374]

main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SYSTEM32\ntdll.dll", target-name: "C:\WINDOWS\SYSTEM32\ntdll.dll", host-name: "C:\WINDOWS\SYSTEM32\ntdll.dll", symbols-loaded: "0", thread-group: "i1"}host-name: "C:\WINDOWS\SYSTEM32\ntdll.dll"id: "C:\WINDOWS\SYSTEM32\ntdll.dll"symbols-loaded: "0"target-name: "C:\WINDOWS\SYSTEM32\ntdll.dll"thread-group: "i1"__proto__: Object
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\System32\kernel32.dll", target-name: "C:\WINDOWS\System32\kernel32.dll", host-name: "C:\WINDOWS\System32\kernel32.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\System32\KernelBase.dll", target-name: "C:\WINDOWS\System32\KernelBase.dll", host-name: "C:\WINDOWS\System32\KernelBase.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SYSTEM32\vcruntime140d.dll", target-name: "C:\WINDOWS\SYSTEM32\vcruntime140d.dll", host-name: "C:\WINDOWS\SYSTEM32\vcruntime140d.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SYSTEM32\msvcp140d.dll", target-name: "C:\WINDOWS\SYSTEM32\msvcp140d.dll", host-name: "C:\WINDOWS\SYSTEM32\msvcp140d.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SYSTEM32\ucrtbased.dll", target-name: "C:\WINDOWS\SYSTEM32\ucrtbased.dll", host-name: "C:\WINDOWS\SYSTEM32\ucrtbased.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  ^ running Object {}
main.coffee:220 dbg-gdb <  * running Object {thread-id: "all"}
main.coffee:238 dbg-gdb <  Hello world.
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SysWOW64\kernel.appcore.dll", target-name: "C:\WINDOWS\SysWOW64\kernel.appcore.dll", host-name: "C:\WINDOWS\SysWOW64\kernel.appcore.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SysWOW64\msvcrt.dll", target-name: "C:\WINDOWS\SysWOW64\msvcrt.dll", host-name: "C:\WINDOWS\SysWOW64\msvcrt.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SysWOW64\rpcrt4.dll", target-name: "C:\WINDOWS\SysWOW64\rpcrt4.dll", host-name: "C:\WINDOWS\SysWOW64\rpcrt4.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SysWOW64\sspicli.dll", target-name: "C:\WINDOWS\SysWOW64\sspicli.dll", host-name: "C:\WINDOWS\SysWOW64\sspicli.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SysWOW64\cryptbase.dll", target-name: "C:\WINDOWS\SysWOW64\cryptbase.dll", host-name: "C:\WINDOWS\SysWOW64\cryptbase.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SysWOW64\bcryptprimitives.dll", target-name: "C:\WINDOWS\SysWOW64\bcryptprimitives.dll", host-name: "C:\WINDOWS\SysWOW64\bcryptprimitives.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:220 dbg-gdb <  = library-loaded Object {id: "C:\WINDOWS\SysWOW64\sechost.dll", target-name: "C:\WINDOWS\SysWOW64\sechost.dll", host-name: "C:\WINDOWS\SysWOW64\sechost.dll", symbols-loaded: "0", thread-group: "i1"}
main.coffee:232 dbg-gdb <  ~ [Thread 20624.0x1374 exited with code 0]

main.coffee:220 dbg-gdb <  = thread-exited Object {id: "4", group-id: "i1"}
main.coffee:232 dbg-gdb <  ~ [Thread 20624.0x57f4 exited with code 0]

main.coffee:220 dbg-gdb <  = thread-exited Object {id: "3", group-id: "i1"}
main.coffee:232 dbg-gdb <  ~ [Thread 20624.0x4748 exited with code 0]

main.coffee:220 dbg-gdb <  = thread-exited Object {id: "2", group-id: "i1"}
main.coffee:232 dbg-gdb <  ~ [Inferior 1 (process 20624) exited normally]

main.coffee:220 dbg-gdb <  = thread-exited Object {id: "1", group-id: "i1"}
main.coffee:220 dbg-gdb <  = thread-group-exited Object {id: "i1", exit-code: "0"}
main.coffee:220 dbg-gdb <  * stopped Object {reason: "exited-normally"}
ProPuke commented 7 years ago

Yeah, there's no debug symbols in that executable for some reason.

Despite being built in debug mode, vs is not generating debug symbols that gdb understands.

It might be that there's a switch the vc compiler needs to enable this, and cmake needs a specific setting to know to do this, but I'm not sure what that is.

Sorry for the vagueness of this answer.

johannesstricker commented 7 years ago

Thanks, now that you say it I can make sense of the missing symbol table. I thought I had this working a year ago using Sublime Text, but I might have compiled with gcc back then.