[Lldb-commits] [lldb] r219544 - Add a new disassembly-format specification so that the disassembler
Eric Christopher
echristo at gmail.com
Fri Oct 10 17:15:59 PDT 2014
On Fri, Oct 10, 2014 at 5:09 PM, Eric Christopher <echristo at gmail.com> wrote:
> On Fri, Oct 10, 2014 at 4:07 PM, Jason Molenda <jmolenda at apple.com> wrote:
>> Author: jmolenda
>> Date: Fri Oct 10 18:07:36 2014
>> New Revision: 219544
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=219544&view=rev
>> Log:
>> Add a new disassembly-format specification so that the disassembler
>> output style can be customized. Change the built-in default to be
>> more similar to gdb's disassembly formatting.
>>
>> The disassembly-format for a gdb-like output is
>>
>> ${addr-file-or-load} <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>:
>>
>> The disassembly-format for the lldb style output is
>>
>> {${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}:
>>
>> The two backticks in the lldb style formatter triggers the sub-expression evaluation in
>> CommandInterpreter::PreprocessCommand() so you can't use that one as-is ... changing to
>> use ' characters instead of ` would work around that.
>>
>> <rdar://problem/9885398>
>>
>>
>> Modified:
>> lldb/trunk/include/lldb/Core/Address.h
>> lldb/trunk/include/lldb/Core/Debugger.h
>> lldb/trunk/include/lldb/Core/Disassembler.h
>> lldb/trunk/include/lldb/Core/Mangled.h
>> lldb/trunk/include/lldb/Core/StreamString.h
>> lldb/trunk/include/lldb/Symbol/SymbolContext.h
>> lldb/trunk/source/API/SBInstruction.cpp
>> lldb/trunk/source/API/SBInstructionList.cpp
>> lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
>> lldb/trunk/source/Commands/CommandObjectSource.cpp
>> lldb/trunk/source/Core/Address.cpp
>> lldb/trunk/source/Core/Debugger.cpp
>> lldb/trunk/source/Core/Disassembler.cpp
>> lldb/trunk/source/Core/Mangled.cpp
>> lldb/trunk/source/Core/StreamString.cpp
>> lldb/trunk/source/Expression/IRExecutionUnit.cpp
>> lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
>> lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
>> lldb/trunk/source/Symbol/SymbolContext.cpp
>> lldb/trunk/source/Symbol/Variable.cpp
>> lldb/trunk/source/Target/StackFrame.cpp
>> lldb/trunk/source/Target/ThreadPlanTracer.cpp
>> lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py
>> lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
>>
>> Modified: lldb/trunk/include/lldb/Core/Address.h
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/include/lldb/Core/Address.h (original)
>> +++ lldb/trunk/include/lldb/Core/Address.h Fri Oct 10 18:07:36 2014
>> @@ -87,6 +87,7 @@ public:
>> ///< and file and line), to information about what the pointer points to
>> ///< if the address is in a section (section of pointers, c strings, etc).
>> DumpStyleResolvedDescriptionNoModule,
>> + DumpStyleResolvedDescriptionNoFunctionArguments,
>> DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for an address for all symbol
>> ///< context members.
>> DumpStyleResolvedPointerDescription ///< Dereference a pointer at the current address and then lookup the
>>
>> Modified: lldb/trunk/include/lldb/Core/Debugger.h
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/include/lldb/Core/Debugger.h (original)
>> +++ lldb/trunk/include/lldb/Core/Debugger.h Fri Oct 10 18:07:36 2014
>> @@ -250,6 +250,13 @@ public:
>> Stream &s,
>> ValueObject* valobj = NULL);
>>
>> + static bool
>> + FormatDisassemblerAddress (const char *format,
>> + const SymbolContext *sc,
>> + const SymbolContext *prev_sc,
>> + const ExecutionContext *exe_ctx,
>> + const Address *addr,
>> + Stream &s);
>>
>> void
>> ClearIOHandlers ();
>> @@ -288,10 +295,13 @@ public:
>>
>> bool
>> GetAutoConfirm () const;
>> -
>> +
>> + const char *
>> + GetDisassemblyFormat() const;
>> +
>> const char *
>> GetFrameFormat() const;
>> -
>> +
>> const char *
>> GetThreadFormat() const;
>>
>>
>> Modified: lldb/trunk/include/lldb/Core/Disassembler.h
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/include/lldb/Core/Disassembler.h (original)
>> +++ lldb/trunk/include/lldb/Core/Disassembler.h Fri Oct 10 18:07:36 2014
>> @@ -77,12 +77,60 @@ public:
>> m_address = addr;
>> }
>>
>> + //------------------------------------------------------------------
>> + /// Dump the text representation of this Instruction to a Stream
>> + ///
>> + /// Print the (optional) address, (optional) bytes, opcode,
>> + /// operands, and instruction comments to a stream.
>> + ///
>> + /// @param[in] s
>> + /// The Stream to add the text to.
>> + ///
>> + /// @param[in] show_address
>> + /// Whether the address (using disassembly_addr_format_spec formatting)
>> + /// should be printed.
>> + ///
>> + /// @param[in] show_bytes
>> + /// Whether the bytes of the assembly instruction should be printed.
>> + ///
>> + /// @param[in] max_opcode_byte_size
>> + /// The size (in bytes) of the largest instruction in the list that
>> + /// we are printing (for text justification/alignment purposes)
>> + /// Only needed if show_bytes is true.
>> + ///
>> + /// @param[in] exe_ctx
>> + /// The current execution context, if available. May be used in
>> + /// the assembling of the operands+comments for this instruction.
>> + /// Pass NULL if not applicable.
>> + ///
>> + /// @param[in] sym_ctx
>> + /// The SymbolContext for this instruction.
>> + /// Pass NULL if not available/computed.
>> + /// Only needed if show_address is true.
>> + ///
>> + /// @param[in] prev_sym_ctx
>> + /// The SymbolContext for the previous instruction. Depending on
>> + /// the disassembly address format specification, a change in
>> + /// Symbol / Function may mean that a line is printed with the new
>> + /// symbol/function name.
>> + /// Pass NULL if unavailable, or if this is the first instruction of
>> + /// the InstructionList.
>> + /// Only needed if show_address is true.
>> + ///
>> + /// @param[in] disassembly_addr_format_spec
>> + /// The format specification for how addresses are printed.
>> + /// Only needed if show_address is true.
>> + //------------------------------------------------------------------
>> +
>> virtual void
>> Dump (Stream *s,
>> uint32_t max_opcode_byte_size,
>> bool show_address,
>> bool show_bytes,
>> - const ExecutionContext* exe_ctx);
>> + const ExecutionContext* exe_ctx,
>> + const SymbolContext *sym_ctx,
>> + const SymbolContext *prev_sym_ctx,
>> + const char *disassembly_addr_format_spec);
>>
>> virtual bool
>> DoesBranch () = 0;
>>
>> Modified: lldb/trunk/include/lldb/Core/Mangled.h
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Mangled.h?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/include/lldb/Core/Mangled.h (original)
>> +++ lldb/trunk/include/lldb/Core/Mangled.h Fri Oct 10 18:07:36 2014
>> @@ -37,7 +37,8 @@ public:
>> enum NamePreference
>> {
>> ePreferMangled,
>> - ePreferDemangled
>> + ePreferDemangled,
>> + ePreferDemangledWithoutArguments
>> };
>>
>> //----------------------------------------------------------------------
>>
>> Modified: lldb/trunk/include/lldb/Core/StreamString.h
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/StreamString.h?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/include/lldb/Core/StreamString.h (original)
>> +++ lldb/trunk/include/lldb/Core/StreamString.h Fri Oct 10 18:07:36 2014
>> @@ -46,6 +46,9 @@ public:
>> size_t
>> GetSize() const;
>>
>> + size_t
>> + GetSizeOfLastLine () const;
>> +
>> std::string &
>> GetString();
>>
>>
>> Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original)
>> +++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Fri Oct 10 18:07:36 2014
>> @@ -168,7 +168,8 @@ public:
>> const Address &so_addr,
>> bool show_fullpaths,
>> bool show_module,
>> - bool show_inlined_frames) const;
>> + bool show_inlined_frames,
>> + bool show_function_arguments) const;
>>
>> //------------------------------------------------------------------
>> /// Get the address range contained within a symbol context.
>>
>> Modified: lldb/trunk/source/API/SBInstruction.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstruction.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/API/SBInstruction.cpp (original)
>> +++ lldb/trunk/source/API/SBInstruction.cpp Fri Oct 10 18:07:36 2014
>> @@ -20,6 +20,7 @@
>> #include "lldb/Core/DataExtractor.h"
>> #include "lldb/Core/Disassembler.h"
>> #include "lldb/Core/EmulateInstruction.h"
>> +#include "lldb/Core/Module.h"
>> #include "lldb/Core/StreamFile.h"
>> #include "lldb/Target/ExecutionContext.h"
>> #include "lldb/Target/StackFrame.h"
>> @@ -170,9 +171,15 @@ SBInstruction::GetDescription (lldb::SBS
>> {
>> if (m_opaque_sp)
>> {
>> + SymbolContext sc;
>> + const Address &addr = m_opaque_sp->GetAddress();
>> + ModuleSP module_sp (addr.GetModule());
>> + if (module_sp)
>> + module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
>> // Use the "ref()" instead of the "get()" accessor in case the SBStream
>> // didn't have a stream already created, one will get created...
>> - m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL);
>> + const char *disassemble_format = "${addr-file-or-load}: ";
>> + m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, disassemble_format);
>> return true;
>> }
>> return false;
>> @@ -186,8 +193,14 @@ SBInstruction::Print (FILE *out)
>>
>> if (m_opaque_sp)
>> {
>> + SymbolContext sc;
>> + const Address &addr = m_opaque_sp->GetAddress();
>> + ModuleSP module_sp (addr.GetModule());
>> + if (module_sp)
>> + module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
>> StreamFile out_stream (out, false);
>> - m_opaque_sp->Dump (&out_stream, 0, true, false, NULL);
>> + const char *disassemble_format = "${addr-file-or-load}: ";
>> + m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, disassemble_format);
>> }
>> }
>>
>>
>> Modified: lldb/trunk/source/API/SBInstructionList.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstructionList.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/API/SBInstructionList.cpp (original)
>> +++ lldb/trunk/source/API/SBInstructionList.cpp Fri Oct 10 18:07:36 2014
>> @@ -11,7 +11,9 @@
>> #include "lldb/API/SBInstruction.h"
>> #include "lldb/API/SBStream.h"
>> #include "lldb/Core/Disassembler.h"
>> +#include "lldb/Core/Module.h"
>> #include "lldb/Core/Stream.h"
>> +#include "lldb/Symbol/SymbolContext.h"
>>
>> using namespace lldb;
>> using namespace lldb_private;
>> @@ -100,12 +102,24 @@ SBInstructionList::GetDescription (lldb:
>> // exist already inside description...
>> Stream &sref = description.ref();
>> const uint32_t max_opcode_byte_size = m_opaque_sp->GetInstructionList().GetMaxOpcocdeByteSize();
>> + const char *disassemble_format = "${addr-file-or-load}: ";
>> + SymbolContext sc;
>> + SymbolContext prev_sc;
>> for (size_t i=0; i<num_instructions; ++i)
>> {
>> Instruction *inst = m_opaque_sp->GetInstructionList().GetInstructionAtIndex (i).get();
>> if (inst == NULL)
>> break;
>> - inst->Dump (&sref, max_opcode_byte_size, true, false, NULL);
>> +
>> + const Address &addr = inst->GetAddress();
>> + prev_sc = sc;
>> + ModuleSP module_sp (addr.GetModule());
>> + if (module_sp)
>> + {
>> + module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
>> + }
>> +
>> + inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, disassemble_format);
>> sref.EOL();
>> }
>> return true;
>>
>> Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
>> +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Oct 10 18:07:36 2014
>> @@ -569,7 +569,7 @@ BreakpointLocation::GetDescription (Stre
>> s->PutCString ("re-exported target = ");
>> else
>> s->PutCString("where = ");
>> - sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false);
>> + sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false, true);
>> }
>> else
>> {
>>
>> Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
>> +++ lldb/trunk/source/Commands/CommandObjectSource.cpp Fri Oct 10 18:07:36 2014
>> @@ -689,12 +689,14 @@ protected:
>> 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_inlined_frames,
>> + show_function_arguments);
>> result.GetOutputStream().EOL();
>>
>> if (m_options.num_lines == 0)
>>
>> Modified: lldb/trunk/source/Core/Address.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Core/Address.cpp (original)
>> +++ lldb/trunk/source/Core/Address.cpp Fri Oct 10 18:07:36 2014
>> @@ -465,6 +465,7 @@ Address::Dump (Stream *s, ExecutionConte
>>
>> case DumpStyleResolvedDescription:
>> case DumpStyleResolvedDescriptionNoModule:
>> + case DumpStyleResolvedDescriptionNoFunctionArguments:
>> if (IsSectionOffset())
>> {
>> uint32_t pointer_size = 4;
>> @@ -550,7 +551,7 @@ Address::Dump (Stream *s, ExecutionConte
>> #endif
>> Address cstr_addr(*this);
>> cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
>> - func_sc.DumpStopContext(s, exe_scope, so_addr, true, true, false);
>> + func_sc.DumpStopContext(s, exe_scope, so_addr, true, true, false, true);
>> if (ReadAddress (exe_scope, cstr_addr, pointer_size, so_addr))
>> {
>> #if VERBOSE_OUTPUT
>> @@ -633,7 +634,7 @@ Address::Dump (Stream *s, ExecutionConte
>> if (pointer_sc.function || pointer_sc.symbol)
>> {
>> s->PutCString(": ");
>> - pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false, false);
>> + pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false, false, true);
>> }
>> }
>> }
>> @@ -658,6 +659,7 @@ Address::Dump (Stream *s, ExecutionConte
>> const bool show_module = (style == DumpStyleResolvedDescription);
>> const bool show_fullpaths = false;
>> const bool show_inlined_frames = true;
>> + const bool show_function_arguments = (style != DumpStyleResolvedDescriptionNoFunctionArguments);
>> if (sc.function == NULL && sc.symbol != NULL)
>> {
>> // If we have just a symbol make sure it is in the right section
>> @@ -679,7 +681,8 @@ Address::Dump (Stream *s, ExecutionConte
>> *this,
>> show_fullpaths,
>> show_module,
>> - show_inlined_frames);
>> + show_inlined_frames,
>> + show_function_arguments);
>> }
>> else
>> {
>>
>> Modified: lldb/trunk/source/Core/Debugger.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Core/Debugger.cpp (original)
>> +++ lldb/trunk/source/Core/Debugger.cpp Fri Oct 10 18:07:36 2014
>> @@ -45,6 +45,8 @@
>> #include "lldb/Symbol/Function.h"
>> #include "lldb/Symbol/Symbol.h"
>> #include "lldb/Symbol/VariableList.h"
>> +#include "lldb/Target/CPPLanguageRuntime.h"
>> +#include "lldb/Target/ObjCLanguageRuntime.h"
>> #include "lldb/Target/TargetList.h"
>> #include "lldb/Target/Process.h"
>> #include "lldb/Target/RegisterContext.h"
>> @@ -122,12 +124,14 @@ g_language_enumerators[] =
>> FILE_AND_LINE\
>> "\\n"
>>
>> +#define DEFAULT_DISASSEMBLY_FORMAT "${addr-file-or-load} <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>: "
>>
>>
>> static PropertyDefinition
>> g_properties[] =
>> {
>> { "auto-confirm", OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true all confirmation prompts will receive their default reply." },
>> +{ "disassembly-format", OptionValue::eTypeString , true, 0 , DEFAULT_DISASSEMBLY_FORMAT, NULL, "The default disassembly format string to use when disassembling instruction sequences." },
>> { "frame-format", OptionValue::eTypeString , true, 0 , DEFAULT_FRAME_FORMAT, NULL, "The default frame format string to use when displaying stack frame information for threads." },
>> { "notify-void", OptionValue::eTypeBoolean, true, false, NULL, NULL, "Notify the user explicitly if an expression returns void (default: false)." },
>> { "prompt", OptionValue::eTypeString , true, OptionValueString::eOptionEncodeCharacterEscapeSequences, "(lldb) ", NULL, "The debugger command line prompt displayed for the user." },
>> @@ -148,6 +152,7 @@ g_properties[] =
>> enum
>> {
>> ePropertyAutoConfirm = 0,
>> + ePropertyDisassemblyFormat,
>> ePropertyFrameFormat,
>> ePropertyNotiftVoid,
>> ePropertyPrompt,
>> @@ -231,6 +236,13 @@ Debugger::GetAutoConfirm () const
>> }
>>
>> const char *
>> +Debugger::GetDisassemblyFormat() const
>> +{
>> + const uint32_t idx = ePropertyDisassemblyFormat;
>> + return m_collection_sp->GetPropertyAtIndexAsString (NULL, idx, g_properties[idx].default_cstr_value);
>> +}
>> +
>> +const char *
>> Debugger::GetFrameFormat() const
>> {
>> const uint32_t idx = ePropertyFrameFormat;
>> @@ -1128,6 +1140,8 @@ TestPromptFormats (StackFrame *frame)
>> StreamString s;
>> const char *prompt_format =
>> "{addr = '${addr}'\n}"
>> + "{addr-file-or-load = '${addr-file-or-load}'\n}"
>> + "{current-pc-arrow = '${current-pc-arrow}'\n}"
>> "{process.id = '${process.id}'\n}"
>> "{process.name = '${process.name}'\n}"
>> "{process.file.basename = '${process.file.basename}'\n}"
>> @@ -1155,9 +1169,13 @@ TestPromptFormats (StackFrame *frame)
>> "{frame.reg.xmm0 = '${frame.reg.xmm0}'\n}"
>> "{frame.reg.carp = '${frame.reg.carp}'\n}"
>> "{function.id = '${function.id}'\n}"
>> + "{function.changed = '${function.changed}'\n}"
>> + "{function.initial-function = '${function.initial-function}'\n}"
>> "{function.name = '${function.name}'\n}"
>> + "{function.name-without-args = '${function.name-without-args}'\n}"
>> "{function.name-with-args = '${function.name-with-args}'\n}"
>> "{function.addr-offset = '${function.addr-offset}'\n}"
>> + "{function.concrete-only-addr-offset-no-padding = '${function.concrete-only-addr-offset-no-padding}'\n}"
>> "{function.line-offset = '${function.line-offset}'\n}"
>> "{function.pc-offset = '${function.pc-offset}'\n}"
>> "{line.file.basename = '${line.file.basename}'\n}"
>> @@ -1555,7 +1573,9 @@ FormatPromptRecurse
>> const Address *addr,
>> Stream &s,
>> const char **end,
>> - ValueObject* valobj
>> + ValueObject* valobj,
>> + bool function_changed,
>> + bool initial_function
>> )
>> {
>> ValueObject* realvalobj = NULL; // makes it super-easy to parse pointers
>> @@ -1597,7 +1617,7 @@ FormatPromptRecurse
>>
>> ++p; // Skip the '{'
>>
>> - if (FormatPromptRecurse (p, sc, exe_ctx, addr, sub_strm, &p, valobj))
>> + if (FormatPromptRecurse (p, sc, exe_ctx, addr, sub_strm, &p, valobj, function_changed, initial_function))
>> {
>> // The stream had all it needed
>> s.Write(sub_strm.GetData(), sub_strm.GetSize());
>> @@ -1631,6 +1651,12 @@ FormatPromptRecurse
>> const char *cstr = NULL;
>> std::string token_format;
>> Address format_addr;
>> +
>> + // normally "addr" means print a raw address but
>> + // "file-addr-or-load-addr" means print a module + file addr if there's no load addr
>> + bool print_file_addr_or_load_addr = false;
>> + bool addr_offset_concrete_func_only = false;
>> + bool addr_offset_print_with_no_padding = false;
>> bool calculate_format_addr_function_offset = false;
>> // Set reg_kind and reg_num to invalid values
>> RegisterKind reg_kind = kNumRegisterKinds;
>> @@ -1941,7 +1967,7 @@ FormatPromptRecurse
>> if (!special_directions)
>> var_success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
>> else
>> - var_success &= FormatPromptRecurse(special_directions, sc, exe_ctx, addr, s, NULL, item);
>> + var_success &= FormatPromptRecurse(special_directions, sc, exe_ctx, addr, s, NULL, item, function_changed, initial_function);
>>
>> if (--max_num_children == 0)
>> {
>> @@ -1957,7 +1983,12 @@ FormatPromptRecurse
>> }
>> break;
>> case 'a':
>> - if (IsToken (var_name_begin, "addr}"))
>> + if (IsToken (var_name_begin, "addr-file-or-load}"))
>> + {
>> + print_file_addr_or_load_addr = true;
>> + }
>> + if (IsToken (var_name_begin, "addr}")
>> + || IsToken (var_name_begin, "addr-file-or-load}"))
>> {
>> if (addr && addr->IsValid())
>> {
>> @@ -2159,8 +2190,7 @@ FormatPromptRecurse
>> }
>> }
>> break;
>> -
>> -
>> +
>> case 'm':
>> if (IsToken (var_name_begin, "module."))
>> {
>> @@ -2288,6 +2318,14 @@ FormatPromptRecurse
>>
>> var_success = true;
>> }
>> + if (IsToken (var_name_begin, "changed}") && function_changed)
>> + {
>> + var_success = true;
>> + }
>> + if (IsToken (var_name_begin, "initial-function}") && initial_function)
>> + {
>> + var_success = true;
>> + }
>> else if (IsToken (var_name_begin, "name}"))
>> {
>> if (sc->function)
>> @@ -2314,6 +2352,19 @@ FormatPromptRecurse
>> var_success = true;
>> }
>> }
>> + else if (IsToken (var_name_begin, "name-without-args}"))
>> + {
>> + ConstString name;
>> + if (sc->function)
>> + name = sc->function->GetMangled().GetName (Mangled::ePreferDemangledWithoutArguments);
>> + else if (sc->symbol)
>> + name = sc->symbol->GetMangled().GetName (Mangled::ePreferDemangledWithoutArguments);
>> + if (name)
>> + {
>> + s.PutCString(name.GetCString());
>> + var_success = true;
>> + }
>> + }
>> else if (IsToken (var_name_begin, "name-with-args}"))
>> {
>> // Print the function name with arguments in it
>> @@ -2457,8 +2508,14 @@ FormatPromptRecurse
>> }
>> }
>> }
>> - else if (IsToken (var_name_begin, "addr-offset}"))
>> + else if (IsToken (var_name_begin, "addr-offset}")
>> + || IsToken (var_name_begin, "concrete-only-addr-offset-no-padding}"))
>> {
>> + if (IsToken (var_name_begin, "concrete-only-addr-offset-no-padding}"))
>> + {
>> + addr_offset_print_with_no_padding = true;
>> + addr_offset_concrete_func_only = true;
>> + }
>> var_success = addr != NULL;
>> if (var_success)
>> {
>> @@ -2529,6 +2586,34 @@ FormatPromptRecurse
>> }
>> }
>> break;
>> + case 'c':
>> + if (IsToken (var_name_begin, "current-pc-arrow"))
>> + {
>> + if (addr && exe_ctx && exe_ctx->GetFramePtr())
>> + {
>> + RegisterContextSP reg_ctx = exe_ctx->GetFramePtr()->GetRegisterContextSP();
>> + if (reg_ctx.get())
>> + {
>> + addr_t pc_loadaddr = reg_ctx->GetPC();
>> + if (pc_loadaddr != LLDB_INVALID_ADDRESS)
>> + {
>> + Address pc;
>> + pc.SetLoadAddress (pc_loadaddr, exe_ctx->GetTargetPtr());
>> + if (pc == *addr)
>> + {
>> + s.Printf ("->");
>> + var_success = true;
>> + }
>> + else
>> + {
>> + s.Printf(" ");
>> + var_success = true;
>> + }
>> + }
>> + }
>> + }
>> + }
>> + break;
>> }
>>
>> if (var_success)
>> @@ -2586,7 +2671,7 @@ FormatPromptRecurse
>> if (sc->function)
>> {
>> func_addr = sc->function->GetAddressRange().GetBaseAddress();
>> - if (sc->block)
>> + if (sc->block && addr_offset_concrete_func_only == false)
>> {
>> // Check to make sure we aren't in an inline
>> // function. If we are, use the inline block
>> @@ -2604,14 +2689,19 @@ FormatPromptRecurse
>>
>> if (func_addr.IsValid())
>> {
>> + const char *addr_offset_padding = " ";
>> + if (addr_offset_print_with_no_padding)
>> + {
>> + addr_offset_padding = "";
>> + }
>> if (func_addr.GetSection() == format_addr.GetSection())
>> {
>> addr_t func_file_addr = func_addr.GetFileAddress();
>> addr_t addr_file_addr = format_addr.GetFileAddress();
>> if (addr_file_addr > func_file_addr)
>> - s.Printf(" + %" PRIu64, addr_file_addr - func_file_addr);
>> + s.Printf("%s+%s%" PRIu64, addr_offset_padding, addr_offset_padding, addr_file_addr - func_file_addr);
>> else if (addr_file_addr < func_file_addr)
>> - s.Printf(" - %" PRIu64, func_file_addr - addr_file_addr);
>> + s.Printf("%s-%s%" PRIu64, addr_offset_padding, addr_offset_padding, func_file_addr - addr_file_addr);
>> var_success = true;
>> }
>> else
>> @@ -2622,9 +2712,9 @@ FormatPromptRecurse
>> addr_t func_load_addr = func_addr.GetLoadAddress (target);
>> addr_t addr_load_addr = format_addr.GetLoadAddress (target);
>> if (addr_load_addr > func_load_addr)
>> - s.Printf(" + %" PRIu64, addr_load_addr - func_load_addr);
>> + s.Printf("%s+%s%" PRIu64, addr_offset_padding, addr_offset_padding, addr_load_addr - func_load_addr);
>> else if (addr_load_addr < func_load_addr)
>> - s.Printf(" - %" PRIu64, func_load_addr - addr_load_addr);
>> + s.Printf("%s-%s%" PRIu64, addr_offset_padding, addr_offset_padding, func_load_addr - addr_load_addr);
>> var_success = true;
>> }
>> }
>> @@ -2641,10 +2731,21 @@ FormatPromptRecurse
>>
>> if (vaddr != LLDB_INVALID_ADDRESS)
>> {
>> - int addr_width = target->GetArchitecture().GetAddressByteSize() * 2;
>> + int addr_width = 0;
>> + if (exe_ctx && target)
>> + {
>> + target->GetArchitecture().GetAddressByteSize() * 2;
You didn't actually set addr_width to the result of the computation
here and there wasn't a comment saying that it should happen. I
guessed and did this in:
dzur:~/sources/llvm/tools/lldb> svn ci source/Core/Debugger.cpp
Sending source/Core/Debugger.cpp
Transmitting file data .
Committed revision 219549.
-eric
>> + }
>> if (addr_width == 0)
>> addr_width = 16;
>> - s.Printf("0x%*.*" PRIx64, addr_width, addr_width, vaddr);
>> + if (print_file_addr_or_load_addr)
>> + {
>> + format_addr.Dump (&s, exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, 0);
>> + }
>> + else
>> + {
>> + s.Printf("0x%*.*" PRIx64, addr_width, addr_width, vaddr);
>> + }
>> var_success = true;
>> }
>> }
>> @@ -2758,9 +2859,55 @@ Debugger::FormatPrompt
>> std::string format_str = lldb_utility::ansi::FormatAnsiTerminalCodes (format, use_color);
>> if (format_str.length())
>> format = format_str.c_str();
>> - return FormatPromptRecurse (format, sc, exe_ctx, addr, s, NULL, valobj);
>> + return FormatPromptRecurse (format, sc, exe_ctx, addr, s, NULL, valobj, false, false);
>> +}
>> +
>> +bool
>> +Debugger::FormatDisassemblerAddress (const char *format,
>> + const SymbolContext *sc,
>> + const SymbolContext *prev_sc,
>> + const ExecutionContext *exe_ctx,
>> + const Address *addr,
>> + Stream &s)
>> +{
>> + if (format == NULL && exe_ctx != NULL && exe_ctx->HasTargetScope())
>> + {
>> + format = exe_ctx->GetTargetRef().GetDebugger().GetDisassemblyFormat();
>> + }
>> + bool function_changed = false;
>> + bool initial_function = false;
>> + if (prev_sc && (prev_sc->function || prev_sc->symbol))
>> + {
>> + if (sc && (sc->function || sc->symbol))
>> + {
>> + if (prev_sc->symbol && sc->symbol)
>> + {
>> + if (!sc->symbol->Compare (prev_sc->symbol->GetName(), prev_sc->symbol->GetType()))
>> + {
>> + function_changed = true;
>> + }
>> + }
>> + else if (prev_sc->function && sc->function)
>> + {
>> + if (prev_sc->function->GetMangled() != sc->function->GetMangled())
>> + {
>> + function_changed = true;
>> + }
>> + }
>> + }
>> + }
>> + // The first context on a list of instructions will have a prev_sc that
>> + // has no Function or Symbol -- if SymbolContext had an IsValid() method, it
>> + // would return false. But we do get a prev_sc pointer.
>> + if ((sc && (sc->function || sc->symbol))
>> + && prev_sc && (prev_sc->function == NULL && prev_sc->symbol == NULL))
>> + {
>> + initial_function = true;
>> + }
>> + return FormatPromptRecurse (format, sc, exe_ctx, addr, s, NULL, NULL, function_changed, initial_function);
>> }
>>
>> +
>> void
>> Debugger::SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton)
>> {
>>
>> Modified: lldb/trunk/source/Core/Disassembler.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Core/Disassembler.cpp (original)
>> +++ lldb/trunk/source/Core/Disassembler.cpp Fri Oct 10 18:07:36 2014
>> @@ -410,17 +410,18 @@ Disassembler::PrintInstructions
>> SymbolContext prev_sc;
>> AddressRange sc_range;
>> const Address *pc_addr_ptr = NULL;
>> - ExecutionContextScope *exe_scope = exe_ctx.GetBestExecutionContextScope();
>> StackFrame *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)
>> + for (size_t i = 0; i < num_instructions_found; ++i)
>> {
>> Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
>> if (inst)
>> @@ -447,7 +448,7 @@ Disassembler::PrintInstructions
>> if (offset != 0)
>> strm.EOL();
>>
>> - sc.DumpStopContext(&strm, exe_ctx.GetProcessPtr(), addr, false, true, false);
>> + sc.DumpStopContext(&strm, exe_ctx.GetProcessPtr(), addr, false, true, false, false);
>> strm.EOL();
>>
>> if (sc.comp_unit && sc.line_entry.IsValid())
>> @@ -462,23 +463,6 @@ Disassembler::PrintInstructions
>> }
>> }
>> }
>> - 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
>> {
>> @@ -486,12 +470,13 @@ Disassembler::PrintInstructions
>> }
>> }
>>
>> - if ((options & eOptionMarkPCAddress) && pc_addr_ptr)
>> + const bool show_bytes = (options & eOptionShowBytes) != 0;
>> + const char *disassembly_format = "${addr-file-or-load}: ";
>> + if (exe_ctx.HasTargetScope())
>> {
>> - strm.PutCString(inst_is_at_pc ? "-> " : " ");
>> + disassembly_format = exe_ctx.GetTargetRef().GetDebugger().GetDisassemblyFormat ();
>> }
>> - const bool show_bytes = (options & eOptionShowBytes) != 0;
>> - inst->Dump(&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx);
>> + inst->Dump (&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, &sc, &prev_sc, disassembly_format);
>> strm.EOL();
>> }
>> else
>> @@ -578,7 +563,10 @@ Instruction::Dump (lldb_private::Stream
>> uint32_t max_opcode_byte_size,
>> bool show_address,
>> bool show_bytes,
>> - const ExecutionContext* exe_ctx)
>> + const ExecutionContext* exe_ctx,
>> + const SymbolContext *sym_ctx,
>> + const SymbolContext *prev_sym_ctx,
>> + const char *disassembly_addr_format_spec)
>> {
>> size_t opcode_column_width = 7;
>> const size_t operand_column_width = 25;
>> @@ -589,13 +577,7 @@ Instruction::Dump (lldb_private::Stream
>>
>> if (show_address)
>> {
>> - m_address.Dump(&ss,
>> - exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL,
>> - Address::DumpStyleLoadAddress,
>> - Address::DumpStyleModuleWithFileAddress,
>> - 0);
>> -
>> - ss.PutCString(": ");
>> + Debugger::FormatDisassemblerAddress (disassembly_addr_format_spec, sym_ctx, prev_sym_ctx, exe_ctx, &m_address, ss);
>> }
>>
>> if (show_bytes)
>> @@ -621,7 +603,7 @@ Instruction::Dump (lldb_private::Stream
>> }
>> }
>>
>> - const size_t opcode_pos = ss.GetSize();
>> + const size_t opcode_pos = ss.GetSizeOfLastLine();
>>
>> // The default opcode size of 7 characters is plenty for most architectures
>> // but some like arm can pull out the occasional vqrshrun.s16. We won't get
>> @@ -1003,13 +985,18 @@ InstructionList::Dump (Stream *s,
>> {
>> const uint32_t max_opcode_byte_size = GetMaxOpcocdeByteSize();
>> collection::const_iterator pos, begin, end;
>> + const char *disassemble_format = "${addr-file-or-load}: ";
>> + if (exe_ctx)
>> + {
>> + disassemble_format = exe_ctx->GetTargetRef().GetDebugger().GetDisassemblyFormat ();
>> + }
>> for (begin = m_instructions.begin(), end = m_instructions.end(), pos = begin;
>> pos != end;
>> ++pos)
>> {
>> if (pos != begin)
>> s->EOL();
>> - (*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes, exe_ctx);
>> + (*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes, exe_ctx, NULL, NULL, disassemble_format);
>> }
>> }
>>
>>
>> Modified: lldb/trunk/source/Core/Mangled.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Mangled.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Core/Mangled.cpp (original)
>> +++ lldb/trunk/source/Core/Mangled.cpp Fri Oct 10 18:07:36 2014
>> @@ -4986,10 +4986,12 @@ __cxa_demangle(const char* mangled_name,
>> #include "lldb/Core/RegularExpression.h"
>> #include "lldb/Core/Stream.h"
>> #include "lldb/Core/Timer.h"
>> +#include "lldb/Target/CPPLanguageRuntime.h"
>> #include <ctype.h>
>> #include <string.h>
>> #include <stdlib.h>
>>
>> +
>> using namespace lldb_private;
>>
>> static inline bool
>> @@ -5000,6 +5002,58 @@ cstring_is_mangled (const char *s)
>> return false;
>> }
>>
>> +static const ConstString &
>> +get_demangled_name_without_arguments (const Mangled *obj)
>> +{
>> + // This pair is <mangled name, demangled name without function arguments>
>> + static std::pair<ConstString, ConstString> g_most_recent_mangled_to_name_sans_args;
>> +
>> + // Need to have the mangled & demangled names we're currently examining as statics
>> + // so we can return a const ref to them at the end of the func if we don't have
>> + // anything better.
>> + static ConstString g_last_mangled;
>> + static ConstString g_last_demangled;
>> +
>> + ConstString mangled = obj->GetMangledName ();
>> + ConstString demangled = obj->GetDemangledName ();
>> +
>> + if (mangled && g_most_recent_mangled_to_name_sans_args.first == mangled)
>> + {
>> + return g_most_recent_mangled_to_name_sans_args.second;
>> + }
>> +
>> + g_last_demangled = demangled;
>> + g_last_mangled = mangled;
>> +
>> + const char *mangled_name_cstr = mangled.GetCString();
>> + const char *demangled_name_cstr = demangled.GetCString();
>
> This variable was unused so I removed it in
>
> dzur:~/sources/llvm/tools/lldb> svn ci source/Core/Mangled.cpp
> Sending source/Core/Mangled.cpp
> Transmitting file data .
> Committed revision 219547.
>
> -eric
>
>> +
>> + if (demangled && mangled_name_cstr && mangled_name_cstr[0])
>> + {
>> + if (mangled_name_cstr[0] == '_' && mangled_name_cstr[1] == 'Z' &&
>> + (mangled_name_cstr[2] != 'T' && // avoid virtual table, VTT structure, typeinfo structure, and typeinfo mangled_name
>> + mangled_name_cstr[2] != 'G' && // avoid guard variables
>> + mangled_name_cstr[2] != 'Z')) // named local entities (if we eventually handle eSymbolTypeData, we will want this back)
>> + {
>> + CPPLanguageRuntime::MethodName cxx_method (demangled);
>> + if (!cxx_method.GetBasename().empty() && !cxx_method.GetContext().empty())
>> + {
>> + std::string shortname = cxx_method.GetContext().str();
>> + shortname += "::";
>> + shortname += cxx_method.GetBasename().str();
>> + ConstString result(shortname.c_str());
>> + g_most_recent_mangled_to_name_sans_args.first = mangled;
>> + g_most_recent_mangled_to_name_sans_args.second = result;
>> + return g_most_recent_mangled_to_name_sans_args.second;
>> + }
>> + }
>> + }
>> +
>> + if (demangled)
>> + return g_last_demangled;
>> + return g_last_mangled;
>> +}
>> +
>> #pragma mark Mangled
>> //----------------------------------------------------------------------
>> // Default constructor
>> @@ -5215,6 +5269,14 @@ Mangled::NameMatches (const RegularExpre
>> const ConstString&
>> Mangled::GetName (Mangled::NamePreference preference) const
>> {
>> + if (preference == ePreferDemangledWithoutArguments)
>> + {
>> + // Call the accessor to make sure we get a demangled name in case
>> + // it hasn't been demangled yet...
>> + GetDemangledName();
>> +
>> + return get_demangled_name_without_arguments (this);
>> + }
>> if (preference == ePreferDemangled)
>> {
>> // Call the accessor to make sure we get a demangled name in case
>>
>> Modified: lldb/trunk/source/Core/StreamString.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StreamString.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Core/StreamString.cpp (original)
>> +++ lldb/trunk/source/Core/StreamString.cpp Fri Oct 10 18:07:36 2014
>> @@ -65,6 +65,22 @@ StreamString::GetSize () const
>> return m_packet.size();
>> }
>>
>> +size_t
>> +StreamString::GetSizeOfLastLine () const
>> +{
>> + const size_t length = m_packet.size();
>> + size_t last_line_begin_pos = m_packet.find_last_of("\r\n");
>> + if (last_line_begin_pos == std::string::npos)
>> + {
>> + return length;
>> + }
>> + else
>> + {
>> + ++last_line_begin_pos;
>> + return length - last_line_begin_pos;
>> + }
>> +}
>> +
>> std::string &
>> StreamString::GetString()
>> {
>>
>> Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
>> +++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Fri Oct 10 18:07:36 2014
>> @@ -13,6 +13,7 @@
>> #include "llvm/Support/SourceMgr.h"
>> #include "lldb/Core/DataBufferHeap.h"
>> #include "lldb/Core/DataExtractor.h"
>> +#include "lldb/Core/Debugger.h"
>> #include "lldb/Core/Disassembler.h"
>> #include "lldb/Core/Log.h"
>> #include "lldb/Core/Module.h"
>> @@ -199,6 +200,11 @@ IRExecutionUnit::DisassembleFunction (St
>>
>> InstructionList &instruction_list = disassembler_sp->GetInstructionList();
>> const uint32_t max_opcode_byte_size = instruction_list.GetMaxOpcocdeByteSize();
>> + const char *disassemble_format = "${addr-file-or-load}: ";
>> + if (exe_ctx.HasTargetScope())
>> + {
>> + disassemble_format = exe_ctx.GetTargetRef().GetDebugger().GetDisassemblyFormat();
>> + }
>>
>> for (size_t instruction_index = 0, num_instructions = instruction_list.GetSize();
>> instruction_index < num_instructions;
>> @@ -209,7 +215,10 @@ IRExecutionUnit::DisassembleFunction (St
>> max_opcode_byte_size,
>> true,
>> true,
>> - &exe_ctx);
>> + &exe_ctx,
>> + NULL,
>> + NULL,
>> + disassemble_format);
>> stream.PutChar('\n');
>> }
>> // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
>>
>> Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)
>> +++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Fri Oct 10 18:07:36 2014
>> @@ -832,11 +832,19 @@ const char *DisassemblerLLVMC::SymbolLoo
>>
>> value_so_addr.Dump (&ss,
>> target,
>> - Address::DumpStyleResolvedDescriptionNoModule,
>> + Address::DumpStyleResolvedDescriptionNoFunctionArguments,
>> Address::DumpStyleSectionNameOffset);
>>
>> if (!ss.GetString().empty())
>> {
>> + // If Address::Dump returned a multi-line description, most commonly seen when we
>> + // have multiple levels of inlined functions at an address, only show the first line.
>> + std::string &str(ss.GetString());
>> + size_t first_eol_char = str.find_first_of ("\r\n");
>> + if (first_eol_char != std::string::npos)
>> + {
>> + str.erase (first_eol_char);
>> + }
>> m_inst->AppendComment(ss.GetString());
>> }
>> }
>>
>> Modified: lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
>> +++ lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Fri Oct 10 18:07:36 2014
>> @@ -146,7 +146,8 @@ UnwindAssemblyInstEmulation::GetNonCallS
>> if (log && log->GetVerbose ())
>> {
>> StreamString strm;
>> - inst->Dump(&strm, inst_list.GetMaxOpcocdeByteSize (), show_address, show_bytes, NULL);
>> + const char *disassemble_format = "${frame.pc}: ";
>> + inst->Dump(&strm, inst_list.GetMaxOpcocdeByteSize (), show_address, show_bytes, NULL, NULL, NULL, disassemble_format);
>> log->PutCString (strm.GetData());
>> }
>>
>>
>> Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
>> +++ lldb/trunk/source/Symbol/SymbolContext.cpp Fri Oct 10 18:07:36 2014
>> @@ -128,7 +128,8 @@ SymbolContext::DumpStopContext
>> const Address &addr,
>> bool show_fullpaths,
>> bool show_module,
>> - bool show_inlined_frames
>> + bool show_inlined_frames,
>> + bool show_function_arguments
>> ) const
>> {
>> bool dumped_something = false;
>> @@ -146,7 +147,12 @@ SymbolContext::DumpStopContext
>> {
>> SymbolContext inline_parent_sc;
>> Address inline_parent_addr;
>> - if (function->GetMangled().GetName())
>> + if (show_function_arguments == false && function->GetMangled().GetName(Mangled::ePreferDemangledWithoutArguments))
>> + {
>> + dumped_something = true;
>> + function->GetMangled().GetName(Mangled::ePreferDemangledWithoutArguments).Dump(s);
>> + }
>> + else if (function->GetMangled().GetName())
>> {
>> dumped_something = true;
>> function->GetMangled().GetName().Dump(s);
>> @@ -188,7 +194,7 @@ SymbolContext::DumpStopContext
>> {
>> s->EOL();
>> s->Indent();
>> - return inline_parent_sc.DumpStopContext (s, exe_scope, inline_parent_addr, show_fullpaths, show_module, show_inlined_frames);
>> + return inline_parent_sc.DumpStopContext (s, exe_scope, inline_parent_addr, show_fullpaths, show_module, show_inlined_frames, show_function_arguments);
>> }
>> }
>> else
>>
>> Modified: lldb/trunk/source/Symbol/Variable.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Symbol/Variable.cpp (original)
>> +++ lldb/trunk/source/Symbol/Variable.cpp Fri Oct 10 18:07:36 2014
>> @@ -174,13 +174,15 @@ Variable::DumpDeclaration (Stream *s, bo
>> sc.block = nullptr;
>> sc.line_entry.Clear();
>> bool show_inlined_frames = false;
>> + const bool show_function_arguments = true;
>>
>> dumped_declaration_info = sc.DumpStopContext (s,
>> nullptr,
>> Address(),
>> show_fullpaths,
>> show_module,
>> - show_inlined_frames);
>> + show_inlined_frames,
>> + show_function_arguments);
>>
>> if (sc.function)
>> s->PutChar(':');
>>
>> Modified: lldb/trunk/source/Target/StackFrame.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Target/StackFrame.cpp (original)
>> +++ lldb/trunk/source/Target/StackFrame.cpp Fri Oct 10 18:07:36 2014
>> @@ -1380,12 +1380,14 @@ StackFrame::Dump (Stream *strm, bool sho
>> GetSymbolContext(eSymbolContextEverything);
>> const bool show_module = true;
>> const bool show_inline = true;
>> + const bool show_function_arguments = true;
>> m_sc.DumpStopContext (strm,
>> exe_ctx.GetBestExecutionContextScope(),
>> GetFrameCodeAddress(),
>> show_fullpaths,
>> show_module,
>> - show_inline);
>> + show_inline,
>> + show_function_arguments);
>> }
>>
>> void
>>
>> Modified: lldb/trunk/source/Target/ThreadPlanTracer.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTracer.cpp?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Target/ThreadPlanTracer.cpp (original)
>> +++ lldb/trunk/source/Target/ThreadPlanTracer.cpp Fri Oct 10 18:07:36 2014
>> @@ -212,11 +212,15 @@ ThreadPlanAssemblyTracer::Log ()
>> const bool show_bytes = true;
>> const bool show_address = true;
>> Instruction *instruction = instruction_list.GetInstructionAtIndex(0).get();
>> + const char *disassemble_format = "${addr-file-or-load}: ";
>> instruction->Dump (stream,
>> max_opcode_byte_size,
>> show_address,
>> show_bytes,
>> - NULL);
>> + NULL,
>> + NULL,
>> + NULL,
>> + disassemble_format);
>> }
>> }
>> }
>>
>> Modified: lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py (original)
>> +++ lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py Fri Oct 10 18:07:36 2014
>> @@ -150,8 +150,8 @@ class AbbreviationsTestCase(TestBase):
>> # ARCH, if not specified, defaults to x86_64.
>> if self.getArchitecture() in ["", 'x86_64', 'i386']:
>> self.expect("dis -f",
>> - startstr = "a.out`sum(int, int)",
>> - substrs = [' mov',
>> + substrs = ['<sum(int, int)>:',
>> + ' mov',
>> ' addl ',
>> 'ret'])
>>
>>
>> Modified: lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=219544&r1=219543&r2=219544&view=diff
>> ==============================================================================
>> --- lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py (original)
>> +++ lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py Fri Oct 10 18:07:36 2014
>> @@ -176,8 +176,11 @@ class AssertingInferiorTestCase(TestBase
>> # of the function and in the next function. We also can't back the PC up
>> # because we don't know how much to back it up by on targets with opcodes
>> # that have differing sizes
>> - self.expect("disassemble -a %s" % frame.GetPC(),
>> - substrs = ['->'])
>> + pc_backup_offset = 1
>> + if frame.GetFrameID() == 0:
>> + pc_backup_offset = 0
>> + self.expect("disassemble -a %s" % (frame.GetPC() - pc_backup_offset),
>> + substrs = ['<%s>:' % frame.GetFunctionName()])
>>
>> def check_expr_in_main(self, thread):
>> depth = thread.GetNumFrames()
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
More information about the lldb-commits
mailing list