Search code examples
macoslldb

How can I print XPC msg in lldb the full object using po or other method


(lldb) po 0x7fa5ed509460
<OS_xpc_data: data[0x7fa5ed509460]: { refcnt = 1, xrefcnt = 1, buff = 0x7fa5ee00d040, len = 1921 } <data: 0x7fa5ed509460>: { length = 1921 bytes, contents = 0x62706c6973743030d4010203040506070a58247665727369... }>

I have an XPC massage, I want to print the full data in contents and if it's serialised (it is) deserialised it.

I tried the folowing:

po [[0x7fa5ed40d440 dictionary] objectForKey:@"contents"]
po [[0x7fa5ed40d440] objectForKey:@"contents"]
po 0x7fa5ed509460.contents
po 0x7fa5ed509460->contents
po 0x7fa5ed509460[@"contents"]

None of them worked.

What is the correct way to get it? What is the correct way to deserialised it?


Solution

  • Based on https://www.fortinet.com/blog/threat-research/a-look-into-xpc-internals--reverse-engineering-the-xpc-objects

    8. xpc_data_t
    

    enter image description here

    You could read it like this:

    x 0x7fa5ee00d040 -c 1921