Author Topic: Can't run debugger  (Read 40684 times)

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Can't run debugger
« on: September 09, 2010, 01:46:28 pm »
Hi,
After a successful build with debugging enabled, I can't run the 'gdb' debugger. Clicking 'start' or hitting f8 does nothing. Only the debugger tab below is selected and nothing else. I've tried this both on an XP and a Vista machine with same result. 'do not run the debugee' in the debugger options is not checked and the path to AVR 'gdb' in 'toolchain executables' is correct. Also I cannot add any watch variable, when I add a variable the watch window is always empty. I don't have wxwidgets installed, do I need to install? I'm using codeblocks v10.05. Has anybody else experienced this? Need help, thnx...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #1 on: September 09, 2010, 02:03:35 pm »
Enable the debuggers debug log (Settings -> compiler & debugger -> debugger -> show debugger's log)
Inspect the log and if you don't find anything useful you can paste the log in a [ code ] tags, so we can look at it.
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #2 on: September 10, 2010, 12:08:03 am »
Debugger log is always enabled but the information below doesn't always appear on the 'debugger' tab. After hitting f8 to start the debugger the 'Start' or 'F8' is still available without anything launched. Thnx for the reply, here is the log:

Code: [Select]
Selecting target:
Debug
Adding source dir: D:\Electronics\Projects\testcb\source\
Adding source dir: D:\Electronics\Projects\testcb\source\

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #3 on: September 10, 2010, 12:43:17 am »
You're not reading!!!!
I've said the debug log not the normal one...
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #4 on: September 10, 2010, 11:12:13 am »
I'm very sorry! Where do I find it? That's the only information on the tabs below regarding the debugger. Does it reside on some file? Pls forgive my ignorance!

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Can't run debugger
« Reply #5 on: September 10, 2010, 11:20:12 am »
I'm very sorry! Where do I find it? That's the only information on the tabs below regarding the debugger. Does it reside on some file? Pls forgive my ignorance!

Enable the debuggers debug log (Settings -> compiler & debugger -> debugger -> show debugger's log)
Inspect the log and if you don't find anything useful you can paste the log in a [ code ] tags, so we can look at it.

Highlighting by me.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #6 on: September 10, 2010, 11:29:50 am »
I've enabled the log already but I wasn't sure which tab was the log he mentioned. I disabled it and realized the 1 with the title 'Debugger (debug)' disappeared. I guess that's the 1 in question but it's always empty, when I try to 'start' debug or push 'f8' there isn't anything listed. So pasted the normal 'Debugger' tab contents, I apologize for that. Something maybe wrong with what's being executed when the 'Start' debugger is selected?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #7 on: September 10, 2010, 12:44:16 pm »
Have you tried to scroll up and down the empty log.
My windows version of C::B is experiencing this problem, the text is there but the window is not refreshed.
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #8 on: September 10, 2010, 01:26:19 pm »
Yes I had checked that before and now again it's definitely empty. Is it possible I messed up the command to be executed?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #9 on: September 10, 2010, 03:34:35 pm »
Do you have gdb installed?
Can you provide simple test project that reproduces the problem?
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #10 on: September 10, 2010, 03:53:41 pm »
The compiler setting I use is 'GNU AVR GCC Compiler' and the compiler itself is 'WinAVR'. It's installed under 'C:\GNU\WinAVR'. The executables are in the 'C:\GNU\WinAVR\bin' directory. The 'gdb' used is 'avr-gdb' with correct path in the 'toolchain executables' under the 'compiler and debugger' settings. 'Compilers installation directory' is also correct. I attached the test project I use with the whole folder included. It's located under 'D:\Electronics\Projects\' on my computer. Will it help if I export my configuration and post it here also? Thnx very much for the help...


[attachment deleted by admin]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #11 on: September 10, 2010, 04:47:37 pm »
You've missed the simple part :)
Can you debug simple hello world console application, using mingw?
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #12 on: September 10, 2010, 05:20:32 pm »
I didn't know they are related, do I have to have mingw installed for debugging an embedded AVR project? I also tried to debug the basic 'helloworld' with mingw same result with no trace of anything in the 'Debugger (debug)' tab although it compiles and runs perfectly. I have checked the executables paths as always and they are correct as always. What may be the problem?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #13 on: September 10, 2010, 05:39:18 pm »
They are not related, but I don't have an embedded compiler nor do I want to install one.
The case with simple console application is the most tested one and if it doesn't work you've a problem with your setup.

Can you try the debugger's branch nightly?
Also have you tried to select (click + drag) in the white window of the debugger's debug log? As I've stated there is some problem with this window on windows and it is not refreshed, but the text is there.
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #14 on: September 10, 2010, 08:56:21 pm »
I used "CB_20100904_rev6570_DEBUGGER_BRANCH_win32" to test everything again. At first it complained about the 'libexpat.dll' which v10.05 never did. After I installed expat with mingw-get, I am now able to debug mingw console applications in both the rev6570 and v10.05. But regarding the 'AVR GCC Compiler' the same problem continues exactly the same in both rev6570 and v10.05. The 'Debugger (debug)' tab is definitely empty and nothing gets executed.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #15 on: September 10, 2010, 09:27:32 pm »
So you have some configuration problem....
Does the avr gdb run from the console?
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #16 on: September 10, 2010, 09:30:49 pm »
Yes, without any problem!

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #17 on: September 12, 2010, 10:58:50 am »
I also realized, although the debugger doesn't start it's like codeblocks enters a debug state and stays there. When I open another project it asks if it should stop the debugger or after I try to debug an AVR project with nothing visually appearing nor starting, I cannot start debug for a mingw console application which I can if I don't start it for AVR first. Where can I access the settings for the debugger command line scripts?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #18 on: September 12, 2010, 11:50:47 am »
Where can I access the settings for the debugger command line scripts?
Cannot compute... are you asking for the command options used to launch the debugger? (if so, look in the code src/plugins/debuggergdb/*)
When you start the debugger in AVR project do you have gdb running (look in the task manager)?
Also do you see the debug log in when you debug console application with mingw's gdb?

(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #19 on: September 13, 2010, 02:41:19 pm »
Yes it was command options I was asking for and I guess I can't change them without compiling codeblocks, like from some settings menu, right? I'm trying on the 3rd different machine now on an XP OS and behavior is the same as the 2 before. Debugging with MinGW works but nothing happens with 'avr gdb' and 'mingw' doesn't work afterwards. There isn't any trace of 'gdb' nor anything else related with gdb on the task manager and yes I see the debug log and everything else when debugging with 'mingw's gdb'. I ran out of ideas! Thnx for the help...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #20 on: September 13, 2010, 03:53:50 pm »
You can try the latest nightly for the debuggers branch and if that doesn't work you've two options:
1. build and debug c::b yourself
2. provide extremely detailed list of steps you're executing, from the compiler installation to the pressing of f8, also I'll need the links to download the compiler and debugger you're using, and a simple test project.

1. will be faster, because I don't like switching to windows too much :)
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #21 on: September 13, 2010, 09:38:12 pm »
I'm grateful for ur help. I'm only experienced in C for 8-16 bit microcontrollers and without any experience in C++ so option 1 is not possible by my side, I apologize for that. As for option 2, there exists a list below. ;) That's what I've done for my 3rd try on a 32-bit XP:

1 - I installed codeblocks 10.05 with mingw under 'C:\Program Files\codeblocks' and moved the mingw directory to 'C:\GNU\MinGW' and added 'C:\GNU\MinGW\bin' to PATH
2 - Here is the link for the latest winavr installation
http://sourceforge.net/projects/winavr/files/WinAVR/20100110/WinAVR-20100110-install.exe/download
on the page
http://sourceforge.net/projects/winavr/files/
I installed it under 'C:\GNU\WinAVR' and it adds 'C:\GNU\WinAVR\bin;C:\GNU\WinAVR\utils\bin' to path but I aligned path to make 'C:\GNU\MinGW\bin' come first.
3 - In codeblocks under 'compiler and debugger' settings I corrected compiler's install directory 'C:\GNU\MinGW' for MinGW and 'C:\GNU\WinAVR' for AVR GCC Compiler.
4 - For debugger settings only 'auto-build project to ensure up to date', 'add other open projects paths' and 'do not run debugee' options are not checked.
5 - I attached the project I use to test with the '.cbp' and other files. The project resides in drive 'D:'. It builds without any problems

That's all the changes I made to codeblocks. I think the project options reside in the '.cbp' file if not I'll also list them if needed.

And 1 last thing. I know codeblocks is free and provided 'as is'. I didn't expect for that much help and ur help is much appreciated, thank u! ;)


[attachment deleted by admin]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #22 on: September 13, 2010, 10:41:58 pm »
Why do you add the compilers to the PATH?
Can you try without?
Can you try to misspell the debuggers executable name in the toolchain options?
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #23 on: September 13, 2010, 11:13:09 pm »
I add them to path because winavr asks for it and mingw installer also adds it. I tried without compilers in the path, unfortunately same result. When I misspell debugger executable name, codeblocks gives the error 'The debugger executable is not set. To set it, go to...'! There is another detail needs to be told. After nothing happens when I try to run avr debugger with correct executable name, I don't get the error above even I misspell the debugger executable. Nothing changes until I quit and start codeblocks again and then I can get the error above again. It's like codeblocks is waiting for the avr-gdb to start but it never starts and codeblocks debug plugin hangs in the debug state somehow waiting for something. Just my guess.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #24 on: September 15, 2010, 12:35:16 pm »
Ok I've found the problem. In 'Project/Properties' menu under 'Build targets' tab, when u set the type to 'Native' on the 'Selected build target options' which I do for embedded applications, the problem appears. Even when the type is set to 'Native' for the MinGW compiler, the debugger doesn't run like the avr-gdb. Is this the normal behavior for the 'Native' type or should a bug report be filled? Afaik only the linking commands under 'Advanced compiler options' change when the type is changed, don't they?
« Last Edit: September 15, 2010, 12:37:15 pm by scarphin »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #25 on: September 15, 2010, 01:18:56 pm »
The bug happens when you change from console to native?
This options should not change your build options (at least on linux it doesn't), it just tell's C::B to launch a console for you when you debug/run your project.

(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #26 on: September 15, 2010, 01:41:25 pm »
The bug happens when you change from console to native?

Yes, definitely!!! I even confirmed this on another Vista box for the 4th time. I installed cb 10.05 and winavr with everything default. And when I change the type to 'native', avr-gdb doesn't run nor anything visible happens and my guess is the debugger plugin hangs. After restarting cb and if the type is set to 'Console application', avr-gdb and logging works without a problem.

Below is the linker commands which I copied from 'Advanced compiler options' for 'AVR GCC Compiler' in the order 'link executable', 'link console executable' and 'link native executable'. Last 2 is the same but that's not the case for MinGW.

$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -mwindows
$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs
$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs

Do I get any advantage by setting the type to 'native' for embedded applications as doing so doesn't launch the debugger? I think that's a bug to be confirmed. Thnx...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #27 on: September 15, 2010, 02:05:13 pm »
Don't know if it is a bug, I'm not an embedded developer.

If you try the same steps with the mingw, do you get the same behavior? If you do, then this is a bug :)
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #28 on: September 15, 2010, 02:56:58 pm »
If I set the type to 'Native' for MinGW, the debugger won't start and there is nothing on the 'Debugger (debug)' tab as I mentioned before. So this must be a bug. Am I allowed to fill in a bug report for this?

Edit: I also wonder if this is the case for linux version or not! If not then this is related to windows versions with Vista and XP confirmed.
« Last Edit: September 15, 2010, 03:00:11 pm by scarphin »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #29 on: September 15, 2010, 04:26:59 pm »
First try the latest normal nightly and then the debuggers branch nightly...
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #30 on: September 15, 2010, 04:55:52 pm »
Ok I have confirmed with the latest 12 September normal nightly and debugger branch nightly, the debugger doesn't launch when the target type is set to 'Native'. Now what? ;)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #31 on: September 15, 2010, 05:44:19 pm »
Should have to restart to windows to try it :)
But that will happen, when I get home...
(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!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Can't run debugger
« Reply #32 on: September 15, 2010, 06:21:34 pm »
Similar here on linux, if switched to native, debuggers debug-log is empty and the last entry in the "normal" debugger log is:
Code: [Select]
Adding source dir: /home/jens/src/src/
Adding source dir: /home/jens/src/src/

I don't know what native is made for, I will look into it.
« Last Edit: September 15, 2010, 06:38:16 pm by jens »

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #33 on: September 15, 2010, 07:25:52 pm »
It's great to see some1 else has had the same problem with me, I was starting to believe I set something wrong in all 4 windows boxes I tried! ;) In a document I read regarding the setup of Codeblocks to use the AVR GCC compiler, the author set the type to 'Native' for the AVR applications, that's why I was trying to debug with that setting. He didn't included how to debug though.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #34 on: September 15, 2010, 11:15:23 pm »
I was able to reproduce it, too... And I think it hasn't been implemented at all.

I've made a patch for the debuggers branch: http://forums.codeblocks.org/index.php/topic,10908.msg89578.html#msg89578

scarphin: thank you :)
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #35 on: September 16, 2010, 02:09:48 am »
U're welcome and I want to thank all of u again for Codeblocks! ;) But I just have 1 more newbie problem for now. As the bug is resolved and I need to keep going with my projects, what must be my version of Codeblocks to use? Do I have to build Codeblocks on my machine to make use of the patch or if I wait till the next nightly release will it be included already? And will it be ok if I overwrite the v10.05 installed files with the nightly build or should I use them separated? It's just that I like installing programs instead of unzipping and running them directly. ;)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #36 on: September 16, 2010, 08:47:18 am »
Next debugger branch nightly will have the fix. See the info for installing nightlies...
You can switch your projects to GUI or Console and continue using 10.05.
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #37 on: September 16, 2010, 12:51:59 pm »
I've read the info, it says extract and use. ;D Anyway I'll deal with it but what's the difference between 'Native' and 'Console application'? I intend to use 'Native' as I'm not coding a console application but what do I loose if I select 'Console application'?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13007
    • Travis build status
Re: Can't run debugger
« Reply #38 on: September 16, 2010, 01:04:05 pm »
The ability to use printf for debugging :)
(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!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #39 on: September 16, 2010, 01:27:03 pm »
Ok, got it, 'console application' for printf'ing, 'native' for nothing. ;) Thnx for everything...

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Can't run debugger
« Reply #40 on: September 29, 2010, 03:18:21 pm »
After running a couple of sessions with most of the things working without a problem, I realized 'codeblocks debug console' doesn't have anything appear on it till the end of debug session. The behavior is the same when the type is set to 'console application' from 'native'. As I can't think of this 'debug console' for any printfing from the embedded target, I really can't understand why it stands there. Is it a must with the running of debugger or it stands there just for printfing anything from the target? Can this be left out if the latter is the case?