2013年5月31日 星期五

[GDB] How to build GDB tool into Embedded System

Compile GDB tool for host pc.
Download GDBServer Package
Just download this package, then make it will compile until to finish.

Let GDB support the architecture of ARM.
--enable-tui --> Let the GDB have GUI debug interface after compile.

./configure --target=armeb-unknown-linux-uclibcgnueabi \
--prefix=/home/happy/armgdb \
--exec-prefix=/home/happy/armgdb \
--enable-tui

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Q:
eval.c:1705: error: 'subscript_array' may be used uninitialized in this
function

A:
At eval.c find the below code.
if (nargs != ndimensions)
error (_("Wrong number of subscripts"));

ADD
memset(&subscript_array, 0, sizeof(subscript_array));//new line

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Compile gdbserver for Embedded System.
cd gdb/gdbserver/

#! /bin/sh
export CPPFLAGS=""
export LDFLAGS=""
export CFLAGS=""
export AR=armeb-unknown-linux-uclibcgnueabi-ar
export AS=armeb-unknown-linux-uclibcgnueabi-as
export LD=armeb-unknown-linux-uclibcgnueabi-ld
export RANLIB=armeb-unknown-linux-uclibcgnueabi-ranlib
export CC=armeb-unknown-linux-uclibcgnueabi-gcc
export NM=armeb-unknown-linux-uclibcgnueabi-nm
export ARCH=arm

./configure --target=armeb-unknown-linux-uclibcgnueabi \
--host=armeb-unknown-linux-uclibcgnueabi \
--prefix=/home/happy/armgdb \
--exec-prefix=/home/happy/armgdb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
After compile gdb package, upload gdbserver to embedded system.
Create a hello.c.
Compile hello.c by using armeb-unknown-linux-uclibcgnueabi-gcc.
Put hello to Embedded System.
Type gdbserver 192.168.x.x:12345 happy on the Embedded System.
Or
Type gdbserver 222.222.222.222:12345 happy on the Embedded System.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
After compile gdb package, execute armeb-linux-gdb on the host PC.
On host pc
go to gdb --> Type gdbtui -q hello --> type target remote 192.168.x.x:12345 (connect to remote host)
Or
./armeb-linux-gdb
Under (gdb) shell, type "target remote 222.222.222.222:12345" will connect to embedded system.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Reference:

Related Posts:

0 意見:

張貼留言