| 335 | } |
| 336 | |
| 337 | static void DLDebugHandler(void * arg, WebDebugConnection * connection) |
| 338 | { |
| 339 | const WebDebugConnection::QueryParams & params = connection->GetQueryParams(); |
| 340 | if (!params.empty()) |
| 341 | { |
| 342 | bool ok = false; |
| 343 | |
| 344 | for (size_t i = 0; i < params.size(); ++i) |
| 345 | { |
| 346 | if (params[i].Key == "action") |
| 347 | { |
| 348 | if (params[i].Value == "break") |
| 349 | { |
| 350 | DoTask(connection, kBreakExecution); |
| 351 | return; |
| 352 | } |
| 353 | else if (params[i].Value == "resume") |
| 354 | { |
| 355 | DoTask(connection, kResumeExecution); |
| 356 | return; |
| 357 | } |
| 358 | } |
| 359 | else if (params[i].Key == "scrub") |
| 360 | { |
| 361 | gInstructionCountLimit = ParseU32(params[i].Value, 10); |
| 362 | DoTask(connection, kTaskScrub); |
| 363 | return; |
| 364 | } |
| 365 | else if (params[i].Key == "screen") |
| 366 | { |
| 367 | //int cmd = atoi(params[i].Value); |
| 368 | DoTask(connection, kTaskTakeScreenshot); |
| 369 | return; |
| 370 | } |
| 371 | else if (params[i].Key == "dump") |
| 372 | { |
| 373 | //int cmd = atoi(params[i].Value); |
| 374 | DoTask(connection, kTaskDumpDList); |
| 375 | return; |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | // Fallthrough for handlers that just return 'ok'. |
| 380 | connection->BeginResponse(ok ? 200 : 400, -1, kTextPlain); |
| 381 | connection->WriteString(ok ? "ok\n" : "fail\n"); |
| 382 | connection->EndResponse(); |
| 383 | return; |
| 384 | } |
| 385 | |
| 386 | if (!ServeResource(connection, "/html/dldebugger.html")) |
| 387 | { |
| 388 | Generate500(connection, "Couldn't load html/debugger.html"); |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | bool DLDebugger_RegisterWebDebug() |
| 393 | { |
nothing calls this directly
no test coverage detected