This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [Process/FreeBSDKernel] Introduce libkvm support
ClosedPublic

Authored by mgorny on Dec 19 2021, 10:21 AM.

Details

Summary

Introduce initial support for using libkvm on FreeBSD. The library
can be used as an alternate implementation for processing kernel
coredumps but it can also be used to access live kernel memory through
specifying "/dev/mem" as the core file, i.e.:

lldb --core /dev/mem /boot/kernel/kernel

Diff Detail

Event Timeline

mgorny created this revision.Dec 19 2021, 10:21 AM
mgorny requested review of this revision.Dec 19 2021, 10:21 AM

How about factoring the two implementations into subclasses. If the classes are small, maybe you can just declare them in the cpp file...

mgorny updated this revision to Diff 395471.Dec 20 2021, 9:06 AM

Split into FVC/KVM classes.

How about factoring the two implementations into subclasses. If the classes are small, maybe you can just declare them in the cpp file...

Yes, that's a nice idea. As an extra, we can easily use the real pointer types and remove all these casts.

Just a couple of quick comments.

How about factoring the two implementations into subclasses. If the classes are small, maybe you can just declare them in the cpp file...

Yes, that's a nice idea. As an extra, we can easily use the real pointer types and remove all these casts.

Yep. :)

lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
29–72

put into anonymous namespace, for maximum compliance.

54

is looks like this ought to be private

89

Do you really want to do this if the fvc call was successful? What is the expected priority of the two implementations? Maybe just use return statements instead of assignments?

mgorny marked 3 inline comments as done.Dec 22 2021, 5:21 AM
mgorny added inline comments.
lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
89

Oh shi, I didn't notice that it doesn't use return statements. Fixed now.

mgorny updated this revision to Diff 395850.Dec 22 2021, 5:21 AM
mgorny marked an inline comment as done.

Implemented requested changed.

labath accepted this revision.Dec 22 2021, 6:56 AM
This revision is now accepted and ready to land.Dec 22 2021, 6:56 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2021, 7:16 AM