diff --git a/examples/hello_debugger.cpp b/examples/hello_debugger.cpp index 342e862..62b619f 100644 --- a/examples/hello_debugger.cpp +++ b/examples/hello_debugger.cpp @@ -50,7 +50,7 @@ You can set breakpoints, and single line step. You may also notice that the locals contains a single variable for the currently executing line number.)"; // Total number of newlines in source. -constexpr int numSourceLines = 7; +constexpr int64_t numSourceLines = 7; // Debugger holds the dummy debugger state and fires events to the EventHandler // passed to the constructor. @@ -68,7 +68,7 @@ class Debugger { void pause(); // currentLine() returns the currently executing line number. - int currentLine(); + int64_t currentLine(); // stepForward() instructs the debugger to step forward one line. void stepForward(); @@ -77,21 +77,21 @@ class Debugger { void clearBreakpoints(); // addBreakpoint() sets a new breakpoint on the given line. - void addBreakpoint(int line); + void addBreakpoint(int64_t line); private: EventHandler onEvent; std::mutex mutex; - int line = 1; - std::unordered_set breakpoints; + int64_t line = 1; + std::unordered_set breakpoints; }; Debugger::Debugger(const EventHandler& onEvent) : onEvent(onEvent) {} void Debugger::run() { std::unique_lock lock(mutex); - for (int i = 0; i < numSourceLines; i++) { - auto l = ((line + i) % numSourceLines) + 1; + for (int64_t i = 0; i < numSourceLines; i++) { + int64_t l = ((line + i) % numSourceLines) + 1; if (breakpoints.count(l)) { line = l; lock.unlock(); @@ -105,7 +105,7 @@ void Debugger::pause() { onEvent(Event::Paused); } -int Debugger::currentLine() { +int64_t Debugger::currentLine() { std::unique_lock lock(mutex); return line; } @@ -122,7 +122,7 @@ void Debugger::clearBreakpoints() { this->breakpoints.clear(); } -void Debugger::addBreakpoint(int l) { +void Debugger::addBreakpoint(int64_t l) { std::unique_lock lock(mutex); this->breakpoints.emplace(l); } @@ -156,7 +156,7 @@ void Event::fire() { } // anonymous namespace // main() entry point to the DAP server. -int main(int, char* []) { +int main(int, char*[]) { #ifdef OS_WINDOWS // Change stdin & stdout from text mode to binary mode. // This ensures sequences of \r\n are not changed to \n. diff --git a/include/dap/types.h b/include/dap/types.h index 8d02e0f..7954e87 100644 --- a/include/dap/types.h +++ b/include/dap/types.h @@ -25,6 +25,8 @@ #include #include +#include + namespace dap { // string is a sequence of characters. @@ -52,9 +54,9 @@ class boolean { class integer { public: inline integer() : val(0) {} - inline integer(int i) : val(i) {} - inline operator int() const { return val; } - inline integer& operator=(int i) { + inline integer(int64_t i) : val(i) {} + inline operator int64_t() const { return val; } + inline integer& operator=(int64_t i) { val = i; return *this; } @@ -65,7 +67,7 @@ class integer { } private: - int val; + int64_t val; }; // number holds a 64-bit floating point number. diff --git a/src/session.cpp b/src/session.cpp index 4ea85a4..c8005dd 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -167,7 +167,8 @@ class Impl : public dap::Session { } } - std::pair response(int seq) { + std::pair response( + int64_t seq) { std::unique_lock lock(responseMutex); auto responseIt = responseMap.find(seq); if (responseIt == responseMap.end()) { @@ -252,7 +253,7 @@ class Impl : public dap::Session { requestMap; std::mutex responseMutex; - std::unordered_map> responseMap;