[lldb] Track the target's executable instead of guessing (#228131)
When no module had type eTypeExecutable, Target::GetExecutableModule
returned the first image. A main executable can be a shared library,
such as an ELF PIE or firmware, and in the common case the fallback
found it. But a target with only libraries got one of them back as its
executable, and when the executable was removed, the next image took its
place.
Have the target remember which module is its executable, and return
nullptr when it has none. A target that only had libraries added to it
now reports no executable. Callers that dereferenced the result without
a check now handle nullptr.
GitOrigin-RevId: 839f8621d7256651de4aeae2c65993b87d62c29d
22 files changed