Re: [uCsimm] debugging with GDB-- Trouble running gdbserver

From: 권석근 (kwonsk@mail.linuxonchip.com)
Date: Wed May 31 2000 - 11:33:14 EDT


Hi, Robert Tagliarini

I think that you might have correct gdbserver.
Did you installed new kernel (supporting break point for gdb) in the FLASH?
Unpatched kernel could show SIGILL when she met TRAP#1 (for break point)
instruction.

Thanks.
kwonsk

-----원본 메시지-----
보낸 사람: Robert Tagliarini <rtagliarini@eLutions.com>
받는 사람: 'ucsimm@uClinux.com' <ucsimm@uClinux.com>
참조: kwonsk@mutech.co.kr <kwonsk@mutech.co.kr>
날짜: 2000년 5월 31일 수요일 오후 10:25
제목: RE: [uCsimm] debugging with GDB-- Trouble running gdbserver

>This is starting to look ugly. I put some debug prints in server.c before
>and after the call to prepare_resume_reply that handles the ? command from
>the host. Now things work a little better but still not right. If I set a
>breakpoint, I can run to the breakpoint ok but continuing does not work.
>How stable is this version (gdbserver 4.18 with kwonsk's 1/00 patches)?
Any
>idea what I might be doing wrong? m68k-pic-coff-gcc --version reports gcc
>version 2.7.2.3-pic-060999 is there a later version that I should be
using?
>
>Thanks,
>Bob Tagliarini
>
> gdbserver :3000 test
>Process test created; pid = 124
>code at 358058, data at 35a6e0
>Remote debugging using :3000
>Calling prepare_resume_reply for ? reply
>status = 54, signal = 5
>after p_r_r... own_buf[0:3] = 54,30,35,31
>
>Child terminated with signal = 4
>
>Child terminated with signal = 0x4
>GDBserver exiting
>
>This GDB was configured as "--host=i686-pc-linux-gnu
>--target=m68k-unknown-coff"...
>(gdb) target remote 192.168.0.219:3000
>Remote debugging using 192.168.0.219:3000
>0x358058 in text_start ()
>(gdb) break main
>Breakpoint 1 at 0x3590f2: file test.c, line 14.
>(gdb) n
>Single stepping until exit from function text_start,
>which has no line number information.
>
>Program received signal SIGILL, Illegal instruction.
>0x3590f4 in main () at test.c:14
>14 an8 = *(unsigned char *)0xFFFFF000;
>(gdb) c
>Continuing.
>
>Program terminated with signal SIGILL, Illegal instruction.
>The program no longer exists.
>(gdb)
>
>
>> -----Original Message-----
>> From: Robert Tagliarini [SMTP:bobtag@cftnet.com]
>> Sent: Tuesday, May 30, 2000 11:53 AM
>> To: ucsimm@uClinux.com
>> Cc: kwonsk@mutech.co.kr
>> Subject: Re: [uCsimm] debugging with GDB-- Trouble running gdbserver
>>
>> Hello,
>> I'm still trying to follow Kwonsk's "small note". I have completed all
of
>> step
>> 1. thanks to help from the list and am trying step 2. where I need some
>> more
>> help please.
>>
>> My gdbserver runs and the following displays:
>> # gdbserver :3000 test
>> Process test created; pid = 37
>> code at 34c058, data at 34e6e0
>>
>> Remote debugging using :3000 #displays after target remote... entered
on
>> host
>>
>> readchar: Got EOF #after ^c ^c y on host side
>> Remote side has terminated connection. GDBserver will reopen the
>> connection.
>>
>> On the host side, I get:
>> This GDB was configured as "--host=i686-pc-linux-gnu
>> --target=m68k-unknown-coff"...
>> (gdb) set remotedebug 1
>> (gdb) target remote 192.168.0.219:3000
>> Remote debugging using 192.168.0.219: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=33c058;Data=34e6e0;Bss=34e6e0;
>> Sending packet: $?#3f...Ack
>> Packet received:
>> warning: Invalid remote reply: #from sniffer, this reply was $#
>> (typed ^c here)
>> remote_stop called
>> (typed ^c here)
>> Interrupted while waiting for the program.
>> Give up (and stop debugging it)? (y or n) y
>> (gdb)
>>
>> I'm new to gdb so I'm not too sure what to expect but it appears that
>> things
>> are deadlocked after the "warning: Invalid remote reply" is displayed.
>> keystrokes on the host are echoed but the only thing that I've found that
>> gets
>> a response is the ^c.
>>
>> I would really appreciate any suggestions you can give.
>> Thanks,
>> Bob Tagliarini
>>
>> On Sat,15 Jan 2000, you 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?
>>
>> 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 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