forked from OSchip/llvm-project
				
			Simplify FuncUnwinders::GetEHFrameAugmentedUnwindPlan
Summary: GetEHFrameAugmentedUnwindPlan duplicated the work of GetEHFrameUnwindPlan in getting the original plan from DWARF CFI. This changes the function to call GetEHFrameUnwindPlan instead of doing all the work itself. A copy constructor is added to UnwindPlan to enable plan copying. Test Plan: No regressions on linux test suite. Reviewers: jasonmolenda, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9369 llvm-svn: 236607
This commit is contained in:
		
							parent
							
								
									5fe2e25f7c
								
							
						
					
					
						commit
						ad5ee04058
					
				| 
						 | 
					@ -504,6 +504,22 @@ public:
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Performs a deep copy of the plan, including all the rows (expensive).
 | 
				
			||||||
 | 
					    UnwindPlan (const UnwindPlan &rhs) :
 | 
				
			||||||
 | 
					        m_plan_valid_address_range (rhs.m_plan_valid_address_range),
 | 
				
			||||||
 | 
					        m_register_kind (rhs.m_register_kind),
 | 
				
			||||||
 | 
					        m_return_addr_register (rhs.m_return_addr_register),
 | 
				
			||||||
 | 
					        m_source_name (rhs.m_source_name),
 | 
				
			||||||
 | 
					        m_plan_is_sourced_from_compiler (rhs.m_plan_is_sourced_from_compiler),
 | 
				
			||||||
 | 
					        m_plan_is_valid_at_all_instruction_locations (rhs.m_plan_is_valid_at_all_instruction_locations),
 | 
				
			||||||
 | 
					        m_lsda_address (rhs.m_lsda_address),
 | 
				
			||||||
 | 
					        m_personality_func_addr (rhs.m_personality_func_addr)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        m_row_list.reserve (rhs.m_row_list.size());
 | 
				
			||||||
 | 
					        for (const RowSP &row_sp: rhs.m_row_list)
 | 
				
			||||||
 | 
					            m_row_list.emplace_back (new Row (*row_sp));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ~UnwindPlan ()
 | 
					    ~UnwindPlan ()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,21 +145,12 @@ FuncUnwinders::GetEHFrameAugmentedUnwindPlan (Target &target, Thread &thread, in
 | 
				
			||||||
    Mutex::Locker lock (m_mutex);
 | 
					    Mutex::Locker lock (m_mutex);
 | 
				
			||||||
    m_tried_unwind_plan_eh_frame_augmented = true;
 | 
					    m_tried_unwind_plan_eh_frame_augmented = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (m_range.GetBaseAddress().IsValid())
 | 
					    UnwindPlanSP eh_frame_plan = GetEHFrameUnwindPlan (target, current_offset);
 | 
				
			||||||
    {
 | 
					    if (!eh_frame_plan)
 | 
				
			||||||
        Address current_pc (m_range.GetBaseAddress ());
 | 
					        return m_unwind_plan_eh_frame_augmented_sp;
 | 
				
			||||||
        if (current_offset != -1)
 | 
					
 | 
				
			||||||
            current_pc.SetOffset (current_pc.GetOffset() + current_offset);
 | 
					    m_unwind_plan_eh_frame_augmented_sp.reset(new UnwindPlan(*eh_frame_plan));
 | 
				
			||||||
        DWARFCallFrameInfo *eh_frame = m_unwind_table.GetEHFrameInfo();
 | 
					
 | 
				
			||||||
        if (eh_frame)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            m_unwind_plan_eh_frame_augmented_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
 | 
					 | 
				
			||||||
            if (!eh_frame->GetUnwindPlan (current_pc, *m_unwind_plan_eh_frame_augmented_sp))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                m_unwind_plan_eh_frame_augmented_sp.reset();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
    // Augment the eh_frame instructions with epilogue descriptions if necessary so the
 | 
					    // Augment the eh_frame instructions with epilogue descriptions if necessary so the
 | 
				
			||||||
    // UnwindPlan can be used at any instruction in the function.
 | 
					    // UnwindPlan can be used at any instruction in the function.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -175,9 +166,6 @@ FuncUnwinders::GetEHFrameAugmentedUnwindPlan (Target &target, Thread &thread, in
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        m_unwind_plan_eh_frame_augmented_sp.reset();
 | 
					        m_unwind_plan_eh_frame_augmented_sp.reset();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return m_unwind_plan_eh_frame_augmented_sp;
 | 
					    return m_unwind_plan_eh_frame_augmented_sp;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue