The first, standard way is to send a GSEvent type #500 to the application, then the dump will be written to /tmp/UIDump in plist format. You can achieve the same by calling in gdb:
call (void)[[UIApplication sharedApplication] _dumpUIHierarchy:0]
When the dump is completed, a Darwin notification "com.apple.UIHierarchyDump.finished" will be posted.
(You can also take a screenshot with _dumpScreenContents:0 / GSEvent type #501, but the file is in JPEG and pressing Lock+Home isn't that hard...)
(Note: May fail for AppStore apps due to sandboxing.)