Skip to content

Conversation

andrurogerz
Copy link
Collaborator

@andrurogerz andrurogerz commented Oct 29, 2024

Purpose

Properly implement a subset of match filters for the qfProcessInfo and qsProcessInfo packets.

fixes #167
fixes #171

Overview

  • Fix the Handle_qfProcessInfo implementation to parse the incoming string; it was mistakenly using the full argument string args instead of the individual argument string arg.
  • Decode the hex-encoded process name string to match against in Handle_qfProcessInfo. It was incorrectly not decoded before.
  • Fix PlatformSessionImplBase::updateProcesses to clear the process list before enumerating/matching.
    • Without this fix, the process list keeps growing with redundant entries.
  • Implement PlatformSessionImplBase::processMatch to perform the actual matching against the values provided with the qfProcessInfo packet. They were previously ignored (and noted in a TODO).
  • When matching against the process name, try matching against both the process name in the ProcessInfo structure and the base thread name for the process.
    • This matching is necessary on Linux and Android because the process name is the fully qualified path name to the executable, but the match name is just the base name (e.g. "/home/user/a.out" vs "a.out") which matches the primary thread name.
    • This change was the most targeted fix that didn't disrupt other behavior and break other test cases that rely on ProcessInfo.name being the fully qualified executable file name.
  • Add TODOs for the remaining missing functionality. The test coverage on this code path appears to be incomplete.
  • Enable the TestProcessAttach.ProcessAttachTestCase.test_attach_to_process_by_name test case on Linux and Android.

Background

The qfProcessInfo and qsProcessInfo packets are and LLDB platform extension and are used together to enumerate processes on the target. They are documented here.

Validation

Ranually run the test_attach_to_process_by_name test case on Android and Linux to confirm it passes.

@andrurogerz andrurogerz force-pushed the process-list branch 2 times, most recently from 025f864 to 87629d2 Compare October 30, 2024 16:20
@andrurogerz andrurogerz force-pushed the process-list branch 2 times, most recently from 989fd77 to dfc44d7 Compare October 30, 2024 16:43
@andrurogerz andrurogerz merged commit 87d5ae7 into compnerd:main Oct 30, 2024
30 checks passed
@andrurogerz andrurogerz deleted the process-list branch October 30, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

platform process list output grows indefinitely with duplicate entries qfProcessInfo and qsProcessInfo packets do not filter process list

3 participants