News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Using GDB remote

Started by Kampi, September 25, 2016, 06:42:14 PM

Previous topic - Next topic

Kampi

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)
{
printf("Hallo\n");

while(1)
{
}

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 192.168.178.32
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:
Debug
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
done

[debug]Reading symbols from /home/daniel/Schreibtisch/GDB/GDB_Test/bin/Debug/GDB_Test...done.
[debug](gdb)
[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]>>>>>>cb_gdb:
[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 <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-linux-gnu".
[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 (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.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 0
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Haltepunkt 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory /home/daniel/Schreibtisch/GDB/GDB_Test/
[debug]Source directories searched: /home/daniel/Schreibtisch/GDB/GDB_Test:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> directory /home/daniel/Schreibtisch/GDB/
[debug]Source directories searched: /home/daniel/Schreibtisch/GDB:/home/daniel/Schreibtisch/GDB/GDB_Test:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> target remote tcp:192.168.178.33:1234
[debug]Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080fdffbe00000000400d3343100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[debug]Remote debugging using tcp:192.168.178.33:1234
[debug]>>>>>>cb_gdb:

Connected

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

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

BlueHazzard

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:
http://stackoverflow.com/questions/26490834/remote-debugging-using-gdb-server-and-client-not-working

and this
http://www.cnblogs.com/lake-of-embedded-system/p/3478253.html

Kampi

Hello,

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