Author Topic: Using GDB remote  (Read 9544 times)

Offline Kampi

  • Single posting newcomer
  • *
  • Posts: 2
Using GDB remote
« on: September 25, 2016, 06:42:14 pm »
Hello Guys,

I have a board with an embedded linux and gdbserver running on it.
Now I want to debug some code remote with gdb from my host system (Ubuntu 14.04) with codeblocks 13.12.
I write a small programm to test it:

#include <stdio.h>

int main(void)


return 0;

I use an arm cross compiler, which i have generated with yocto (see Compiler.jpg) and arm-none-eabi-gdb (see Debugger.jpg).
My build log looks like this:

arm-poky-linux-gnueabi-gcc -Wall -g -I/home/daniel/Schreibtisch/Git/Lib/Zynq_Linux -c /home/daniel/Schreibtisch/GDB/Hallo.c -o obj/Debug/Hallo.o
arm-poky-linux-gnueabi-g++  -o bin/Debug/GDB_Test obj/Debug/Hallo.o   
Output file is bin/Debug/GDB_Test with size 10,32 KB

Now I copy the "Hallo" file to my linux board and start the gdbserver:

root@zedboard-zynq7:/Software# gdbserver HOST:1234 Test
Process Test created; pid = 1028
Listening on port 1234
Remote debugging from host
readchar: Got EOF
Remote side has terminated connection.  GDBserver will reopen the connection.
Listening on port 1234

Now I configure my Debugger in the project settings (see Debugger.jpg) with the IP-Adress of my linux board. I got this output after setting a breakpoint and start of a debugging session:

Building to ensure sources are up-to-date
Selecting target:
Adding source dir: /home/daniel/Schreibtisch/GDB/GDB_Test/
Adding source dir: /home/daniel/Schreibtisch/GDB/
Adding file: /home/daniel/Schreibtisch/GDB/GDB_Test/bin/Debug/GDB_Test
Changing directory to: /home/daniel/Schreibtisch/GDB/GDB_Test/.

[debug]Command-line: /usr/bin/gdb -nx -fullname  -quiet  -args /home/daniel/Schreibtisch/GDB/GDB_Test/bin/Debug/GDB_Test
[debug]Working dir : /home/daniel/Schreibtisch/GDB/GDB_Test

Starting debugger: /usr/bin/gdb -nx -fullname  -quiet  -args /home/daniel/Schreibtisch/GDB/GDB_Test/bin/Debug/GDB_Test

[debug]Reading symbols from /home/daniel/Schreibtisch/GDB/GDB_Test/bin/Debug/GDB_Test...done.
[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Connecting to remote target
Setting breakpoints

[debug]> show version
[debug]GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
[debug]Copyright (C) 2014 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <>
[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-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]Find the GDB manual and other documentation resources online at:
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]> set confirm off

Debugger name and version: GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1

[debug]> set width 0
[debug]> set height 0
[debug]> set breakpoint pending on
[debug]> set print asm-demangle on
[debug]> set unwindonsignal on
[debug]> set print elements 0
[debug]> set disassembly-flavor intel
[debug]> catch throw
[debug]Haltepunkt 1 (throw)
[debug]> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
[debug]> directory /home/daniel/Schreibtisch/GDB/GDB_Test/
[debug]Source directories searched: /home/daniel/Schreibtisch/GDB/GDB_Test:$cdir:$cwd
[debug]> directory /home/daniel/Schreibtisch/GDB/
[debug]Source directories searched: /home/daniel/Schreibtisch/GDB:/home/daniel/Schreibtisch/GDB/GDB_Test:$cdir:$cwd
[debug]> target remote tcp:
[debug]Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080fdffbe00000000400d3343100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[debug]Remote debugging using tcp:


[debug]> tty /dev/pts/0
[debug]Queued:[tty /dev/pts/0]
[debug]> continue
[debug]The program is not being run.

The program is not being run.

[debug]> quit

Debugger finished with status 0

But the debugger doensn´t stop at my breakpoint in codeblocks. Why?
How can I use gdb in the right way?

Thanks for help

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3255
Re: Using GDB remote
« Reply #1 on: September 25, 2016, 07:12:36 pm »
Have you tried without codeblocks? Only start gdb from console and try to connect to your target

This seems to be some sort of incompatibility? 2 sec of google:

and this

Offline Kampi

  • Single posting newcomer
  • *
  • Posts: 2
Re: Using GDB remote
« Reply #2 on: September 25, 2016, 07:27:05 pm »

yes, I´ve tried it without codeblocks (see attachment).