Index: lldb/bindings/python/CMakeLists.txt =================================================================== --- lldb/bindings/python/CMakeLists.txt +++ lldb/bindings/python/CMakeLists.txt @@ -114,6 +114,7 @@ ${swig_target} ${lldb_python_target_dir} "macosx" FILES "${LLDB_SOURCE_DIR}/examples/python/crashlog.py" + "${LLDB_SOURCE_DIR}/examples/python/scripted_process/crashlog_scripted_process.py" "${LLDB_SOURCE_DIR}/examples/darwin/heap_find/heap.py") create_python_package( Index: lldb/examples/python/crashlog.py =================================================================== --- lldb/examples/python/crashlog.py +++ lldb/examples/python/crashlog.py @@ -63,7 +63,6 @@ from lldb.utils import symbolication - def read_plist(s): if sys.version_info.major == 3: return plistlib.loads(s) @@ -768,138 +767,6 @@ sys.exit(0) -class Interactive(cmd.Cmd): - '''Interactive prompt for analyzing one or more Darwin crash logs, type "help" to see a list of supported commands.''' - image_option_parser = None - - def __init__(self, crash_logs): - cmd.Cmd.__init__(self) - self.use_rawinput = False - self.intro = 'Interactive crashlogs prompt, type "help" to see a list of supported commands.' - self.crash_logs = crash_logs - self.prompt = '% ' - - def default(self, line): - '''Catch all for unknown command, which will exit the interpreter.''' - print("uknown command: %s" % line) - return True - - def do_q(self, line): - '''Quit command''' - return True - - def do_quit(self, line): - '''Quit command''' - return True - - def do_symbolicate(self, line): - description = '''Symbolicate one or more darwin crash log files by index to provide source file and line information, - inlined stack frames back to the concrete functions, and disassemble the location of the crash - for the first frame of the crashed thread.''' - option_parser = CreateSymbolicateCrashLogOptions( - 'symbolicate', description, False) - command_args = shlex.split(line) - try: - (options, args) = option_parser.parse_args(command_args) - except: - return - - if args: - # We have arguments, they must valid be crash log file indexes - for idx_str in args: - idx = int(idx_str) - if idx < len(self.crash_logs): - SymbolicateCrashLog(self.crash_logs[idx], options) - else: - print('error: crash log index %u is out of range' % (idx)) - else: - # No arguments, symbolicate all crash logs using the options - # provided - for idx in range(len(self.crash_logs)): - SymbolicateCrashLog(self.crash_logs[idx], options) - - def do_list(self, line=None): - '''Dump a list of all crash logs that are currently loaded. - - USAGE: list''' - print('%u crash logs are loaded:' % len(self.crash_logs)) - for (crash_log_idx, crash_log) in enumerate(self.crash_logs): - print('[%u] = %s' % (crash_log_idx, crash_log.path)) - - def do_image(self, line): - '''Dump information about one or more binary images in the crash log given an image basename, or all images if no arguments are provided.''' - usage = "usage: %prog [options] [PATH ...]" - description = '''Dump information about one or more images in all crash logs. The can be a full path, image basename, or partial path. Searches are done in this order.''' - command_args = shlex.split(line) - if not self.image_option_parser: - self.image_option_parser = optparse.OptionParser( - description=description, prog='image', usage=usage) - self.image_option_parser.add_option( - '-a', - '--all', - action='store_true', - help='show all images', - default=False) - try: - (options, args) = self.image_option_parser.parse_args(command_args) - except: - return - - if args: - for image_path in args: - fullpath_search = image_path[0] == '/' - for (crash_log_idx, crash_log) in enumerate(self.crash_logs): - matches_found = 0 - for (image_idx, image) in enumerate(crash_log.images): - if fullpath_search: - if image.get_resolved_path() == image_path: - matches_found += 1 - print('[%u] ' % (crash_log_idx), image) - else: - image_basename = image.get_resolved_path_basename() - if image_basename == image_path: - matches_found += 1 - print('[%u] ' % (crash_log_idx), image) - if matches_found == 0: - for (image_idx, image) in enumerate(crash_log.images): - resolved_image_path = image.get_resolved_path() - if resolved_image_path and string.find( - image.get_resolved_path(), image_path) >= 0: - print('[%u] ' % (crash_log_idx), image) - else: - for crash_log in self.crash_logs: - for (image_idx, image) in enumerate(crash_log.images): - print('[%u] %s' % (image_idx, image)) - return False - - -def interactive_crashlogs(debugger, options, args): - crash_log_files = list() - for arg in args: - for resolved_path in glob.glob(arg): - crash_log_files.append(resolved_path) - - crash_logs = list() - for crash_log_file in crash_log_files: - try: - crash_log = CrashLogParser().parse(debugger, crash_log_file, options.verbose) - except Exception as e: - print(e) - continue - if options.debug: - crash_log.dump() - if not crash_log.images: - print('error: no images in crash log "%s"' % (crash_log)) - continue - else: - crash_logs.append(crash_log) - - interpreter = Interactive(crash_logs) - # List all crash logs that were imported - interpreter.do_list() - interpreter.cmdloop() - - def save_crashlog(debugger, command, exe_ctx, result, dict): usage = "usage: %prog [options] " description = '''Export the state of current target into a crashlog file''' @@ -1094,6 +961,43 @@ for error in crash_log.errors: print(error) +def load_crashlog_in_scripted_process(debugger, crash_log_file): + result = lldb.SBCommandReturnObject() + + crashlog_path = os.path.expanduser(crash_log_file) + if not os.path.exists(crashlog_path): + result.PutCString("error: crashlog file %s does not exist" % crashlog_path) + + try: + crashlog = CrashLogParser().parse(debugger, crashlog_path, False) + except Exception as e: + result.PutCString("error: python exception: %s" % e) + return + + target = crashlog.create_target() + if not target: + result.PutCString("error: couldn't create target") + return + + ci = debugger.GetCommandInterpreter() + if not ci: + result.PutCString("error: couldn't get command interpreter") + return + + res = lldb.SBCommandReturnObject() + ci.HandleCommand('script from lldb.macosx import crashlog_scripted_process', res) + if not res.Succeeded(): + result.PutCString("error: couldn't import crashlog scripted process module") + return + + structured_data = lldb.SBStructuredData() + structured_data.SetFromJSON(json.dumps({ "crashlog_path" : crashlog_path })) + launch_info = lldb.SBLaunchInfo(None) + launch_info.SetProcessPluginName("ScriptedProcess") + launch_info.SetScriptedProcessClassName("crashlog_scripted_process.CrashLogScriptedProcess") + launch_info.SetScriptedProcessDictionary(structured_data) + error = lldb.SBError() + process = target.Launch(launch_info, error) def CreateSymbolicateCrashLogOptions( command_name, @@ -1197,8 +1101,14 @@ '-i', '--interactive', action='store_true', - help='parse all crash logs and enter interactive mode', + help='parse a crash log and load it in a ScriptedProcess', default=False) + option_parser.add_option( + '-b', + '--batch', + action='store_true', + help='dump symbolicated stackframes without creating a debug session', + default=True) return option_parser @@ -1230,11 +1140,23 @@ time.sleep(options.debug_delay) error = lldb.SBError() - if args: + def should_run_in_interactive_mode(options, ci): if options.interactive: - interactive_crashlogs(debugger, options, args) + return True + elif options.batch: + return False + # elif ci and ci.IsInteractive(): + # return True else: - for crash_log_file in args: + return False + + ci = debugger.GetCommandInterpreter() + + if args: + for crash_log_file in args: + if should_run_in_interactive_mode(options, ci): + load_crashlog_in_scripted_process(debugger, crash_log_file) + else: crash_log = CrashLogParser().parse(debugger, crash_log_file, options.verbose) SymbolicateCrashLog(crash_log, options) Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py =================================================================== --- /dev/null +++ lldb/examples/python/scripted_process/crashlog_scripted_process.py @@ -0,0 +1,148 @@ +import os,json,struct,signal + +from typing import Any, Dict + +import lldb +from lldb.plugins.scripted_process import ScriptedProcess +from lldb.plugins.scripted_process import ScriptedThread + +from lldb.macosx.crashlog import CrashLog,CrashLogParser + +class CrashLogScriptedProcess(ScriptedProcess): + def parse_crashlog(self): + try: + crash_log = CrashLogParser().parse(self.dbg, self.crashlog_path, False) + except Exception as e: + return + + self.pid = crash_log.process_id + self.crashed_thread_idx = crash_log.crashed_thread_idx + self.loaded_images = [] + + for thread in crash_log.threads: + if thread.did_crash(): + for ident in thread.idents: + images = crash_log.find_images_with_identifier(ident) + if images: + for image in images: + #TODO: Add to self.loaded_images and load images in lldb + err = image.add_module(self.target) + if err: + print(err) + else: + self.loaded_images.append(image) + self.threads[thread.index] = CrashLogScriptedThread(self, None, thread) + + def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData): + super().__init__(target, args) + + if not self.target or not self.target.IsValid(): + return + + self.crashlog_path = None + + crashlog_path = args.GetValueForKey("crashlog_path") + if crashlog_path and crashlog_path.IsValid(): + if crashlog_path.GetType() == lldb.eStructuredDataTypeString: + self.crashlog_path = crashlog_path.GetStringValue(4096) + + if not self.crashlog_path: + return + + self.pid = super().get_process_id() + self.crashed_thread_idx = 0 + self.parse_crashlog() + + def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryRegionInfo: + return None + + def get_thread_with_id(self, tid: int): + return {} + + def get_registers_for_thread(self, tid: int): + return {} + + def read_memory_at_address(self, addr: int, size: int) -> lldb.SBData: + # NOTE: CrashLogs don't contain any memory. + return lldb.SBData() + + def get_loaded_images(self): + # TODO: Iterate over corefile_target modules and build a data structure + # from it. + return self.loaded_images + + def get_process_id(self) -> int: + return self.pid + + def should_stop(self) -> bool: + return True + + def is_alive(self) -> bool: + return True + + def get_scripted_thread_plugin(self): + return CrashLogScriptedThread.__module__ + "." + CrashLogScriptedThread.__name__ + +class CrashLogScriptedThread(ScriptedThread): + def create_register_ctx(self): + if not self.has_crashed: + return dict.fromkeys([*map(lambda reg: reg['name'], self.register_info['registers'])] , 0) + + if not self.backing_thread or not len(self.backing_thread.registers): + return dict.fromkeys([*map(lambda reg: reg['name'], self.register_info['registers'])] , 0) + + for reg in self.register_info['registers']: + reg_name = reg['name'] + if reg_name in self.backing_thread.registers: + self.register_ctx[reg_name] = self.backing_thread.registers[reg_name] + else: + self.register_ctx[reg_name] = 0 + + return self.register_ctx + + def create_stackframes(self): + if not self.has_crashed: + return None + + if not self.backing_thread or not len(self.backing_thread.frames): + return None + + for frame in self.backing_thread.frames: + sym_addr = lldb.SBAddress() + sym_addr.SetLoadAddress(frame.pc, self.target) + if not sym_addr.IsValid(): + continue + self.frames.append({"idx": frame.index, "pc": frame.pc}) + + return self.frames + + def __init__(self, process, args, crashlog_thread): + super().__init__(process, args) + + self.backing_thread = crashlog_thread + self.idx = self.backing_thread.index + self.has_crashed = (self.scripted_process.crashed_thread_idx == self.idx) + self.create_stackframes() + + def get_thread_id(self) -> int: + return self.idx + + def get_name(self) -> str: + return CrashLogScriptedThread.__name__ + ".thread-" + str(self.idx) + + def get_state(self): + if not self.has_crashed: + return lldb.eStateStopped + return lldb.eStateCrashed + + def get_stop_reason(self) -> Dict[str, Any]: + if not self.has_crashed: + return { "type": lldb.eStopReasonNone, "data": { }} + # TODO: Investigate what stop reason should be reported when crashed + return { "type": lldb.eStopReasonException, "data": { "desc": "EXC_BAD_ACCESS" }} + + def get_register_context(self) -> str: + if not self.register_ctx: + self.register_ctx = self.create_register_ctx() + + return struct.pack("{}Q".format(len(self.register_ctx)), *self.register_ctx.values()) Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp =================================================================== --- lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -303,6 +303,9 @@ StructuredData::DictionarySP thread_info_sp = GetInterface().GetThreadsInfo(); + // FIXME: Need to sort the dictionary otherwise the thread ids won't match the + // thread indices. + if (!thread_info_sp) return ScriptedInterface::ErrorWithMessage( LLVM_PRETTY_FUNCTION, Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips =================================================================== --- /dev/null +++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips @@ -0,0 +1,172 @@ +{"app_name":"scripted_crashlog_json.test.tmp.out","timestamp":"2022-02-14 16:30:31.00 -0800","app_version":"","slice_uuid":"b928ee77-9429-334f-ac88-41440bb3d4c7","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.3 (21E209)","incident_id":"E57CADE7-DC44-45CE-8D16-18EBC4406B97","name":"scripted_crashlog_json.test.tmp.out"} +{ + "uptime" : 260000, + "procLaunch" : "2022-02-14 16:30:31.8048 -0800", + "procRole" : "Unspecified", + "version" : 2, + "userID" : 501, + "deployVersion" : 210, + "modelCode" : "MacBookPro18,2", + "procStartAbsTime" : 6478056069413, + "coalitionID" : 22196, + "osVersion" : { + "train" : "macOS 12.3", + "build" : "21E209", + "releaseType" : "Internal" + }, + "captureTime" : "2022-02-14 16:30:31.8096 -0800", + "incident" : "E57CADE7-DC44-45CE-8D16-18EBC4406B97", + "bug_type" : "309", + "pid" : 92190, + "procExitAbsTime" : 6478056175721, + "translated" : false, + "cpuType" : "ARM-64", + "procName" : "scripted_crashlog_json.test.tmp.out", + "procPath" : "\/Users\/USER\/*\/scripted_crashlog_json.test.tmp.out", + "parentProc" : "zsh", + "parentPid" : 82132, + "coalitionName" : "com.apple.Terminal", + "crashReporterKey" : "CDC11418-EDBF-2A49-0D83-8B441A5004B0", + "responsiblePid" : 76395, + "responsibleProc" : "Terminal", + "wakeTime" : 14889, + "sleepWakeUUID" : "BCA947AE-2F0A-44C7-8445-FEDFFA236CD0", + "sip" : "enabled", + "vmRegionInfo" : "0 is not in any region. Bytes before following region: 4372692992\n REGION TYPE START - END [ VSIZE] PRT\/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 104a20000-104a24000 [ 16K] r-x\/r-x SM=COW ....test.tmp.out", + "isCorpse" : 1, + "exception" : {"codes":"0x0000000000000001, 0x0000000000000000","rawCodes":[1,0],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x0000000000000000"}, + "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":92190}, + "vmregioninfo" : "0 is not in any region. Bytes before following region: 4372692992\n REGION TYPE START - END [ VSIZE] PRT\/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 104a20000-104a24000 [ 16K] r-x\/r-x SM=COW ....test.tmp.out", + "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":156,"task_for_pid":28},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0}, + "faultingThread" : 0, + "threads" : [{"triggered":true,"id":4567339,"threadState":{"x":[{"value":1},{"value":6094187136},{"value":6094187152},{"value":6094187720},{"value":0},{"value":0},{"value":0},{"value":0},{"value":1},{"value":0},{"value":0},{"value":2},{"value":2},{"value":0},{"value":80},{"value":0},{"value":13118353544},{"value":7701436843874442528},{"value":0},{"value":4373676128},{"sourceLine":8,"value":4372709256,"sourceFile":"test.c","symbol":"main","symbolLocation":0},{"value":4373332080,"symbolLocation":0,"symbol":"dyld4::sConfigBuffer"},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0}],"flavor":"ARM_THREAD_STATE64","lr":{"value":4372709248},"cpsr":{"value":1610616832},"fp":{"value":6094186736},"sp":{"value":6094186720},"esr":{"value":2449473606,"description":"(Data Abort) byte write Translation fault"},"pc":{"value":4372709224,"matchesCrashFrame":1},"far":{"value":0}},"queue":"com.apple.main-thread","frames":[{"imageOffset":16232,"sourceLine":3,"sourceFile":"test.c","symbol":"foo","imageIndex":0,"symbolLocation":16},{"imageOffset":16256,"sourceLine":6,"sourceFile":"test.c","symbol":"bar","imageIndex":0,"symbolLocation":12},{"imageOffset":16288,"sourceLine":8,"sourceFile":"test.c","symbol":"main","imageIndex":0,"symbolLocation":24},{"imageOffset":20620,"symbol":"start","symbolLocation":520,"imageIndex":1}]}], + "usedImages" : [ + { + "source" : "P", + "arch" : "arm64", + "base" : 4372692992, + "size" : 16384, + "uuid" : "b928ee77-9429-334f-ac88-41440bb3d4c7", + "path" : "\/Users\/USER\/*\/scripted_crashlog_json.test.tmp.out", + "name" : "scripted_crashlog_json.test.tmp.out" + }, + { + "source" : "P", + "arch" : "arm64e", + "base" : 4372938752, + "size" : 393216, + "uuid" : "41293cda-474b-3700-924e-6ba0f7698eac", + "path" : "\/usr\/lib\/dyld", + "name" : "dyld" + } +], + "sharedCache" : { + "base" : 6924156928, + "size" : 3151052800, + "uuid" : "2ff78c31-e522-3e4a-a414-568e926f7274" +}, + "vmSummary" : "ReadOnly portion of Libraries: Total=589.5M resident=0K(0%) swapped_out_or_unallocated=589.5M(100%)\nWritable regions: Total=529.1M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=529.1M(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nKernel Alloc Once 32K 1 \nMALLOC 137.2M 11 \nMALLOC guard page 96K 5 \nMALLOC_NANO (reserved) 384.0M 1 reserved VM address space (unallocated)\nSTACK GUARD 56.0M 1 \nStack 8176K 1 \n__AUTH 46K 11 \n__AUTH_CONST 67K 38 \n__DATA 173K 36 \n__DATA_CONST 242K 39 \n__DATA_DIRTY 73K 21 \n__LINKEDIT 584.9M 3 \n__OBJC_CONST 10K 5 \n__OBJC_RO 82.9M 1 \n__OBJC_RW 3168K 1 \n__TEXT 4696K 43 \ndyld private memory 1024K 1 \nshared memory 48K 2 \n=========== ======= ======= \nTOTAL 1.2G 221 \nTOTAL, minus reserved VM space 878.5M 221 \n", + "legacyInfo" : { + "threadTriggered" : { + "queue" : "com.apple.main-thread" + } +}, + "trialInfo" : { + "rollouts" : [ + { + "rolloutId" : "60186475825c62000ccf5450", + "factorPackIds" : { + "SIRI_VALUE_INFERENCE_CONTACT_RESOLUTION" : "601864d8825c62000ccf5451" + }, + "deploymentId" : 230000005 + }, + { + "rolloutId" : "61030413bfe6dc472e1c980c", + "factorPackIds" : { + + }, + "deploymentId" : 230000183 + } + ], + "experiments" : [ + + ] +}, + "filteredLog" : [ + "Timestamp Type Thread Act Process[pid] (Sender)", + "2022-02-14 16:21:01.3467 -0800 error 0x458148 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:21:02.3348 -0800 error 0x457d25 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.WebKit(88917) deny(1) file-read-data \/Library\/Application Support\/CrashReporter\/SubmitDiagInfo.domains...", + "2022-02-14 16:21:08.0202 -0800 error 0x458148 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:21:18.4514 -0800 error 0x458374 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577278...", + "2022-02-14 16:21:22.0453 -0800 error 0x458148 0x0 sandboxd[392] (sandboxd): Sandbox: remindd(91144) deny(1) file-write-create \/Users\/mib\/Library\/HTTPStorages\/com.apple.remindd...", + "2022-02-14 16:21:27.1241 -0800 error 0x458374 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:21:30.9335 -0800 error 0x458148 0x0 sandboxd[392] (sandboxd): Sandbox: bird(800) deny(1) file-read-data \/Users\/mib...", + "2022-02-14 16:21:36.9956 -0800 error 0x458148 0x0 sandboxd[392] (sandboxd): Sandbox: SafariBookmarksS(974) deny(1) user-preference-read com.apple.CloudKit...", + "2022-02-14 16:22:03.9557 -0800 error 0x45863d 0x0 sandboxd[392] (sandboxd): Sandbox: imagent(887) deny(1) user-preference-read com.apple.TelephonyUtilities...", + "2022-02-14 16:22:12.6416 -0800 error 0x458959 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577332...", + "2022-02-14 16:22:12.6626 -0800 error 0x458959 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/dad5e7e94ff85bdb82ad12a99afe0df9427bcfd987c77ad0f3428e5954224642\/666577332...", + "2022-02-14 16:22:24.6180 -0800 error 0x458959 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/eab90e592de9b3bf59e9daeb7de937c87b26e05b7c8069bf7850b0e074f8efae\/666577344...", + "2022-02-14 16:22:24.6583 -0800 error 0x4589fa 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577344...", + "2022-02-14 16:22:37.7670 -0800 error 0x458aae 0x0 sandboxd[392] (sandboxd): Sandbox: bird(800) deny(1) file-read-data \/Users\/mib...", + "2022-02-14 16:22:48.1285 -0800 error 0x458c6b 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:22:48.4287 -0800 error 0x458c6b 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.WebKit(91435) deny(1) mach-lookup com.apple.distributed_notifications@Uv3...", + "2022-02-14 16:23:07.0004 -0800 error 0x458e11 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:23:22.8418 -0800 error 0x458ecd 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577402...", + "2022-02-14 16:23:22.8540 -0800 error 0x458ecd 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/dad5e7e94ff85bdb82ad12a99afe0df9427bcfd987c77ad0f3428e5954224642\/666577402...", + "2022-02-14 16:23:24.8429 -0800 error 0x458ecd 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577404...", + "2022-02-14 16:23:25.6030 -0800 error 0x458ecd 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:23:38.3934 -0800 error 0x45900e 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:23:48.4182 -0800 error 0x45900f 0x0 sandboxd[392] (sandboxd): Sandbox: SafariBookmarksS(974) deny(1) user-preference-read com.apple.CloudKit...", + "2022-02-14 16:23:51.9232 -0800 error 0x459097 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.WebKit(88932) deny(1) file-read-data \/Library\/Application Support\/CrashReporter\/SubmitDiagInfo.domains...", + "2022-02-14 16:24:10.9941 -0800 error 0x459097 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577450...", + "2022-02-14 16:24:27.3656 -0800 error 0x459334 0x0 sandboxd[392] (sandboxd): Sandbox: imagent(887) deny(1) user-preference-read com.apple.TelephonyUtilities...", + "2022-02-14 16:24:31.0444 -0800 error 0x459334 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577471...", + "2022-02-14 16:24:31.0606 -0800 error 0x459334 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/dad5e7e94ff85bdb82ad12a99afe0df9427bcfd987c77ad0f3428e5954224642\/666577471...", + "2022-02-14 16:24:45.1200 -0800 error 0x459509 0x0 sandboxd[392] (sandboxd): Sandbox: dasd(375) allow lsopen...", + "2022-02-14 16:24:48.2464 -0800 error 0x459334 0x0 sandboxd[392] (sandboxd): Sandbox: gamed(8865) deny(1) iokit-get-properties IsEphemeral...", + "2022-02-14 16:24:48.6283 -0800 error 0x459509 0x0 sandboxd[392] (sandboxd): Sandbox: gamed(8865) deny(1) iokit-get-properties IsEphemeral...", + "2022-02-14 16:24:58.3591 -0800 error 0x4595f3 0x0 sandboxd[392] (sandboxd): Sandbox: imagent(887) deny(1) user-preference-read com.apple.TelephonyUtilities...", + "2022-02-14 16:25:13.9822 -0800 error 0x4595f3 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.Safari(964) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:25:37.1983 -0800 error 0x45979b 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577537...", + "2022-02-14 16:25:37.2143 -0800 error 0x45979b 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/dad5e7e94ff85bdb82ad12a99afe0df9427bcfd987c77ad0f3428e5954224642\/666577537...", + "2022-02-14 16:25:39.7584 -0800 error 0x45979b 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.WebKit(68489) deny(1) mach-lookup com.apple.system.opendirectoryd.libinfo...", + "2022-02-14 16:25:39.7586 -0800 error 0x45979b 0x0 sandboxd[392] (sandboxd): 0x1b533c000 - 0x1b669bffe com.apple.JavaScriptCore (17613 - 17613.1.16.1.2) <0bc0ad5e-cf86-30d3-8998-afe6714856c3> \/System\/Library\/Frameworks\/JavaScriptCore.framework\/Versions\/A\/JavaScriptCore...", + "2022-02-14 16:25:45.2146 -0800 error 0x45989e 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577545...", + "2022-02-14 16:25:53.6823 -0800 error 0x45979b 0x0 sandboxd[392] (sandboxd): Sandbox: systemsoundserve(819) deny(1) file-read-metadata \/Library\/Apple\/usr\/libexec\/oah\/libRosettaRuntime...", + "2022-02-14 16:26:09.3013 -0800 error 0x459a44 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577569...", + "2022-02-14 16:26:09.3288 -0800 error 0x459a44 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/dad5e7e94ff85bdb82ad12a99afe0df9427bcfd987c77ad0f3428e5954224642\/666577569...", + "2022-02-14 16:26:15.6592 -0800 error 0x459a76 0x0 sandboxd[392] (sandboxd): Sandbox: systemsoundserve(819) deny(1) file-read-metadata \/Library\/Apple\/usr\/libexec\/oah\/libRosettaRuntime...", + "2022-02-14 16:26:37.2589 -0800 error 0x459c28 0x0 sandboxd[392] (sandboxd): Sandbox: SafariBookmarksS(974) deny(1) user-preference-read com.apple.CloudKit...", + "2022-02-14 16:26:37.3814 -0800 error 0x459a76 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577597...", + "2022-02-14 16:26:41.7112 -0800 error 0x459c28 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.WebKit(68489) deny(1) mach-lookup com.apple.system.opendirectoryd.libinfo...", + "2022-02-14 16:26:41.7115 -0800 error 0x459c28 0x0 sandboxd[392] (sandboxd): 0x1b533c000 - 0x1b669bffe com.apple.JavaScriptCore (17613 - 17613.1.16.1.2) <0bc0ad5e-cf86-30d3-8998-afe6714856c3> \/System\/Library\/Frameworks\/JavaScriptCore.framework\/Versions\/A\/JavaScriptCore...", + "2022-02-14 16:26:46.0770 -0800 error 0x459a76 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.WebKit(68489) deny(1) mach-lookup com.apple.system.opendirectoryd.libinfo...", + "2022-02-14 16:26:46.0774 -0800 error 0x459a76 0x0 sandboxd[392] (sandboxd): 0x1a9804000 - 0x1a9f68ffc com.apple.MediaToolbox (1.0 - 2940.17.2) <27e706a6-5d69-3df5-b87c-bcda8e439358> \/System\/Library\/Frameworks\/MediaToolbox.framework\/Versions\/A\/MediaToolbox...", + "2022-02-14 16:26:53.9795 -0800 error 0x459cd6 0x0 sandboxd[392] (sandboxd): Sandbox: dasd(375) allow lsopen...", + "2022-02-14 16:27:13.1209 -0800 error 0x459efa 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:27:21.3889 -0800 error 0x459cd6 0x0 sandboxd[392] (sandboxd): Sandbox: bird(800) deny(1) file-read-data \/Users\/mib...", + "2022-02-14 16:27:25.5366 -0800 error 0x459ffa 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577645...", + "2022-02-14 16:27:41.5833 -0800 error 0x459ffa 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577661...", + "2022-02-14 16:27:44.6079 -0800 error 0x45a252 0x0 sandboxd[392] (sandboxd): Sandbox: bird(800) deny(1) file-read-data \/Users\/mib...", + "2022-02-14 16:27:49.6048 -0800 error 0x45a252 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577669...", + "2022-02-14 16:27:53.3640 -0800 error 0x459ffa 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:27:55.8095 -0800 error 0x45a252 0x0 sandboxd[392] (sandboxd): Sandbox: dasd(375) allow lsopen...", + "2022-02-14 16:28:15.5527 -0800 error 0x45a6c3 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:28:21.3943 -0800 error 0x45a6c3 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:28:27.6808 -0800 error 0x45a846 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:28:42.1426 -0800 error 0x45ab28 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.WebKit(88922) deny(1) file-read-data \/Library\/Application Support\/CrashReporter\/SubmitDiagInfo.domains...", + "2022-02-14 16:28:49.8098 -0800 error 0x45ab5a 0x0 sandboxd[392] (sandboxd): Sandbox: SafariBookmarksS(974) deny(1) user-preference-read com.apple.CloudKit...", + "2022-02-14 16:28:52.5428 -0800 error 0x45ab5a 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:28:56.7008 -0800 error 0x45ab5a 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:29:01.3586 -0800 error 0x45ab5a 0x0 sandboxd[392] (sandboxd): Sandbox: pboard(822) deny(1) mach-task-name others [Slack(68777)]...", + "2022-02-14 16:29:39.9316 -0800 error 0x45ab5a 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577779...", + "2022-02-14 16:29:39.9445 -0800 error 0x45ab5a 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/dad5e7e94ff85bdb82ad12a99afe0df9427bcfd987c77ad0f3428e5954224642\/666577779...", + "2022-02-14 16:29:49.4988 -0800 error 0x45aea1 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication...", + "2022-02-14 16:29:49.9347 -0800 error 0x45aea1 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/19fe304b4c54e7dd9ae4725b53c9103a93bc7307846aea7de1a387b35faa3e87\/666577789...", + "2022-02-14 16:29:50.8918 -0800 error 0x45ab5a 0x0 sandboxd[392] (sandboxd): Sandbox: com.apple.WebKit(68489) deny(1) mach-lookup com.apple.system.opendirectoryd.libinfo...", + "2022-02-14 16:29:50.8924 -0800 error 0x45ab5a 0x0 sandboxd[392] (sandboxd): 0x101138000 - 0x10119507b dyld (954) <41293cda-474b-3700-924e-6ba0f7698eac> \/usr\/lib\/dyld...", + "2022-02-14 16:30:12.3334 -0800 error 0x45b00b 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/c4dd0e03b36926e0d7a27512d252ca886b47c18a1f480fc4c27e46f5af8e9330\/666577812...", + "2022-02-14 16:30:12.3449 -0800 error 0x45b00b 0x0 sandboxd[392] (sandboxd): System Policy: mds(346) deny(1) file-read-data \/private\/var\/db\/searchparty\/sharedVault\/BeaconPayloadCache\/f399b3f74e0cbe08c19ad27837c84857db5cd59fb390ca04b89445a14a7a091a\/666577812...", + "2022-02-14 16:30:30.2995 -0800 error 0x45b0d0 0x0 sandboxd[392] (sandboxd): Sandbox: contentlinkingd(1031) deny(1) user-preference-read kCFPreferencesAnyApplication..." +] +} Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test =================================================================== --- /dev/null +++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test @@ -0,0 +1,10 @@ +# RUN: %clang_host -g %S/Inputs/test.c -o %t.out + +# RUN: cp %S/Inputs/scripted_crashlog.ips %t.crash +# RUN: %python %S/patch-crashlog.py --binary %t.out --crashlog %t.crash --offsets '{"main":20, "bar":9, "foo":16}' --json +# RUN: %lldb %t.out -o 'command script import lldb.macosx.crashlog' -o 'crashlog -i %t.crash' -o 'process status' 2>&1 | FileCheck %s + +# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands +# CHECK: Process 92190 stopped +# CHECK: * thread #1, name = 'CrashLogScriptedThread.thread-0', stop reason = EXC_BAD_ACCESS +# CHECK: frame #0: 0x0000000104a23f68 scripted_crashlog_json.test.tmp.out`foo at test.c:3:6 [artificial]