Skip to content

Commit cc60304

Browse files
committed
[lldb] Remove unused UnwindPlan functions
`GetLSDAAddress` and `GetPersonalityRoutinePtrAddress` are unused and they create a bit of a problem for discontinuous functions, because the unwind plan for these consists of multiple eh_frame descriptors and (at least in theory) each of them could have a different value for these entities. We could say we only support functions for which these are always the same, or create some sort of a Address2LSDA lookup map, but I think it's better to leave this question to someone who actually needs this.
1 parent f16fb65 commit cc60304

File tree

6 files changed

+5
-130
lines changed

6 files changed

+5
-130
lines changed

lldb/include/lldb/Symbol/FuncUnwinders.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,6 @@ class FuncUnwinders {
6161
});
6262
}
6363

64-
// A function may have a Language Specific Data Area specified -- a block of
65-
// data in
66-
// the object file which is used in the processing of an exception throw /
67-
// catch. If any of the UnwindPlans have the address of the LSDA region for
68-
// this function, this will return it.
69-
Address GetLSDAAddress(Target &target);
70-
71-
// A function may have a Personality Routine associated with it -- used in the
72-
// processing of throwing an exception. If any of the UnwindPlans have the
73-
// address of the personality routine, this will return it. Read the target-
74-
// pointer at this address to get the personality function address.
75-
Address GetPersonalityRoutinePtrAddress(Target &target);
76-
7764
// The following methods to retrieve specific unwind plans should rarely be
7865
// used. Instead, clients should ask for the *behavior* they are looking for,
7966
// using one of the above UnwindPlan retrieval methods.

lldb/include/lldb/Symbol/UnwindPlan.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,7 @@ class UnwindPlan {
445445
m_plan_is_sourced_from_compiler(rhs.m_plan_is_sourced_from_compiler),
446446
m_plan_is_valid_at_all_instruction_locations(
447447
rhs.m_plan_is_valid_at_all_instruction_locations),
448-
m_plan_is_for_signal_trap(rhs.m_plan_is_for_signal_trap),
449-
m_lsda_address(rhs.m_lsda_address),
450-
m_personality_func_addr(rhs.m_personality_func_addr) {
448+
m_plan_is_for_signal_trap(rhs.m_plan_is_for_signal_trap) {
451449
m_row_list.reserve(rhs.m_row_list.size());
452450
for (const RowSP &row_sp : rhs.m_row_list)
453451
m_row_list.emplace_back(new Row(*row_sp));
@@ -553,22 +551,10 @@ class UnwindPlan {
553551
m_plan_is_sourced_from_compiler = eLazyBoolCalculate;
554552
m_plan_is_valid_at_all_instruction_locations = eLazyBoolCalculate;
555553
m_plan_is_for_signal_trap = eLazyBoolCalculate;
556-
m_lsda_address.Clear();
557-
m_personality_func_addr.Clear();
558554
}
559555

560556
const RegisterInfo *GetRegisterInfo(Thread *thread, uint32_t reg_num) const;
561557

562-
Address GetLSDAAddress() const { return m_lsda_address; }
563-
564-
void SetLSDAAddress(Address lsda_addr) { m_lsda_address = lsda_addr; }
565-
566-
Address GetPersonalityFunctionPtr() const { return m_personality_func_addr; }
567-
568-
void SetPersonalityFunctionPtr(Address presonality_func_ptr) {
569-
m_personality_func_addr = presonality_func_ptr;
570-
}
571-
572558
private:
573559
std::vector<RowSP> m_row_list;
574560
std::vector<AddressRange> m_plan_valid_ranges;
@@ -583,13 +569,6 @@ class UnwindPlan {
583569
lldb_private::LazyBool m_plan_is_sourced_from_compiler;
584570
lldb_private::LazyBool m_plan_is_valid_at_all_instruction_locations;
585571
lldb_private::LazyBool m_plan_is_for_signal_trap;
586-
587-
Address m_lsda_address; // Where the language specific data area exists in the
588-
// module - used
589-
// in exception handling.
590-
Address m_personality_func_addr; // The address of a pointer to the
591-
// personality function - used in
592-
// exception handling.
593572
}; // class UnwindPlan
594573

595574
} // namespace lldb_private

lldb/source/Symbol/CompactUnwindInfo.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,6 @@ bool CompactUnwindInfo::CreateUnwindPlan_x86_64(Target &target,
741741
unwind_plan.SetUnwindPlanForSignalTrap(eLazyBoolNo);
742742
unwind_plan.SetRegisterKind(eRegisterKindEHFrame);
743743

744-
unwind_plan.SetLSDAAddress(function_info.lsda_address);
745-
unwind_plan.SetPersonalityFunctionPtr(function_info.personality_ptr_address);
746-
747744
UnwindPlan::Row row;
748745

749746
const int wordsize = 8;
@@ -1011,9 +1008,6 @@ bool CompactUnwindInfo::CreateUnwindPlan_i386(Target &target,
10111008
unwind_plan.SetUnwindPlanForSignalTrap(eLazyBoolNo);
10121009
unwind_plan.SetRegisterKind(eRegisterKindEHFrame);
10131010

1014-
unwind_plan.SetLSDAAddress(function_info.lsda_address);
1015-
unwind_plan.SetPersonalityFunctionPtr(function_info.personality_ptr_address);
1016-
10171011
UnwindPlan::Row row;
10181012

10191013
const int wordsize = 4;
@@ -1306,9 +1300,6 @@ bool CompactUnwindInfo::CreateUnwindPlan_arm64(Target &target,
13061300
unwind_plan.SetUnwindPlanForSignalTrap(eLazyBoolNo);
13071301
unwind_plan.SetRegisterKind(eRegisterKindEHFrame);
13081302

1309-
unwind_plan.SetLSDAAddress(function_info.lsda_address);
1310-
unwind_plan.SetPersonalityFunctionPtr(function_info.personality_ptr_address);
1311-
13121303
UnwindPlan::Row row;
13131304

13141305
const int wordsize = 8;
@@ -1437,9 +1428,6 @@ bool CompactUnwindInfo::CreateUnwindPlan_armv7(Target &target,
14371428
unwind_plan.SetUnwindPlanForSignalTrap(eLazyBoolNo);
14381429
unwind_plan.SetRegisterKind(eRegisterKindEHFrame);
14391430

1440-
unwind_plan.SetLSDAAddress(function_info.lsda_address);
1441-
unwind_plan.SetPersonalityFunctionPtr(function_info.personality_ptr_address);
1442-
14431431
UnwindPlan::Row row;
14441432

14451433
const int wordsize = 4;

lldb/source/Symbol/DWARFCallFrameInfo.cpp

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -583,43 +583,13 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset,
583583
m_objfile.GetSectionList());
584584
range.SetByteSize(range_len);
585585

586-
addr_t lsda_data_file_address = LLDB_INVALID_ADDRESS;
587-
588-
if (cie->augmentation[0] == 'z') {
589-
uint32_t aug_data_len = (uint32_t)m_cfi_data.GetULEB128(&offset);
590-
if (aug_data_len != 0 && cie->lsda_addr_encoding != DW_EH_PE_omit) {
591-
lldb::offset_t saved_offset = offset;
592-
lsda_data_file_address =
593-
GetGNUEHPointer(m_cfi_data, &offset, cie->lsda_addr_encoding,
594-
pc_rel_addr, text_addr, data_addr);
595-
if (offset - saved_offset != aug_data_len) {
596-
// There is more in the augmentation region than we know how to process;
597-
// don't read anything.
598-
lsda_data_file_address = LLDB_INVALID_ADDRESS;
599-
}
600-
offset = saved_offset;
601-
}
602-
offset += aug_data_len;
603-
}
586+
// Skip the LSDA, if present.
587+
if (cie->augmentation[0] == 'z')
588+
offset += (uint32_t)m_cfi_data.GetULEB128(&offset);
589+
604590
unwind_plan.SetUnwindPlanForSignalTrap(
605591
strchr(cie->augmentation, 'S') ? eLazyBoolYes : eLazyBoolNo);
606592

607-
Address lsda_data;
608-
Address personality_function_ptr;
609-
610-
if (lsda_data_file_address != LLDB_INVALID_ADDRESS &&
611-
cie->personality_loc != LLDB_INVALID_ADDRESS) {
612-
m_objfile.GetModule()->ResolveFileAddress(lsda_data_file_address,
613-
lsda_data);
614-
m_objfile.GetModule()->ResolveFileAddress(cie->personality_loc,
615-
personality_function_ptr);
616-
}
617-
618-
if (lsda_data.IsValid() && personality_function_ptr.IsValid()) {
619-
unwind_plan.SetLSDAAddress(lsda_data);
620-
unwind_plan.SetPersonalityFunctionPtr(personality_function_ptr);
621-
}
622-
623593
uint32_t code_align = cie->code_align;
624594
int32_t data_align = cie->data_align;
625595

lldb/source/Symbol/FuncUnwinders.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -537,39 +537,3 @@ FuncUnwinders::GetUnwindAssemblyProfiler(Target &target) {
537537
}
538538
return assembly_profiler_sp;
539539
}
540-
541-
Address FuncUnwinders::GetLSDAAddress(Target &target) {
542-
Address lsda_addr;
543-
544-
std::shared_ptr<const UnwindPlan> unwind_plan_sp =
545-
GetEHFrameUnwindPlan(target);
546-
if (unwind_plan_sp.get() == nullptr) {
547-
unwind_plan_sp = GetCompactUnwindUnwindPlan(target);
548-
}
549-
if (unwind_plan_sp.get() == nullptr) {
550-
unwind_plan_sp = GetObjectFileUnwindPlan(target);
551-
}
552-
if (unwind_plan_sp.get() && unwind_plan_sp->GetLSDAAddress().IsValid()) {
553-
lsda_addr = unwind_plan_sp->GetLSDAAddress();
554-
}
555-
return lsda_addr;
556-
}
557-
558-
Address FuncUnwinders::GetPersonalityRoutinePtrAddress(Target &target) {
559-
Address personality_addr;
560-
561-
std::shared_ptr<const UnwindPlan> unwind_plan_sp =
562-
GetEHFrameUnwindPlan(target);
563-
if (unwind_plan_sp.get() == nullptr) {
564-
unwind_plan_sp = GetCompactUnwindUnwindPlan(target);
565-
}
566-
if (unwind_plan_sp.get() == nullptr) {
567-
unwind_plan_sp = GetObjectFileUnwindPlan(target);
568-
}
569-
if (unwind_plan_sp.get() &&
570-
unwind_plan_sp->GetPersonalityFunctionPtr().IsValid()) {
571-
personality_addr = unwind_plan_sp->GetPersonalityFunctionPtr();
572-
}
573-
574-
return personality_addr;
575-
}

lldb/source/Symbol/UnwindPlan.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -511,19 +511,6 @@ void UnwindPlan::Dump(Stream &s, Thread *thread, lldb::addr_t base_addr) const {
511511
s.Printf("This UnwindPlan originally sourced from %s\n",
512512
m_source_name.GetCString());
513513
}
514-
if (m_lsda_address.IsValid() && m_personality_func_addr.IsValid()) {
515-
TargetSP target_sp(thread->CalculateTarget());
516-
addr_t lsda_load_addr = m_lsda_address.GetLoadAddress(target_sp.get());
517-
addr_t personality_func_load_addr =
518-
m_personality_func_addr.GetLoadAddress(target_sp.get());
519-
520-
if (lsda_load_addr != LLDB_INVALID_ADDRESS &&
521-
personality_func_load_addr != LLDB_INVALID_ADDRESS) {
522-
s.Printf("LSDA address 0x%" PRIx64
523-
", personality routine is at address 0x%" PRIx64 "\n",
524-
lsda_load_addr, personality_func_load_addr);
525-
}
526-
}
527514
s.Printf("This UnwindPlan is sourced from the compiler: ");
528515
switch (m_plan_is_sourced_from_compiler) {
529516
case eLazyBoolYes:

0 commit comments

Comments
 (0)