This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [Host/{free,net}bsd] Fix process matching by name
ClosedPublic

Authored by mgorny on Oct 30 2020, 4:07 AM.

Details

Summary

Fix process matching by name to make 'process attach -n ...' work.

The process finding code has an optimization that defers getting
the process name and executable format after the numeric (PID, UID...)
parameters are tested. However, the ProcessInstanceInfoMatch.Matches()
method has been matching process name against the incomplete process
information as well, and effectively no process ever matched.

In order to fix this, create a copy of ProcessInstanceInfoMatch, set
it to ignore process name and se this copy for the initial match.
The same fix applies to FreeBSD and NetBSD host code.

Diff Detail

Event Timeline

mgorny created this revision.Oct 30 2020, 4:07 AM
mgorny requested review of this revision.Oct 30 2020, 4:07 AM

There's a test that this fixes, right?

There is TestProcessAttach.py that has an @expectedFailureNetBSD but no FreeBSD annotation, as well as TestCompletion.py, but I don't see these in the failing list.

process attach -n foo does fail for me on FreeBSD

There's a test that this fixes, right?

The attaching tests still fail for me, I'm trying to investigate why. However, it does fix process attach -n ... in LLDB session.

labath accepted this revision.Oct 30 2020, 7:40 AM

Ok, so it will be tested once the remaining issue is fixed.

This revision is now accepted and ready to land.Oct 30 2020, 7:40 AM

Actually, this is tested already with the old plugin. It's just the new plugin that's suffering the issue, probably inherited from the original NetBSD code :-(.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 3 2020, 12:46 AM