vimspector,读取地址处的内存

huangapple go评论59阅读模式
英文:

vimspector, read memory at address

问题

I trying to debug (for study purposes) simple program written with c language. I use vimspector(gdb) as debugger.
我正在尝试调试(用于学习目的)用C语言编写的简单程序。我使用vimspector(gdb)作为调试器。

How can I read memory at certain address with vimspector?
如何使用vimspector读取特定地址的内存?

I found vimspector can do this (someone's screenshot as a proof):
我发现vimspector可以做到这一点(有人的截图作为证据):

Section "dump memory" of vimspector's readme says:
vimspector的自述文件中的“dump memory”部分说:

Some debug adapters provide a way to dump process memory associated with variables. This can be done from the Variables and Watches windows with:
一些调试适配器提供了一种用于转储与变量关联的进程内存的方法。可以从变量和观察窗口执行此操作:

  • The WinBar option "Dump"
  • WinBar选项“Dump”
  • m mapping (by default, can be customised)
  • m映射(默认情况下可以自定义)
  • vimspector#ReadMemory() function
    vimspector#ReadMemory()函数

I tried to call function vimspector#ReadMemory and got errors everytime
我尝试调用vimspector#ReadMemory函数,并每次都遇到错误:

:call vimspector#ReadMemory()
Cannot find memory reference for that
无法找到该内存引用

:call vimspector#ReadMemory(myvar)
E116: Invalid arguments for function vimspector#ReadMemory
E116: vimspector#ReadMemory函数的参数无效

:call vimspector#ReadMemory(0x7ffff7e959d7)
TypeError: vimspector.debug_session.DebugSession.ReadMemory() argument after ** must be a mapping, not str
TypeError: vimspector.debug_session.DebugSession.ReadMemory()的参数**后必须是映射,而不是字符串

When I trying <leader>m nothing happened.
当我尝试<leader>m时,什么都没有发生。

英文:

I trying to debug (for study purposes) simple program written with c language. I use vimspector(gdb) as debugger.
How can I read memory at certain address with vimspector?
I found vimspector can do this (someone's screenshot as a proof):
https://camo.githubusercontent.com/da69c1bda28db4e3f22f35ac9d52b22b1eab80afcfabd2003b98aefeb7e54929/68747470733a2f2f61736369696e656d612e6f72672f612f6573456e634178503435434a6d6f38456d31735174785259652e737667

Section "dump memory" of vimspector's readme says:
> Some debug adapters provide a way to dump process memory associated with variables. This can be done from the Variables and Watches windows with:
>
> * The WinBar option "Dump"
> * &lt;leader>m mapping (by default, can be customised)
> * vimspector#ReadMemory() function

I tried to call function vimspector#ReadMemory and got errors everytime

:call vimspector#ReadMemory()
Cannot find memory reference for that

:call vimspector#ReadMemory(myvar)
E116: Invalid arguments for function vimspector#ReadMemory

:call vimspector#ReadMemory(0x7ffff7e959d7)
TypeError: vimspector.debug_session.DebugSession.ReadMemory() argument after ** must be a mapping, not str

When I trying &lt;leader&gt;m nothing happened.

答案1

得分: 0

I also find this issue and search by google, found your question, but seems no one answers it, by serval minutes of trying, I found the root cause, you need to trigger this function inside variable or watch windows, by default, they were layout at left side. then you can press m on a variable or address, magic will happen.

please mentions that, after trigger m, you need to wait about 2 seconds, then vimspector will ask you to input some parameters to dump the memory.

hopes this will help you

英文:

I also find this issue and search by google, found your question, but seems no one answers it, by serval minutes of trying, I found the root cause, you need to trigger this function inside variable or watch windows, by default, they were layout at left side. then you can press &lt;leader>m on a variable or address, magic will happen.

please mentions that, after trigger &lt;leader>m, you need to wait about 2 seconds, then vimspector will ask you to input some parameters to dump the memory.

hopes this will help you

huangapple
  • 本文由 发表于 2023年4月13日 22:17:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76006516.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定