-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[lldb-dap] Show load addresses in disassembly #136755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,15 +8,18 @@ | |
|
|
||
| #include "lldb/API/SBInstructionList.h" | ||
| #include "lldb/API/SBAddress.h" | ||
| #include "lldb/API/SBExecutionContext.h" | ||
| #include "lldb/API/SBFile.h" | ||
| #include "lldb/API/SBInstruction.h" | ||
| #include "lldb/API/SBStream.h" | ||
| #include "lldb/Core/Disassembler.h" | ||
| #include "lldb/Core/Module.h" | ||
| #include "lldb/Host/StreamFile.h" | ||
| #include "lldb/Symbol/SymbolContext.h" | ||
| #include "lldb/Target/ExecutionContext.h" | ||
| #include "lldb/Utility/Instrumentation.h" | ||
| #include "lldb/Utility/Stream.h" | ||
| #include <memory> | ||
|
|
||
| using namespace lldb; | ||
| using namespace lldb_private; | ||
|
|
@@ -138,7 +141,14 @@ bool SBInstructionList::GetDescription(lldb::SBStream &stream) { | |
| return GetDescription(stream.ref()); | ||
| } | ||
|
|
||
| bool SBInstructionList::GetDescription(Stream &sref) { | ||
| bool SBInstructionList::GetDescription(lldb::SBStream &stream, | ||
| lldb::SBExecutionContext &exe_ctx) { | ||
| LLDB_INSTRUMENT_VA(this, stream); | ||
| return GetDescription(stream.ref(), &exe_ctx); | ||
| } | ||
|
|
||
| bool SBInstructionList::GetDescription(Stream &sref, | ||
| lldb::SBExecutionContext *exe_ctx) { | ||
|
||
|
|
||
| if (m_opaque_sp) { | ||
| size_t num_instructions = GetSize(); | ||
|
|
@@ -148,10 +158,15 @@ bool SBInstructionList::GetDescription(Stream &sref) { | |
| const uint32_t max_opcode_byte_size = | ||
| m_opaque_sp->GetInstructionList().GetMaxOpcocdeByteSize(); | ||
| FormatEntity::Entry format; | ||
| FormatEntity::Parse("${addr}: ", format); | ||
| FormatEntity::Parse("${addr-file-or-load}: ", format); | ||
| SymbolContext sc; | ||
| SymbolContext prev_sc; | ||
|
|
||
| std::shared_ptr<ExecutionContext> exe_ctx_ptr; | ||
| if (nullptr != exe_ctx) { | ||
| exe_ctx_ptr = std::make_shared<ExecutionContext>(exe_ctx->get()); | ||
| } | ||
|
||
|
|
||
| // Expected address of the next instruction. Used to print an empty line | ||
| // for non-contiguous blocks of insns. | ||
| std::optional<Address> next_addr; | ||
|
|
@@ -172,8 +187,8 @@ bool SBInstructionList::GetDescription(Stream &sref) { | |
| if (next_addr && *next_addr != addr) | ||
| sref.EOL(); | ||
| inst->Dump(&sref, max_opcode_byte_size, true, false, | ||
| /*show_control_flow_kind=*/false, nullptr, &sc, &prev_sc, | ||
| &format, 0); | ||
| /*show_control_flow_kind=*/false, exe_ctx_ptr.get(), &sc, | ||
| &prev_sc, &format, 0); | ||
| sref.EOL(); | ||
| next_addr = addr; | ||
| next_addr->Slide(inst->GetOpcode().GetByteSize()); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this can now take the private type (i.e.
ExecutionContext*). All the SB API objects are PIMPL objects so it feels a bit weird to take their address.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯