assembly - 为什么我的手臂汇编代码没有在 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 */
我觉得奇怪的是,字符串“Process 20966 exited ...”被放置在 lldb 命令提示符之后,并且提示符正在等待输入。
调试会话是通过 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
这一定是某种形式的不当行为。
解决方案
推荐阅读
- docker - grpc 状态代码不可用,详细信息为操作系统错误
- c - C Mocking:如何正确地做到这一点
- visual-c++ - VS C++ 可以通过命令行卸载吗?
- tensorflow - 将 tfrecord 文件批量加载到 keras 模型中
- php - 哪种表结构在性能方面更有效
- react-native - 使用 ExtraData 更改 FlatList 中的唯一项
- python - 如何选择具有多个条件的行?
- scala - 将 JSON 从 URL 转换为数据帧(Pyspark 和 Scala)
- javascript - 如何将 api 中的数据和标签插入数据集中以显示图表
- .net - 使用接近设备发送和接收对 APDU 命令的响应