On Sunday 08 December 2002 07:54 am, Florent Pillet wrote:
> Multilink seems to be very cool. Maybe it's time to resurrect it -- I
> have a LARGE code base that I'd like to move over to gcc, but modifying
> all the C++ classes to declare the segment into which each one should
> go is insane.
>
> I had not heard of Multilink before, but this is definitely something
> to check out.
I also had experienced Multilink a few years ago in playing with the Yanoff
project. IIRC it *had* a limitation on only being able to debug code in the
first segment. Now David has a clever method to fix that, and since he's
released the 0.3 version which is prc-tools 2.x compatible, it was just the
thing I needed.
I've attached a sample Makefile to help. Lookit how tiny and simple it is
with Multilink :)
Here's a little primer on debugging with Multilink..
The Makefile makes a little gdb script, named "debug" in my case. After
your initial breakpoint with gdb, you issue "load-segments" and it will take
care of the symbols for segments > 0. From that point on, debugging is
normal.
So I use:
m68k-palmos-gdb -x debug gnugotmail0000.out
See, the first segment's COFF object is specified on the gdb command line,
and the gdb script uses add-symbol-file to load symbols for
gnugotmail0001.out ... etc. Neato.
There is ONE gotcha. gdb-5.x's add-symbol-file command has been broken for
a while, in that it only accepts a literal parameter. I found a single-line
patch from an ancient USENET post which is applicable, and I posted it to
the debian prc-tools bug submission. I've also attached it here.
My Makefile:
----- BEGIN
## Makefile for gnugotmail
TARGET = gnugotmail
APPNAME = "gnugotmail"
APPID = "GNGM"
OBJS = $(TARGET).o timer.o md5c.o sockets.o pop.o smtp.o common.o
LIBS =
CC = m68k-palmos-gcc
LL =
CFLAGS = -Wall -g -O2
PILRC = pilrc -q
NM = m68k-palmos-nm
BUILDPRC = build-prc
PILOTXFER = pilot-xfer
MULTILINK = m68k-palmos-multilink
all: $(TARGET).prc
.S.o:
$(CC) $(TARGETFLAGS) -c $<
.c.s:
$(CC) $(CSFLAGS) $<
$(TARGET).prc: $(TARGET) bin.res
$(BUILDPRC) $(TARGET).prc $(APPNAME) $(APPID) *.grc *.bin
bin.res: $(TARGET).rcp $(TARGET).pbm
$(PILRC) $(TARGET).rcp .
touch bin.res
$(TARGET): $(OBJS)
$(MULTILINK) -g -gdb-script debug -stdlib -fid $(APPID) -basename $(TARGET)
$(OBJS)
! $(NM) -u $(TARGET)*.out
send: $(TARGET).prc
$(PILOTXFER) -i $(TARGET).prc
depend:
makedepend -Y -I. *.c
clean:
-rm -f *.[oa] $(TARGET) *.bin bin.res *.grc *.out Makefile.bak
veryclean: clean
-rm -f $(TARGET).prc pilot.ram pilot.scratch
----- END
GDB-5.0 patch to fix add-symbol-file:
----- BEGIN
--- orig-gdb-5.0/gdb/symfile.c Tue Nov 19 21:49:35 2002
+++ gdb-5.0/gdb/symfile.c Tue Nov 19 21:49:51 2002
@@ -1646,11 +1646,14 @@
char *val = opt[i].value;
char *sec = opt[i].name;
+ /*
val = opt[i].value;
if (val[0] == '0' && val[1] == 'x')
addr = strtoul (val+2, NULL, 16);
else
addr = strtoul (val, NULL, 10);
+ */
+ addr = parse_and_eval_address(val);
if (strcmp (sec, ".text") == 0)
section_addrs.text_addr = addr;
----- END
--
/* Chris Faherty <[EMAIL PROTECTED]> */
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/