This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add more dylib paths for exception breakpoints
ClosedPublic

Authored by fdeazeve on Aug 24 2022, 1:09 PM.

Details

Summary

When setting a breakpoint upon throwing exceptions, LLDB only
searches for the libc++abi code inside dylibs named:

  1. libc++abi.dylib
  2. libSystem.B.dylib

However, this fails to account for libs with a version number. For
example, when building the libcxx and libcxxabi runtimes, the following
dylibs are generated:

build/lib/libc++abi.1.0.dylib
build/lib/libc++abi.1.dylib -> libc++abi.1.0.dylib
build/lib/libc++abi.dylib -> libc++abi.1.dylib

If we are debugging a program linked against any of the "versioned"
libs, the breakpoint doesn't work. This commit adds these names to the
search list.

Diff Detail

Event Timeline

fdeazeve created this revision.Aug 24 2022, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 1:09 PM
fdeazeve requested review of this revision.Aug 24 2022, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 1:09 PM
aprantl added a subscriber: aprantl.
aprantl added inline comments.
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
457

Should these be ordered such that the most likely matches on the most modern systems come first?

fdeazeve added inline comments.Aug 24 2022, 1:18 PM
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
457

According to @jasonmolenda, the order is not relevant from a practical point of view, as breakpoints will be set in _all_ of the above (if they exist). Unless your intent here is for readers to know which files are more common?

aprantl added inline comments.Aug 24 2022, 1:37 PM
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
457

I also just realized that the ones you added here are the less common ones. So this LGTM

jingham accepted this revision.Aug 24 2022, 2:03 PM

LGTM too.

This revision is now accepted and ready to land.Aug 24 2022, 2:03 PM
fdeazeve added inline comments.Aug 25 2022, 3:45 AM
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
457

For the reference of future readers, my previous comment was incorrect, as I had misinterpreted something. The order matters in that, whenever a new dylib is loaded, its name is checked against this list. The earlier the match, the earlier we stop the search.

This revision was automatically updated to reflect the committed changes.