Re: [uCsimm] debugging with GDB :: Trouble building gdbserver

From: Robert Tagliarini (bobtag@cftnet.com)
Date: Thu May 25 2000 - 14:04:54 EDT


Hello,
I'm trying to follow this instruction to get gdb working. I cannot seem to get
gdbserver to build. 1.4.1 - 1.4.4 I can do OK. 1.4.5 fails though giving
[root@cornerstone gdbserver]# make gdbserver
rm -f gdbserver
m68k-pic-coff-gcc -o gdbserver utils.o server.o remote-utils.o \

server.o: In function `_cleanup':
server.c:275: multiple definition of `_cleanup'
/opt/uClinux/m68k-pic-coff/lib/crt0.o:crt0.S:43: first defined here
server.o: In function `start_inferior':
server.c:35: undefined reference to `create_inferior'
server.c(.text+0x34): relocation truncated to fit: DISP16 create_inferior
server.c:39: undefined reference to `mywait'
server.c(.text+0x50): relocation truncated to fit: DISP16 mywait
server.o: In function `main':
server.c:68: undefined reference to `show_area'
server.c(.text+0x1b8): relocation truncated to fit: DISP16 show_area
server.c:99: undefined reference to `fetch_inferior_registers'
server.c(.text+0x338): relocation truncated to fit: DISP16 fetch_inferior_regist
ers
server.c:113: undefined reference to `registers'
server.c:116: undefined reference to `registers'
server.c:117: undefined reference to `store_inferior_registers'
server.c(.text+0x39a): relocation truncated to fit: DISP16 store_inferior_regist

There's more errors but hopefully this gives an idea.

Any hints would be greatly appreciated.

Thanks,
Bob Tagliarini

On Sat, 15 Jan 2000, 권석근 wrote:
> Hi, all
>
> This is my small note on hwo to use gdb on uClinux system.
> I have tested this on uCsimm platform and
> ,in my thought, it also works on other uClinux based system.
>
> It's about debugging user application on the target using
> gdbserver. it means remote debugging. GDB on the host machine
> controls user application on uCsimm through gdbserver with TCP/IP
> connection.
>
> 1. preparation.
> 1.1 Make GDB for m68K cross debugger
> Get the source (i've taken gdb-4.18).
> Configure it using '--target=m68k-unknown-coff'
> ./configure --target=m68k-unknown-coff
> And make.
>
> 1.2 Make ptrace library
> There is ptrace.c in the uClinux's uC-libc source tree.
> (uC-libc/sysdeps/m68k/ptrace.c)
> But Strangely, No Makefile includes this. Let's include this.
> add one line at the end of file uC-libc/sysdeps/makefile.objs like this,
> write.o \
> m68k/ptrace.o
> And make at the base directory. Then you have new libc.a with ptrace.
> Replace this libc.a with original. If you don't like replace orignal
> libc.a then extract ptrace.o and use this object later
> m68k-pic-coff-ar x libc.a ptrace.o
>
> 1.3 Patch the kernel for Trap #1 support(breakpoint)
> patch linux/arch/m68knommu/kernel/traps.c
>
> about line 210?
> add new vector like this
> _ramvec[15] = trap15;
> _ramvec[33] = trap33; <---- added line
> this trap33 is #if 0ed below
>
> delete the line that treat Trap #1 as a Illeagal Instructin Signal
> about line 485?
> case VEC_TRAP1: ----> delete this
>
> add new VEC_TRAP1 case statement before defalut case
> about line 530?
> case VEC_TRAP1:
> /* kwonsk: is this right? */
> fp->ptregs.pc -= 2;
> sig = SIGTRAP;
> break;
> default:
> sig = SIGILL;
> break;
>
> and make new kernel. and don't forget install this new kernel
>
> 1.4 Make gdbserver
> Did you installed gdb-4.18? patch gdbserver need gdb-4.18 source tree.
>
> 1.4.1 Configure original gdbserver
> cd gdb-4.18/gdb/gdbserver
> ../../configure --target=m68k-linux.coff
>
> 1.4.2 patch server.c, server.h low-linux.c, remote-utils.c, util.c
> after step1.4.1
> I've included diff file.
>
> 1.4.3 patch Makefile for gdbserver
> chance CC to m68k-pic-coff-gcc, gdbserver will run on
> uCsimm.
> add line to change stack size using coff2flt (try 32768)
> (Don't try make yet).
>
> 1.4.4 patch /opt/lib/gcc-lib/m68k-pic-coff/2.7.2.3-pic-060999/spec
> why this? this make linker easy. they will complaning about gcrt0.o
> libg.o when they compile with -g option.
> change *startfile spec {g:gcrt0%O%s} to {g:crt0%O%s}
> change *lib spec: remove {g:-lg...}
>
> 1.4.5 then make gdbserver
> make gdbserver
>
Remaining instructions and encoded diff file deleted.
This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:36 EST