MCPcopy Create free account
hub / github.com/Vector35/debugger / GetProcessList

Method GetProcessList

core/adapters/lldbadapter.cpp:391–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389
390
391std::vector<DebugProcess> LldbAdapter::GetProcessList()
392{
393 std::vector<DebugProcess> debug_processes {};
394
395 std::istringstream processList(InvokeBackendCommand("platform process list"));
396 std::string line;
397
398 while (getline(processList, line, '\n'))
399 {
400 uint32_t pid{};
401
402 // skip header lines and lines that have len <= 56
403 if (line.rfind("matching processes were found on") != std::string::npos
404 || line.rfind("PID PARENT USER") != std::string::npos
405 || line.rfind("====== ======") != std::string::npos
406 || line.size() <= 56)
407 {
408 continue;
409 }
410
411 if (sscanf(line.c_str(), "%d", &pid) == 0)
412 continue;
413
414 // example output lines:
415 // 1268 944 csrss.exe
416 // 37635 9677 xusheng arm64-apple-* Code Helper (Renderer)
417 //
418 // we've 56 bytes until process name which is calculated like this:
419 // (6 + 1) + (6 + 1) + (10 + 1) + (30 + 1)
420
421 std::string processName(std::next(line.begin(), 56), line.end());
422
423 debug_processes.emplace_back(pid, processName);
424 }
425
426 return debug_processes;
427}
428
429
430std::vector<DebugThread> LldbAdapter::GetThreadList()

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected