Git Product home page Git Product logo

Comments (4)

hello-david avatar hello-david commented on August 15, 2024

说法是不是反了,以pod形式引入组件相当于引入一个Framework,mth_stack_backtrace_of_thread的偏移理当是在这个Framework里面吧。

from mthawkeye.

mademao avatar mademao commented on August 15, 2024

有点笔误。
通过pod导入之后,mth_stack_backtrace_of_thread的偏移是在这个Framework中,所以在调用栈回溯的时候是可以正常回溯的。
但是如果是手动导入的话,mth_stack_backtrace_of_thread在主项目MachO文件的Dynamic Load Info中,在调用栈回溯时,当回溯到mth_stack_backtrace_of_thread方法时即停止,无法回溯更上层方法。

具体我写了一个Demo,其中手动引入了与mth_stack_backtrace.hm代码一致的两个文件,并重命名相关内容。之后在同一个位置使用两个文件来回溯调用栈,得到的信息如下:

手动导入:

0x7fff51b5adfa---mach_msg_trap
0x105bdb70b---_ZNK16ImageLoaderMachO24getExportedSymbolAddressEPKN11ImageLoader6SymbolERKNS0_11LinkContextEPKS0_bPKc
0x105bd4b5e---_ZNK11ImageLoader25findExportedSymbolAddressERKNS_11LinkContextEPKcPKS_ibPS6_Pm
0x105bdf8d8---ZN26ImageLoaderMachOCompressed15resolveTwolevelERKN11ImageLoader11LinkContextEPKcPKS0_S7_jbbPS7
0x105bdfb46---_ZN26ImageLoaderMachOCompressed7resolveERKN11ImageLoader11LinkContextEPKchlPPKS0_PNS_10LastLookupEb
0x105c1b86b---GCC_except_table4

Pod导入:

0x7fff51b5adfa---mach_msg_trap
0x7fff51b61ae6---thread_get_state
0x105b933fe---mth_stack_backtrace_of_thread
0x105b86c6d----[ViewController touchesEnded:withEvent:]
0x7fff48cb94e1---forwardTouchMethod
0x7fff48cb95b0----[UIResponder touchesEnded:withEvent:]
0x7fff48cc858b----[UIWindow _sendTouchesForEvent:]
0x7fff48cca310----[UIWindow sendEvent:]
0x7fff48ca4754----[UIApplication sendEvent:]
0x7fff48d2f551---__dispatchPreprocessedEventFromEventQueue
0x7fff48d32715---__handleEventQueueInternal
0x7fff48d28fb8---__handleHIDEventFetcherDrain
0x7fff23da0d30---CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
0x7fff23da0c5b---__CFRunLoopDoSource0
0x7fff23da0433---__CFRunLoopDoSources0
0x7fff23d9b02d---__CFRunLoopRun
0x7fff23d9a943---CFRunLoopRunSpecific
0x7fff38ba6c19---GSEventRunModal
0x7fff48c8b9eb---UIApplicationMain
0x105b870a1---main
0x7fff51a231fc---start

可以看出如果手动导入mth_stack_backtrace文件时,它的回溯功能是不完全的。

from mthawkeye.

hello-david avatar hello-david commented on August 15, 2024

@mademao 我没看太懂,你这个Demo是dyld加载后第一次读取镜像符号显示上面那段把?后面再次点击手动导入跟pod导入显示的堆栈符号是一致的。可以请教一下@euanchan

from mthawkeye.

mademao avatar mademao commented on August 15, 2024

@hello-david “后面再次点击手动导入跟pod导入显示的堆栈符号是一致的”,这个结论应该是在模拟器上得出的吧。可以尝试连接真机,真机每次点击手动导入显示的堆栈符号都不完整。

另外我目前找到了一个解决方案:调整手动导入所在工程最低编译版本低于iOS13.0即可解决问题。这也应该是pod导入不存在堆栈显示不完整问题的原因。

至于为什么最低编译版本在iOS13之上时候会出现这个问题,可能是苹果对编译过程做了调整,具体原因还需要抽空调研一下。

from mthawkeye.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.