[Lldb-commits] [lldb] [lldb-dap] Add memory history in ASan report (PR #183740)
Sergei Druzhkov via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 5 02:33:16 PST 2026
https://github.com/DrSergei updated https://github.com/llvm/llvm-project/pull/183740
>From 179971a9eb98e17d896b9a8c08245d5725812d2e Mon Sep 17 00:00:00 2001
From: Sergei Druzhkov <serzhdruzhok at gmail.com>
Date: Fri, 27 Feb 2026 16:29:06 +0300
Subject: [PATCH 1/3] [lldb-dap] Add memory history in ASan report
---
.../Handler/ExceptionInfoRequestHandler.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
index c92a607d9b7b0..bded3dbd9cd81 100644
--- a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
@@ -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 addres: 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;
>From b63c6175b2dc200b8eb790619d160fb5d684916c Mon Sep 17 00:00:00 2001
From: Sergei Druzhkov <serzhdruzhok at gmail.com>
Date: Fri, 27 Feb 2026 20:23:26 +0300
Subject: [PATCH 2/3] Fix typo
---
lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
index bded3dbd9cd81..d4b8ce477092c 100644
--- a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
@@ -240,7 +240,7 @@ static std::string FormatExtendedStopInfo(lldb::SBThread &thread) {
lldb::SBThreadCollection history_threads =
process.GetHistoryThreads(address);
lldb::SBStream stream;
- OS << "Memory history associated with addres: 0x"
+ OS << "Memory history associated with address: 0x"
<< llvm::utohexstr(address) << "\n";
for (const auto history_thread : history_threads) {
if (history_thread.GetStatus(stream))
>From 6febcc99b738eedf07049e5ed0bd8e2bf72291db Mon Sep 17 00:00:00 2001
From: Sergei Druzhkov <serzhdruzhok at gmail.com>
Date: Thu, 5 Mar 2026 13:32:57 +0300
Subject: [PATCH 3/3] Add more const
---
.../lldb-dap/Handler/ExceptionInfoRequestHandler.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
index d4b8ce477092c..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;
}
More information about the lldb-commits
mailing list