Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
remove unused code and revert to standard GetStepThroughDispatchPlan API
Browse files Browse the repository at this point in the history
fix some other changed call signatures
  • Loading branch information
codeon-nat committed Mar 21, 2019
1 parent 3a8bf26 commit 2440b3a
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 62 deletions.
1 change: 0 additions & 1 deletion include/lldb/Target/ObjCLanguageRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -87,7 +86,7 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;

lldb::SearchFilterSP CreateExceptionSearchFilter() override;

static std::tuple<FileSpec, ConstString> GetExceptionThrowLocation();

lldb::ValueObjectSP GetExceptionObjectForThread(
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3341,6 +3341,7 @@ bool DWARFASTParserClang::ParseChildMembers(
*/

bool DWARFASTParserClang::ParseMulleABIParameters( const DWARFDIE &die,
clang::DeclContext *containing_decl_ctx,
const CompilerType &compiler_type,
std::vector<lldb_private::CompilerType> &function_param_types,
std::vector<clang::ParmVarDecl *> &function_param_decls,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<lldb_private::CompilerType> &function_param_types,
std::vector<clang::ParmVarDecl *> &function_param_decls,
Expand Down

0 comments on commit 2440b3a

Please sign in to comment.