Andes Workshop

It is currently Sun Oct 20, 2019 6:13 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 查看真實記憶體裡的指令
PostPosted: Fri Dec 23, 2011 6:48 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
有時候我們以為記憶體裡load進去的程式,
和編譯出來一樣,
事實上在軟硬體同時開發的階段,
硬體也常常出問題。

所以為了查看真實記憶體裡的指令,
請用下面的gdb command。
Attachment:
content.gif
content.gif [ 13.22 KiB | Viewed 5474 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


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group