如何在LLDB中写入XMM寄存器 [英] How to write into XMM Registers in LLDB
问题描述
我正在尝试使用LLDB API从python中的寄存器读取和写入值.对于通用寄存器,我一直使用 frame.register ['register name'].value
读取和写入寄存器值,这对我来说是成功的.
I am trying to read and write values from registers in python using the LLDB API.
For the General Purpose Registers, I have been using the frame.register['register name'].value
to read and write register values, which works successfully for me.
但是,当我接近浮点寄存器时,我发现无法再这样做了,因为某些寄存器(例如XMM寄存器)没有 value
属性例如, frame.register ['xmm0'].value
将返回 None
.
However, as I approach the Floating Point Registers, I found that this could not be done anymore, as some of the registers, such as the XMM registers do not have a value
attribute
e.g frame.register['xmm0'].value
would return None
.
我查看了LLDB API文档,尽管它没有返回字符串格式,但是我可以通过 frame.register ['xmm0'].GetData()
获得寄存器值.例如 value
属性.但是,我仍然找不到使用LLDB API写入寄存器的方法.我了解我可以使用 register write xmm0"{0x00 0x01 ... 0x0f}"
在CLI中以交互方式执行此操作,如下所示 https://www.mail-archive.com/lldb-dev@lists.llvm.org/msg03228.html ,但是我希望能够在python中做到这一点,因为我正在编写脚本来执行此任务.
I have looked into the LLDB API Documentation and I could somehow get the register value using the frame.register['xmm0'].GetData()
, although it doesn't return a string format like the value
attribute.
However, I am still unable to find a way to write into the registers using the LLDB API. I understand that I would be able to do this interactively in CLI using register write xmm0 "{0x00 0x01 ... 0x0f}"
, as shown in
https://www.mail-archive.com/lldb-dev@lists.llvm.org/msg03228.html, but I would like to be able to do it in python, as I am writing a script in order to perform this task.
那么,有没有办法让我使用LLDB API写入XMM寄存器或一般的矢量类型寄存器?
So, is there a way for me to write into the XMM registers, or in general, vector type registers using LLDB API?
推荐答案
几天后,我终于设法使用LLDB API读写向量寄存器.XMM寄存器具有属性 summary
,也可以使用 SBValue.GetSummary()
获得该属性,该属性以以下形式返回XMM寄存器内的值的字符串:(0x00 0x01 .... 0x0f)
字符串格式.
After a few days, I finally managed to read and write into the vector registers using the LLDB API.
The XMM Registers has an attribute summary
, which can also be obtained using SBValue.GetSummary()
, this attribute returns a string of the values inside the XMM register in the form of (0x00 0x01 .... 0x0f)
string format.
要修改XMM寄存器,因为XMM寄存器不具有属性 value
,所以 lldb.frame.register ['register name'].value
将是无用的,但是还有一种使用 lldb.frame.registers [0] .GetChildMemberWithName('xmm0').SetValueFromCString(value,self.error)
更新寄存器值的方法.值对象必须是字符串格式,仍然遵循"{0x00 0x01 ... 0x0f}"
格式.
To modify the XMM Registers, since the XMM registers have no attribute value
, lldb.frame.register['register name'].value
would be useless , but there is another way to update registers value, using lldb.frame.registers[0].GetChildMemberWithName('xmm0').SetValueFromCString(value, self.error)
. The value object has to be a string format, still following the "{0x00 0x01 ... 0x0f}"
format.
这篇关于如何在LLDB中写入XMM寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!