diff --git a/SWIG/Tools/WAD/Makefile b/SWIG/Tools/WAD/Makefile index 7d3dc184f..8f9a31d98 100644 --- a/SWIG/Tools/WAD/Makefile +++ b/SWIG/Tools/WAD/Makefile @@ -13,7 +13,7 @@ PYINCLUDE = -I/usr/local/include/python2.0 TCLINCLUDE = -I/usr/local/include # Location of your Perl installation -PERLINCLUDE = -I/usr/lib/perl5/5.00503/i386-linux/CORE +PERLINCLUDE = -I/usr/perl5/5.00503/sun4-solaris/CORE all: wad python tcl perl diff --git a/SWIG/Tools/WAD/README b/SWIG/Tools/WAD/README index 2a16b1b0b..00eca7521 100644 --- a/SWIG/Tools/WAD/README +++ b/SWIG/Tools/WAD/README @@ -82,7 +82,7 @@ platform directory and type 'make install'. Notes: - The Sun version of WAD has only been tested when compiled with the - Sun Workshop C/C++ compilers. Although WAD works with other programs + Sun Workshop C/C++ compilers. However WAD works with other programs that have been compiled with gcc. If gcc is installed on your machine, you may want to set the following environment variables before running configure: @@ -127,7 +127,7 @@ For scripting languages, WAD works in a similar manner--simply link your scripting language extension module with the appropriate WAD library (wadpy, wadtcl, wadpl). For example: - % cc pymodule.o -lwadpy + % ld -G $(OBJS) -lwadpy -o pymodule.so When the scripting module is loaded into the interpreter, WAD should automatically initialize. diff --git a/SWIG/Tools/WAD/Wad/Makefile b/SWIG/Tools/WAD/Wad/Makefile index 619795fc6..75fec0dd7 100644 --- a/SWIG/Tools/WAD/Wad/Makefile +++ b/SWIG/Tools/WAD/Wad/Makefile @@ -10,7 +10,7 @@ WADSRCS = return.c default.c stack.c stab.c elf.c object.c init.c segment.c signal.c WADOBJS = return.o default.o stack.o stab.o elf.o object.o signal.o segment.o init.o INCLUDE = -I../Include -I. $(SINCLUDE) -WADOPT = -DWAD_LINUX +WADOPT = -DWAD_SOLARIS # Location of your Python installation PYINCLUDE = -I/usr/local/include/python2.0 @@ -23,21 +23,21 @@ TCLSRCS = wadtcl.cxx TCLOBJS = wadtcl.o # Location of your Perl installation -PERLINCLUDE = -I/usr/lib/perl5/5.00503/i386-linux/CORE +PERLINCLUDE = -I/usr/perl5/5.00503/sun4-solaris/CORE PERLSRCS = wadpl.cxx PERLOBJS = wadpl.o # C Compiler -CC = gcc -CFLAGS = #-fpic +CC = cc +CFLAGS = # # C++ Compiler -CXX = c++ -CXXFLAGS = #-fpic +CXX = CC +CXXFLAGS = #-Kpic # Linking options CLINK = -CXXLINK = g++ -shared +CXXLINK = CC -G # Rules for creation of a .o file from .cxx .SUFFIXES: .cxx diff --git a/SWIG/Tools/WAD/Wad/plat/segment_linux.c b/SWIG/Tools/WAD/Wad/plat/segment_linux.c index 1e07d15e0..1cfb18dae 100644 --- a/SWIG/Tools/WAD/Wad/plat/segment_linux.c +++ b/SWIG/Tools/WAD/Wad/plat/segment_linux.c @@ -14,20 +14,21 @@ static char linux_firstsegment[1024]; static int linux_first = 1; -static FILE * +static int segment_open() { FILE *f; f = fopen("/proc/self/maps", "r"); linux_first =1; - return f; + return (int) f; } static int -segment_read(FILE *fs, WadSegment *s) +segment_read(int fd, WadSegment *s) { char pbuffer[1024]; char *c; int len; + FILE *fs = (FILE *) fd; c = fgets(pbuffer,1024,fs); if (!c) return 0; diff --git a/SWIG/Tools/WAD/Wad/stack.c b/SWIG/Tools/WAD/Wad/stack.c index 2cb5ff89b..48b389df3 100644 --- a/SWIG/Tools/WAD/Wad/stack.c +++ b/SWIG/Tools/WAD/Wad/stack.c @@ -56,6 +56,8 @@ static int trace_len = 0; and frame pointer. Returns a pointer to a wad exception frame structure which is actually a large memory mapped file. */ +static char framefile[256]; + WadFrame * wad_stack_trace(unsigned long pc, unsigned long sp, unsigned long fp) { WadSegment *ws, *segments; @@ -64,7 +66,7 @@ wad_stack_trace(unsigned long pc, unsigned long sp, unsigned long fp) { WadDebug wd; WadSymbol wsym; int nlevels; - char framefile[256]; + int ffile; unsigned long p_pc; unsigned long p_sp; @@ -80,7 +82,7 @@ wad_stack_trace(unsigned long pc, unsigned long sp, unsigned long fp) { segments = wad_segment_read(); /* Open the frame file for output */ - sprintf(framefile,"/tmp/wad.%d", getpid()); + tmpnam(framefile); ffile = open(framefile, O_CREAT | O_TRUNC | O_WRONLY, 0644); if (ffile < 0) { printf("can't open %s\n", framefile); @@ -277,8 +279,7 @@ wad_stack_trace(unsigned long pc, unsigned long sp, unsigned long fp) { void wad_release_trace() { char name[256]; munmap(trace_addr, trace_len); - sprintf(name,"/tmp/wad.%d", getpid()); - unlink(name); + unlink(framefile); trace_addr = 0; trace_len = 0; }