aboutsummaryrefslogtreecommitdiff
path: root/lldb/tools
diff options
context:
space:
mode:
authorJohn Harrison <harjohn@google.com>2023-11-30 12:17:12 -0800
committerGitHub <noreply@github.com>2023-11-30 15:17:12 -0500
commitc8f72856dbdd0039fc16eae51726da105ea679c0 (patch)
tree2675833a6a13427f31151d520afa41cb0048d47f /lldb/tools
parentff485a0e77a55847cb50768b01c04fe45a6879ea (diff)
downloadllvm-c8f72856dbdd0039fc16eae51726da105ea679c0.zip
llvm-c8f72856dbdd0039fc16eae51726da105ea679c0.tar.gz
llvm-c8f72856dbdd0039fc16eae51726da105ea679c0.tar.bz2
[lldb-dap] Fixing a type encoding issue with dap Stopped events. (#72292)
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.
Diffstat (limited to 'lldb/tools')
-rw-r--r--lldb/tools/lldb-dap/JSONUtils.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index 03a43f9..3a63046 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"
@@ -959,11 +960,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);