From: Igor Kulaychuk Date: Mon, 17 Jul 2017 01:25:44 +0000 (+0300) Subject: Fake vsdbg commands X-Git-Tag: submit/tizen/20180620.071641~180 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9972efac23c7cec283d2e1bb3a4feb1079682a0;p=sdk%2Ftools%2Fnetcoredbg.git Fake vsdbg commands --- diff --git a/src/debug/netcoredbg/breakpoints.cpp b/src/debug/netcoredbg/breakpoints.cpp index b3ab5e3..d2ee7fc 100644 --- a/src/debug/netcoredbg/breakpoints.cpp +++ b/src/debug/netcoredbg/breakpoints.cpp @@ -126,6 +126,12 @@ static ULONG32 InsertBreakpoint(Breakpoint &bp) return id; } +ULONG32 InsertExceptionBreakpoint(const std::string &name) +{ + Breakpoint bp; + return InsertBreakpoint(bp); +} + HRESULT DeleteBreakpoint(ULONG32 id) { std::lock_guard lock(g_breakMutex); diff --git a/src/debug/netcoredbg/commands.cpp b/src/debug/netcoredbg/commands.cpp index 0aa1ff1..606a7bd 100644 --- a/src/debug/netcoredbg/commands.cpp +++ b/src/debug/netcoredbg/commands.cpp @@ -25,6 +25,7 @@ HRESULT GetStepRangeFromCurrentIP(ICorDebugThread *pThread, COR_DEBUG_STEP_RANGE HRESULT DeleteBreakpoint(ULONG32 id); HRESULT InsertBreakpointInProcess(ICorDebugProcess *pProcess, std::string filename, int linenum, ULONG32 &id); HRESULT PrintBreakpoint(ULONG32 id, std::string &output); +ULONG32 InsertExceptionBreakpoint(const std::string &name); // Frames HRESULT GetFrameAt(ICorDebugThread *pThread, int level, ICorDebugFrame **ppFrame); @@ -368,7 +369,38 @@ HRESULT Debugger::HandleCommand(std::string command, this->TerminateProcess(); return S_OK; - }} + }}, + { "handshake", [](ICorDebugProcess *, const std::vector &args, std::string &output) -> HRESULT { + if (!args.empty() && args.at(0) == "init") + output = "request=\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\""; + + return S_OK; + }}, + { "gdb-set", [this](ICorDebugProcess *, const std::vector &args, std::string &output) -> HRESULT { + return S_OK; + }}, + { "break-exception-insert", [](ICorDebugProcess *, const std::vector &args, std::string &output) -> HRESULT { + if (args.empty()) + return E_FAIL; + size_t i = 1; + if (args.at(0) == "--mda") + i = 2; + + std::stringstream ss; + const char *sep = ""; + ss << "bkpt=["; + for (; i < args.size(); i++) + { + ULONG32 id = InsertExceptionBreakpoint(args.at(i)); + ss << sep; + sep = ","; + ss << "{number=\"" << id << "\"}"; + } + ss << "]"; + output = ss.str(); + + return S_OK; + }}, }; auto command_it = commands.find(command); diff --git a/src/debug/netcoredbg/main.cpp b/src/debug/netcoredbg/main.cpp index 83d4e75..1a1ad0a 100644 --- a/src/debug/netcoredbg/main.cpp +++ b/src/debug/netcoredbg/main.cpp @@ -444,7 +444,9 @@ public: TryLoadModuleSymbols(pModule, id, name, symbolsLoaded, baseAddress, size); { std::stringstream ss; - ss << "id=\"{" << id << "}\",target-name=\"" << name << "\"," + ss << "id=\"{" << id << "}\"," + << "target-name=\"" << name << "\"," + << "host-name=\"" << name << "\"," << "symbols-loaded=\"" << symbolsLoaded << "\"," << "base-address=\"0x" << std::hex << baseAddress << "\"," << "size=\"" << std::dec << size << "\"";