本文整理汇总了C++中SymbolContext::DumpStopContext方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolContext::DumpStopContext方法的具体用法?C++ SymbolContext::DumpStopContext怎么用?C++ SymbolContext::DumpStopContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolContext
的用法示例。
在下文中一共展示了SymbolContext::DumpStopContext方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Address
bool
Variable::DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module)
{
bool dumped_declaration_info = false;
if (m_owner_scope)
{
SymbolContext sc;
m_owner_scope->CalculateSymbolContext(&sc);
sc.block = nullptr;
sc.line_entry.Clear();
bool show_inlined_frames = false;
const bool show_function_arguments = true;
const bool show_function_name = true;
dumped_declaration_info = sc.DumpStopContext (s,
nullptr,
Address(),
show_fullpaths,
show_module,
show_inlined_frames,
show_function_arguments,
show_function_name);
if (sc.function)
s->PutChar(':');
}
if (m_declaration.DumpStopContext (s, false))
dumped_declaration_info = true;
return dumped_declaration_info;
}
示例2: Dump
//.........这里部分代码省略.........
ReadCStringFromMemory(exe_scope, *this, s);
break;
case eSectionTypeDataCStringPointers:
if (ReadAddress(exe_scope, *this, pointer_size, so_addr)) {
#if VERBOSE_OUTPUT
s->PutCString("(char *)");
so_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
DumpStyleFileAddress);
s->PutCString(": ");
#endif
showed_info = true;
ReadCStringFromMemory(exe_scope, so_addr, s);
}
break;
case eSectionTypeDataObjCMessageRefs:
if (ReadAddress(exe_scope, *this, pointer_size, so_addr)) {
if (target && so_addr.IsSectionOffset()) {
SymbolContext func_sc;
target->GetImages().ResolveSymbolContextForAddress(
so_addr, eSymbolContextEverything, func_sc);
if (func_sc.function != nullptr || func_sc.symbol != nullptr) {
showed_info = true;
#if VERBOSE_OUTPUT
s->PutCString("(objc_msgref *) -> { (func*)");
so_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
DumpStyleFileAddress);
#else
s->PutCString("{ ");
#endif
Address cstr_addr(*this);
cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
func_sc.DumpStopContext(s, exe_scope, so_addr, true, true,
false, true, true);
if (ReadAddress(exe_scope, cstr_addr, pointer_size, so_addr)) {
#if VERBOSE_OUTPUT
s->PutCString("), (char *)");
so_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
DumpStyleFileAddress);
s->PutCString(" (");
#else
s->PutCString(", ");
#endif
ReadCStringFromMemory(exe_scope, so_addr, s);
}
#if VERBOSE_OUTPUT
s->PutCString(") }");
#else
s->PutCString(" }");
#endif
}
}
}
break;
case eSectionTypeDataObjCCFStrings: {
Address cfstring_data_addr(*this);
cfstring_data_addr.SetOffset(cfstring_data_addr.GetOffset() +
(2 * pointer_size));
if (ReadAddress(exe_scope, cfstring_data_addr, pointer_size,
so_addr)) {
#if VERBOSE_OUTPUT
s->PutCString("(CFString *) ");
cfstring_data_addr.Dump(s, exe_scope, DumpStyleLoadAddress,
DumpStyleFileAddress);
示例3: if
void
BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
SymbolContext sc;
// If the description level is "initial" then the breakpoint is printing out our initial state,
// and we should let it decide how it wants to print our label.
if (level != eDescriptionLevelInitial)
{
s->Indent();
BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID());
}
if (level == lldb::eDescriptionLevelBrief)
return;
if (level != eDescriptionLevelInitial)
s->PutCString(": ");
if (level == lldb::eDescriptionLevelVerbose)
s->IndentMore();
if (m_address.IsSectionOffset())
{
m_address.CalculateSymbolContext(&sc);
if (level == lldb::eDescriptionLevelFull || level == eDescriptionLevelInitial)
{
if (IsReExported())
s->PutCString ("re-exported target = ");
else
s->PutCString("where = ");
sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false, true, true);
}
else
{
if (sc.module_sp)
{
s->EOL();
s->Indent("module = ");
sc.module_sp->GetFileSpec().Dump (s);
}
if (sc.comp_unit != NULL)
{
s->EOL();
s->Indent("compile unit = ");
static_cast<FileSpec*>(sc.comp_unit)->GetFilename().Dump (s);
if (sc.function != NULL)
{
s->EOL();
s->Indent("function = ");
s->PutCString (sc.function->GetName().AsCString("<unknown>"));
}
if (sc.line_entry.line > 0)
{
s->EOL();
s->Indent("location = ");
sc.line_entry.DumpStopContext (s, true);
}
}
else
{
// If we don't have a comp unit, see if we have a symbol we can print.
if (sc.symbol)
{
s->EOL();
if (IsReExported())
s->Indent ("re-exported target = ");
else
s->Indent("symbol = ");
s->PutCString(sc.symbol->GetName().AsCString("<unknown>"));
}
}
}
}
if (level == lldb::eDescriptionLevelVerbose)
{
s->EOL();
s->Indent();
}
if (m_address.IsSectionOffset() && (level == eDescriptionLevelFull || level == eDescriptionLevelInitial))
s->Printf (", ");
s->Printf ("address = ");
ExecutionContextScope *exe_scope = NULL;
Target *target = &m_owner.GetTarget();
if (target)
exe_scope = target->GetProcessSP().get();
if (exe_scope == NULL)
exe_scope = target;
if (level == eDescriptionLevelInitial)
m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
else
//.........这里部分代码省略.........
示例4: exe_ctx
//.........这里部分代码省略.........
result.AppendErrorWithFormat("address resolves to %s, but there is no line table information available for this address.\n",
error_strm.GetData());
result.SetStatus (eReturnStatusFailed);
return false;
}
}
}
if (sc_list.GetSize() == 0)
{
result.AppendErrorWithFormat("no modules contain load address 0x%" PRIx64 ".\n", m_options.address);
result.SetStatus (eReturnStatusFailed);
return false;
}
}
uint32_t num_matches = sc_list.GetSize();
for (uint32_t i=0; i<num_matches; ++i)
{
sc_list.GetContextAtIndex(i, sc);
if (sc.comp_unit)
{
if (m_options.show_bp_locs)
{
m_breakpoint_locations.Clear();
const bool show_inlines = true;
m_breakpoint_locations.Reset (*sc.comp_unit, 0, show_inlines);
SearchFilter target_search_filter (target->shared_from_this());
target_search_filter.Search (m_breakpoint_locations);
}
bool show_fullpaths = true;
bool show_module = true;
bool show_inlined_frames = true;
sc.DumpStopContext(&result.GetOutputStream(),
exe_ctx.GetBestExecutionContextScope(),
sc.line_entry.range.GetBaseAddress(),
show_fullpaths,
show_module,
show_inlined_frames);
result.GetOutputStream().EOL();
size_t lines_to_back_up = m_options.num_lines >= 10 ? 5 : m_options.num_lines/2;
target->GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
sc.line_entry.line,
lines_to_back_up,
m_options.num_lines - lines_to_back_up,
"->",
&result.GetOutputStream(),
GetBreakpointLocations ());
result.SetStatus (eReturnStatusSuccessFinishResult);
}
}
}
else if (m_options.file_name.empty())
{
// Last valid source manager context, or the current frame if no
// valid last context in source manager.
// One little trick here, if you type the exact same list command twice in a row, it is
// more likely because you typed it once, then typed it again
if (m_options.start_line == 0)
{
if (target->GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream(),
GetBreakpointLocations ()))
{
result.SetStatus (eReturnStatusSuccessFinishResult);
示例5: GetID
void
BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
SymbolContext sc;
s->Indent();
BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID());
if (level == lldb::eDescriptionLevelBrief)
return;
s->PutCString(": ");
if (level == lldb::eDescriptionLevelVerbose)
s->IndentMore();
if (m_address.IsSectionOffset())
{
m_address.CalculateSymbolContext(&sc);
if (level == lldb::eDescriptionLevelFull)
{
s->PutCString("where = ");
sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false);
}
else
{
if (sc.module_sp)
{
s->EOL();
s->Indent("module = ");
sc.module_sp->GetFileSpec().Dump (s);
}
if (sc.comp_unit != NULL)
{
s->EOL();
s->Indent("compile unit = ");
static_cast<FileSpec*>(sc.comp_unit)->GetFilename().Dump (s);
if (sc.function != NULL)
{
s->EOL();
s->Indent("function = ");
s->PutCString (sc.function->GetMangled().GetName().AsCString("<unknown>"));
}
if (sc.line_entry.line > 0)
{
s->EOL();
s->Indent("location = ");
sc.line_entry.DumpStopContext (s, true);
}
}
else
{
// If we don't have a comp unit, see if we have a symbol we can print.
if (sc.symbol)
{
s->EOL();
s->Indent("symbol = ");
s->PutCString(sc.symbol->GetMangled().GetName().AsCString("<unknown>"));
}
}
}
}
if (level == lldb::eDescriptionLevelVerbose)
{
s->EOL();
s->Indent();
}
s->Printf ("%saddress = ", (level == lldb::eDescriptionLevelFull && m_address.IsSectionOffset()) ? ", " : "");
ExecutionContextScope *exe_scope = NULL;
Target *target = &m_owner.GetTarget();
if (target)
exe_scope = target->GetProcessSP().get();
if (exe_scope == NULL)
exe_scope = target;
m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
if (level == lldb::eDescriptionLevelVerbose)
{
s->EOL();
s->Indent();
s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
s->Indent();
s->Printf ("hit count = %-4u\n", GetHitCount());
if (m_options_ap.get())
{
s->Indent();
m_options_ap->GetDescription (s, level);
s->EOL();
}
s->IndentLess();
}
else
//.........这里部分代码省略.........
示例6: target_sp
//.........这里部分代码省略.........
FormatEntity::Entry format;
if (exe_ctx.HasTargetScope())
{
disassembly_format = exe_ctx.GetTargetRef().GetDebugger().GetDisassemblyFormat ();
}
else
{
FormatEntity::Parse("${addr}: ", format);
disassembly_format = &format;
}
// First pass: step through the list of instructions,
// find how long the initial addresses strings are, insert padding
// in the second pass so the opcodes all line up nicely.
size_t address_text_size = 0;
for (size_t i = 0; i < num_instructions_found; ++i)
{
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
if (inst)
{
const Address &addr = inst->GetAddress();
ModuleSP module_sp (addr.GetModule());
if (module_sp)
{
const uint32_t resolve_mask = eSymbolContextFunction | eSymbolContextSymbol;
uint32_t resolved_mask = module_sp->ResolveSymbolContextForAddress(addr, resolve_mask, sc);
if (resolved_mask)
{
StreamString strmstr;
Debugger::FormatDisassemblerAddress (disassembly_format, &sc, NULL, &exe_ctx, &addr, strmstr);
size_t cur_line = strmstr.GetSizeOfLastLine();
if (cur_line > address_text_size)
address_text_size = cur_line;
}
sc.Clear(false);
}
}
}
for (size_t i = 0; i < num_instructions_found; ++i)
{
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
if (inst)
{
const Address &addr = inst->GetAddress();
const bool inst_is_at_pc = pc_addr_ptr && addr == *pc_addr_ptr;
prev_sc = sc;
ModuleSP module_sp (addr.GetModule());
if (module_sp)
{
uint32_t resolved_mask = module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
if (resolved_mask)
{
if (num_mixed_context_lines)
{
if (!sc_range.ContainsFileAddress (addr))
{
sc.GetAddressRange (scope, 0, use_inline_block_range, sc_range);
if (sc != prev_sc)
{
if (offset != 0)
strm.EOL();
sc.DumpStopContext(&strm, exe_ctx.GetProcessPtr(), addr, false, true, false, false, true);
strm.EOL();
if (sc.comp_unit && sc.line_entry.IsValid())
{
source_manager.DisplaySourceLinesWithLineNumbers (sc.line_entry.file,
sc.line_entry.line,
num_mixed_context_lines,
num_mixed_context_lines,
((inst_is_at_pc && (options & eOptionMarkPCSourceLine)) ? "->" : ""),
&strm);
}
}
}
}
}
else
{
sc.Clear(true);
}
}
const bool show_bytes = (options & eOptionShowBytes) != 0;
inst->Dump (&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, &sc, &prev_sc, NULL, address_text_size);
strm.EOL();
}
else
{
break;
}
}
return true;
}
示例7: target_sp
bool
Disassembler::PrintInstructions
(
Disassembler *disasm_ptr,
Debugger &debugger,
const ArchSpec &arch,
const ExecutionContext &exe_ctx,
uint32_t num_instructions,
uint32_t num_mixed_context_lines,
uint32_t options,
Stream &strm
)
{
// We got some things disassembled...
size_t num_instructions_found = disasm_ptr->GetInstructionList().GetSize();
if (num_instructions > 0 && num_instructions < num_instructions_found)
num_instructions_found = num_instructions;
const uint32_t max_opcode_byte_size = disasm_ptr->GetInstructionList().GetMaxOpcocdeByteSize ();
uint32_t offset = 0;
SymbolContext sc;
SymbolContext prev_sc;
AddressRange sc_range;
const Address *pc_addr_ptr = NULL;
ExecutionContextScope *exe_scope = exe_ctx.GetBestExecutionContextScope();
Frame *frame = exe_ctx.GetFramePtr();
TargetSP target_sp (exe_ctx.GetTargetSP());
SourceManager &source_manager = target_sp ? target_sp->GetSourceManager() : debugger.GetSourceManager();
if (frame)
pc_addr_ptr = &frame->GetFrameCodeAddress();
const uint32_t scope = eSymbolContextLineEntry | eSymbolContextFunction | eSymbolContextSymbol;
const bool use_inline_block_range = false;
for (size_t i=0; i<num_instructions_found; ++i)
{
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
if (inst)
{
const Address &addr = inst->GetAddress();
const bool inst_is_at_pc = pc_addr_ptr && addr == *pc_addr_ptr;
prev_sc = sc;
ModuleSP module_sp (addr.GetModule());
if (module_sp)
{
uint32_t resolved_mask = module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
if (resolved_mask)
{
if (num_mixed_context_lines)
{
if (!sc_range.ContainsFileAddress (addr))
{
sc.GetAddressRange (scope, 0, use_inline_block_range, sc_range);
if (sc != prev_sc)
{
if (offset != 0)
strm.EOL();
sc.DumpStopContext(&strm, exe_ctx.GetProcessPtr(), addr, false, true, false);
strm.EOL();
if (sc.comp_unit && sc.line_entry.IsValid())
{
source_manager.DisplaySourceLinesWithLineNumbers (sc.line_entry.file,
sc.line_entry.line,
num_mixed_context_lines,
num_mixed_context_lines,
((inst_is_at_pc && (options & eOptionMarkPCSourceLine)) ? "->" : ""),
&strm);
}
}
}
}
else if ((sc.function || sc.symbol) && (sc.function != prev_sc.function || sc.symbol != prev_sc.symbol))
{
if (prev_sc.function || prev_sc.symbol)
strm.EOL();
bool show_fullpaths = false;
bool show_module = true;
bool show_inlined_frames = true;
sc.DumpStopContext (&strm,
exe_scope,
addr,
show_fullpaths,
show_module,
show_inlined_frames);
strm << ":\n";
}
}
else
{
sc.Clear(true);
}
}
//.........这里部分代码省略.........
示例8: range
//.........这里部分代码省略.........
Address addr(range.GetBaseAddress());
// We extract the section to make sure we don't transition out
// of the current section when disassembling
const Section *addr_section = addr.GetSection();
Module *range_module = range.GetBaseAddress().GetModule();
for (size_t i=0; i<num_instructions; ++i)
{
Disassembler::Instruction *inst = disassembler->GetInstructionList().GetInstructionAtIndex (i);
if (inst)
{
addr_t file_addr = addr.GetFileAddress();
if (addr_section == NULL || addr_section->ContainsFileAddress (file_addr) == false)
{
if (range_module)
range_module->ResolveFileAddress (file_addr, addr);
else if (exe_ctx.target)
exe_ctx.target->GetImages().ResolveFileAddress (file_addr, addr);
addr_section = addr.GetSection();
}
prev_sc = sc;
if (addr_section)
{
Module *module = addr_section->GetModule();
uint32_t resolved_mask = module->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
if (resolved_mask)
{
if (prev_sc.function != sc.function || prev_sc.symbol != sc.symbol)
{
if (prev_sc.function || prev_sc.symbol)
strm.EOL();
strm << sc.module_sp->GetFileSpec().GetFilename();
if (sc.function)
strm << '`' << sc.function->GetMangled().GetName();
else if (sc.symbol)
strm << '`' << sc.symbol->GetMangled().GetName();
strm << ":\n";
}
if (num_mixed_context_lines && !sc_range.ContainsFileAddress (addr))
{
sc.GetAddressRange (eSymbolContextEverything, sc_range);
if (sc != prev_sc)
{
if (offset != 0)
strm.EOL();
sc.DumpStopContext(&strm, process, addr);
if (sc.comp_unit && sc.line_entry.IsValid())
{
debugger.GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.line_entry.file,
sc.line_entry.line,
num_mixed_context_lines,
num_mixed_context_lines,
num_mixed_context_lines ? "->" : "",
&strm);
}
}
}
}
else
{
sc.Clear();
}
}
if (num_mixed_context_lines)
strm.IndentMore ();
strm.Indent();
size_t inst_byte_size = inst->GetByteSize();
inst->Dump(&strm, &addr, show_bytes ? &data : NULL, offset, exe_ctx, show_bytes);
strm.EOL();
offset += inst_byte_size;
addr.SetOffset (addr.GetOffset() + inst_byte_size);
if (num_mixed_context_lines)
strm.IndentLess ();
}
else
{
break;
}
}
if (num_mixed_context_lines)
strm.IndentLess ();
}
}
return true;
}
return false;
}
示例9: name
//.........这里部分代码省略.........
result.SetStatus (eReturnStatusFailed);
return false;
}
}
}
if (sc_list.GetSize() == 0)
{
result.AppendErrorWithFormat("no modules contain load address 0x%" PRIx64 ".\n", m_options.address);
result.SetStatus (eReturnStatusFailed);
return false;
}
}
uint32_t num_matches = sc_list.GetSize();
for (uint32_t i=0; i<num_matches; ++i)
{
SymbolContext sc;
sc_list.GetContextAtIndex(i, sc);
if (sc.comp_unit)
{
if (m_options.show_bp_locs)
{
m_breakpoint_locations.Clear();
const bool show_inlines = true;
m_breakpoint_locations.Reset (*sc.comp_unit, 0, show_inlines);
SearchFilter target_search_filter (target->shared_from_this());
target_search_filter.Search (m_breakpoint_locations);
}
bool show_fullpaths = true;
bool show_module = true;
bool show_inlined_frames = true;
const bool show_function_arguments = true;
sc.DumpStopContext(&result.GetOutputStream(),
m_exe_ctx.GetBestExecutionContextScope(),
sc.line_entry.range.GetBaseAddress(),
show_fullpaths,
show_module,
show_inlined_frames,
show_function_arguments);
result.GetOutputStream().EOL();
if (m_options.num_lines == 0)
m_options.num_lines = 10;
size_t lines_to_back_up = m_options.num_lines >= 10 ? 5 : m_options.num_lines/2;
target->GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
sc.line_entry.line,
lines_to_back_up,
m_options.num_lines - lines_to_back_up,
"->",
&result.GetOutputStream(),
GetBreakpointLocations ());
result.SetStatus (eReturnStatusSuccessFinishResult);
}
}
}
else if (m_options.file_name.empty())
{
// Last valid source manager context, or the current frame if no
// valid last context in source manager.
// One little trick here, if you type the exact same list command twice in a row, it is
// more likely because you typed it once, then typed it again
if (m_options.start_line == 0)
{