Skip to content

Commit b887db2

Browse files
Rebase disassembler annotations branch onto updated DWARFExpressionEntry API
This rebases the `add-disassembler-annotations` work onto the latest `add-dwarfexprentry-api` branch so that the instruction annotation patches sit cleanly atop the new DWARFExpressionEntry struct and helper API. All conflicts have been resolved and the annotation code now integrates with the updated std::optional<AddressRange>-based GetExpressionEntryAtAddress signature.
1 parent cbbc924 commit b887db2

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

lldb/source/Core/Disassembler.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949

5050
#include <cstdint>
5151
#include <cstring>
52-
#include <regex>
5352
#include <utility>
5453

5554
#include <cassert>
@@ -740,28 +739,16 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size,
740739
if (auto entryOrErr = expr_list.GetExpressionEntryAtAddress(func_load_addr, current_pc)) {
741740
auto entry = *entryOrErr;
742741

743-
// Translate file-range to load-space start.
744-
addr_t file_base = entry.file_range.GetBaseAddress().GetFileAddress();
745-
addr_t start_load_addr = file_base + (func_load_addr - expr_list.GetFuncFileAddress());
742+
// Check if entry has a file_range, and filter on address if so.
743+
if (!entry.file_range || entry.file_range->ContainsFileAddress(
744+
(current_pc - func_load_addr) + expr_list.GetFuncFileAddress())) {
746745

747-
if (current_pc >= start_load_addr) {
748746
StreamString loc_str;
749747
ABI *abi = exe_ctx->GetProcessPtr()->GetABI().get();
750748
entry.expr->DumpLocation(&loc_str, eDescriptionLevelBrief, abi);
751749

752750
std::string loc_output = loc_str.GetString().str();
753751

754-
// // Remove ", <decoding error> ..." segments.
755-
// std::regex decoding_err_re(", <decoding error>[^,]*");
756-
// loc_output = std::regex_replace(loc_output, decoding_err_re, "");
757-
758-
// llvm::StringRef cleaned_output = llvm::StringRef(loc_output).trim();
759-
760-
// // Only keep this annotation if there is still something useful left.
761-
// if (!cleaned_output.empty()) {
762-
// annotations.push_back(llvm::formatv("{0} = {1}", name, cleaned_output));
763-
// }
764-
765752
llvm::SmallVector<llvm::StringRef, 4> parts;
766753
llvm::StringRef(loc_str.GetString()).split(parts, ", ");
767754

0 commit comments

Comments
 (0)