[Lldb-commits] [lldb] [lldb-dap] Fixing a type encoding issue with dap Stopped events. (PR #72292)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 14 11:41:14 PST 2023
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/72292
>From ed4b044027e4ccc02bd19af394a076892baeea95 Mon Sep 17 00:00:00 2001
From: John Harrison <harjohn at google.com>
Date: Tue, 14 Nov 2023 10:02:41 -0800
Subject: [PATCH] [lldb-dap] Fixing a type encoding issue with dap Stopped
events.
Previously the type of the breakpoint id in the Stopped event was a uint64_t, however thats the wrong type for a breakpoint id, which can cause encoding issues when internal breakpoints are hit.
---
lldb/tools/lldb-dap/JSONUtils.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index 2023291729762f1..ebb0ba202183c28 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -13,6 +13,7 @@
#include <string.h>
#include "llvm/Support/FormatAdapters.h"
+#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ScopedPrinter.h"
@@ -952,11 +953,10 @@ llvm::json::Value CreateThreadStopped(lldb::SBThread &thread,
EmplaceSafeString(body, "description", exc_bp->label);
} else {
body.try_emplace("reason", "breakpoint");
- char desc_str[64];
- uint64_t bp_id = thread.GetStopReasonDataAtIndex(0);
- uint64_t bp_loc_id = thread.GetStopReasonDataAtIndex(1);
- snprintf(desc_str, sizeof(desc_str), "breakpoint %" PRIu64 ".%" PRIu64,
- bp_id, bp_loc_id);
+ lldb::break_id_t bp_id = thread.GetStopReasonDataAtIndex(0);
+ lldb::break_id_t bp_loc_id = thread.GetStopReasonDataAtIndex(1);
+ std::string desc_str =
+ llvm::formatv("breakpoint {0}.{1}", bp_id, bp_loc_id);
body.try_emplace("hitBreakpointIds",
llvm::json::Array{llvm::json::Value(bp_id)});
EmplaceSafeString(body, "description", desc_str);
More information about the lldb-commits
mailing list