Skip to content

Commit c8f7285

Browse files
authored
[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.
1 parent ff485a0 commit c8f7285

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lldb/tools/lldb-dap/JSONUtils.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <string.h>
1414

1515
#include "llvm/Support/FormatAdapters.h"
16+
#include "llvm/Support/FormatVariadic.h"
1617
#include "llvm/Support/Path.h"
1718
#include "llvm/Support/ScopedPrinter.h"
1819

@@ -959,11 +960,10 @@ llvm::json::Value CreateThreadStopped(lldb::SBThread &thread,
959960
EmplaceSafeString(body, "description", exc_bp->label);
960961
} else {
961962
body.try_emplace("reason", "breakpoint");
962-
char desc_str[64];
963-
uint64_t bp_id = thread.GetStopReasonDataAtIndex(0);
964-
uint64_t bp_loc_id = thread.GetStopReasonDataAtIndex(1);
965-
snprintf(desc_str, sizeof(desc_str), "breakpoint %" PRIu64 ".%" PRIu64,
966-
bp_id, bp_loc_id);
963+
lldb::break_id_t bp_id = thread.GetStopReasonDataAtIndex(0);
964+
lldb::break_id_t bp_loc_id = thread.GetStopReasonDataAtIndex(1);
965+
std::string desc_str =
966+
llvm::formatv("breakpoint {0}.{1}", bp_id, bp_loc_id);
967967
body.try_emplace("hitBreakpointIds",
968968
llvm::json::Array{llvm::json::Value(bp_id)});
969969
EmplaceSafeString(body, "description", desc_str);

0 commit comments

Comments
 (0)