29 lines · python
1import lldb2 3 4def report_command(debugger, command, exe_ctx, result, internal_dict):5 result.AppendMessage(6 f'{lldb.num_module_inits} {lldb.num_target_inits} "{lldb.target_name}"'7 )8 result.SetStatus(lldb.eReturnStatusSuccessFinishResult)9 10 11def __lldb_init_module(debugger, internal_dict):12 # We only want to make one copy of the report command so it will be shared13 if "has_dsym_1" in __name__:14 # lldb is a convenient place to store our counters.15 lldb.num_module_inits = 016 lldb.num_target_inits = 017 lldb.target_name = "<unknown>"18 19 debugger.HandleCommand(20 f"command script add -o -f '{__name__}.report_command' report_command"21 )22 23 lldb.num_module_inits += 124 25 26def __lldb_module_added_to_target(target, internal_dict):27 lldb.num_target_inits += 128 target_name = target.executable.fullpath29