| 357 | rdcstr message; |
| 358 | |
| 359 | bool parse(const rdcstr &line) |
| 360 | { |
| 361 | #define EXPECT_CHAR(c) \ |
| 362 | if(idx >= line.length() || line[idx] != c) \ |
| 363 | return false; \ |
| 364 | idx++; |
| 365 | |
| 366 | // Parse out mostly our own log files, but also output that looks like crash callstacks |
| 367 | // |
| 368 | // Example lines: |
| 369 | // |
| 370 | // clang-format off |
| 371 | // |
| 372 | // 0 1 2 3 4 5 6 7 8 9 10 |
| 373 | // 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 |
| 374 | // I/renderdoc( 1234): @1234567812345678@ RDOC 001234: [01:02:03] filename.cpp( 123) - Log - Hello |
| 375 | // |
| 376 | // F/libc (11519): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 11618 (FooBar), pid 11519 (blah) |
| 377 | // F/DEBUG (12061): backtrace: |
| 378 | // F/DEBUG (12061): #00 pc 000485ec /system/lib/libc.so (pthread_mutex_lock+1) |
| 379 | // F/DEBUG (12061): #01 pc 00137449 /data/app/org.renderdoc.renderdoccmd.arm32==/lib/arm/libVkLayer_GLES_RenderDoc.so |
| 380 | // F/DEBUG (12061): #02 pc 0013bbf1 /data/app/org.renderdoc.renderdoccmd.arm32==/lib/arm/libVkLayer_GLES_RenderDoc.so |
| 381 | // |
| 382 | // clang-format on |
| 383 | // |
| 384 | |
| 385 | size_t idx = 0; |
| 386 | |
| 387 | // too short - minimum is 22 for prefix. Could be longer if PID is over 5 digits |
| 388 | // saves on length checks below |
| 389 | if(line.length() <= 20) |
| 390 | return false; |
| 391 | |
| 392 | // skip past priority character |
| 393 | idx++; |
| 394 | |
| 395 | EXPECT_CHAR('/'); |
| 396 | |
| 397 | // we assume that the logcat filters have worked, so ignore the logcat tag here. Just check if |
| 398 | // it's ours or not |
| 399 | bool ownLog = !strncmp(&line[idx], "renderdoc", 9); |
| 400 | while(idx < line.length() && line[idx] != '(') |
| 401 | idx++; |
| 402 | |
| 403 | size_t tagEnd = idx; |
| 404 | |
| 405 | EXPECT_CHAR('('); |
| 406 | |
| 407 | // skip spaces |
| 408 | while(idx < line.length() && isspace(line[idx])) |
| 409 | idx++; |
| 410 | |
| 411 | // process this PID field - we'll override it with our own if this is one of our logs |
| 412 | pid = 0; |
| 413 | while(idx < line.length() && isdigit(line[idx])) |
| 414 | { |
| 415 | pid *= 10; |
| 416 | pid += int(line[idx] - '0'); |
no test coverage detected