Vs2013在Linux开发中的应用(31):内存块显示
2015-01-07 18:29
525 查看
快乐虾http://blog.csdn.net/lights_joy/欢迎转载,但请保留作者信息
要实现内存块的显示,需要实现IDebugMemoryBytes2接口,类似这样的:
当VS显示内存窗口时,会调用:
这里仅仅实现了一个空接口,并没有实现内存实际值的刷新,但此时已经可以在IDE中看到这样的效果了:
在读取数据的接口中使用gdb的-data-read-memory实际读取数据并填充后就成了这样:
搞定!
要实现内存块的显示,需要实现IDebugMemoryBytes2接口,类似这样的:
class AD7MemoryBytes : IDebugMemoryBytes2 { private AD7Engine _engine; public AD7Engine Engine { get { return _engine; } } public AD7MemoryBytes(AD7Engine engine) { _engine = engine; } public int GetSize(out ulong pqwSize) { throw new NotImplementedException(); } public int ReadAt(IDebugMemoryContext2 pStartContext, uint dwCount, byte[] rgbMemory, out uint pdwRead, ref uint pdwUnreadable) { AD7MemoryAddress addr = pStartContext as AD7MemoryAddress; pdwRead = dwCount; pdwUnreadable = 0; return Constants.S_OK; } public int WriteAt(IDebugMemoryContext2 pStartContext, uint dwCount, byte[] rgbMemory) { throw new NotImplementedException(); }
当VS显示内存窗口时,会调用:
// The memory bytes as represented by the IDebugMemoryBytes2 object is for the program's image in memory and not any memory // that was allocated when the program was executed. public int GetMemoryBytes(out IDebugMemoryBytes2 ppMemoryBytes) { ppMemoryBytes = new AD7MemoryBytes(this); return Constants.S_OK; }
这里仅仅实现了一个空接口,并没有实现内存实际值的刷新,但此时已经可以在IDE中看到这样的效果了:
在读取数据的接口中使用gdb的-data-read-memory实际读取数据并填充后就成了这样:
搞定!
相关文章推荐
- Vs2013在Linux开发中的应用(24):触发断点
- Vs2013在Linux开发中的应用(26):表达式计算
- Vs2013在Linux开发中的应用(21): 线程创建
- Vs2013在Linux开发中的应用(36):Milestone-0.1.0
- Vs2013在Linux开发中的应用(23):信息输出
- Vs2013在Linux开发中的应用(33):反汇编
- Vs2013在Linux开发中的应用(28):单步执行
- Vs2013在Linux开发中的应用(29):寄存器信息
- Vs2013在Linux开发中的应用(16): 修改调试器参数
- Vs2013在Linux开发中的应用(18): 应用程序调试方案
- Vs2013在Linux开发中的应用(35):Telnet支持
- Vs2013在Linux开发中的应用(32):文本可视化
- Vs2013在Linux开发中的应用(30):程序中断
- Vs2013在Linux开发中的应用(27):线程列表
- Vs2013在Linux开发中的应用(22):模块加载
- Vs2013在Linux开发中的应用(20): 断点设置
- Vs2013在Linux开发中的应用(14): 远程调试设想
- linux入门-使用vs2015开发与调试linux下应用
- caffe在windows下如何在vs2013新建工程开发自己的应用cpu模式
- vs2013在图像处理中的应用(5):3D显示