From 2440b3aa3328388142da7a7808f5b2a3350c34e6 Mon Sep 17 00:00:00 2001 From: Nat! Date: Thu, 21 Mar 2019 13:46:11 +0100 Subject: [PATCH] remove unused code and revert to standard GetStepThroughDispatchPlan API fix some other changed call signatures --- include/lldb/Target/ObjCLanguageRuntime.h | 1 - .../AppleObjCRuntime/AppleObjCRuntime.cpp | 5 +- .../ObjC/AppleObjCRuntime/AppleObjCRuntime.h | 5 +- .../MulleObjCRuntime/MulleObjCRuntime.cpp | 4 +- .../ObjC/MulleObjCRuntime/MulleObjCRuntime.h | 1 - .../MulleObjCRuntime/MulleObjCRuntimeV1.cpp | 1 - .../MulleObjCTrampolineHandler.cpp | 50 ++----------------- .../MulleObjCTrampolineHandler.h | 1 - ...lleThreadPlanStepThroughObjCTrampoline.cpp | 3 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 4 +- .../SymbolFile/DWARF/DWARFASTParserClang.h | 1 + 11 files changed, 14 insertions(+), 62 deletions(-) diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h index 8e8f279793..22193bb4ba 100644 --- a/include/lldb/Target/ObjCLanguageRuntime.h +++ b/include/lldb/Target/ObjCLanguageRuntime.h @@ -221,7 +221,6 @@ class ObjCLanguageRuntime : public LanguageRuntime { virtual bool HasReadObjCLibrary() = 0; virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, - StackID &return_stack_id, bool stop_others) = 0; lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel); diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index a4172ae2eb..cd75d75815 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -338,7 +338,6 @@ bool AppleObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) { } ThreadPlanSP AppleObjCRuntime::GetStepThroughTrampolinePlan(Thread &thread, - StackID &return_stack_id, bool stop_others) { ThreadPlanSP thread_plan_sp; if (m_objc_trampoline_handler_ap.get()) @@ -472,10 +471,10 @@ ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread( if (!cpp_runtime) return ValueObjectSP(); auto cpp_exception = cpp_runtime->GetExceptionObjectForThread(thread_sp); if (!cpp_exception) return ValueObjectSP(); - + auto descriptor = GetClassDescriptor(*cpp_exception.get()); if (!descriptor || !descriptor->IsValid()) return ValueObjectSP(); - + while (descriptor) { ConstString class_name(descriptor->GetClassName()); if (class_name == ConstString("NSException")) return cpp_exception; diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h index 53ca37f171..57161801ef 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h @@ -67,7 +67,6 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime { bool HasReadObjCLibrary() override { return m_read_objc_library; } lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, - StackID &return_stack_id, bool stop_others) override; // Get the "libobjc.A.dylib" module from the current target if we can find @@ -87,7 +86,7 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime { bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override; lldb::SearchFilterSP CreateExceptionSearchFilter() override; - + static std::tuple GetExceptionThrowLocation(); lldb::ValueObjectSP GetExceptionObjectForThread( @@ -100,7 +99,7 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime { virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, lldb::addr_t &cf_false); - + virtual bool IsTaggedPointer (lldb::addr_t addr) { return false; } protected: diff --git a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntime.cpp b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntime.cpp index e5ba49ed22..abe31f77bc 100644 --- a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntime.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntime.cpp @@ -17,7 +17,6 @@ #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Core/Scalar.h" #include "lldb/Core/Section.h" #include "lldb/Core/ValueObject.h" #include "lldb/Expression/DiagnosticManager.h" @@ -413,13 +412,12 @@ bool MulleObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) { } ThreadPlanSP MulleObjCRuntime::GetStepThroughTrampolinePlan(Thread &thread, - StackID &return_stack_id, bool stop_others) { ThreadPlanSP thread_plan_sp; if (m_objc_trampoline_handler_ap.get()) thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan( - thread, return_stack_id, stop_others); + thread, stop_others); return thread_plan_sp; } diff --git a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntime.h b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntime.h index 669a6459a9..87ca2311ea 100644 --- a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntime.h +++ b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntime.h @@ -70,7 +70,6 @@ class MulleObjCRuntime : public lldb_private::ObjCLanguageRuntime { bool HasReadObjCLibrary() override { return m_read_objc_library; } lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, - StackID &return_stack_id, bool stop_others) override; // Get the "libobjc.A.dylib" module from the current target if we can find diff --git a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntimeV1.cpp b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntimeV1.cpp index 0a30755a15..f4ef50b856 100644 --- a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntimeV1.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCRuntimeV1.cpp @@ -16,7 +16,6 @@ #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Core/Scalar.h" #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UtilityFunction.h" diff --git a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCTrampolineHandler.cpp b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCTrampolineHandler.cpp index 0fff5bf099..e70fbe1f37 100644 --- a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCTrampolineHandler.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCTrampolineHandler.cpp @@ -354,52 +354,16 @@ ThreadPlanSP MulleObjCTrampolineHandler::GetStepOutDispatchPlan( Thread &thread, bool stop_others) { + Status status; return( thread.QueueThreadPlanForStepOut( false, nullptr, false, stop_others, eVoteYes, eVoteNoOpinion, - thread.GetSelectedFrameIndex())); -} - - -void MulleObjCTrampolineHandler::SetBreakpointForReturn( Thread &thread, const StackID &m_stack_id) -{ - break_id_t m_backstop_bkpt_id; - uint64_t m_start_address; - uint64_t m_backstop_addr; - - m_start_address = thread.GetRegisterContext()->GetPC(0); - - // We are going to return back to the concrete frame 1, we might pass by - // some inlined code that we're in - // the middle of by doing this, but it's easier than trying to figure out - // where the inlined code might return to. - - StackFrameSP return_frame_sp = thread.GetFrameWithStackID(m_stack_id); - - if (return_frame_sp) { - m_backstop_addr = return_frame_sp->GetFrameCodeAddress().GetLoadAddress( - thread.CalculateTarget().get()); - Breakpoint *return_bp = - thread.GetProcess() - ->GetTarget() - .CreateBreakpoint(m_backstop_addr, true, false) - .get(); - if (return_bp != nullptr) { - return_bp->SetThreadID(thread.GetID()); - m_backstop_bkpt_id = return_bp->GetID(); - return_bp->SetBreakpointKind("step-through-backstop"); - } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); - if (log) { - log->Printf("Setting backstop breakpoint %d at address: 0x%" PRIx64, - m_backstop_bkpt_id, m_backstop_addr); - } - } + thread.GetSelectedFrameIndex(), + status)); } ThreadPlanSP MulleObjCTrampolineHandler::GetStepThroughDispatchPlan( Thread &thread, - const StackID &stackid, bool stop_others) { ThreadPlanSP ret_plan_sp; @@ -622,14 +586,6 @@ MulleObjCTrampolineHandler::GetStepThroughDispatchPlan( Thread &thread, // fprintf( stderr, "impl: 0x%llx\n", (unsigned long long)impl_addr); } - /* - * At this point we "know" that we are going to step through, either directly - * or via that trampoline thingy... so since out message sender is not a - * true trampoline but a c-function, we need to set a breakpoint - * (this is done better with the thunk code) - */ - // SetBreakpointForReturn( thread, stackid); - if (impl_addr != LLDB_INVALID_ADDRESS) { // Yup, it was in the cache, so we can run to that address directly. diff --git a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCTrampolineHandler.h b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCTrampolineHandler.h index 50ce3091a2..f61a2c7693 100644 --- a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCTrampolineHandler.h +++ b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleObjCTrampolineHandler.h @@ -31,7 +31,6 @@ class MulleObjCTrampolineHandler { ~MulleObjCTrampolineHandler(); lldb::ThreadPlanSP GetStepThroughDispatchPlan( Thread &thread, - const StackID &stackid, bool stop_others); lldb::ThreadPlanSP GetStepOutDispatchPlan(Thread &thread, bool stop_others); diff --git a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleThreadPlanStepThroughObjCTrampoline.cpp b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleThreadPlanStepThroughObjCTrampoline.cpp index e79f80536e..24f3a530b4 100644 --- a/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleThreadPlanStepThroughObjCTrampoline.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/MulleObjCRuntime/MulleThreadPlanStepThroughObjCTrampoline.cpp @@ -184,12 +184,13 @@ bool MulleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) { SymbolContext sc = m_thread.GetStackFrameAtIndex(0)->GetSymbolContext( eSymbolContextEverything); + Status status; const bool abort_other_plans = false; const bool first_insn = true; const uint32_t frame_idx = 0; m_run_to_sp = m_thread.QueueThreadPlanForStepOutNoShouldStop( abort_other_plans, &sc, first_insn, m_stop_others, eVoteNoOpinion, - eVoteNoOpinion, frame_idx); + eVoteNoOpinion, frame_idx, status); m_run_to_sp->SetPrivate(true); return false; } diff --git a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 29faffdae1..2b79a2924e 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -3341,6 +3341,7 @@ bool DWARFASTParserClang::ParseChildMembers( */ bool DWARFASTParserClang::ParseMulleABIParameters( const DWARFDIE &die, + clang::DeclContext *containing_decl_ctx, const CompilerType &compiler_type, std::vector &function_param_types, std::vector &function_param_decls, @@ -3373,7 +3374,7 @@ bool DWARFASTParserClang::ParseMulleABIParameters( const DWARFDIE &die, function_param_types.push_back( fieldType); clang::ParmVarDecl *param_var_decl = - m_ast.CreateParameterDeclaration( + m_ast.CreateParameterDeclaration( containing_decl_ctx, name.c_str(), fieldType, storage); assert(param_var_decl); function_param_decls.push_back(param_var_decl); @@ -3528,6 +3529,7 @@ size_t DWARFASTParserClang::ParseChildParameters( Type *type = die.ResolveTypeUID(DIERef(param_type_die_form)); if (type) { ParseMulleABIParameters( die, + containing_decl_ctx, type->GetForwardCompilerType(), function_param_types, function_param_decls, diff --git a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h index a572a65b89..15a17af89f 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h +++ b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h @@ -93,6 +93,7 @@ class DWARFASTParserClang : public DWARFASTParser { /// @mulle-lldb@ make _param function arguments again > bool ParseMulleABIParameters( const DWARFDIE &die, + clang::DeclContext *containing_decl_ctx, const lldb_private::CompilerType &compiler_type, std::vector &function_param_types, std::vector &function_param_decls,