This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Host] Add missing proc states
ClosedPublic

Authored by rupprecht on Aug 28 2020, 2:51 PM.

Details

Summary

The /proc/<pid>/status parsing is missing a few cases:

  • Idle
  • Parked
  • Dead

If we encounter an unknown proc state, this leads to an msan warning. In reality, we only check that the state != Zombie, so it doesn't really matter that we handle all cases, but handle them anyway (current list: [1]). Also explicitly set it to unknown if we encounter an unknown state. There will still be an msan warning if the proc entry has no State: line, but that should not happen.

Use a StringSwitch to make the handling of proc states a little more compact.

[1] https://github.com/torvalds/linux/blob/master/fs/proc/array.c

Diff Detail

Event Timeline

rupprecht created this revision.Aug 28 2020, 2:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2020, 2:51 PM
rupprecht requested review of this revision.Aug 28 2020, 2:51 PM
labath accepted this revision.Sep 2 2020, 7:35 AM
This revision is now accepted and ready to land.Sep 2 2020, 7:35 AM
This revision was landed with ongoing or failed builds.Sep 2 2020, 8:52 AM
This revision was automatically updated to reflect the committed changes.