读取寄存器指向GDB的内存 [英] Reading memory pointed by register with GDB

查看:315
本文介绍了读取寄存器指向GDB的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我知道内存位置,有没有办法从GDB查看内存内容?

这是我正在调试为我的操作系统课程编写的x86汇编程序。我想要做的是在x86上用C和gas(GNU汇编器)编写用于Linux的用户级线程库。我分配了自己的堆栈,并将esp寄存器指向了该内存位置。现在我想要做的是读取内存,看看我分配的堆栈中有什么。

解决方案

gdb

  p(int *)$ esp 
x / 20x $ esp
p((int *)$ esp)[3]


Is there a way to look at memory content from GDB if I know the memory location.

That is I'm debugging a x86 assembly program I written for my Operating Systems Course. What I'm trying to do is to write a user level thread library for linux on x86 with C and gas (GNU assembler). I allocated my own stacks and I made the esp register point to that memory location. Now what I want to do is read the memory to see what is in that stack I allocated.

解决方案

I would try something like the following commands (under gdb)

 p (int*)$esp
 x /20x $esp
 p ((int*)$esp)[3]

这篇关于读取寄存器指向GDB的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆