From 214483a47ffdf47879a0f7f6970a19986b640c41 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Wed, 11 Apr 2018 16:30:21 +0300 Subject: [PATCH] Use dynamic input buffer for MI commands --- src/debug/netcoredbg/miprotocol.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/debug/netcoredbg/miprotocol.cpp b/src/debug/netcoredbg/miprotocol.cpp index 9ad410e..a0b04d6 100644 --- a/src/debug/netcoredbg/miprotocol.cpp +++ b/src/debug/netcoredbg/miprotocol.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "frames.h" @@ -899,20 +900,21 @@ static bool ParseLine(const std::string &str, void MIProtocol::CommandLoop() { - static char inputBuffer[1024]; std::string token; while (!m_exit) { token.clear(); + std::string input; Printf("(gdb)\n"); - if (!fgets(inputBuffer, _countof(inputBuffer), stdin)) + std::getline(std::cin, input); + if (input.empty() && std::cin.eof()) break; std::vector args; std::string command; - if (!ParseLine(inputBuffer, token, command, args)) + if (!ParseLine(input, token, command, args)) { Printf("%s^error,msg=\"Failed to parse input\"\n", token.c_str()); continue; -- 2.34.1