26
26
#include " lldb/Target/Thread.h"
27
27
#include " lldb/Target/ThreadPlanCallFunction.h"
28
28
#include " lldb/Target/ThreadPlanRunToAddress.h"
29
+ #include " lldb/Target/ThreadPlanStepInstruction.h"
29
30
#include " lldb/Utility/DataBuffer.h"
30
31
#include " lldb/Utility/DataBufferHeap.h"
31
32
#include " lldb/Utility/LLDBLog.h"
@@ -923,15 +924,15 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
923
924
if (current_symbol != nullptr ) {
924
925
std::vector<Address> addresses;
925
926
927
+ ConstString current_name =
928
+ current_symbol->GetMangled ().GetName (Mangled::ePreferMangled);
926
929
if (current_symbol->IsTrampoline ()) {
927
- ConstString trampoline_name =
928
- current_symbol->GetMangled ().GetName (Mangled::ePreferMangled);
929
930
930
- if (trampoline_name ) {
931
+ if (current_name ) {
931
932
const ModuleList &images = target_sp->GetImages ();
932
933
933
934
SymbolContextList code_symbols;
934
- images.FindSymbolsWithNameAndType (trampoline_name , eSymbolTypeCode,
935
+ images.FindSymbolsWithNameAndType (current_name , eSymbolTypeCode,
935
936
code_symbols);
936
937
for (const SymbolContext &context : code_symbols) {
937
938
Address addr = context.GetFunctionOrSymbolAddress ();
@@ -945,8 +946,8 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
945
946
}
946
947
947
948
SymbolContextList reexported_symbols;
948
- images.FindSymbolsWithNameAndType (
949
- trampoline_name, eSymbolTypeReExported, reexported_symbols);
949
+ images.FindSymbolsWithNameAndType (current_name, eSymbolTypeReExported,
950
+ reexported_symbols);
950
951
for (const SymbolContext &context : reexported_symbols) {
951
952
if (context.symbol ) {
952
953
Symbol *actual_symbol =
@@ -968,7 +969,7 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
968
969
}
969
970
970
971
SymbolContextList indirect_symbols;
971
- images.FindSymbolsWithNameAndType (trampoline_name , eSymbolTypeResolver,
972
+ images.FindSymbolsWithNameAndType (current_name , eSymbolTypeResolver,
972
973
indirect_symbols);
973
974
974
975
for (const SymbolContext &context : indirect_symbols) {
@@ -1028,6 +1029,18 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
1028
1029
thread_plan_sp = std::make_shared<ThreadPlanRunToAddress>(
1029
1030
thread, load_addrs, stop_others);
1030
1031
}
1032
+ // One more case we have to consider is "branch islands". These are regular
1033
+ // TEXT symbols but their names end in .island. They are to allow arm64
1034
+ // code to branch further than the size of the address slot allows. We
1035
+ // just need to single-instruction step in that case.
1036
+ if (!thread_plan_sp && current_name.GetStringRef ().ends_with (" .island" )) {
1037
+ thread_plan_sp = std::make_shared<ThreadPlanStepInstruction>(
1038
+ thread,
1039
+ /* step_over= */ false , /* stop_others */ false , eVoteNoOpinion,
1040
+ eVoteNoOpinion);
1041
+ LLDB_LOG (log, " Stepping one instruction over branch island: '{0}'." ,
1042
+ current_name);
1043
+ }
1031
1044
} else {
1032
1045
LLDB_LOGF (log, " Could not find symbol for step through." );
1033
1046
}
0 commit comments