gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Bogus switch/jump-table code on mips?


From: Camm Maguire
Subject: [Gcl-devel] Bogus switch/jump-table code on mips?
Date: Sat, 23 Jun 2007 15:14:42 -0400

Greetings!  Might someone please help me understand how the jump
address computation code below is supposed to work, and why it is not
working?

The natural thing for me to suspect is GCL's native object relocation
code, which has been successfully tested on mips before, but the gdb
session below appears to show that the code is executing properly,
just that the logic is wrong (or at least is opague to me.)

When V346 is 8 or above, the code correctly branches to the end of the
switch, but when less than 8, an invalid address is computed for the
jump.  In the example below, V346 is 0.

Thanks so much,


=============================================================================
2046 V357= V346;switch(V357){
2047 case 2:
2048 goto T856;
2049 T856:;
2050 if(!(eql_is_eq((V335)))){
(gdb)
2051 goto T864;}
2052 V347= (fixnum)0;
2053 goto T853;
2054 goto T864;
2055 T864:;
2056 V347= V357;
2057 goto T853;
2058 case 3:
2059 goto T857;
2060 T857:;
(gdb)
2061 if(!(eql_is_eq((V335)))){
2062 goto T867;}
2063 V347= (fixnum)1;
2064 goto T853;
2065 goto T867;
2066 T867:;
2067 V347= V357;
2068 goto T853;
2069 case 4:
2070 goto T858;
(gdb)
2071 T858:;
2072 if(!(equal_is_eq((V335)))){
2073 goto T870;}
2074 V347= (fixnum)0;
2075 goto T853;
2076 goto T870;
2077 T870:;
2078 V347= V357;
2079 goto T853;
2080 case 5:
(gdb)
2081 goto T859;
2082 T859:;
2083 if(!(equal_is_eq((V335)))){
2084 goto T873;}
2085 V347= (fixnum)1;
2086 goto T853;
2087 goto T873;
2088 T873:;
2089 V347= V357;
2090 goto T853;
(gdb)
2091 case 6:
2092 goto T860;
2093 T860:;
2094 if(!(equalp_is_eq((V335)))){
2095 goto T876;}
2096 V347= (fixnum)0;
2097 goto T853;
2098 goto T876;
2099 T876:;
2100 V347= V357;
(gdb)
2101 goto T853;
2102 case 7:
2103 goto T861;
2104 T861:;
2105 if(!(equalp_is_eq((V335)))){
2106 goto T879;}
2107 V347= (fixnum)1;
2108 goto T853;
2109 goto T879;
2110 T879:;
(gdb)
2111 V347= V357;
2112 goto T853;
2113 default:
2114 goto T862;
2115 T862:;
2116 V347= V357;
2117 goto T853;
2118 V347= fix(Cnil);
2119 goto T853;}
2120 V347= fix(Cnil);}


(gdb) disassemble 0x1359800 0x1359900
Dump of assembler code from 0x1359800 to 0x1359900:
0x01359800 <LI30+1844>: sw v0,140(s8)
0x01359804 <LI30+1848>: lw v0,140(s8)
0x01359808 <LI30+1852>: nop
0x0135980c <LI30+1856>: sw v0,372(s8)
0x01359810 <LI30+1860>: lw v1,372(s8)
0x01359814 <LI30+1864>: nop
0x01359818 <LI30+1868>: sltiu v0,v1,8
0x0135981c <LI30+1872>: beqz v0,0x1359ec0 <LI30+3572>
0x01359820 <LI30+1876>: nop
0x01359824 <LI30+1880>: lw v0,372(s8)
0x01359828 <LI30+1884>: nop
0x0135982c <LI30+1888>: sll v1,v0,0x2
0x01359830 <LI30+1892>: lui v0,0x13a
0x01359834 <LI30+1896>: nop
0x01359838 <LI30+1900>: addiu v0,v0,-16736
0x0135983c <LI30+1904>: addu v0,v1,v0
0x01359840 <LI30+1908>: lw v0,0(v0)
0x01359844 <LI30+1912>: nop
0x01359848 <LI30+1916>: addu v0,v0,gp
0x0135984c <LI30+1920>: jr v0
0x01359850 <LI30+1924>: nop
0x01359854 <LI30+1928>: lw v0,412(s8)
---Type <return> to continue, or q <return> to quit---



Breakpoint 2, LI30 (V334=0x78b9d8, V333=0x519e60, first=0x79bf78)
    at ../lsp/gcl_listlib.c:1905
1905 int narg = VFUN_NARGS; VMB30 VMS30 VMV30
(gdb)
Continuing.

Breakpoint 3, LI30 (V334=0x78b9d8, V333=0x519e60, first=0x79bf78)
    at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) c
Continuing.

Breakpoint 4, 0x01359818 in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v0
v0: 0x0
(gdb) i reg v1
v1: 0x0
(gdb) c
Continuing.

Breakpoint 5, 0x0135981c in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v1
v1: 0x0
(gdb) i reg v0
v0: 0x1
(gdb) b *0x01359824
Note: breakpoint 6 also set at pc 0x1359824.
Breakpoint 8 at 0x1359824: file ../lsp/gcl_listlib.c, line 2046.
(gdb) b *0x0135982c
Breakpoint 9 at 0x135982c: file ../lsp/gcl_listlib.c, line 2046.
(gdb) b *0x01359830
Breakpoint 10 at 0x1359830: file ../lsp/gcl_listlib.c, line 2046.
(gdb) b *0x01359838
Breakpoint 11 at 0x1359838: file ../lsp/gcl_listlib.c, line 2046.
(gdb) b *0x0135983c
Breakpoint 12 at 0x135983c: file ../lsp/gcl_listlib.c, line 2046.
(gdb) b * 0x01359840
Breakpoint 13 at 0x1359840: file ../lsp/gcl_listlib.c, line 2046.
(gdb) b * 0x01359848
Breakpoint 14 at 0x1359848: file ../lsp/gcl_listlib.c, line 2046.
(gdb) b * 0x0135984c
Breakpoint 15 at 0x135984c: file ../lsp/gcl_listlib.c, line 2046.
(gdb) c
Continuing.

Breakpoint 6, 0x01359824 in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v0
v0: 0x1
(gdb) c
Continuing.

Breakpoint 9, 0x0135982c in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v0
v0: 0x0
(gdb) i reg v1
v1: 0x0
(gdb) c
Continuing.

Breakpoint 10, 0x01359830 in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v1
v1: 0x0
(gdb) i reg v0
v0: 0x0
(gdb) c
Continuing.

Breakpoint 11, 0x01359838 in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v1
v1: 0x0
(gdb) i reg v0
v0: 0x13a0000
(gdb) c
Continuing.

Breakpoint 12, 0x0135983c in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v0
v0: 0x139bea0
(gdb) i reg v1
v1: 0x0
(gdb) c
Continuing.

Breakpoint 13, 0x01359840 in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v0
v0: 0x139bea0
(gdb) c
Continuing.

Breakpoint 14, 0x01359848 in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v0
v0: 0x1351ec0
(gdb) i reg gp
gp: 0x139c3e0
(gdb) p 0x139c3e0+0x1351ec0
$3 = 40821408
(gdb) p/x 0x139c3e0+0x1351ec0
$4 = 0x26ee2a0
(gdb) c
Continuing.

Breakpoint 15, 0x0135984c in LI30 (V334=0x78b9d8, V333=0x519e60,
    first=0x79bf78) at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
(gdb) i reg v0
v0: 0x26ee2a0
(gdb) n
0x0135984c in LI30 (V334=0x78b9d8, V333=0x519e60, first=0x79bf78)
    at ../lsp/gcl_listlib.c:2046
2046 V357= V346;switch(V357){
Could not insert single-step breakpoint at 0x26ee2a0
(gdb) p core_end
$5 = 0x19b3000 <Address 0x19b3000 out of bounds>
(gdb) q
The program is running.  Exit anyway? (y or n) y

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]