brintos

brintos / llvm-project-archived public Read only

0
0
Text · 797 B · c699355 Raw
25 lines · python
1#!/usr/bin/env python2 3 4def __lldb_init_module(debugger, internal_dict):5    debugger.HandleCommand(6        f"command alias in_call_stack breakpoint command add --python-function {__name__}.in_call_stack -k name -v %1"7    )8 9 10def in_call_stack(frame, bp_loc, arg_dict, _):11    """Only break if the given name is in the current call stack."""12    name = arg_dict.GetValueForKey("name").GetStringValue(1000)13    thread = frame.GetThread()14    found = False15    for frame in thread.frames:16        # Check the symbol.17        symbol = frame.GetSymbol()18        if symbol and name in frame.GetSymbol().GetName():19            return True20        # Check the function.21        function = frame.GetFunction()22        if function and name in function.GetName():23            return True24    return False25