I am trying to write a DTrace script that will show me the parameter passed in -[NSURLConnection sendSynchronousRequest:returningResponse:error:] , and I cannot find a structure that works to extract the string from the passed NSString parameter. This question has an answer that works for OS X applications, but it doesnโt work for my application that uses the iOS simulator.
Although I am looking for a solution for this specific example, I am much more interested in finding out the best way to determine / discover the underlying memory structure for any given Objective-C object. As you can see from the OS X test application that I wrote, the NSString parameter does not always contain the original string data in the same place. In the case where it __NSCFString seems to be located (prefix length) with 16 bytes in. In the case when he a __NSCFConstant builds it somewhere else, which is not immediately obvious, looking at a dump of raw memory.
If there are structures in the system headers that show me what I'm looking for, that would be a good first step, but I think LLDB can also show me useful hints.

struct objective-c lldb dtrace
Mark eddington
source share