Author Topic: CodeBlocks and Codesourcery GDB  (Read 45414 times)

Offline themaddin

  • Multiple posting newcomer
  • *
  • Posts: 16
CodeBlocks and Codesourcery GDB
« on: February 16, 2012, 12:21:18 pm »
Hello everyone,

is somebody out there who is debugging with Codeblocks and Codesourcery GDB?
I have troubles debugging with Codeblocks and Codesourcery GDB. It seems Codesourcery executes every GDB instruction from Codeblocks twice.


Debuggers log with Codesourcery GDB:
Code: [Select]
[debug]GNU gdb (Sourcery CodeBench Lite 2011.09-69) 7.2.50.20100908-cvs
[debug]Copyright (C) 2010 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 "--host=i686-mingw32 --target=arm-none-eabi".
[debug]For bug reporting instructions, please see:
[debug]<https://support.codesourcery.com/GNUToolchain/>.
[debug]>>>>>>cb_gdb:GNU gdb (Sourcery CodeBench Lite 2011.09-69) 7.2.50.20100908-cvs
[debug]> set confirm off

Debugger name and version: GNU gdb (Sourcery CodeBench Lite 2011.09-69) 7.2.50.20100908-cvs

[debug]Copyright (C) 2010 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 "--host=i686-mingw32 --target=arm-none-eabi".
[debug]For bug reporting instructions, please see:
[debug]<https://support.codesourcery.com/GNUToolchain/>.
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> set debugevents on
[debug]No symbol table is loaded.  Use the "file" command.
[debug]No symbol table is loaded.  Use the "file" command.
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> set new-console on
[debug]No symbol table is loaded.  Use the "file" command.
[debug]No symbol table is loaded.  Use the "file" command.
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]No symbol table is loaded.  Use the "file" command.
[debug]No symbol table is loaded.  Use the "file" command.
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> catch throw
[debug]No symbol table is loaded.  Use the "file" command.
[debug]No symbol table is loaded.  Use the "file" command.
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:Catchpoint 2 (throw)
[debug]> source C:\CodeBlocks_NB7790sa\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory D:/cb_projects/mysecproject/
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]>>>>>>cb_gdb:
[debug]Don't know how to run.  Try "help target".
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
Every confirmation appears twice.


With Yagarto GDB everything is fine:
Code: [Select]
[debug]GNU gdb (GDB) 7.2
[debug]Copyright (C) 2010 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 "--host=i686-pc-mingw32 --target=arm-none-eabi".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.2

[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 0
[debug]>>>>>>cb_gdb:
[debug]> set debugevents on
[debug]No symbol table is loaded.  Use the "file" command.
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]No symbol table is loaded.  Use the "file" command.
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]No symbol table is loaded.  Use the "file" command.
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]No symbol table is loaded.  Use the "file" command.
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\CodeBlocks_NB7790sa\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory D:/cb_projects/mysecproject/
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Don't know how to run.  Try "help target".
[debug]>>>>>>cb_gdb:

Kind regards
themaddin

Offline Lost_Byte

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: CodeBlocks and Codesourcery GDB
« Reply #1 on: March 11, 2012, 10:09:12 am »
I have the same behavior.
Let me know, if you solved this problem.

P.S. I'm using Code::Blocks about 3 years in Embedded Linux Developing for targets, such as: ATMEL ARM9, AVR, Marvell PXA based systems. This problem became with new (for me) TI-Sitara based platform, and ARM GNU/Linux Sourcery G++ Lite 2009q1-203

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: CodeBlocks and Codesourcery GDB
« Reply #2 on: March 11, 2012, 11:14:19 am »
Lost_Byte: This is a known problem, but it is not ours problem.
See this for discussion: http://forums.codeblocks.org/index.php/topic,15947.0.html

If you're interested in this been fixed you should contact the codesourcery's support.
(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: CodeBlocks and Codesourcery GDB
« Reply #3 on: March 11, 2012, 01:07:16 pm »
For an update by my side, I tried to contact the only e-mail address I could find on their site and both my e-mails returned undelivered. I won't go further.

Offline Lost_Byte

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: CodeBlocks and Codesourcery GDB
« Reply #4 on: March 16, 2012, 06:43:43 am »
OK. Will be brief.
Code Sourcery did not respond. It's not surprising, becouse of Lite is "as is" toolchain, end there is propietary Code Bench.
C::B Developer (i guessed) oBFusCATed said:
This is unfortunate.

Note: Change of plans, anyone having this problem and wanting it being fixed should talk to codesourcery's support/dev/gdb maintainers.
I don't intend to support every quirk in every different gdb release.

If you don't want to talk to codesourcery's support your only chance is to patch c::b yourself.

I've solved this that way: Simple win32 console app that provides tunneling for stdin,stdout,stderr with filtering '\r' in stdin tunnel.

Usage:
1. Place gdb-cb-bridge.exe and gdb-cb-bridge.cfg into your Code Sourcery "/bin" directory, beside [arm-none-gnueaby-,or whatever prefix]-gdb.exe tool.  File gdb-cb-bridge.cfg contain nothing but your gdb tool filename (i.e. [prefix-]gdb.exe).
2. In "Main Menu">"Settings">"Compiler and Debugger">"Toolchain executables">"Debugger" just replace [prefix-]gdb.exe to gdb-cb-bridge.exe

Attached files:
 exec, cfg-example (my cfg), project and source (sorry, almost uncommented).

Regards!
« Last Edit: March 16, 2012, 06:49:17 am by Lost_Byte »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: CodeBlocks and Codesourcery GDB
« Reply #5 on: March 16, 2012, 08:47:44 am »
Does setting breakpoints on the fly (while the debuggee/inferior is running) work?
(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 Lost_Byte

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: CodeBlocks and Codesourcery GDB
« Reply #6 on: March 16, 2012, 09:58:04 am »
Does setting breakpoints on the fly (while the debuggee/inferior is running) work?

Oh... I hope, understood the question correctly ...
I can set breakpoint while debuggee/inferior is running, and "red point" appears on source view. But this takes effect (debugged process stops at breakpoint) only after sending SIGINT to the process.
And I have the same behavior on others gdb such as builded from scratch or provided by SoC/mC manufacturers.
« Last Edit: March 16, 2012, 10:10:08 am by Lost_Byte »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: CodeBlocks and Codesourcery GDB
« Reply #7 on: March 16, 2012, 10:01:42 am »
If I understand you answer correctly it doesn't work out of the box?
The other test you can do is to press the pause button, while the debuggee is running.
If this works then the breakpoints should work, too.
(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 Lost_Byte

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: CodeBlocks and Codesourcery GDB
« Reply #8 on: March 16, 2012, 10:14:32 am »
The other test you can do is to press the pause button, while the debuggee is running.

No, it does not work.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: CodeBlocks and Codesourcery GDB
« Reply #9 on: March 16, 2012, 11:02:38 am »
Can you give detailed explanation how to fix 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 Lost_Byte

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: CodeBlocks and Codesourcery GDB
« Reply #10 on: March 16, 2012, 01:00:43 pm »
Can you give detailed explanation how to fix the problem?

Explanation...

Sorry, my English is not very well. But I'll try to explain correctly.

Initial conditions:
IDE C::B 10.5
Toolchain: CodeSourcery G++ Lite (arm-2011.03-41 arm-none-linux-gnueabi)
Host: i686-pc
Target (uname -a output): Linux am180x-evm 3.2.0-rc3+ #122 PREEMPT Fri Mar 16 10:54:28 MSK 2012 armv5tejl unknown

Debugging - i.e. remote debugging through TCP, gdbserver is running on target, gdb.exe is running on host.
CodeSourcery gdb.exe stdio passing through the gdb-cb-brige.

Such features as setting breakpoints, disassembling, variable inspecting and other work perfectly until gdbserver inferior (debugging process) is STOPPED. (At break point, after SIGINT, or until "continue" command have not sended since debugging had started)

After "continue" command, (i.e. inferior is RUNNING) there are only two cases, when inferior will stop:
1. Inferior obtains breakpoint setted before "continue" command;
2. Inferior gets a SIGINT signal( to do that just press CTRL+c if inferior is a console app).

When inferior is running, button "Stop debuger" or setting breakpoints and other options do not take effect.
Certainly, because of there are no gdb prompt.

The same behavior takes all combination of IDE+gdb+gdbserver (or GUI-frontend+gdb+gdbserver) i have seen, except gdbs which have been working through JTAG hardware ISE's.
Probably is it a feature of remote debugging? Or maybe I don't understand something?
Of course, it's fine to have ability to stop debugging procces anywhere/anytime, but, in my opinion, that's not really needs in practice.

So, my sketch (gdb-cg-bridge) fixs incompatibility besides C::B and CodeSourcery gdb in my case.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: CodeBlocks and Codesourcery GDB
« Reply #11 on: March 16, 2012, 01:05:48 pm »
Hm, I thought you've using the latest version of the debugger's branch nightly.
Please try it and then report if the pause button works.

BTW. What is your native OS?
(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 Lost_Byte

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: CodeBlocks and Codesourcery GDB
« Reply #12 on: March 16, 2012, 01:55:11 pm »
Hm, I thought you've using the latest version of the debugger's branch nightly.
Please try it and then report if the pause button works.

What do you mean in "debugger's branch nightly"?

BTW. What is your native OS?

My HOST OS (for development,and where C::B is running) is WIN-XP SP3

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: CodeBlocks and Codesourcery GDB
« Reply #13 on: March 16, 2012, 02:10:34 pm »
(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 Lost_Byte

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: CodeBlocks and Codesourcery GDB
« Reply #14 on: March 19, 2012, 10:09:06 am »
Please try it and then report if the pause button works.

It does not works.
The same behavior.