Author Topic: [FIXED] Debugger issue [update of gdb needed]  (Read 3829 times)

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
[FIXED] Debugger issue [update of gdb needed]
« on: August 31, 2022, 08:43:11 am »
Hello to all of you;

I'm having a small problem with the code blocks debugger, when I try to start debugging, it opens the windows terminal and when I push any key, it closes the terminal and stops debugging... does anyone have any ideas?

(the following is the message I get at the end of the debugging)

Quote
Set variable: PATH=.;C:\Program Files\CodeBlocks\MinGW\bin;C:\Program Files\CodeBlocks\MinGW;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files\Amazon Corretto\jdk18.0.1_10\bin;C:\Python310\Scripts;C:\Python310;C:\Program Files\Python310\Scripts;C:\Program Files\Python310;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\chocolatey\bin;C:\msys64\mingw64\bin;C:\MinGW\MinGW\bin;C;C:\Users\GodMode\AppData\Local\Microsoft\WindowsApps;C:\Users\GodMode\AppData\Local\Programs\Microsoft VS Code\bin
Starting debugger: C:\Program Files\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname -quiet  -args C:/Users/JohnD/DOCUME~1/EXERCI~1/RVISIO~2/Ex_6/Ex_6/bin/Debug/Ex_6.exe
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 8.1
Child process PID: 1528
[Inferior 1 (process 1528) exited normally]
Debugger finished with status 0

« Last Edit: September 01, 2022, 08:52:32 am by thierryv »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Debugger issue
« Reply #1 on: August 31, 2022, 01:06:19 pm »
Did you set a breakpoint or select "Run to cursor"?


Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #2 on: August 31, 2022, 01:12:53 pm »
I did place some breakpoints,
but as soon as the debugger arrives at the breakpoint I have the impression that it closes the terminal and continues the program normally.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Debugger issue
« Reply #3 on: August 31, 2022, 03:07:31 pm »
I think your program just terminates. Have you tried to single step after the breakpoint?

To gatter more information to help you better please activate the full debug log in
Settings->Debugger->Common->Enable full (debug) log
and post it here (like you did in the first post. Thank you for that! but we need the full log to help you more)

Offline gd_on

  • Lives here!
  • ****
  • Posts: 796
Re: Debugger issue
« Reply #4 on: August 31, 2022, 03:39:19 pm »
I remember than with old gdb versions, there was sometimes problems when it was placed in a path containing a space character. It's the case here (Program Files).
Try to copy your compiler installation at the root, for example C:\MinGW. Adjust paths in C::B and retry.
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #5 on: August 31, 2022, 05:04:31 pm »
I can't even reply to my own thread:'( the site doesn't want it, what a day

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #6 on: August 31, 2022, 05:06:13 pm »
A BIG thank you for your help in any case.

I still have a strange thing, when I click on the red arrow, the terminal opens and closes, I have a message that flashes in Cccc that I managed to take by chance.

I have some problem to post the debugger log, the site doesn't want to apparently. even with quote or code.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Debugger issue
« Reply #7 on: August 31, 2022, 05:15:30 pm »
This forum software absolutely does not like some non ascii charachters, so if the log has non ascii characters the best would be to put it in a txt file and attach it here

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #8 on: August 31, 2022, 05:18:01 pm »
Lets try like that :D

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #9 on: August 31, 2022, 05:18:38 pm »
This forum software absolutely does not like some non ascii charachters, so if the log has non ascii characters the best would be to put it in a txt file and attach it here

THANKS ! :D

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Debugger issue
« Reply #10 on: August 31, 2022, 05:39:43 pm »
Yea, also gdb does not like non ascii charachters, i would move your project from the sub folder "R##visions_Ludo" to something with only ascii characters.

Actually i do not know if gdb does not like it or how we call gdb... Anyway i would only use ascii characters in paths (and probably _ instead of spaces, but this is a personal preference)

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #11 on: August 31, 2022, 05:58:16 pm »
So I replaced my exercise folder and placed it in the root of "C:\" I also placed the debugger in "C:\MinGW" but nothing happens, the terminal doesn't pop when I press the red arrow to start the debugging.
I also installed "Msys64" to try with something else, but ... no

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #12 on: August 31, 2022, 06:04:24 pm »
By moving the location of the compiler and debugger to "C:\CodeBlocks\MinGW\Bin" the terminal appears well, but disappears almost as quickly, but still no possibility to do step by step, or go into.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Debugger issue
« Reply #13 on: August 31, 2022, 06:04:58 pm »
Code
[debug]"C:/Programmations/Ex_6/bin/Debug/Ex_6.exe": not in executable format: File format not recognized
[debug](gdb)
ok, now it is getting funny...

Does the exe exists?
Try to recompile your project:
From the drop down menu near the green arrow select "debug"
Now rebuild the target with the blue circle arrows or Build->Rebuild
then try again...

Quote
I also installed "Msys64"
ow... this could now lead to problems like you are seeing...

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Debugger issue
« Reply #14 on: August 31, 2022, 06:06:30 pm »
From your last log
Quote
[debug][Thread 4760.0x2dbc exited with code 0]
[debug][Inferior 1 (process 4760) exited normally]
This indicates that your program exits before it reaches the breakpint...
Try to add the breakpoint at the first line in the main function and then single step trough (not by using the red arrow, but the single step button)

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #15 on: August 31, 2022, 07:42:50 pm »
From your last log
Quote
[debug][Thread 4760.0x2dbc exited with code 0]
[debug][Inferior 1 (process 4760) exited normally]
This indicates that your program exits before it reaches the breakpint...
Try to add the breakpoint at the first line in the main function and then single step trough (not by using the red arrow, but the single step button)

ok, when i do as you describe it works !
not very practical, but functional in any case! ! YEAH
Thanks, I was getting desperate.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Debugger issue
« Reply #16 on: August 31, 2022, 09:24:16 pm »
Of cours you can do bisectional search with break points to find the point where your application exits.
Also make sure you have deactivated all code optimization so not that you put a break point in a line that gets optimized away from the compiler and debugger can not break on it

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Debugger issue
« Reply #17 on: August 31, 2022, 11:56:51 pm »
GDB 8.1 has issues like the one reported. As such please update to a later version (at least use V9 or preferably 11 or 12). The latest GDB is V12.1, but not all compiler toolchains have this version yet.

If you cannot get a later version for the compiler toolchain you are using then try the latest from the following github repo:

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #18 on: September 01, 2022, 08:44:23 am »
GDB 8.1 has issues like the one reported. As such please update to a later version (at least use V9 or preferably 11 or 12). The latest GDB is V12.1, but not all compiler toolchains have this version yet.

If you cannot get a later version for the compiler toolchain you are using then try the latest from the following github repo:

Of cours you can do bisectional search with break points to find the point where your application exits.
Also make sure you have deactivated all code optimization so not that you put a break point in a line that gets optimized away from the compiler and debugger can not break on it

I will try does two advices, thanks for your time and feedback ! 

Offline thierryv

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugger issue
« Reply #19 on: September 01, 2022, 08:51:53 am »
GDB 8.1 has issues like the one reported. As such please update to a later version (at least use V9 or preferably 11 or 12). The latest GDB is V12.1, but not all compiler toolchains have this version yet.

If you cannot get a later version for the compiler toolchain you are using then try the latest from the following github repo:

Moreover, it would seem that with the recommended update of gdb, it works (for the moment), thanks again for everything.