Issue 16225 - sal/osl/unx/backtrace.c for IRIX
Summary: sal/osl/unx/backtrace.c for IRIX
Status: CLOSED WONT_FIX
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: current
Hardware: SGI IRIX
: P3 Trivial (vote)
Target Milestone: ---
Assignee: nickb
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-30 01:58 UTC by nickb
Modified: 2010-03-29 20:43 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
sal/osl/unx/backtrace.c - add IRIX bits for backtracing (1.12 KB, patch)
2003-07-04 03:17 UTC, nickb
no flags Details | Diff
same as above, without using printing the final (invalid) frame (1.19 KB, patch)
2003-07-04 03:37 UTC, nickb
no flags Details | Diff
sal/osl/unx/backtrace.c - with appropriate headers (1.33 KB, patch)
2003-07-11 03:25 UTC, nickb
no flags Details | Diff
sal/util/makefile - link in extra bits for IRIX backtrace (516 bytes, patch)
2003-07-11 03:29 UTC, nickb
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description nickb 2003-06-30 01:58:21 UTC
IRIX needs some code in sal/osl/unx/backtrace.c for the crash reporter.

I have some code, just need to tidy it up a little and I'll post it.
Comment 1 Martin Hollmichel 2003-07-03 09:24:00 UTC
set target milestone.
Comment 2 nickb 2003-07-04 03:17:57 UTC
Created attachment 7396 [details]
sal/osl/unx/backtrace.c - add IRIX bits for backtracing
Comment 3 nickb 2003-07-04 03:33:36 UTC
One problem with this patch is due to a dodgy gcc on IRIX.
Using a sample program, which calls a few functions (to make things
interesting) and then aborts, I get the following results:

% /usr/local/gcc-2.95.3/bin/gcc -v
Reading specs from
/usr/local/gcc-2.95.3/lib/gcc-lib/mips-sgi-irix6.5/2.95.3/specs
gcc version 2.95.3 20010315 (release)
% /usr/local/gcc-2.95.3/bin/gcc -o stacktrace stack.c
test_stacktrace.c -lexc
% ./stacktrace
__exc_unwind: Error: pc(0x100013d8) not in any .debug_frame table
 0x000000000001 <unknown function>
% /usr/local/gcc-2.95.3/bin/gcc -g -o stacktrace stack.c
test_stacktrace.c -lexc
% ./stacktrace
 0x0000100014bc backtrace
 0x000010001504 cfunc
 0x00001000154c bfunc
 0x00001000159c afunc
 0x000010001290 main

% gcc -v
Reading specs from /usr/freeware/lib/gcc-lib/mips-sgi-irix6.5/3.0.4/specs
Configured with: ../configure --prefix=/usr/freeware
--enable-version-specific-runtime-libs --disable-shared
--enable-threads --enable-haifa
Thread model: single
gcc version 3.0.4
% gcc -o stacktrace stack.c test_stacktrace.c -lexc
% ./stacktrace
__exc_unwind: Error: pc(0x10001498) not in any .debug_frame table
% gcc -g -o stacktrace stack.c test_stacktrace.c -lexc
% ./stacktrace
 0x000010001578 backtrace
 0x0000100015c0 cfunc
 0x000010001608 bfunc
 0x000010001658 afunc
 0x000010001320 main

% cc -version
MIPSpro Compilers: Version 7.3.1.2m
% cc -o stacktrace stack.c test_stacktrace.c -lexc
stack.c:
test_stacktrace.c:
% ./stacktrace
 0x000010000f94 backtrace
 0x000010000fd4 cfunc
 0x000010001014 bfunc
 0x00001000105c afunc
 0x000010000e50 main
% cc -g -o stacktrace stack.c test_stacktrace.c -lexc
stack.c:
test_stacktrace.c:
% ./stacktrace
 0x000010000fb4 backtrace
 0x000010000ff4 cfunc
 0x000010001034 bfunc
 0x00001000107c afunc
 0x000010000e70 main

% cc -Ofast -o stacktrace stack.c test_stacktrace.c -lexc
stack.c:
test_stacktrace.c:
% ./stacktrace
 0x000010001688 backtrace
 0x0000100010e0 main
Comment 4 nickb 2003-07-04 03:37:38 UTC
Created attachment 7397 [details]
same as above, without using printing the final (invalid) frame
Comment 5 nickb 2003-07-04 03:39:08 UTC
Whoops, forgot to say, gcc on IRIX does not support -rdynamic, which 
presumably would help get the symbols even without -g.
Comment 6 nickb 2003-07-11 03:25:15 UTC
Created attachment 7568 [details]
sal/osl/unx/backtrace.c - with appropriate headers
Comment 7 nickb 2003-07-11 03:29:46 UTC
Created attachment 7570 [details]
sal/util/makefile - link in extra bits for IRIX backtrace
Comment 8 nickb 2003-07-11 03:33:53 UTC
the back trace code compiles and links now... :-)
Comment 9 Martin Hollmichel 2003-07-14 17:13:51 UTC
committed to ooo11rc2.
Comment 10 Martin Hollmichel 2003-07-16 13:00:41 UTC
verified.
Comment 11 Martin Hollmichel 2004-02-06 17:22:03 UTC
close issue.
Comment 12 nickb 2004-07-02 06:29:23 UTC
We have code in backtrace.c for IRIX, so we should compile it

sal/osl/unx/makefile.mk:
.IF "$(OS)"=="SOLARIS" || "$(OS)"=="FREEBSD" || "$(OS)"=="NETBSD" ||
"$(OS)$(CPU)"=="LINUXS"
SLOFILES += $(SLO)$/backtrace.obj
OBJFILES += $(OBJ)$/backtrace.obj
.ENDIF
Comment 13 caolanm 2010-03-29 20:43:33 UTC
per issue 106845 sb removed the partial irix port, so this doesn't make sense in
isolation anymore106845
Comment 14 caolanm 2010-03-29 20:43:52 UTC
closing