Permalink
Browse files

Debugger: Add some docs for new APIs.

  • Loading branch information...
unknownbrackets committed Jun 16, 2018
1 parent e6917cc commit f0694ba11516675366ad9d45d861f7a5df7443f9
Showing with 162 additions and 0 deletions.
  1. +94 −0 Core/Debugger/WebSocket/BreakpointSubscriber.cpp
  2. +68 −0 Core/Debugger/WebSocket/GPUBufferSubscriber.cpp
@@ -121,6 +121,18 @@ struct WebSocketCPUBreakpointParams {
}
};
// Add a new CPU instruction breakpoint (cpu.breakpoint.add)
//
// Parameters:
// - address: unsigned integer address of instruction to break at.
// - enabled: optional boolean, whether to actually enter stepping when this breakpoint trips.
// - log: optional boolean, whether to log when this breakpoint trips.
// - condition: optional string expression to evaluate - breakpoint does not trip if false.
// - logFormat: optional string to log when breakpoint trips, may include {expression} parts.
//
// Response (same event name) with no extra data.
//
// Note: will replace any breakpoint at the same address.
void WebSocketCPUBreakpointAdd(DebuggerRequest &req) {
WebSocketCPUBreakpointParams params;
if (!params.Parse(req))
@@ -131,6 +143,16 @@ void WebSocketCPUBreakpointAdd(DebuggerRequest &req) {
req.Respond();
}
// Update a CPU instruction breakpoint (cpu.breakpoint.update)
//
// Parameters:
// - address: unsigned integer address of instruction to break at.
// - enabled: optional boolean, whether to actually enter stepping when this breakpoint trips.
// - log: optional boolean, whether to log when this breakpoint trips.
// - condition: optional string expression to evaluate - breakpoint does not trip if false.
// - logFormat: optional string to log when breakpoint trips, may include {expression} parts.
//
// Response (same event name) with no extra data.
void WebSocketCPUBreakpointUpdate(DebuggerRequest &req) {
WebSocketCPUBreakpointParams params;
if (!params.Parse(req))
@@ -143,6 +165,12 @@ void WebSocketCPUBreakpointUpdate(DebuggerRequest &req) {
req.Respond();
}
// Remove a CPU instruction breakpoint (cpu.breakpoint.remove)
//
// Parameters:
// - address: unsigned integer address of instruction to break at.
//
// Response (same event name) with no extra data.
void WebSocketCPUBreakpointRemove(DebuggerRequest &req) {
if (!currentDebugMIPS->isAlive()) {
return req.Fail("CPU not started");
@@ -156,6 +184,19 @@ void WebSocketCPUBreakpointRemove(DebuggerRequest &req) {
req.Respond();
}
// List all CPU instruction breakpoints (cpu.breakpoint.list)
//
// No parameters.
//
// Response (same event name):
// - breakpoints: array of objects, each with properties:
// - address: unsigned integer address of instruction to break at.
// - enabled: boolean, whether to actually enter stepping when this breakpoint trips.
// - log: optional boolean, whether to log when this breakpoint trips.
// - condition: null, or string expression to evaluate - breakpoint does not trip if false.
// - logFormat: null, or string to log when breakpoint trips, may include {expression} parts.
// - symbol: null, or string label or symbol at breakpoint address.
// - code: string disassembly of breakpoint address.
void WebSocketCPUBreakpointList(DebuggerRequest &req) {
if (!currentDebugMIPS->isAlive()) {
return req.Fail("CPU not started");
@@ -278,6 +319,22 @@ struct WebSocketMemoryBreakpointParams {
}
};
// Add a new memory breakpoint (memory.breakpoint.add)
//
// Parameters:
// - address: unsigned integer address for the start of the memory range.
// - size: unsigned integer specifying size of memory range.
// - enabled: optional boolean, whether to actually enter stepping when this breakpoint trips.
// - log: optional boolean, whether to log when this breakpoint trips.
// - read: optional boolean, whether to trip on any read to this address.
// - write: optional boolean, whether to trip on any write to this address.
// - change: optional boolean, whether to trip on a write to this address which modifies data
// (or any write that may modify data.)
// - logFormat: optional string to log when breakpoint trips, may include {expression} parts.
//
// Response (same event name) with no extra data.
//
// Note: will replace any breakpoint that has the same start address and size.
void WebSocketMemoryBreakpointAdd(DebuggerRequest &req) {
WebSocketMemoryBreakpointParams params;
if (!params.Parse(req))
@@ -288,6 +345,20 @@ void WebSocketMemoryBreakpointAdd(DebuggerRequest &req) {
req.Respond();
}
// Update a memory breakpoint (memory.breakpoint.update)
//
// Parameters:
// - address: unsigned integer address for the start of the memory range.
// - size: unsigned integer specifying size of memory range.
// - enabled: optional boolean, whether to actually enter stepping when this breakpoint trips.
// - log: optional boolean, whether to log when this breakpoint trips.
// - read: optional boolean, whether to trip on any read to this address.
// - write: optional boolean, whether to trip on any write to this address.
// - change: optional boolean, whether to trip on a write to this address which modifies data
// (or any write that may modify data.)
// - logFormat: optional string to log when breakpoint trips, may include {expression} parts.
//
// Response (same event name) with no extra data.
void WebSocketMemoryBreakpointUpdate(DebuggerRequest &req) {
WebSocketMemoryBreakpointParams params;
if (!params.Parse(req))
@@ -302,6 +373,13 @@ void WebSocketMemoryBreakpointUpdate(DebuggerRequest &req) {
req.Respond();
}
// Remove a memory breakpoint (memory.breakpoint.remove)
//
// Parameters:
// - address: unsigned integer address for the start of the memory range.
// - size: unsigned integer specifying size of memory range.
//
// Response (same event name) with no extra data.
void WebSocketMemoryBreakpointRemove(DebuggerRequest &req) {
if (!currentDebugMIPS->isAlive()) {
return req.Fail("CPU not started");
@@ -318,6 +396,22 @@ void WebSocketMemoryBreakpointRemove(DebuggerRequest &req) {
req.Respond();
}
// List all memory breakpoints (memory.breakpoint.list)
//
// No parameters.
//
// Response (same event name):
// - breakpoints: array of objects, each with properties:
// - address: unsigned integer address for the start of the memory range.
// - size: unsigned integer specifying size of memory range.
// - enabled: boolean, whether to actually enter stepping when this breakpoint trips.
// - log: optional boolean, whether to log when this breakpoint trips.
// - read: optional boolean, whether to trip on any read to this address.
// - write: optional boolean, whether to trip on any write to this address.
// - change: optional boolean, whether to trip on a write to this address which modifies data
// (or any write that may modify data.)
// - logFormat: null, or string to log when breakpoint trips, may include {expression} parts.
// - symbol: null, or string label or symbol at breakpoint address.
void WebSocketMemoryBreakpointList(DebuggerRequest &req) {
if (!currentDebugMIPS->isAlive()) {
return req.Fail("CPU not started");
@@ -239,24 +239,92 @@ static void GenericStreamBuffer(DebuggerRequest &req, std::function<bool(const G
}
}
// Retrieve a screenshot (gpu.buffer.screenshot)
//
// Parameters:
// - type: either 'uri' or 'base64'.
// - alpha: boolean to include the alpha channel for 'uri' type (not normally useful for screenshots.)
//
// Response (same event name) for 'uri' type:
// - width: numeric width of screenshot.
// - height: numeric height of screenshot.
// - uri: data: URI of PNG image for display.
//
// Response (same event name) for 'base64' type:
// - width: numeric width of screenshot (also stride, in pixels, of binary data.)
// - height: numeric height of screenshot.
// - flipped: boolean to indicate whether buffer is vertically flipped.
// - format: string indicating format, such as 'R8G8B8A8_UNORM' or 'B8G8R8A8_UNORM'.
// - base64: base64 encode of binary data.
void WebSocketGPUBufferScreenshot(DebuggerRequest &req) {
GenericStreamBuffer(req, [](const GPUDebugBuffer *&buf) {
return GPUStepping::GPU_GetOutputFramebuffer(buf);
});
}
// Retrieve current color render buffer (gpu.buffer.renderColor)
//
// Parameters:
// - type: either 'uri' or 'base64'.
// - alpha: boolean to include the alpha channel for 'uri' type.
//
// Response (same event name) for 'uri' type:
// - width: numeric width of render buffer (may include stride.)
// - height: numeric height of render buffer.
// - uri: data: URI of PNG image for display.
//
// Response (same event name) for 'base64' type:
// - width: numeric width of render buffer (also stride, in pixels, of binary data.)
// - height: numeric height of render buffer.
// - flipped: boolean to indicate whether buffer is vertically flipped.
// - format: string indicating format, such as 'R8G8B8A8_UNORM' or 'B8G8R8A8_UNORM'.
// - base64: base64 encode of binary data.
void WebSocketGPUBufferRenderColor(DebuggerRequest &req) {
GenericStreamBuffer(req, [](const GPUDebugBuffer *&buf) {
return GPUStepping::GPU_GetCurrentFramebuffer(buf, GPU_DBG_FRAMEBUF_RENDER);
});
}
// Retrieve current depth render buffer (gpu.buffer.renderDepth)
//
// Parameters:
// - type: either 'uri' or 'base64'.
// - alpha: true to use alpha to encode depth, otherwise red for 'uri' type.
//
// Response (same event name) for 'uri' type:
// - width: numeric width of render buffer (may include stride.)
// - height: numeric height of render buffer.
// - uri: data: URI of PNG image for display.
//
// Response (same event name) for 'base64' type:
// - width: numeric width of render buffer (also stride, in pixels, of binary data.)
// - height: numeric height of render buffer.
// - flipped: boolean to indicate whether buffer is vertically flipped.
// - format: string indicating format, such as 'D16', 'D24_X8' or 'D32F'.
// - base64: base64 encode of binary data.
void WebSocketGPUBufferRenderDepth(DebuggerRequest &req) {
GenericStreamBuffer(req, [](const GPUDebugBuffer *&buf) {
return GPUStepping::GPU_GetCurrentDepthbuffer(buf);
});
}
// Retrieve current stencil render buffer (gpu.buffer.renderStencil)
//
// Parameters:
// - type: either 'uri' or 'base64'.
// - alpha: true to use alpha to encode stencil, otherwise red for 'uri' type.
//
// Response (same event name) for 'uri' type:
// - width: numeric width of render buffer (may include stride.)
// - height: numeric height of render buffer.
// - uri: data: URI of PNG image for display.
//
// Response (same event name) for 'base64' type:
// - width: numeric width of render buffer (also stride, in pixels, of binary data.)
// - height: numeric height of render buffer.
// - flipped: boolean to indicate whether buffer is vertically flipped.
// - format: string indicating format, such as 'X24_S8' or 'S8'.
// - base64: base64 encode of binary data.
void WebSocketGPUBufferRenderStencil(DebuggerRequest &req) {
GenericStreamBuffer(req, [](const GPUDebugBuffer *&buf) {
return GPUStepping::GPU_GetCurrentStencilbuffer(buf);

0 comments on commit f0694ba

Please sign in to comment.