News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Can't debug even a Hello world program

Started by dwaindibbley, May 12, 2021, 01:46:59 PM

Previous topic - Next topic

dwaindibbley

My problem is that in Windows, I can no longer debug a program. It worked before, I think I fixed it, something perhaps to do with paths with spaces, now its not working. First I re-installed 20.03 CodeBlocks, then I tried just the hello world command line example as follows.

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hello world!\n");
    return 0;
}
If I set a breakpoint on the printf and start debugging I get the following in the debug window

Setting breakpoints

[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 8.1
[debug]Copyright (C) 2018 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-w64-mingw32".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 8.1

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory C:/temp/test_debug/
[debug]Source directories searched: C:/temp/test_debug;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/temp/test_debug/main.c:6"
[debug]Breakpoint 2 at 0x401559: file C:\temp\test_debug\main.c, line 6.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\temp\test_debug\bin\Debug\test_debug.exe

Child process PID: 7612

[debug][New Thread 7612.0x2980]
[debug][New Thread 7612.0x1e3c]
[debug]Thread 1 hit Breakpoint 2, main () at C:\temp\test_debug\main.c:6
[debug]C:\temp\test_debug\main.c:6:58:beg:0x401559
[debug]>>>>>>cb_gdb:

At C:\temp\test_debug\main.c:6

[debug]> show language
[debug]The current source language is "auto; currently c".
[debug]>>>>>>cb_gdb:
[debug]> info locals
[debug]No locals.
[debug]>>>>>>cb_gdb:
[debug]> info args
[debug]No arguments.
[debug]>>>>>>cb_gdb:
[debug]> if 1
disassemble 0x401559
info frame
end

[debug] >
[debug] > >
[debug]Dump of assembler code for function main:
[debug]   0x0000000000401550 <+0>:   sub    $0x28,%rsp
[debug]   0x0000000000401554 <+4>:   callq  0x401620 <__main>
[debug]=> 0x0000000000401559 <+9>:   lea    0x2aa0(%rip),%rcx        # 0x404000
[debug]   0x0000000000401560 <+16>:   callq  0x402a50 <puts>
[debug]   0x0000000000401565 <+21>:   mov    $0x0,%eax
[debug]   0x000000000040156a <+26>:   add    $0x28,%rsp
[debug]   0x000000000040156e <+30>:   retq   
[debug]End of assembler dump.

Debugger finished with status 1

And after a couple of seconds it throws the "Debugger Finished with status 1" no matter what I try to do. Only thing I can think of is something has become corrupt in the configuration files. I have noticed it is a bad idea to try to use a Linux config on windows so now use seperate configs. I have googled this issue but not found an answer!


oBFusCATed

The debugger shipped with 20.03 is known to be broken.
Search the forum for topics about working debuggers...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

dwaindibbley


AndrewCot

It would be quicker to just grab the latest nightly build and use it.

Miguel Gimenez

The debugger is external to the nightly, so it will use whatever debugger you have previously.