Author: Sergei Druzhkov Date: 2026-03-06T13:01:28+03:00 New Revision: 13a846553b3b2b4b57ee690166dc14de0790a519
URL: https://github.com/llvm/llvm-project/commit/13a846553b3b2b4b57ee690166dc14de0790a519 DIFF: https://github.com/llvm/llvm-project/commit/13a846553b3b2b4b57ee690166dc14de0790a519.diff LOG: [lldb-dap] Add memory history in ASan report (#183740) Added memory history in ASan report (like `memory history` console command) Added: Modified: lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp Removed: ################################################################################ diff --git a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp index c92a607d9b7b0..e76544af143aa 100644 --- a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp @@ -130,7 +130,7 @@ static bool fromJSON(const json::Value ¶ms, RuntimeInstrumentReport &report, } // end namespace -static raw_ostream &operator<<(raw_ostream &OS, UBSanReport &report) { +static raw_ostream &operator<<(raw_ostream &OS, const UBSanReport &report) { if (!report.filename.empty()) { OS << report.filename; if (report.line != LLDB_INVALID_LINE_NUMBER) { @@ -151,7 +151,7 @@ static raw_ostream &operator<<(raw_ostream &OS, UBSanReport &report) { } static raw_ostream &operator<<(raw_ostream &OS, - MainThreadCheckerReport &report) { + const MainThreadCheckerReport &report) { if (!report.description.empty()) OS << report.description << "\n"; @@ -163,7 +163,7 @@ static raw_ostream &operator<<(raw_ostream &OS, return OS; } -static raw_ostream &operator<<(raw_ostream &OS, ASanReport &report) { +static raw_ostream &operator<<(raw_ostream &OS, const ASanReport &report) { if (!report.stop_type.empty()) OS << report.stop_type << ": "; if (!report.description.empty()) @@ -183,8 +183,8 @@ static raw_ostream &operator<<(raw_ostream &OS, ASanReport &report) { } static raw_ostream &operator<<(raw_ostream &OS, - RuntimeInstrumentReport &report) { - std::visit([&](auto &r) { OS << r; }, report); + const RuntimeInstrumentReport &report) { + std::visit([&](const auto &r) { OS << r; }, report); return OS; } @@ -231,6 +231,25 @@ static std::string FormatExtendedStopInfo(lldb::SBThread &thread) { // Check if we can improve the formatting of the raw JSON report. if (report) { OS << *report; + std::visit( + [&](auto &&report) { + using T = std::decay_t<decltype(report)>; + if constexpr (std::is_same_v<T, ASanReport>) { + lldb::addr_t address = report.address; + lldb::SBProcess process = thread.GetProcess(); + lldb::SBThreadCollection history_threads = + process.GetHistoryThreads(address); + lldb::SBStream stream; + OS << "Memory history associated with address: 0x" + << llvm::utohexstr(address) << "\n"; + for (const auto history_thread : history_threads) { + if (history_thread.GetStatus(stream)) + OS << stream << "\n"; + stream.Clear(); + } + } + }, + *report); } else { consumeError(report.takeError()); OS << stream; _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
