Fall back to dyld's _dyld_start when no LC_MAIN / main() func can be found
The new DriverKit user-land kernel drivers in macOS 10.15 / Catalina do not have a main() function or an LC_MAIN load command. lldb uses the address of main() as the return address for inferior function calls; it puts a breakpoint on main, runs the inferior function call, and when the main() breakpoint is hit, lldb knows unambiguously that the inferior function call ran to completion - no other function calls main. This change hoists the logic for finding the "entry address" from ThreadPlanCallFunction to Target. It changes the logic to first try to get the entry address from the main executable module, but if that module does not have one, it will iterate through all modules looking for an entry address. The patch also adds code to ObjectFileMachO to use dyld's _dyld_start function as an entry address. <rdar://problem/52343958> Differential Revision: https://reviews.llvm.org/D64897 llvm-svn: 366493
Loading
Please register or sign in to comment