% cat xs.c
#include "xlong.h"
int main (void)
{ xlong xv;
long lv;
xv = 5;
xv |= 8;
lv = xv;
return(0);
}
% g++ -DLS_BYTE_SWAP xs.c xlong.c
% gdb a.out
GNU gdb 5.3-20030128 (Apple version gdb-309) (Thu Dec 4 15:41:30 GMT 2003)
This GDB was configured as "powerpc-apple-darwin".
Reading symbols for shared libraries .. done
(gdb) disassemble main
Dump of assembler code for function main:
0x00002744 <main+0>: mflr r0
0x00002748 <main+4>: stmw r30,-8(r1)
0x0000274c <main+8>: stw r0,8(r1)
0x00002750 <main+12>: stwu r1,-96(r1)
0x00002754 <main+16>: mr r30,r1
0x00002758 <main+20>: addi r3,r30,64 ; Address of xv
0x0000275c <main+24>: li r4,5 ; Constant 5
0x00002760 <main+28>: bl 0x9e28 <_ZN5xlongaSEi>
0x00002764 <main+32>: addi r3,r30,64 ; Address of xv
0x00002768 <main+36>: li r4,8 ; Constant 8
0x0000276c <main+40>: bl 0x9978 <_ZN5xlongoREi>
0x00002770 <main+44>: addi r3,r30,64 ; Address of xv
0x00002774 <main+48>: bl 0x93d8 <_ZN5xlongcvlEv>
0x00002778 <main+52>: mr r0,r3 ; Result from xv
0x0000277c <main+56>: stw r0,68(r30) ; Stored into lv
0x00002780 <main+60>: li r0,0 ; return 0
0x00002784 <main+64>: mr r3,r0
0x00002788 <main+68>: lwz r1,0(r1)
0x0000278c <main+72>: lwz r0,8(r1)
0x00002790 <main+76>: mtlr r0
0x00002794 <main+80>: lmw r30,-8(r1)
0x00002798 <main+84>: blr
End of assembler dump.
(gdb) disassemble 0x9e28
Dump of assembler code for function _ZN5xlongaSEi:
0x00009e28 <_ZN5xlongaSEi+0>: mflr r0
0x00009e2c <_ZN5xlongaSEi+4>: stmw r29,-12(r1)
0x00009e30 <_ZN5xlongaSEi+8>: stw r0,8(r1)
0x00009e34 <_ZN5xlongaSEi+12>: stwu r1,-80(r1)
0x00009e38 <_ZN5xlongaSEi+16>: mr r30,r1
0x00009e3c <_ZN5xlongaSEi+20>: stw r3,104(r30) ; Where to store
0x00009e40 <_ZN5xlongaSEi+24>: stw r4,108(r30) ; Value to store
0x00009e44 <_ZN5xlongaSEi+28>: lwz r29,104(r30)
0x00009e48 <_ZN5xlongaSEi+32>: lwz r3,108(r30)
0x00009e4c <_ZN5xlongaSEi+36>: bl 0x282c <_Z6xstorLl>
0x00009e50 <_ZN5xlongaSEi+40>: stw r3,0(r29)
0x00009e54 <_ZN5xlongaSEi+44>: lwz r0,104(r30)
0x00009e58 <_ZN5xlongaSEi+48>: mr r3,r0
0x00009e5c <_ZN5xlongaSEi+52>: lwz r1,0(r1)
0x00009e60 <_ZN5xlongaSEi+56>: lwz r0,8(r1)
0x00009e64 <_ZN5xlongaSEi+60>: mtlr r0
0x00009e68 <_ZN5xlongaSEi+64>: lmw r29,-12(r1)
0x00009e6c <_ZN5xlongaSEi+68>: blr
End of assembler dump.
(gdb) disassemble 0x9978
Dump of assembler code for function _ZN5xlongoREi:
0x00009978 <_ZN5xlongoREi+0>: mflr r0
0x0000997c <_ZN5xlongoREi+4>: stmw r29,-12(r1)
0x00009980 <_ZN5xlongoREi+8>: stw r0,8(r1)
0x00009984 <_ZN5xlongoREi+12>: stwu r1,-80(r1)
0x00009988 <_ZN5xlongoREi+16>: mr r30,r1
0x0000998c <_ZN5xlongoREi+20>: stw r3,104(r30)
0x00009990 <_ZN5xlongoREi+24>: stw r4,108(r30)
0x00009994 <_ZN5xlongoREi+28>: lwz r29,104(r30)
0x00009998 <_ZN5xlongoREi+32>: lwz r2,104(r30)
0x0000999c <_ZN5xlongoREi+36>: lwz r3,0(r2)
0x000099a0 <_ZN5xlongoREi+40>: bl 0x279c <_Z6xloadLl>
0x000099a4 <_ZN5xlongoREi+44>: mr r2,r3
0x000099a8 <_ZN5xlongoREi+48>: lwz r0,108(r30)
0x000099ac <_ZN5xlongoREi+52>: or r0,r2,r0
0x000099b0 <_ZN5xlongoREi+56>: mr r3,r0
0x000099b4 <_ZN5xlongoREi+60>: bl 0x282c <_Z6xstorLl>
0x000099b8 <_ZN5xlongoREi+64>: stw r3,0(r29)
0x000099bc <_ZN5xlongoREi+68>: lwz r0,104(r30)
0x000099c0 <_ZN5xlongoREi+72>: mr r3,r0
0x000099c4 <_ZN5xlongoREi+76>: lwz r1,0(r1)
0x000099c8 <_ZN5xlongoREi+80>: lwz r0,8(r1)
0x000099cc <_ZN5xlongoREi+84>: mtlr r0
0x000099d0 <_ZN5xlongoREi+88>: lmw r29,-12(r1)
0x000099d4 <_ZN5xlongoREi+92>: blr
End of assembler dump.
(gdb) disassemble 0x93d8
Dump of assembler code for function _ZN5xlongcvlEv:
0x000093d8 <_ZN5xlongcvlEv+0>: mflr r0
0x000093dc <_ZN5xlongcvlEv+4>: stmw r30,-8(r1)
0x000093e0 <_ZN5xlongcvlEv+8>: stw r0,8(r1)
0x000093e4 <_ZN5xlongcvlEv+12>: stwu r1,-80(r1)
0x000093e8 <_ZN5xlongcvlEv+16>: mr r30,r1
0x000093ec <_ZN5xlongcvlEv+20>: stw r3,104(r30)
0x000093f0 <_ZN5xlongcvlEv+24>: lwz r2,104(r30)
0x000093f4 <_ZN5xlongcvlEv+28>: lwz r3,0(r2)
0x000093f8 <_ZN5xlongcvlEv+32>: bl 0x279c <_Z6xloadLl>
0x000093fc <_ZN5xlongcvlEv+36>: mr r0,r3
0x00009400 <_ZN5xlongcvlEv+40>: mr r3,r0
0x00009404 <_ZN5xlongcvlEv+44>: lwz r1,0(r1)
0x00009408 <_ZN5xlongcvlEv+48>: lwz r0,8(r1)
0x0000940c <_ZN5xlongcvlEv+52>: mtlr r0
0x00009410 <_ZN5xlongcvlEv+56>: lmw r30,-8(r1)
0x00009414 <_ZN5xlongcvlEv+60>: blr
End of assembler dump.
(gdb) disassemble 0x282c
Dump of assembler code for function _Z6xstorLl:
0x0000282c <_Z6xstorLl+0>: stmw r30,-8(r1)
0x00002830 <_Z6xstorLl+4>: stwu r1,-64(r1)
0x00002834 <_Z6xstorLl+8>: mr r30,r1
0x00002838 <_Z6xstorLl+12>: stw r3,88(r30)
0x0000283c <_Z6xstorLl+16>: lwz r0,88(r30)
0x00002840 <_Z6xstorLl+20>: stw r0,32(r30)
0x00002844 <_Z6xstorLl+24>: lbz r0,35(r30)
0x00002848 <_Z6xstorLl+28>: stb r0,36(r30)
0x0000284c <_Z6xstorLl+32>: lbz r0,34(r30)
0x00002850 <_Z6xstorLl+36>: stb r0,37(r30)
0x00002854 <_Z6xstorLl+40>: lbz r0,33(r30)
0x00002858 <_Z6xstorLl+44>: stb r0,38(r30)
0x0000285c <_Z6xstorLl+48>: lbz r0,32(r30)
0x00002860 <_Z6xstorLl+52>: stb r0,39(r30)
0x00002864 <_Z6xstorLl+56>: lwz r0,36(r30)
0x00002868 <_Z6xstorLl+60>: mr r3,r0
0x0000286c <_Z6xstorLl+64>: lwz r1,0(r1)
0x00002870 <_Z6xstorLl+68>: lmw r30,-8(r1)
0x00002874 <_Z6xstorLl+72>: blr
End of assembler dump.
(gdb) disassemble 0x279c
Dump of assembler code for function _Z6xloadLl:
0x0000279c <_Z6xloadLl+0>: stmw r30,-8(r1)
0x000027a0 <_Z6xloadLl+4>: stwu r1,-64(r1)
0x000027a4 <_Z6xloadLl+8>: mr r30,r1
0x000027a8 <_Z6xloadLl+12>: stw r3,88(r30)
0x000027ac <_Z6xloadLl+16>: lwz r0,88(r30)
0x000027b0 <_Z6xloadLl+20>: stw r0,32(r30)
0x000027b4 <_Z6xloadLl+24>: lbz r0,35(r30)
0x000027b8 <_Z6xloadLl+28>: stb r0,36(r30)
0x000027bc <_Z6xloadLl+32>: lbz r0,34(r30)
0x000027c0 <_Z6xloadLl+36>: stb r0,37(r30)
0x000027c4 <_Z6xloadLl+40>: lbz r0,33(r30)
0x000027c8 <_Z6xloadLl+44>: stb r0,38(r30)
0x000027cc <_Z6xloadLl+48>: lbz r0,32(r30)
0x000027d0 <_Z6xloadLl+52>: stb r0,39(r30)
0x000027d4 <_Z6xloadLl+56>: lwz r0,36(r30)
0x000027d8 <_Z6xloadLl+60>: mr r3,r0
0x000027dc <_Z6xloadLl+64>: lwz r1,0(r1)
0x000027e0 <_Z6xloadLl+68>: lmw r30,-8(r1)
0x000027e4 <_Z6xloadLl+72>: blr
End of assembler dump.
(gdb) quit