ARM 程序内存转储

发布于 2025-01-14 03:50:38 字数 1832 浏览 1 评论 0原文

我被问到有关内存转储以及如何查找 var x 和 y 的值的问题。我想知道如何找到那些我将在下面发布的问题。 -谢谢

 1  
 2 .global  main    @ main: is our entry point and must be global  
 3 .func    main 
 4 .data    
 5 .balign 4 
 6 x:       .word  ???? 
 7 y:       .word  ???? 
 8 string:   .asciz "????" 
 9 .text 
10 main: 
11  ldr r0, = x     /*r0 gets the address of  x*/ 
12  ldr r0, [r0]    /*r0 gets the content of the memory 
13                  /* pointed to by the the content r0*/  
14  
15  ldr r1, = y     /*r1 gets the address of  y*/ 
16  ldr r1, [r1]    /*r1 gets the content of the memory */ 
17  
18  ldr r3, = string /*r3 gets the address of  string*/ 
19  ldr r3, [r3]    /*r3 gets the content of the memory*/ 
20  
21  ????            /* What is this instruction */ 
22  ????            /*   What is this instruction  */ 
23  bx  lr  

需要的一些信息如下: 组装后。链接、运行、gdp-ing,我输入了以下gdb指令:

(gdb) p/x &x 
$1 = 0x21024 

上面的命令表明变量x的地址是0x21024。

然后我转储了内存的内容,从地址0x21024开始,
通过键入以下命令:

 (gdb) x/80b 0x21024 
 
0x21024: 0x63 0x00 0x00 0x00 0xc7 0xff 0xff 0xff 
0x2102c: 0x54 0x6f 0x20 0x42 0x65 0x20 0x6f 0x72 
0x21034: 0x20 0x4e 0x6f 0x74 0x20 0x74 0x6f 0x20 
0x2103c: 0x42 0x65 0x20 0x54 0x68 0x61 0x74 0x20 
0x21044: 0x69 0x73 0x20 0x20 0x74 0x68 0x65 0x20 
0x2104c: 0x51 0x75 0x65 0x73 0x74 0x69 0x6f 0x6e 
0x21054: 0x3f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x2105c: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x21064: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x2106c: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 

问题: 我运行了程序,然后用“??????”替换了 x、y、字符串的值。

  1. 使用上面的内存转储,x和y的十进制值是多少(第6行和第7行,x值为正,y值为负。)

  2. String(第 8 行)是一条消息,您需要找到。

我将第 21 行和 22 行的指令替换为 xxxx 和 xxxxx 第21行指令的代码为0f 00 a0 e3,第22行指令的代码为 是 01 00 80 e0。
3. 这些说明是什么?

I'm being asked a question about a memory dump and how to find the values of the var x and y. I was wondering how I would find those I'll post the questions below.
-Thanks

 1  
 2 .global  main    @ main: is our entry point and must be global  
 3 .func    main 
 4 .data    
 5 .balign 4 
 6 x:       .word  ???? 
 7 y:       .word  ???? 
 8 string:   .asciz "????" 
 9 .text 
10 main: 
11  ldr r0, = x     /*r0 gets the address of  x*/ 
12  ldr r0, [r0]    /*r0 gets the content of the memory 
13                  /* pointed to by the the content r0*/  
14  
15  ldr r1, = y     /*r1 gets the address of  y*/ 
16  ldr r1, [r1]    /*r1 gets the content of the memory */ 
17  
18  ldr r3, = string /*r3 gets the address of  string*/ 
19  ldr r3, [r3]    /*r3 gets the content of the memory*/ 
20  
21  ????            /* What is this instruction */ 
22  ????            /*   What is this instruction  */ 
23  bx  lr  

Some information needed are as follows:
After assembling. Linking, running, and gdp-ing, I typed the following gdb instructions:

(gdb) p/x &x 
$1 = 0x21024 

The above command indicates that the address of the variable x is 0x21024.

Then I dumped the content of the memory, starting at the address 0x21024,
by typing the following command:

 (gdb) x/80b 0x21024 
 
0x21024: 0x63 0x00 0x00 0x00 0xc7 0xff 0xff 0xff 
0x2102c: 0x54 0x6f 0x20 0x42 0x65 0x20 0x6f 0x72 
0x21034: 0x20 0x4e 0x6f 0x74 0x20 0x74 0x6f 0x20 
0x2103c: 0x42 0x65 0x20 0x54 0x68 0x61 0x74 0x20 
0x21044: 0x69 0x73 0x20 0x20 0x74 0x68 0x65 0x20 
0x2104c: 0x51 0x75 0x65 0x73 0x74 0x69 0x6f 0x6e 
0x21054: 0x3f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x2105c: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x21064: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x2106c: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 

Questions:
I ran the program then I replaced the values of x, y, string by “?????

  1. Using the above memory dump, what are the value in decimal of x and y (lines 6 and 7 The value x is positive and the value of y is negative.)

  2. String (line 8) is a message that you need to find.

I replaced the instructions at line 21 and 22 by xxxx and xxxxx
The code of the line 21 instruction is 0f 00 a0 e3 and the code of the line 22 instruction
is 01 00 80 e0.
3. What are these instructions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文