Folks:
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.
I compiled as:
gpc \ -g \ --transparent-file-names \ --no-mixed-comments \ -Wall \ lister.p -o lister
When I run dbx
dbx lister
I get
(header stuff deleted) Reading lister Reading ld.so.1 Reading libm.so.1 Reading libc.so.1 Reading libdl.so.1 Reading libc_psr.so.1 dbx: warning: Unknown symbol type: /home/strawberry/toms/work/lister/bug2005aug3/lister:lister.p stab #5 char:t(0,2)=@s8;-20; dbx: warning: Unknown symbol type: /home/strawberry/toms/work/lister/bug2005aug3/lister:lister.p stab #176 Sof:S(0,192)=@s24;@S;S(0,193)=r(0,1);0000000000001;0000000000003; dbx: warning: can't find local function 'Digit': /home/strawberry/toms/work/lister/bug2005aug3/lister:lister.p stab #265 Digit:f(0,61),Digit,Pluckdigit dbx: warning: can't find local function 'Pluckdigit': /home/strawberry/toms/work/lister/bug2005aug3/lister:lister.p stab #291 Pluckdigit:f(0,68),Pluckdigit,Getdatetime dbx: warning: Unknown symbol type: /home/strawberry/toms/work/lister/bug2005aug3/lister:lister.p stab #1222 tmp_string_32:(0,210)=s12Capacity:(0,4),0,32;length:(0,4),32,32;_p_schema_:(0,211)=@s8;@S;S(0,212)=r(0,1);0000000000001;0000000000001;,64,8;; dbx: number not found at /home/strawberry/toms/work/lister/bug2005aug3/lister:lister.p stab #1222 tmp_string_32:(0,210)=s12Capacity:(0,4),0,32;length:(0,4),32,32;_p_schema_:(0,211)=@s8;@S;S(0,212)=r(0,1);0000000000001;0000000000001;,64,8;; (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx)
and then tell it to
run
It runs fine (up to the crash):
(expected output) signal SEGV (no mapping at the fault address) in 272 at 0x3003c 0x0003003c: 272+0x0350: ld [%o0 + 0x4], %o1 (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx)
but for the
line
command I always get:
dbx: no current source file
Somehow it does not locate the Pascal source.
What (perhaps obviously trivial) thing am I missing?
(I tried xping but it was not obvious how to get it to point to the error. I tried workshop on this sun machine and it gave me a machine code location.)
Maybe there is a page somewhere that says how to do this? I didn't find it.
gpc -g --transparent-file-names --no-mixed-comments -Wall lister.p -o lister
The command
files
gives
dbx: no program
Thanks!
Tom
Dr. Thomas D. Schneider National Cancer Institute Laboratory of Experimental and Computational Biology Molecular Information Theory Group Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu (use only if first address fails) http://www.lecb.ncifcrf.gov/~toms/
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