wjh+@ANDREW.CMU.EDU (Fred Hansen) (06/05/90)
Zalman Stern has contributed a bit of Sun4 assembler code that allegedly returns the return address within its caller's caller. This will mean that plumber listings on the Sun4 can now properly list the return address to the place where the malloc was called. I've revised malloc appropriately, but cannot test it since I have no Sun4. If you can test the changes below, please do and let me know so I can install them in the system. Fred Hansen THE CHANGES BELOW ARE UNTESTED. source code for *** getcallr.spp *** #ifdef sun4 #include <sun4/asm_linkage.h> .text ENTRY(getcaller) mov %i7, %o0 retl nop #endif *** end getcallr.spp *** % rcsdiff -c malloc.ci Imakefile RCS file: RCS/malloc.ci,v retrieving revision 2.10 diff -c -r2.10 malloc.ci *** /tmp/,RCSt1001879 Mon Jun 4 15:13:38 1990 --- malloc.ci Mon Jun 4 15:04:44 1990 *************** *** 278,293 **** A.RecurringM0 = 0; #ifdef IDENTIFY if (v) { - #if ( defined(vax) | defined(mips) ) - char **mpp; - #endif /* vax|mips */ - struct hdr *t = ((struct hdr *)v)-1; #if ( defined(vax) | defined(mips) ) ! mpp = (((char **)&nbytes) - RETADDROFF); t->caller = *mpp; ! #else /* vax|mips */ ! t->caller = *(((char **)&nbytes) - RETADDROFF); #endif /* vax|mips */ t->seqno = A.SeqNo++; } --- 278,295 ---- A.RecurringM0 = 0; #ifdef IDENTIFY if (v) { struct hdr *t = ((struct hdr *)v)-1; #if ( defined(vax) | defined(mips) ) ! char **mpp = (((char **)&nbytes) ! - RETADDROFF); t->caller = *mpp; ! #else ! #if ( defined(sys_sun4_40)) ! t->caller = getcaller(); ! #else /* sun4 */ ! t->caller = *(((char **)&nbytes) ! - RETADDROFF); ! #endif /* sun4 */ #endif /* vax|mips */ t->seqno = A.SeqNo++; } =================================================================== RCS file: RCS/Imakefile,v retrieving revision 2.5 diff -c -r2.5 Imakefile *** /tmp/,RCSt1001879 Mon Jun 4 15:13:44 1990 --- Imakefile Mon Jun 4 15:09:39 1990 *************** *** 9,18 **** #ifdef ANDREW_MALLOC_ENV NormalObjectRule() ! LibraryTarget(libmalloc.a, malloc.o plumber.o) InstallLibrary(libmalloc.a, $(DESTDIR)/lib) ! LibraryTarget(libplumber.a, pmalloc.o pplumber.o) InstallLibrary(libplumber.a, $(DESTDIR)/lib) InstallFile(malloc.h, $(INSTINCFLAGS), $(DESTDIR)/include) - #endif InstallDocs(malloc.help, ${DESTDIR}/help) --- 9,19 ---- #ifdef ANDREW_MALLOC_ENV NormalObjectRule() ! NormalAsmPPRule() ! LibraryTarget(libmalloc.a, malloc.o getcallr.o plumber.o) InstallLibrary(libmalloc.a, $(DESTDIR)/lib) ! LibraryTarget(libplumber.a, pmalloc.o getcallr.o pplumber.o) InstallLibrary(libplumber.a, $(DESTDIR)/lib) InstallFile(malloc.h, $(INSTINCFLAGS), $(DESTDIR)/include) InstallDocs(malloc.help, ${DESTDIR}/help) + #endif %