Andes Workshop
http://forum.andestech.com/

查看真實記憶體裡的指令
http://forum.andestech.com/viewtopic.php?f=23&t=219
Page 1 of 1

Author:  cindy [ Fri Dec 23, 2011 6:48 am ]
Post subject:  查看真實記憶體裡的指令

有時候我們以為記憶體裡load進去的程式,
和編譯出來一樣,
事實上在軟硬體同時開發的階段,
硬體也常常出問題。

所以為了查看真實記憶體裡的指令,
請用下面的gdb command。
Attachment:
content.gif
content.gif [ 13.22 KiB | Viewed 5903 times ]


set trust-readonly-sections off
disas 0x50010c

Dump of assembler code for function main:
0x00500104 <main+0>: smw.adm $sp,[$sp],$sp,#0xa
0x00500108 <main+4>: addi $fp,$sp,#4
0x0050010c <main+8>: sethi $r0,#1282
0x00500110 <main+12>: ori $r0,$r0,#0x2b0
0x00500114 <main+16>: sethi $r15,#1280
0x00500118 <main+20>: ori $r15,$r15,#0x1cc
0x0050011c <main+24>: jral5 $r15
0x0050011e <main+26>: movi $r0,#0
0x00500122 <main+30>: addi $sp,$fp,#-4
0x00500126 <main+34>: lmw.bim $sp,[$sp],$sp,#0xa
0x0050012a <main+38>: ret $lp
End of assembler dump.
x/6i 0x50010c
0x50010c <main+8>: sethi $r0,#1282
0x500110 <main+12>: ori $r0,$r0,#0x2b0
0x500114 <main+16>: sethi $r15,#1280
0x500118 <main+20>: ori $r15,$r15,#0x1cc
0x50011c <main+24>: jral5 $r15
0x50011e <main+26>: movi $r0,#0
disas main
Dump of assembler code for function main:
0x00500104 <main+0>: smw.adm $sp,[$sp],$sp,#0xa
0x00500108 <main+4>: addi $fp,$sp,#4
0x0050010c <main+8>: sethi $r0,#1282
0x00500110 <main+12>: ori $r0,$r0,#0x2b0
0x00500114 <main+16>: sethi $r15,#1280
0x00500118 <main+20>: ori $r15,$r15,#0x1cc
0x0050011c <main+24>: jral5 $r15
0x0050011e <main+26>: movi $r0,#0
0x00500122 <main+30>: addi $sp,$fp,#-4
0x00500126 <main+34>: lmw.bim $sp,[$sp],$sp,#0xa
0x0050012a <main+38>: ret $lp
End of assembler dump.

show trust-readonly-sections
這可以查目前的設定為on或off

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/