This is an archive of the discontinued LLVM Phabricator instance.

Add the ability to debug through an exec into ld
ClosedPublic

Authored by clayborg on May 9 2022, 11:52 AM.

Details

Summary

A previous commit enabled LLDB to be able to debug a program launched via ld: https://reviews.llvm.org/D108061.

This commit adds the ability to debug a program launched via ld when it happens during an exec into the dynamic loader. There was an issue where after the exec we would locate the rendezvous structure right away but it didn't contain any valid values and we would try to set the dyanamic loader breakpoint at address zero. This patch fixes that and adds a test.

Diff Detail

Event Timeline

clayborg created this revision.May 9 2022, 11:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 11:52 AM
clayborg requested review of this revision.May 9 2022, 11:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 11:52 AM
yinghuitan added inline comments.May 9 2022, 12:10 PM
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
312

Since zero break address is considered invalid, maybe move m_rendezvous.GetBreakAddress() != 0 check into DYLDRendezvous::IsValid() method?

clayborg added inline comments.May 9 2022, 2:56 PM
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
312

I wanted to be safe and not mess up anyone else that might be using m_rendezvous.IsValid() as it isn't super clear what IsValid() should return. So to be super safe and not affect any other code, I would prefer to leave it this way unless one of the original authors of this file has a different opinion.

wallace accepted this revision.May 9 2022, 3:47 PM

nice!

This revision is now accepted and ready to land.May 9 2022, 3:47 PM
This revision was automatically updated to reflect the committed changes.