frame #1和frame #2
这种情况需要怎么定位
frame #0: 0x00000001025769f8 TargetApp`-[LogManager log:]
frame #1: 0x0000000120e4401c
frame #2: 0x0000000120e4401c
frame #3: 0x00000002005b0ac4 UIKitCore`-[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 64
frame #4: 0x00000002005b8ccc UIKitCore`_UIGestureRecognizerSendTargetActions + 124
frame #5: 0x00000002005b6670 UIKitCore`_UIGestureRecognizerSendActions + 316
frame #6: 0x00000002005b5b9c UIKitCore`-[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 760
frame #7: 0x00000002005a9c78 UIKitCore`_UIGestureEnvironmentUpdate + 2180
frame #8: 0x00000002005a93a8 UIKitCore`-[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 384
frame #9: 0x00000002005a9188 UIKitCore`-[UIGestureEnvironment _updateForEvent:window:] + 204
frame #10: 0x00000002009c17d0 UIKitCore`-[UIWindow sendEvent:] + 3112
frame #11: 0x00000002009a185c UIKitCore`-[UIApplication sendEvent:] + 340
frame #12: 0x0000000200a679d4 UIKitCore`__dispatchPreprocessedEventFromEventQueue + 1768
RSEf
2
看一下地址落在哪个模块范围?
这个UIGestureRecognizerTarget可以通过- target显示目标对象和sel
脚本:
SBFrame→SBModule→SBFileSpec→fileName
↓
SBFrame→SBSymbol→startAddress
我这个当时应该是因为引入了一个hook框架导致的.把hook框架移除之后调试就没问题了
yangyss
(yangyss)
6
获得文件名,有2中途径,一种是从 模块->文件规范…得到对应的name和地址
另外一种是通过 符号得到,其中,符号得到的方式 有两种情况
SBFrame->(SBFunction/SBSymbol)-> 然后就能或者 对应name 地址
而bt指令,就是这么实现的:
def print_stacktrace(thread, string_buffer=False):
"""Prints a simple stack trace of this thread."""
output = io.StringIO() if string_buffer else sys.stdout
target = thread.GetProcess().GetTarget()
depth = thread.GetNumFrames()
mods = get_module_names(thread)
funcs = get_function_names(thread)
symbols = get_symbol_names(thread)
files = get_filenames(thread)
lines = get_line_numbers(thread)
addrs = get_pc_addresses(thread)
if thread.GetStopReason() != lldb.eStopReasonInvalid:
desc = "stop reason=" + stop_reason_to_str(thread.GetStopReason())
else:
desc = ""
print("Stack trace for thread id={0:#x} name={1} queue={2} ".format(
thread.GetThreadID(), thread.GetName(), thread.GetQueueName()) + desc, file=output)
for i in range(depth):
frame = thread.GetFrameAtIndex(i)
function = frame.GetFunction()
load_addr = addrs[i].GetLoadAddress(target)
if not function:
file_addr = addrs[i].GetFileAddress()
start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress()
symbol_offset = file_addr - start_addr
print(" frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}".format(
num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset), file=output)
else:
print(" frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}".format(
num=i, addr=load_addr, mod=mods[i], func='%s [inlined]' %
funcs[i] if frame.IsInlined() else funcs[i], file=files[i], line=lines[i], args=get_args_as_string(
frame, showFuncName=False) if not frame.IsInlined() else '()'), file=output)
if string_buffer:
return output.getvalue()
出现上述问题,基本就是上面代码里,哪里出问题了。或者被人针对处理了
补充下,文件路径:
…/llvm-project/lldb/utils/lui/lldbutil.py
要是有这种bt后不显示模块的样本可以发下大家一起研究看看