By the way, on architectures where function arguments are passed to registers (x86_64, armv7), lldb defines a series of register aliases that map to the register used to pass integral values โโ- arg1, arg2, etc. For example,
#include <stdio.h> int main () { char *mytext = "hello world\n"; puts (mytext); return 0; }
and we can easily see which argument is passed to place without having to remember ABI conventions,
4 char *mytext = "hello world\n"; -> 5 puts (mytext); 6 return 0; 7 } (lldb) p mytext (char *) $0 = 0x0000000100000f54 "hello world\n" (lldb) br se -n puts Breakpoint created: 2: name = 'puts', locations = 1, resolved = 1 (lldb) c Process 2325 resuming Process 2325 stopped libsystem_c.dylib`puts: -> 0x7fff99ce1d9a: pushq %rbp 0x7fff99ce1d9b: movq %rsp, %rbp 0x7fff99ce1d9e: pushq %rbx 0x7fff99ce1d9f: subq $56, %rsp (lldb) p/x $arg1 (unsigned long) $2 = 0x0000000100000f54 (lldb)
x86_64 and armv7 both pass the first "few" integral values โโin registers - except that they can be stored on the stack or in other places, and these aliases do not work. Lldb does not currently provide similar convenience aliases for floating point arguments. But for the most common cases, this applies to what people need.
Jason molenda
source share