Permalink
Browse files

Merge pull request #10909 from unknownbrackets/debugger

WebSocket based debugger interface
  • Loading branch information...
unknownbrackets committed Jun 9, 2018
2 parents 6884751 + 085bcde commit 9d96e6579ca00e77d132bc01d300d4dbb8fd6a3f
Showing with 3,654 additions and 279 deletions.
  1. +22 −0 CMakeLists.txt
  2. +1 −1 Common/ConsoleListener.cpp
  3. +6 −12 Common/LogManager.cpp
  4. +2 −1 Common/LogManager.h
  5. +1 −0 Core/Config.cpp
  6. +1 −0 Core/Config.h
  7. +4 −0 Core/Core.h
  8. +23 −0 Core/Core.vcxproj
  9. +72 −0 Core/Core.vcxproj.filters
  10. +141 −40 Core/Debugger/Breakpoints.cpp
  11. +11 −4 Core/Debugger/Breakpoints.h
  12. +42 −29 Core/Debugger/DisassemblyManager.cpp
  13. +7 −7 Core/Debugger/DisassemblyManager.h
  14. +209 −0 Core/Debugger/WebSocket.cpp
  15. +26 −0 Core/Debugger/WebSocket.h
  16. +352 −0 Core/Debugger/WebSocket/BreakpointSubscriber.cpp
  17. +32 −0 Core/Debugger/WebSocket/BreakpointSubscriber.h
  18. +412 −0 Core/Debugger/WebSocket/CPUCoreSubscriber.cpp
  19. +30 −0 Core/Debugger/WebSocket/CPUCoreSubscriber.h
  20. +481 −0 Core/Debugger/WebSocket/DisasmSubscriber.cpp
  21. +23 −0 Core/Debugger/WebSocket/DisasmSubscriber.h
  22. +94 −0 Core/Debugger/WebSocket/GameBroadcaster.cpp
  23. +36 −0 Core/Debugger/WebSocket/GameBroadcaster.h
  24. +67 −0 Core/Debugger/WebSocket/GameSubscriber.cpp
  25. +25 −0 Core/Debugger/WebSocket/GameSubscriber.h
  26. +103 −0 Core/Debugger/WebSocket/HLESubscriber.cpp
  27. +26 −0 Core/Debugger/WebSocket/HLESubscriber.h
  28. +118 −0 Core/Debugger/WebSocket/LogBroadcaster.cpp
  29. +35 −0 Core/Debugger/WebSocket/LogBroadcaster.h
  30. +61 −0 Core/Debugger/WebSocket/SteppingBroadcaster.cpp
  31. +37 −0 Core/Debugger/WebSocket/SteppingBroadcaster.h
  32. +298 −0 Core/Debugger/WebSocket/SteppingSubscriber.cpp
  33. +23 −0 Core/Debugger/WebSocket/SteppingSubscriber.h
  34. +267 −0 Core/Debugger/WebSocket/WebSocketUtils.cpp
  35. +100 −0 Core/Debugger/WebSocket/WebSocketUtils.h
  36. +90 −0 Core/HLE/KernelThreadDebugInterface.h
  37. +39 −17 Core/HLE/sceKernelThread.cpp
  38. +2 −0 Core/HLE/sceKernelThread.h
  39. +18 −1 Core/MIPS/MIPSDebugInterface.cpp
  40. +18 −33 Core/MIPS/MIPSDebugInterface.h
  41. +31 −31 Core/MIPS/MIPSDisVFPU.cpp
  42. +76 −32 Core/MIPS/MIPSVFPUUtils.cpp
  43. +6 −0 Core/MIPS/MIPSVFPUUtils.h
  44. +5 −7 Core/MIPS/x86/JitSafeMem.cpp
  45. +10 −4 Core/MemMap.cpp
  46. +4 −0 Core/System.cpp
  47. +1 −0 Core/System.h
  48. +6 −0 Core/WebServer.cpp
  49. +2 −1 Core/WebServer.h
  50. +24 −0 UI/GameSettingsScreen.cpp
  51. +5 −1 UI/GameSettingsScreen.h
  52. +5 −3 UI/NativeApp.cpp
  53. +4 −1 Windows/Debugger/CtrlDisAsmView.cpp
  54. +5 −0 Windows/Debugger/CtrlMemView.cpp
  55. +12 −0 android/jni/Android.mk
  56. +69 −25 ext/native/json/json_writer.cpp
  57. +20 −28 ext/native/json/json_writer.h
  58. +1 −1 ext/native/net/http_server.cpp
  59. +1 −0 ext/native/net/http_server.h
  60. +11 −0 ext/native/net/websocket_server.cpp
  61. +1 −0 ext/native/net/websocket_server.h
View
@@ -1402,6 +1402,28 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/Debugger/SymbolMap.h
Core/Debugger/DisassemblyManager.cpp
Core/Debugger/DisassemblyManager.h
Core/Debugger/WebSocket.cpp
Core/Debugger/WebSocket.h
Core/Debugger/WebSocket/BreakpointSubscriber.cpp
Core/Debugger/WebSocket/BreakpointSubscriber.h
Core/Debugger/WebSocket/CPUCoreSubscriber.cpp
Core/Debugger/WebSocket/CPUCoreSubscriber.h
Core/Debugger/WebSocket/DisasmSubscriber.cpp
Core/Debugger/WebSocket/DisasmSubscriber.h
Core/Debugger/WebSocket/GameBroadcaster.cpp
Core/Debugger/WebSocket/GameBroadcaster.h
Core/Debugger/WebSocket/GameSubscriber.cpp
Core/Debugger/WebSocket/GameSubscriber.h
Core/Debugger/WebSocket/HLESubscriber.cpp
Core/Debugger/WebSocket/HLESubscriber.h
Core/Debugger/WebSocket/LogBroadcaster.cpp
Core/Debugger/WebSocket/LogBroadcaster.h
Core/Debugger/WebSocket/SteppingBroadcaster.cpp
Core/Debugger/WebSocket/SteppingBroadcaster.h
Core/Debugger/WebSocket/SteppingSubscriber.cpp
Core/Debugger/WebSocket/SteppingSubscriber.h
Core/Debugger/WebSocket/WebSocketUtils.cpp
Core/Debugger/WebSocket/WebSocketUtils.h
Core/Dialog/PSPDialog.cpp
Core/Dialog/PSPDialog.h
Core/Dialog/PSPGamedataInstallDialog.cpp
@@ -600,7 +600,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
void ConsoleListener::Log(const LogMessage &msg) {
char Text[2048];
snprintf(Text, sizeof(Text), "%s %s", msg.header, msg.msg.c_str());
snprintf(Text, sizeof(Text), "%s %s %s", msg.timestamp, msg.header, msg.msg.c_str());
Text[sizeof(Text) - 2] = '\n';
Text[sizeof(Text) - 1] = '\0';
View
@@ -225,22 +225,17 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const
if (fileshort != file)
file = fileshort + 1;
}
char formattedTime[13];
std::lock_guard<std::mutex> lk(log_lock_);
Common::Timer::GetTimeFormatted(formattedTime);
Common::Timer::GetTimeFormatted(message.timestamp);
size_t prefixLen;
if (hleCurrentThreadName) {
prefixLen = snprintf(message.header, sizeof(message.header), "%s %-12.12s %c[%s]: %s:%d",
formattedTime,
snprintf(message.header, sizeof(message.header), "%-12.12s %c[%s]: %s:%d",
hleCurrentThreadName, level_to_char[(int)level],
log.m_shortName,
file, line);
} else {
prefixLen = snprintf(message.header, sizeof(message.header), "%s %s:%d %c[%s]:",
formattedTime,
snprintf(message.header, sizeof(message.header), "%s:%d %c[%s]:",
file, line, level_to_char[(int)level],
log.m_shortName);
}
@@ -250,15 +245,14 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const
va_copy(args_copy, args);
size_t neededBytes = vsnprintf(msgBuf, sizeof(msgBuf), format, args);
message.msg.resize(neededBytes + 1);
if (neededBytes > sizeof(msgBuf)) {
// Needed more space? Re-run vsnprintf.
message.msg.resize(neededBytes + 1);
vsnprintf(&message.msg[0], neededBytes + 1, format, args_copy);
} else {
message.msg.resize(neededBytes + 1);
memcpy(&message.msg[0], msgBuf, neededBytes);
}
message.msg[message.msg.size() - 1] = '\n';
message.msg[neededBytes] = '\n';
va_end(args_copy);
std::lock_guard<std::mutex> listeners_lock(listeners_lock_);
@@ -313,7 +307,7 @@ void FileLogListener::Log(const LogMessage &message) {
return;
std::lock_guard<std::mutex> lk(m_log_lock);
m_logfile << message.header << " " << message.msg << std::flush;
m_logfile << message.timestamp << " " << message.header << " " << message.msg << std::flush;
}
void OutputDebugStringLogListener::Log(const LogMessage &message) {
View
@@ -34,7 +34,8 @@ extern const char *hleCurrentThreadName;
// Struct that listeners can output how they want. For example, on Android we don't want to add
// timestamp or write the level as a string, those already exist.
struct LogMessage {
char header[64]; // timestamp and the other stuff in front...
char timestamp[16];
char header[64]; // Filename/thread/etc. in front.
LogTypes::LOG_LEVELS level;
const char *log;
std::string msg; // The actual log message.
View
@@ -380,6 +380,7 @@ static ConfigSetting generalSettings[] = {
ConfigSetting("RemoteISOManualConfig", &g_Config.bRemoteISOManual, false),
ConfigSetting("RemoteShareOnStartup", &g_Config.bRemoteShareOnStartup, false),
ConfigSetting("RemoteISOSubdir", &g_Config.sRemoteISOSubdir, "/"),
ConfigSetting("RemoteDebuggerOnStartup", &g_Config.bRemoteDebuggerOnStartup, false),
#ifdef __ANDROID__
ConfigSetting("ScreenRotation", &g_Config.iScreenRotation, 1),
View
@@ -143,6 +143,7 @@ struct Config {
bool bRemoteISOManual;
bool bRemoteShareOnStartup;
std::string sRemoteISOSubdir;
bool bRemoteDebuggerOnStartup;
bool bMemStickInserted;
int iScreenRotation; // The rotation angle of the PPSSPP UI. Only supported on Android and possibly other mobile platforms.
View
@@ -45,6 +45,10 @@ enum class CoreLifecycle {
STOPPING,
// Guaranteed call after STOPPING.
STOPPED,
// Sometimes called for save states. Guaranteed sequence, and never during STARTING or STOPPING.
MEMORY_REINITING,
MEMORY_REINITED,
};
typedef void (* CoreLifecycleFunc)(CoreLifecycle stage);
View
@@ -184,6 +184,17 @@
<ClCompile Include="..\ext\udis86\syn.c" />
<ClCompile Include="..\ext\udis86\udis86.c" />
<ClCompile Include="AVIDump.cpp" />
<ClCompile Include="Debugger\WebSocket.cpp" />
<ClCompile Include="Debugger\WebSocket\BreakpointSubscriber.cpp" />
<ClCompile Include="Debugger\WebSocket\CPUCoreSubscriber.cpp" />
<ClCompile Include="Debugger\WebSocket\GameBroadcaster.cpp" />
<ClCompile Include="Debugger\WebSocket\GameSubscriber.cpp" />
<ClCompile Include="Debugger\WebSocket\HLESubscriber.cpp" />
<ClCompile Include="Debugger\WebSocket\LogBroadcaster.cpp" />
<ClCompile Include="Debugger\WebSocket\DisasmSubscriber.cpp" />
<ClCompile Include="Debugger\WebSocket\SteppingBroadcaster.cpp" />
<ClCompile Include="Debugger\WebSocket\SteppingSubscriber.cpp" />
<ClCompile Include="Debugger\WebSocket\WebSocketUtils.cpp" />
<ClCompile Include="FileSystems\BlobFileSystem.cpp" />
<ClCompile Include="HLE\KUBridge.cpp" />
<ClCompile Include="HLE\sceUsbCam.cpp" />
@@ -532,7 +543,19 @@
<ClInclude Include="..\ext\udis86\udint.h" />
<ClInclude Include="..\ext\udis86\udis86.h" />
<ClInclude Include="AVIDump.h" />
<ClInclude Include="Debugger\WebSocket.h" />
<ClInclude Include="Debugger\WebSocket\BreakpointSubscriber.h" />
<ClInclude Include="Debugger\WebSocket\GameSubscriber.h" />
<ClInclude Include="Debugger\WebSocket\DisasmSubscriber.h" />
<ClInclude Include="Debugger\WebSocket\HLESubscriber.h" />
<ClInclude Include="Debugger\WebSocket\SteppingSubscriber.h" />
<ClInclude Include="Debugger\WebSocket\WebSocketUtils.h" />
<ClInclude Include="Debugger\WebSocket\CPUCoreSubscriber.h" />
<ClInclude Include="Debugger\WebSocket\GameBroadcaster.h" />
<ClInclude Include="Debugger\WebSocket\LogBroadcaster.h" />
<ClInclude Include="Debugger\WebSocket\SteppingBroadcaster.h" />
<ClInclude Include="FileSystems\BlobFileSystem.h" />
<ClInclude Include="HLE\KernelThreadDebugInterface.h" />
<ClInclude Include="HLE\KUBridge.h" />
<ClInclude Include="HLE\sceUsbCam.h" />
<ClInclude Include="MIPS\IR\IRFrontend.h" />
View
@@ -70,6 +70,9 @@
<Filter Include="MIPS\IR">
<UniqueIdentifier>{119ac973-e457-4025-9e1e-4fb34022ae23}</UniqueIdentifier>
</Filter>
<Filter Include="Debugger\WebSocket">
<UniqueIdentifier>{c21d9bb5-614d-451b-8c0b-3078b29122d8}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ELF\ElfReader.cpp">
@@ -692,6 +695,39 @@
<ClCompile Include="WebServer.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket.cpp">
<Filter>Debugger</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\LogBroadcaster.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\SteppingBroadcaster.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\GameBroadcaster.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\CPUCoreSubscriber.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\WebSocketUtils.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\GameSubscriber.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\DisasmSubscriber.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\SteppingSubscriber.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\BreakpointSubscriber.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
<ClCompile Include="Debugger\WebSocket\HLESubscriber.cpp">
<Filter>Debugger\WebSocket</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ELF\ElfReader.h">
@@ -1274,6 +1310,42 @@
<ClInclude Include="WebServer.h">
<Filter>Core</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket.h">
<Filter>Debugger</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\LogBroadcaster.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\SteppingBroadcaster.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\GameBroadcaster.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\CPUCoreSubscriber.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\WebSocketUtils.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\GameSubscriber.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\DisasmSubscriber.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\SteppingSubscriber.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\BreakpointSubscriber.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
<ClInclude Include="HLE\KernelThreadDebugInterface.h">
<Filter>HLE\Kernel</Filter>
</ClInclude>
<ClInclude Include="Debugger\WebSocket\HLESubscriber.h">
<Filter>Debugger\WebSocket</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />
Oops, something went wrong.

0 comments on commit 9d96e65

Please sign in to comment.