@@ -1176,8 +1176,7 @@ void SwiftLanguageRuntime::FindFunctionPointersInCall(
1176
1176
if (target_context.symbol )
1177
1177
fn_ptr_address = target_context.symbol ->GetAddress ();
1178
1178
else if (target_context.function )
1179
- fn_ptr_address =
1180
- target_context.function ->GetAddressRange ().GetBaseAddress ();
1179
+ fn_ptr_address = target_context.function ->GetAddress ();
1181
1180
}
1182
1181
}
1183
1182
}
@@ -1602,13 +1601,14 @@ class ProjectionSyntheticChildren : public SyntheticChildren {
1602
1601
return nullptr ;
1603
1602
}
1604
1603
1605
- size_t GetIndexOfChildWithName (ConstString name) override {
1604
+ llvm::Expected< size_t > GetIndexOfChildWithName (ConstString name) override {
1606
1605
for (size_t idx = 0 ; idx < m_projection->field_projections .size ();
1607
1606
idx++) {
1608
1607
if (m_projection->field_projections .at (idx).name == name)
1609
1608
return idx;
1610
1609
}
1611
- return UINT32_MAX;
1610
+ return llvm::createStringError (" Type has no child named '%s'" ,
1611
+ name.AsCString ());
1612
1612
}
1613
1613
1614
1614
lldb::ChildCacheState Update () override {
@@ -2486,7 +2486,7 @@ static llvm::Expected<addr_t> ReadPtrFromAddr(Process &process, addr_t addr,
2486
2486
// / access to those here would be challenging.
2487
2487
static llvm::Expected<addr_t > GetCFA (Process &process, RegisterContext ®ctx,
2488
2488
addr_t pc_offset,
2489
- UnwindPlan &unwind_plan) {
2489
+ const UnwindPlan &unwind_plan) {
2490
2490
auto *row = unwind_plan.GetRowForFunctionOffset (pc_offset);
2491
2491
if (!row)
2492
2492
return llvm::createStringError (
@@ -2516,22 +2516,22 @@ static llvm::Expected<addr_t> GetCFA(Process &process, RegisterContext ®ctx,
2516
2516
cfa_loc.GetValueType ());
2517
2517
}
2518
2518
2519
- static UnwindPlanSP GetUnwindPlanForAsyncRegister (FuncUnwinders &unwinders,
2520
- Target &target,
2521
- Thread &thread) {
2519
+ static std::shared_ptr< const UnwindPlan>
2520
+ GetUnwindPlanForAsyncRegister (FuncUnwinders &unwinders, Target &target,
2521
+ Thread &thread) {
2522
2522
// We cannot trust compiler emitted unwind plans, as they respect the
2523
2523
// swifttail calling convention, which assumes the async register is _not_
2524
2524
// restored and therefore it is not tracked by compiler plans. If LLDB uses
2525
2525
// those plans, it may take "no info" to mean "register not clobbered". For
2526
2526
// those reasons, always favour the assembly plan first, it will try to track
2527
2527
// the async register by assuming the usual arm calling conventions.
2528
- if (UnwindPlanSP asm_plan = unwinders.GetAssemblyUnwindPlan (target, thread))
2528
+ if (auto asm_plan = unwinders.GetAssemblyUnwindPlan (target, thread))
2529
2529
return asm_plan;
2530
2530
// In the unlikely case the assembly plan is not available, try all others.
2531
2531
return unwinders.GetUnwindPlanAtNonCallSite (target, thread);
2532
2532
}
2533
2533
2534
- static llvm::Expected<UnwindPlanSP >
2534
+ static llvm::Expected<std::shared_ptr< const UnwindPlan> >
2535
2535
GetAsmUnwindPlan (Address pc, SymbolContext &sc, Thread &thread) {
2536
2536
FuncUnwindersSP unwinders =
2537
2537
pc.GetModule ()->GetUnwindTable ().GetFuncUnwindersContainingAddress (pc,
@@ -2541,7 +2541,7 @@ GetAsmUnwindPlan(Address pc, SymbolContext &sc, Thread &thread) {
2541
2541
" function unwinder at address 0x%8.8" PRIx64,
2542
2542
pc.GetFileAddress ());
2543
2543
2544
- UnwindPlanSP unwind_plan = GetUnwindPlanForAsyncRegister (
2544
+ auto unwind_plan = GetUnwindPlanForAsyncRegister (
2545
2545
*unwinders, thread.GetProcess ()->GetTarget (), thread);
2546
2546
if (!unwind_plan)
2547
2547
return llvm::createStringError (
@@ -2551,8 +2551,8 @@ GetAsmUnwindPlan(Address pc, SymbolContext &sc, Thread &thread) {
2551
2551
return unwind_plan;
2552
2552
}
2553
2553
2554
- static llvm::Expected<uint32_t > GetFpRegisterNumber (UnwindPlan &unwind_plan,
2555
- RegisterContext ®ctx) {
2554
+ static llvm::Expected<uint32_t >
2555
+ GetFpRegisterNumber ( const UnwindPlan &unwind_plan, RegisterContext ®ctx) {
2556
2556
uint32_t fp_unwind_regdomain;
2557
2557
if (!regctx.ConvertBetweenRegisterKinds (
2558
2558
lldb::eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FP,
@@ -2569,7 +2569,7 @@ static llvm::Expected<uint32_t> GetFpRegisterNumber(UnwindPlan &unwind_plan,
2569
2569
}
2570
2570
2571
2571
struct FrameSetupInfo {
2572
- addr_t frame_setup_func_offset;
2572
+ int64_t frame_setup_func_offset;
2573
2573
int fp_cfa_offset;
2574
2574
};
2575
2575
@@ -2580,7 +2580,7 @@ struct FrameSetupInfo {
2580
2580
// / compared against it.
2581
2581
// / 2. The CFA offset at which FP is stored, meaningless in the frameless case.
2582
2582
static llvm::Expected<FrameSetupInfo>
2583
- GetFrameSetupInfo (UnwindPlan &unwind_plan, RegisterContext ®ctx) {
2583
+ GetFrameSetupInfo (const UnwindPlan &unwind_plan, RegisterContext ®ctx) {
2584
2584
using AbstractRegisterLocation = UnwindPlan::Row::AbstractRegisterLocation;
2585
2585
2586
2586
llvm::Expected<uint32_t > fp_unwind_regdomain =
@@ -2610,7 +2610,7 @@ GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext ®ctx) {
2610
2610
// This is a frameless function, use large positive offset so that a PC can
2611
2611
// still be compared against it.
2612
2612
if (it == fp_locs.end ())
2613
- return FrameSetupInfo{std::numeric_limits<addr_t >::max (), 0 };
2613
+ return FrameSetupInfo{std::numeric_limits<int64_t >::max (), 0 };
2614
2614
2615
2615
// This is an async function with a frame. The prologue roughly follows this
2616
2616
// sequence of instructions:
@@ -2645,7 +2645,7 @@ GetFrameSetupInfo(UnwindPlan &unwind_plan, RegisterContext ®ctx) {
2645
2645
static llvm::Expected<addr_t > ReadAsyncContextRegisterFromUnwind (
2646
2646
SymbolContext &sc, Process &process, Address pc, Address func_start_addr,
2647
2647
RegisterContext ®ctx, AsyncUnwindRegisterNumbers regnums) {
2648
- llvm::Expected<UnwindPlanSP > unwind_plan =
2648
+ llvm::Expected<std::shared_ptr< const UnwindPlan> > unwind_plan =
2649
2649
GetAsmUnwindPlan (pc, sc, regctx.GetThread ());
2650
2650
if (!unwind_plan)
2651
2651
return unwind_plan.takeError ();
@@ -2657,7 +2657,7 @@ static llvm::Expected<addr_t> ReadAsyncContextRegisterFromUnwind(
2657
2657
// Is PC before the frame formation? If so, use async register directly.
2658
2658
// This handles frameless functions, as frame_setup_func_offset is INT_MAX.
2659
2659
addr_t pc_offset = pc.GetFileAddress () - func_start_addr.GetFileAddress ();
2660
- if (pc_offset < frame_setup->frame_setup_func_offset )
2660
+ if (( int64_t ) pc_offset < frame_setup->frame_setup_func_offset )
2661
2661
return ReadRegisterAsAddress (regctx, regnums.GetRegisterKind (),
2662
2662
regnums.async_ctx_regnum );
2663
2663
@@ -2688,9 +2688,11 @@ DoesContinuationPointToSameFunction(addr_t async_reg, SymbolContext &sc,
2688
2688
Address continuation_addr;
2689
2689
continuation_addr.SetLoadAddress (process.FixCodeAddress (*continuation_ptr),
2690
2690
&process.GetTarget ());
2691
- if (sc.function )
2692
- return sc.function ->GetAddressRange ().ContainsLoadAddress (
2693
- continuation_addr, &process.GetTarget ());
2691
+ if (sc.function ) {
2692
+ AddressRange unused_range;
2693
+ return sc.function ->GetRangeContainingLoadAddress (
2694
+ continuation_addr.GetOffset (), process.GetTarget (), unused_range);
2695
+ }
2694
2696
assert (sc.symbol );
2695
2697
return sc.symbol ->ContainsFileAddress (continuation_addr.GetFileAddress ());
2696
2698
}
@@ -2724,8 +2726,7 @@ static llvm::Expected<bool> IsIndirectContext(Process &process,
2724
2726
uint32_t prologue_size = sc.function ? sc.function ->GetPrologueByteSize ()
2725
2727
: sc.symbol ->GetPrologueByteSize ();
2726
2728
Address func_start_addr =
2727
- sc.function ? sc.function ->GetAddressRange ().GetBaseAddress ()
2728
- : sc.symbol ->GetAddress ();
2729
+ sc.function ? sc.function ->GetAddress () : sc.symbol ->GetAddress ();
2729
2730
// Include one instruction after the prologue. This is where breakpoints
2730
2731
// by function name are set, so it's important to get this point right. This
2731
2732
// instruction is exactly at address "base + prologue", so adding 1
@@ -2776,7 +2777,7 @@ SwiftLanguageRuntime::GetRuntimeUnwindPlan(ProcessSP process_sp,
2776
2777
Address func_start_addr;
2777
2778
ConstString mangled_name;
2778
2779
if (sc.function ) {
2779
- func_start_addr = sc.function ->GetAddressRange (). GetBaseAddress ();
2780
+ func_start_addr = sc.function ->GetAddress ();
2780
2781
mangled_name = sc.function ->GetMangled ().GetMangledName ();
2781
2782
} else if (sc.symbol ) {
2782
2783
func_start_addr = sc.symbol ->GetAddress ();
0 commit comments