How to write into XMM Registers in LLDB

Helpp :

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.

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.

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/[email protected]/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.

So, is there a way for me to write into the XMM registers, or in general, vector type registers using LLDB API?

Helpp :

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.

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=10665&siteId=1