Skip to content

Commit 8f0546a

Browse files
fixup! Address review comments
1 parent c03caaf commit 8f0546a

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,17 +2603,16 @@ static llvm::Expected<addr_t> ReadRegisterAsAddress(RegisterContext &regctx,
26032603

26042604
/// Functional wrapper to read a pointer from process memory at `addr +
26052605
/// offset`.
2606-
static llvm::Expected<addr_t>
2607-
ReadPtrFromAddr(Process &process, llvm::Expected<addr_t> addr, int offset = 0) {
2608-
if (!addr)
2609-
return addr;
2606+
static llvm::Expected<addr_t> ReadPtrFromAddr(Process &process, addr_t addr,
2607+
int offset = 0) {
26102608
Status error;
2611-
addr_t ptr = process.ReadPointerFromMemory(*addr + offset, error);
2609+
addr_t ptr = process.ReadPointerFromMemory(addr + offset, error);
26122610
if (ptr != LLDB_INVALID_ADDRESS)
26132611
return ptr;
26142612
return llvm::createStringError("SwiftLanguageRuntime: Failed to read ptr "
2615-
"from memory address 0x%8.8" PRIx64,
2616-
*addr + offset);
2613+
"from memory address 0x%8.8" PRIx64
2614+
" Error was %s",
2615+
addr + offset, error.AsCString());
26172616
}
26182617

26192618
/// Computes the Canonical Frame Address (CFA) by converting the abstract
@@ -2703,7 +2702,9 @@ static llvm::Expected<addr_t> ReadAsyncContextRegisterFromUnwind(
27032702
case RestoreType::atCFAPlusOffset: {
27042703
llvm::Expected<addr_t> cfa =
27052704
GetCFA(process, regctx, unwind_regkind, row->GetCFAValue());
2706-
return ReadPtrFromAddr(process, std::move(cfa), regloc.GetOffset());
2705+
if (!cfa)
2706+
return cfa.takeError();
2707+
return ReadPtrFromAddr(process, *cfa, regloc.GetOffset());
27072708
}
27082709
case RestoreType::isCFAPlusOffset: {
27092710
if (llvm::Expected<addr_t> cfa =
@@ -2736,7 +2737,7 @@ SwiftLanguageRuntime::GetRuntimeUnwindPlan(ProcessSP process_sp,
27362737
LLDB_SCOPED_TIMER();
27372738
auto log_expected = [](llvm::Error error) {
27382739
Log *log = GetLog(LLDBLog::Unwind);
2739-
LLDB_LOG_ERROR(log, std::move(error), "SwiftLanguageRuntime: error {0}");
2740+
LLDB_LOG_ERROR(log, std::move(error), "{0}");
27402741
return UnwindPlanSP();
27412742
};
27422743

lldb/test/API/lang/swift/async/unwind/unwind_in_all_instructions/TestSwiftAsyncUnwindAllInstructions.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
# frame from another virtual frame.
2121
# * The plan for ASYNC___3___ -> ASYNC___4___ is created through
2222
# GetFollowAsyncContextUnwindPlan, but this time it follow the code path where
23-
# `is_indirect = True` (see its implementation).
23+
# `is_indirect = true` (see its implementation).
2424
# * The plan for ASYNC___4___ -> ASYNC___5___ is created through the same code
25-
# path as the previous one. It is not technically needed, but we keep it here
26-
# because it is the first time where we should be creating an identical plan as
27-
# the one from the previous frame.
25+
# path as the previous one. However, it is the first time an unwind plan
26+
# created from that path is used to create another unwind plan.
2827

2928
class TestCase(lldbtest.TestBase):
3029

lldb/test/API/lang/swift/async/unwind/unwind_in_all_instructions/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func ASYNC___1___(cond: Int) async -> Int {
1414
work()
1515
if (cond + i == 3) {
1616
await async_work()
17-
print("breaking here!")
17+
print("exiting loop here!")
1818
break;
1919
}
2020
}

0 commit comments

Comments
 (0)