Created
May 16, 2025 14:39
-
-
Save BlueFalconHD/1c7f1694c8f2b8ec854edecd2219f5df to your computer and use it in GitHub Desktop.
LLDB script that prints all os log subsystems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lldb | |
def _on_hit(frame, bp_loc, _dict): | |
process = frame.GetThread().GetProcess() | |
error = lldb.SBError() | |
# os_log_t os_log_create(const char *subsystem <$x0>, const char *category <$x1>); | |
p_sub = frame.EvaluateExpression("$x0").GetValueAsUnsigned() | |
p_cat = frame.EvaluateExpression("$x1").GetValueAsUnsigned() | |
# read as c-strings | |
subsystem = process.ReadCStringFromMemory(p_sub, 256, error) \ | |
if error.Success() else "<unreadable>" | |
category = process.ReadCStringFromMemory(p_cat, 256, error) \ | |
if error.Success() else "<unreadable>" | |
print(f'os_log_create(subsystem: "{subsystem}", category: "{category}")') | |
# log and keep going | |
return False | |
def __lldb_init_module(debugger, _dict): | |
target = debugger.GetSelectedTarget() | |
bp = target.BreakpointCreateByName("os_log_create") | |
bp.SetScriptCallbackFunction(__name__ + "._on_hit") | |
print("🌀 os_log_create logger is active.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment