为什么我的手臂汇编代码在LLDB中没有命中设置的断点

时间:2018-08-07 16:42:57

标签: assembly raspberry-pi arm breakpoints lldb

我将从列出我已完成并观察到的行为的一切开始。

.data

.balign 4
foo:
  .word 0

.balign 4
foo:
    .word 0

/* -- Code section */
.text

/* Ensure function section starts 4 byte aligned */
.balign 4
.global main
main:
    ldr r1, #40
    mov r0, =foo
    str r1, [r0]

    ldr r3, #2
    mov r2, =bar
    str r3, [r2]


    ldr r0, =foo
    ldr r1, =bar
    ldr r2, [r0]
    ldr r3, [r1]
    add r0, r1, r2

    mov r2, #12
    mov r7, #1
    swi 0

然后我像这样编译并链接

$> as -g store01.s -o store01.o
$> ld store01.o -o store01

然后启动lldb:

$> lldb store01

我已经通过以下方式设置了断点:

(lldb) breakpoint set --name _start
(lldb) breakpoint set --address 0x10078

我已经使用地址成功查看了反汇编

(lldb) disassemble --start-address 0x10078 --end-address 0x10090

但是我什么时候做

(lldb) process launch

我没有遇到任何断点,得到了以下内容

Process 20966 launched: 'pathto/store01' (arm)
(lldb) Process 20966 exited with status = 42 (0x0000002a)
/* blank line with cursor blinking on it */

对于我来说,奇怪的是,在lldb命令提示符后放置了字符串“ Process 20966 exited ...”,并且该提示符正在等待输入。

调试会话是通过SSH与树莓派进行的。

那么,任何人有任何想法或知道为什么没有达到断点?


应要求提供更多信息

$>  lldb store01
(lldb) image lookup -vn _start
1 match found in /somepath/store01:
      Address: store01[0x00010074] (store01...text+0)
      Summary: store01`
       Module: file = "/somepath/store01", arch="arm"
 Compile Unit: id = {0x00000000}, file = "/somepath/store01.s", language = "mipsassem"
LineEntry: [x00010074-0x00010078): /somepath/store01.s:15
Symbol: id = {0x00000001}, range = [0x00010074-0x000200b4)

当我跑步时

(lldb) target modules dump symtab

我看到_start在此符号表中

我跑步时

(lldb) image lookup --verbose --address 0x10078

与上面类似,并使用_store` + 4


这是一些更有趣的行为 我为符号_start设置了断点。没有断点命中。 我再次尝试使用该地址。没有断点命中。 我使用_start + 8的地址再次尝试。没有断点命中。 我删除前两个断点。遇到断点。

(lldb) breakpoint set --name _start
Breakpoint 1: where = store01` + 4, address = 0x00010078
(lldb) process launch
Process 2983 launched: '/path/store01' (arm)
(lldb) Process 2893 exited with status = 42 (0x0000002a)
breakpoint set --address 0x00010078
Breakpoint 2: where = store01` + 4, address = 0x00010078
(lldb) process launch
Process 2910 launched: '/path/store01' (arm)
(lldb) Process 2910 exited with status = 42 (0x0000002a)
breakpoint set --address 0x0001007c
Breakpoint 3: where = store01` + 8, address = 0x0001007c
(lldb) process launch
Process 2927 launched: '/path/store01' (arm)
(lldb) Process 2910 exited with status = 42 (0x0000002a)
(lldb) breakpoint delete 1 2
2 breakpoints deleted; 0 breakpoint locations disabled.
(lldb) process launch
Process 2944 launched: '/path/store01' (arm)
Process 2944 stopped

这一定是某种形式的不当行为。

0 个答案:

没有答案