#!/bin/csh -f #(ie run the cshell on this but don't read the .cshrc) echo version = 2.06 of gpcdebug 2005 Sep 19 # 2005 Sep 19, 2.06: allow for alpha testing # 2005 Sep 15, 2.05: gpc binary switches as in gpcc # 2005 Sep 07, 2.04: rename to gpcdebug - more descriptive but rather ugly # 2005 Sep 01, 2.03: upgrade description # 2005 Aug 15, 2.02: upgrade description # Date: Thu, 4 Aug 2005 10:13:58 +0200 # From: Adriaan van Os # To: gpc@gnu.de # Subject: Re: can't get dbx to find lines # Message-ID: # # Tom Schneider wrote: # # A program of mine is giving a segmentation fault and it's hard to # locate. So I need to compile with debugging on and then run dbx to # find the line number. # # Did you try the addr2line utility (mentioned in a previous email) ? Or # run the program under control of gdb and then use the 'bt' command to # list a backtrace when it crashes. # # Regards, # # Adriaan van Os # # addr2line is a command line program. # # 2005 Jul 04, 2.01: implementation of the below # 2005 Jul 04, 2.00: debug calls debugger on Sun. # This gives a message: # | "debugger is obsolete. # | Plese use "workshop" instead. # | Hint: You can use "workshop -D a.out" # | to start debugging. # 1998 Feb 18, 1.00 : origin if ($#argv == 0) then echo 'usage: debug [program]' echo 'Pascal compile [program] with debugging on.' echo 'The program will be compiled with the "-g" flag.' echo 'Once the program is compiled, run gdb and give these commands:' echo ' run' echo ' bt' echo 'bt gives a backtrace' echo 'One can also use dbx.' exit endif # set for alpha testing: set alpha = true set alpha = false set program = `echo $1 | sed -e "s/\.p//"` echo "Debug (i.e. with -g) compiling program ${program}, then running gdb" # 2005 Sep 15, 2.05: allow use of alternative version of gpc if it exists # from gpcc. if (-f /usr/local/gpc/bin/gpc) then if ($alpha == false) then set gpc = /usr/local/gpc/bin/gpc echo Using $gpc instead of the one in the path else set gpc = /usr/local/gpc-20050331/bin/gpc endif else set gpc = gpc endif echo "using: $gpc" rm -f $program $gpc \ -g \ --transparent-file-names \ --no-mixed-comments \ -Wall \ $program.p -o $program if !(-f $program) then echo "*****************************" echo "* failed to create $program" echo "*****************************" exit endif echo "***********************************************************" echo "* type 'run' or click green down arrow in workshop window *" echo "* In gdb, use the 'bt' command to get a backtrace." echo "***********************************************************" gdb $program exit # Other debug envorinment options: # dbx -C -h $1 # -h gives help # -C might be faster # dbx -I . $program dbx $program workshop -D $1 & exit -Wno-identifier-case-local \ invalid optino????? --standard-pascal \ -O$optimization \ # -Widentifier-case-local \ ******************************************************************************** original code: # 1998 Feb 18, 1.00 : origin # echo -n "debug: run workshop" echo -n "debug: run debugger" # see also sparcworks switch ($#argv) case 1: echo " on $1" debugger $1& # workshop $1& breaksw default: echo "" debugger& # workshop& breaksw endsw