Diagnostics IPC (#24582)
authorJohn Salem <josalem@microsoft.com>
Fri, 24 May 2019 03:18:33 +0000 (20:18 -0700)
committerGitHub <noreply@github.com>
Fri, 24 May 2019 03:18:33 +0000 (20:18 -0700)
commit267f8299ac1fd97430284fa6d44e5e9c6ed26850
tree43a9f01ee054e5360e4c810aacd3c68b4e75cbbf
parent442d71f95973f2d3b4c1fa2fb2664dcabf69329c
Diagnostics IPC (#24582)

* Initial draft of structs and classes for Diagnostic Server IPC Protocol

* Fix some syntax/name issues that weren't getting caught by intellisense in vscode for mac

* * Add member checkers for Flatten and GetSize
* Split Flatten impl to have a default version for simple, fixed-size structs

* * Remove unnecessary abstract class
* Add documentation about templates

* * Change templating for IpcMessage class to be more limited (only on message creation and payload parsing)
* flesh out parse and tryparse
* add requirement for non-fixed-size payloads to implement a static TryParse(buffer, bufferlen)
* refactor namespace to bottom of file

* * moved DiagnosticsIpc namespace into diagnosticprotocol.h to avoid being referenced by debug-pal project
* converted diagnostic server to use DiagnosticsIpc code
* converted EventPipeProtocolHelper to use DiagnosticsIpc code
* made EventPipe end to end use DiagnosticsIpc code

* * Add ASSERTs where relevant
* Refactor stream ownershpi back to previous way for collect tracing response

* * Add contracts where applicable

* * Updating GenerateCoreDump code to use new IPC work after rebase

* * modify contract in DiagnosticProtocolHelper to be more restrictive
* remove comments
* Add comment documentation of SFINAE pattern above usage
* simplify Has* checks
* Fix function resolution for static member check
* Add Constructor for rvalue references to IpcMessage
* avoid code path that would result in a blocking read on 0 bytes
* Fix silly strcmp bug
* fix contractin EventPipeProtocolHelper

* * Modify header declaration to make static initialization easier
* fix type in template code

* * Make all messages use Initialize instead of constructor for hydrating themselves, to make error paths easier

* * Expand and streamline error model to match spec
* Simplify writing error messages to a static function
* memory management

* *modify function signatures for SFINAE to remove clang warning

* * add braces to static initialization to remove clang warnings

* * modify IpcMessage::TryParseImpl, to reset the internal data pointer when passing back a reinterpret_cast to prevent double frees on destruction
* Add notes on requirement that user free the memory for a payload

* * fix bug in TryParse for generateCoreDump
* change INT to uint32_t in GenerateCoreDump payloads

* Remove unused error code

* * rename Miscellaneous command set to Diagnostic
* Remove unnecessary command ids in EventPipe

* Rename Diagnostic command set to Dump

* * Move payload into Holder to simplify cleanup
* Add buffer holder to payloads to ensure the buffers are being cleaned up after use
* updated Profiler attach to use IPC work after rebase

* * Fix typos
* Fix placement of ifdefs for profiler helpers

* * Fix accidental char hidden in ifdef...

* * Add ASSERT to signify we shouldn't be re-using IpcMessages

* * fix another typo hidden behind inactive ifdef...

* * Change errors to use HRESULTS to increase transparency
* fix bug in profiler attach for checking if entire client data is in buffer
14 files changed:
src/inc/corerror.xml
src/pal/prebuilt/inc/corerror.h
src/vm/CMakeLists.txt
src/vm/diagnosticprotocolhelper.cpp [deleted file]
src/vm/diagnosticprotocolhelper.h [deleted file]
src/vm/diagnosticserver.cpp
src/vm/diagnosticsprotocol.h
src/vm/dumpdiagnosticprotocolhelper.cpp [new file with mode: 0644]
src/vm/dumpdiagnosticprotocolhelper.h [new file with mode: 0644]
src/vm/eventpipeprotocolhelper.cpp
src/vm/eventpipeprotocolhelper.h
src/vm/fastserializer.cpp
src/vm/profilerdiagnosticprotocolhelper.cpp [new file with mode: 0644]
src/vm/profilerdiagnosticprotocolhelper.h [new file with mode: 0644]