Re: ESQL/C and Solaris dbx
Posted in 1996
Greg, What I do is convert the #line directives in the .c file into C comments. Then the debugger can work correctly with the .c file, but because the #line directives are also present, you can trace your operations back to the actual ESQL/C code. The attached script is a filter which comments out the #line directives. I use the same technique with Yacc (and Lex) files too. I have a script called rfmt to reformat files in situ which in turn uses overwrite from 'The Unix Programming Environment' by Kernighan & Pike, (which I abbreviate to ow) and I revise my makefile compilation rules for ESQL/C code to read: .ec.o: $(ESQLC) $(ESQLCFLAGS) -e $*.ec $(RFMT) $(LINECOMMENT) $*.c $(ESQLC) $(ESQLCFLAGS) -c $*.c Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> : "@(#)linecomments.sh 1.1 94/06/09" # # Convert #line directives into comments. sed -e '/^[ ]*#[ ]*line/s%.*%/* & */%' \\ -e '/^[ ]*#[ ]*[0-9]/s%.*%/* & */%' \\ $* : "@(#)ow.sh 1.3 92/08/01" # # Overwrite file # From: The UNIX Programming Environment by Kernighan and Pike # Amended: remove PATH setting case $# in 0|1) echo "Usage: $0 file command [arguments]" 1>&2 exit 1;; esac file=$1 shift new=/tmp/ovrwr.$$.1 old=/tmp/ovrwr.$$.2 trap "rm -f $new $old ; exit 1" 1 2 15 if "$@" >$new then cp $file $old trap "" 1 2 15 cp $new $file rm -f $new $old exit 0 else echo "$0: $1 failed - $file unchanged" 1>&2 rm -f $new $old exit 1 fi : "@(#)rfmt.sh 1.4 91/01/28" # # Generic file reformatter usage(){ echo "Usage: rfmt [-c|e] formatter file [file ...]" >&2 exit 1 } # Determine formatter case "$1" in -c) ev=; fmt="$2"; shift 2;; # Normal mode -e) ev=eval; fmt="$2"; shift 2;; # Evaluate formatter argument -*) usage;; *) ev=; fmt="$1"; shift 1;; # Compatability mode esac # Use formatter on each specified file case $# in 0) usage;; *) for file in $* do [ $# -eq 1 ] || echo $file ow $file $ev "$fmt" $file done;; esac >From: gregf@tfs.com (Greg Faulk) >Date: 30 Jan 1996 18:33:36 GMT >X-Informix-List-Id: <news.20719> > >I'm having a problem debugging a ESQL/C application that is comprised of >multiple source files. As an example consider that the applications is >compiled as: > > esql -g -o foo foo.ec bar.ec > >I then debug the program by running dbx: > > dbx foo > >I can then use 'list' to see the code in file 'foo.ec' but I can't set >line number breakpoints for code in file 'bar.ec'. So, I use the dbx 'file' >command to change to file 'bar.ec' and I get the following error: > > (dbx) file bar.ec > > dbx: no such source file: "bar.ec" > >However the following works fine: > > (dbx) file bar.c > >So, my question is, how do I switch to other '.ec' files within dbx and >maintain my ability to set line level breakpoints. Dealing with the >generated '.c' files is a pain due to the included header files, etc. > >TIA.