I tried at this way:
destination = thread.GetFrameAtIndex(0).GetSymbol().GetName()
# registers = thread.GetFrameAtIndex(0).GetRegisters()
for x,i in enumerate(thread.GetFrameAtIndex(0).get_arguments()):
log("arg: {0}: sum: {1} val: {2}".format(x,
i.GetSummary(),
i.GetValue()))
for x, i in enumerate(thread.GetFrameAtIndex(0).GetRegisters()):
log("reg: {0}: sum: {1} val: {2} desc: ".format(
x,
i.GetSummary(),
i.GetValue(),
i.GetObjectDescription()))
The idea is to get all the types, value and content of pointer (when lldb can resolve them) so for example for char *, string, NSString etc. I except that GetSummary() / GetObjectDescription() will be able to resolve them to the actual string.
The problem is when I try to trace thread.GetFrameAtIndex(0).get_arguments()
always return empty list and the output of thread.GetFrameAtIndex(0).GetRegisters()
looks like this:
reg: 0: sum: None val: None desc:
reg: 1: sum: None val: None desc:
reg: 2: sum: None val: None desc:
What I do rung?
My purpose is to add this to call tracer I built in lldb, so in every function the tracer will try to do best efforts to resolve function argument values and in exit it will do best efforts to resolve function return value.
When you call GetRegisters, what you get back is an array of the register groups, GPR, Floating Point and whatever else your machine might have. The register groups don't have values or summaries - though the do have names. So for instance on intel, I get (in the script interpreter):
>>> for reg_group in lldb.frame.GetRegisters():
... print(reg_group.GetName())
...
General Purpose Registers
Floating Point Registers
Exception State Registers
So you need one more iteration, or if you just want the GPR's they are always first, so:
>>> for reg in lldb.frame.GetRegisters()[0]:
... print(reg)
...
(unsigned long) rax = 0x0000000100003f50
(unsigned long) rbx = 0x0000000000000000
(unsigned long) rcx = 0x00007ffeefbff768