From 25085fa39477c3b1ea2fb2648bf926fe8bb2e156 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 13 May 2018 10:45:12 -0700 Subject: [PATCH] Debugger: Add func name and data symbol to disasm. --- Core/Debugger/WebSocket/DisasmSubscriber.cpp | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Core/Debugger/WebSocket/DisasmSubscriber.cpp b/Core/Debugger/WebSocket/DisasmSubscriber.cpp index 9971505a84..78ee607fdf 100644 --- a/Core/Debugger/WebSocket/DisasmSubscriber.cpp +++ b/Core/Debugger/WebSocket/DisasmSubscriber.cpp @@ -112,6 +112,30 @@ void WebSocketDisasmState::WriteDisasmLine(JsonWriter &json, const DisassemblyLi else json.writeString("symbol", addressSymbol); + const u32 funcAddress = g_symbolMap->GetFunctionStart(addr); + const std::string funcName = g_symbolMap->GetLabelString(funcAddress); + if (funcName.empty()) + json.writeNull("function"); + else + json.writeString("function", funcName); + + if (l.type == DISTYPE_DATA) { + u32 dataStart = g_symbolMap->GetDataStart(addr); + if (dataStart == -1) + dataStart = addr; + const std::string dataLabel = g_symbolMap->GetLabelString(dataStart); + + json.pushDict("dataSymbol"); + json.writeUint("start", dataStart); + if (dataLabel.empty()) + json.writeNull("label"); + else + json.writeString("label", dataLabel); + json.pop(); + } else { + json.writeNull("dataSymbol"); + } + bool enabled; // TODO: Account for bp inside macro? if (CBreakPoints::IsAddressBreakPoint(addr, &enabled)) {