Re: [uCsimm] debugging with GDB

From: Stuart Hughes (sehughes@zentropix.com)
Date: Thu Jan 27 2000 - 09:48:15 EST


Hi Kwonsk

Thanks for your instructions, I have nearly got it working but still
have some prombems, but this I mean that I have built gdb/gdbserver, but
when I gdb, gdbserver
does not complete the response correctly (e.g)

This GDB was configured as "--host=i686-pc-linux-gnu
--target=m68k-zentropix-coff"...
(gdb) set remotedebug 1
(gdb) target remote uc:3000
Remote debugging using uc:3000
Sending packet: $Hc-1#09...Ack
Packet received: OK
Sending packet: $qC#b4...Ack
Packet received:
Sending packet: $qOffsets#4b...Ack
Packet received: Text=714058;Data=722018;Bss=722018;
Sending packet: $?#3f...Ack
Packet received:
warning: Invalid remote reply:

Any ideas what might be wrong ???

I tried to follow your instructions, but I could not understand the
following:

> 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).

What/where do I add to the makefile ??? what does coff2flt do (anyone
got a man page ??)

>
> 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...}

I can't find where this is supposed to be done ??

I am using the uClinux CD from Rt-control (2.0.38.0 sept 1999)

Any help you can provide would be greatly appreciated

Regards, Stuart

권석근 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
>
> 2. Using GDB
> now i have gdb for m68k and gdbserver for uClinux.
> then how to debug? probably you already know this.
>
> try with test.c
>
> 2.1 Compile test.c
> m68k-pic-coff-gcc -g test.c
> (will generated test.coff)
>
> 2.2 Trying GDB
> copy binary (test, not test.coff) to uCsimm
> (if you are using nfs then you need not this)
> at target:
> gdbserver myip:port test
> myip: uCsimm's ip) could be omitted.
> port: any free port
> ex) gdbserver :3000 test
> now user application 'test' is ready to debugging at the target side.
>
> at host:
> run new gdb. like this
> >gdb test.coff
>
> say to 'i'll enter remote debug' to gdb. like this
> (gdb) target remote target_ip:3000
>
> of cource target_ip must be a real target ip, saying 192.168.1.200
>
> then go ahead with gdb!
>
> No more.
>
> If you met troble, drop me mail. i could help you.
> kwonsk@mutech.co.kr
>
> PS: i could do source level debugging with gdb. And they
> traced source file well (like set breakpoint at line 11 of
> test.c and show source positon after break).
> But when i tried xxgdb (old grapical frontend
> for GDB), they didn't show C source file in the source window.
> Does anybody know why ? should i try another frontend like
> DDD?
>
> Name: gdbserver.diff
> gdbserver.diff Type: unspecified type (application/octet-stream)
> Encoding: x-uuencode
>
> This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/
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:34 EST