This is an archive of the discontinued LLVM Phabricator instance.

Add logging plugin for Winodows
ClosedPublic

Authored by amccarth on Apr 9 2015, 2:07 PM.

Details

Reviewers
zturner
Summary

Adds a ProcessWindowsLog, patterned off ProcessPosixLog and others. (Nothing uses it yet. I'll do that in a separate patch.

But it does initialize, and you can issue lldb commands like:

(lldb) log list windows
(lldb) log list enable windows all
(lldb) log disable windows memory

There's already a lot of code duplication among the logging classes, so this addition doesn't it make it much worse. It seems there's almost nothing POSIX-specific in ProcessPOSIXLog, so that class could be used as a base to reduce a bunch of the code duplication. If that seems reasonable, I'll go that route.

Diff Detail

Event Timeline

amccarth updated this revision to Diff 23531.Apr 9 2015, 2:07 PM
amccarth retitled this revision from to Add logging plugin for Winodows.
amccarth updated this object.
amccarth edited the test plan for this revision. (Show Details)
amccarth added a reviewer: zturner.
amccarth added a subscriber: Unknown Object (MLST).
zturner edited edge metadata.Apr 9 2015, 2:28 PM

Mostly fine, but since this is duplicating a bunch of code, I'd like to keep the amount of duplication to only what we have an immediate need for.

source/Plugins/Process/Windows/ProcessWindowsLog.cpp
42

Can you make this an llvm::ManagedStatic<std::once_flag> once_flag on Windows is not linker-initialized, and Windows doesn't have thread-safe function local static initialization. This is probably benign in this case, as this is only called from SystemInitialzierCommon::Initialize(), but either way, as a general principle once_flags should be ManagedStatics.

source/Plugins/Process/Windows/ProcessWindowsLog.h
19

This flag doesn't make much sense currently, I think this must have to do with remote ddebugging.

24

Can delete this one too, as Windows doesn't support watchpoints yet.

26

Not sure what this one is, but check what they're using it for on the Linux side, and if it doesn't apply to Windows (yet / ever) then remove this one too

28

Another one that can go.

76–96

I don't think we need any of this nesting stuff. If it becomes useful later, we can always introduce it back.

amccarth added inline comments.Apr 9 2015, 3:48 PM
source/Plugins/Process/Windows/ProcessWindowsLog.cpp
42

Done, but I thought VC++2013 had finally added thread-safe initialization of function statics. Maybe I'm misreading the table: http://blogs.msdn.com/b/vcblog/archive/2013/11/18/announcing-the-visual-c-compiler-november-2013-ctp.aspx

source/Plugins/Process/Windows/ProcessWindowsLog.h
19

Done. I wasn't sure if it was important to keep the flag numbering consistent.

24

Done.

26

It's for "communication," but I'm not sure what that means in this context. Removed.

28

Done.

76–96

Removed.

amccarth updated this revision to Diff 23539.Apr 9 2015, 3:48 PM
amccarth edited edge metadata.

Addressed comments from previous round.

Looks good, thanks!

zturner accepted this revision.Oct 15 2015, 1:45 PM
zturner edited edge metadata.
This revision is now accepted and ready to land.Oct 15 2015, 1:45 PM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r234607.