summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-02-18 05:35:26 +0000
committerGreg Clayton <gclayton@apple.com>2012-02-18 05:35:26 +0000
commitd9e416c0ea61c13440e99fdab86e44c6e71a8eff (patch)
tree7cdcdc10fb941cb0658a5a651a5f6ceb2cd40e63 /lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
parent0dea49e324ecb836ddad859495bde8ffc48a8ae0 (diff)
downloadbcm5719-llvm-d9e416c0ea61c13440e99fdab86e44c6e71a8eff.tar.gz
bcm5719-llvm-d9e416c0ea61c13440e99fdab86e44c6e71a8eff.zip
The second part in thread hardening the internals of LLDB where we make
the lldb_private::StackFrame objects hold onto a weak pointer to the thread object. The lldb_private::StackFrame objects the the most volatile objects we have as when we are doing single stepping, frames can often get lost or thrown away, only to be re-created as another object that still refers to the same frame. We have another bug tracking that. But we need to be able to have frames no longer be able to get the thread when they are not part of a thread anymore, and this is the first step (this fix makes that possible but doesn't implement it yet). Also changed lldb_private::ExecutionContextScope to return shared pointers to all objects in the execution context to further thread harden the internals. llvm-svn: 150871
Diffstat (limited to 'lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp')
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index 0d1e74b2513..182294d65b5 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -106,19 +106,22 @@ PadString(Stream *s, const std::string &str, size_t width)
s->Printf("%s ", str.c_str());
}
static void
-AddSymbolicInfo (ExecutionContextScope *exe_scope,
+AddSymbolicInfo (const ExecutionContext *exe_ctx,
StreamString &comment,
uint64_t operand_value,
const Address &inst_addr)
{
Address so_addr;
Target *target = NULL;
- if (exe_scope)
- target = exe_scope->CalculateTarget();
+ if (exe_ctx)
+ target = exe_ctx->GetTargetPtr();
if (target && !target->GetSectionLoadList().IsEmpty())
{
if (target->GetSectionLoadList().ResolveLoadAddress(operand_value, so_addr))
- so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
+ so_addr.Dump (&comment,
+ exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL,
+ Address::DumpStyleResolvedDescriptionNoModule,
+ Address::DumpStyleSectionNameOffset);
}
else
{
@@ -126,7 +129,10 @@ AddSymbolicInfo (ExecutionContextScope *exe_scope,
if (module)
{
if (module->ResolveFileAddress(operand_value, so_addr))
- so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
+ so_addr.Dump (&comment,
+ exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL,
+ Address::DumpStyleResolvedDescriptionNoModule,
+ Address::DumpStyleSectionNameOffset);
}
}
}
@@ -166,7 +172,7 @@ InstructionLLVM::Dump
uint32_t max_opcode_byte_size,
bool show_address,
bool show_bytes,
- const lldb_private::ExecutionContext* exe_ctx,
+ const ExecutionContext* exe_ctx,
bool raw
)
{
@@ -336,7 +342,7 @@ InstructionLLVM::Dump
comment.Printf("0x%*.*llx ", addr_nibble_size, addr_nibble_size, operand_value);
}
- AddSymbolicInfo(exe_scope, comment, operand_value, GetAddress());
+ AddSymbolicInfo(exe_ctx, comment, operand_value, GetAddress());
} // EDEvaluateOperand
} // EDOperandIsMemory
} // EDGetOperand
@@ -365,7 +371,7 @@ InstructionLLVM::Dump
uint64_t operand_value = PC + atoi(++pos);
// Put the address value into the operands.
operands.Printf("0x%8.8llx ", operand_value);
- AddSymbolicInfo(exe_scope, comment, operand_value, GetAddress());
+ AddSymbolicInfo(exe_ctx, comment, operand_value, GetAddress());
}
}
// Yet more workaround for "bl #..." and "blx #...".
@@ -387,7 +393,7 @@ InstructionLLVM::Dump
llvm::StringRef Str(pos - 1);
RStrip(Str, '\n');
operands.PutCString(Str.str().c_str());
- AddSymbolicInfo(exe_scope, comment, operand_value, GetAddress());
+ AddSymbolicInfo(exe_ctx, comment, operand_value, GetAddress());
}
}
// END of workaround.
@@ -446,10 +452,9 @@ InstructionLLVM::CalculateMnemonicOperandsAndComment (ExecutionContextScope *exe
int currentOpIndex = -1;
StreamString comment;
uint32_t addr_nibble_size = 8;
- addr_t base_addr = LLDB_INVALID_ADDRESS;
- Target *target = NULL;
- if (exe_scope)
- target = exe_scope->CalculateTarget();
+ addr_t base_addr = LLDB_INVALID_ADDRESS;
+ ExecutionContext exe_ctx (exe_scope);
+ Target *target = exe_ctx.GetTargetPtr();
if (target && !target->GetSectionLoadList().IsEmpty())
base_addr = GetAddress().GetLoadAddress (target);
if (base_addr == LLDB_INVALID_ADDRESS)
@@ -501,7 +506,7 @@ InstructionLLVM::CalculateMnemonicOperandsAndComment (ExecutionContextScope *exe
if (!EDEvaluateOperand(&operand_value, operand, IPRegisterReader, &rra))
{
comment.Printf("0x%*.*llx ", addr_nibble_size, addr_nibble_size, operand_value);
- AddSymbolicInfo (exe_scope, comment, operand_value, GetAddress());
+ AddSymbolicInfo (&exe_ctx, comment, operand_value, GetAddress());
}
}
}
@@ -526,7 +531,7 @@ InstructionLLVM::CalculateMnemonicOperandsAndComment (ExecutionContextScope *exe
uint64_t operand_value = PC + atoi(++pos);
// Put the address value into the operands.
comment.Printf("0x%*.*llx ", addr_nibble_size, addr_nibble_size, operand_value);
- AddSymbolicInfo (exe_scope, comment, operand_value, GetAddress());
+ AddSymbolicInfo (&exe_ctx, comment, operand_value, GetAddress());
}
}
// Yet more workaround for "bl #..." and "blx #...".
@@ -551,7 +556,7 @@ InstructionLLVM::CalculateMnemonicOperandsAndComment (ExecutionContextScope *exe
// llvm::StringRef Str(pos - 1);
// RStrip(Str, '\n');
// operands.PutCString(Str.str().c_str());
- AddSymbolicInfo (exe_scope, comment, operand_value, GetAddress());
+ AddSymbolicInfo (&exe_ctx, comment, operand_value, GetAddress());
}
}
// END of workaround.
OpenPOWER on IntegriCloud