linux - 从内存移动到注册并在 gdb 中读取它
问题描述
section .data
price dd 49,98,29
section .text
global _start
_start:
nop
; Put your experiments between the two nops...
mov eax,price
mov ebx,[price]
mov ecx,[price+4]
mov edx, [price+8]
; Put your experiments between the two nops...
nop
我知道 49,98,29 是一个字节。当引用价格时,它只会打印出 49。我必须将价格移动 1 个字节才能得到 98,移动 2 个字节才能得到 29。
在 gdb 中,我可以看到寄存器 edx 具有十进制 29、ecx 98 和 ebx 49。但是当我检查寄存器时,x/3dw $edx
我得到
Cannot access memory at address 0x1d
为什么不显示29?
更新:
我正在尝试查看以下代码的输出
section .data
price db 49,98,29
section .text
global _start
_start:
nop
; Put your experiments between the two nops...
mov eax, price
mov ebx,[price]
mov ecx,[price+1]
mov edx, [price+2]
; Put your experiments between the two nops...
nop
x/db $ebx
给
0x1d6231: Cannot access memory at address 0x1d6231
和
(gdb) p $ebx
$5 = 1925681
为什么要这样做?
解决方案
推荐阅读
- c++ - ADL 和 typedef
- java - 是否可以在 List 中放置两种变量类型?
- mongodb - 查询 MongoDB 视图失败,原因是超出内存限制
- c# - 如何从 Azure API 管理中的请求正文获取原始日期时间值?
- ajax - 未使用 ajax 将参数传递给控制器
- ios - Xcode - 隐私 - 相机使用说明不会询问相机的权限
- android - 是否可以将 *.so 库用于扩展文件?
- reactjs - 使用空依赖项无法在 useEffect 中调用自定义反应钩子
- angularjs - 如何将 rootscope 限制为一个控制器?我想在除一个之外的所有控制器中删除我的 rootscope.myValue !有什么解决办法吗?
- php - 如何使用 eloquent 通过具有嵌套关系(belongsToMany)的子类别计算父类别中的产品