Skip to content

Commit ed4b044

Browse files
committed
[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.
1 parent 060af26 commit ed4b044

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

@@ -952,11 +953,10 @@ llvm::json::Value CreateThreadStopped(lldb::SBThread &thread,
952953
EmplaceSafeString(body, "description", exc_bp->label);
953954
} else {
954955
body.try_emplace("reason", "breakpoint");
955-
char desc_str[64];
956-
uint64_t bp_id = thread.GetStopReasonDataAtIndex(0);
957-
uint64_t bp_loc_id = thread.GetStopReasonDataAtIndex(1);
958-
snprintf(desc_str, sizeof(desc_str), "breakpoint %" PRIu64 ".%" PRIu64,
959-
bp_id, bp_loc_id);
956+
lldb::break_id_t bp_id = thread.GetStopReasonDataAtIndex(0);
957+
lldb::break_id_t bp_loc_id = thread.GetStopReasonDataAtIndex(1);
958+
std::string desc_str =
959+
llvm::formatv("breakpoint {0}.{1}", bp_id, bp_loc_id);
960960
body.try_emplace("hitBreakpointIds",
961961
llvm::json::Array{llvm::json::Value(bp_id)});
962962
EmplaceSafeString(body, "description", desc_str);

0 commit comments

Comments
 (0)