Skip to content

Commit 2d61475

Browse files
committed
Fix the branch island handling to account for the other possible
forms: '.island2' and '.island.2'. Also add more padding so that we produce an island that takes several jumps.
1 parent 9bcf633 commit 2d61475

File tree

6 files changed

+26
-12
lines changed

6 files changed

+26
-12
lines changed

lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,10 +1030,15 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread,
10301030
thread, load_addrs, stop_others);
10311031
}
10321032
// 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")) {
1033+
// TEXT symbols but their names end in .island plus maybe a .digit suffix.
1034+
// They are to allow arm64 code to branch further than the size of the
1035+
// address slot allows. We just need to single-instruction step in that
1036+
// case.
1037+
static const char *g_branch_island_pattern = "\\.island\\.?[0-9]*$";
1038+
static RegularExpression g_branch_island_regex(g_branch_island_pattern);
1039+
1040+
bool is_branch_island = g_branch_island_regex.Execute(current_name);
1041+
if (!thread_plan_sp && is_branch_island) {
10371042
thread_plan_sp = std::make_shared<ThreadPlanStepInstruction>(
10381043
thread,
10391044
/* step_over= */ false, /* stop_others */ false, eVoteNoOpinion,

lldb/test/API/macosx/branch-islands/Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ CFLAGS_EXTRAS := -std=c99
33

44
include Makefile.rules
55

6-
a.out: main.o padding1.o padding2.o foo.o
7-
${CC} ${LDFLAGS} foo.o padding1.o padding2.o main.o -o a.out
6+
a.out: main.o padding1.o padding2.o padding3.o padding4.o foo.o
7+
${CC} ${LDFLAGS} foo.o padding1.o padding2.o padding3.o padding4.o main.o -o a.out
88

9-
padding1.o: padding1.s
10-
${CC} -c $(SRCDIR)/padding1.s
9+
%.o: $(SRCDIR)/%.s
10+
${CC} -c $<
1111

12-
padding2.o: padding2.s
13-
${CC} -c $(SRCDIR)/padding2.s
12+
#padding1.o: padding1.s
13+
# ${CC} -c $(SRCDIR)/padding1.s
14+
15+
#padding2.o: padding2.s
16+
# ${CC} -c $(SRCDIR)/padding2.s
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.text
2-
_junk1:
2+
_padding1:
33
.space 120*1024*1024
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.text
2-
_junk2:
2+
_padding2:
33
.space 120*1024*1024
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.text
2+
_padding3:
3+
.space 120*1024*1024
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.text
2+
_padding4:
3+
.space 120*1024*1024

0 commit comments

Comments
 (0)