Skip to content

Commit

Permalink
PR handling port of Diagnostic Server C++ library from CoreCLR into a C
Browse files Browse the repository at this point in the history
library that can be shared between Mono as well as CoreCLR runtime.

Port follows same guidelines setup for event pipe port dotnet#34600.
Diagnostic server library is currently hosted as part of event pipe
library but hosting its own runtime shim as well as source files
(so could be split into separate library if ever make sense).
Diagnostic Server have dependencies on event pipe library
(and reuse part of event pipe runtime shim from its how shim).

This is the first PR getting the code from diagnostic server codebase
over to C library.
  • Loading branch information
lateralusX committed Oct 2, 2020
1 parent 22791d4 commit 00955f4
Show file tree
Hide file tree
Showing 88 changed files with 8,104 additions and 432 deletions.
28 changes: 26 additions & 2 deletions src/mono/mono/eventpipe/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,32 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(GLIB_CFLAGS) $(SHARED_CFLAG
noinst_LTLIBRARIES = libeventpipe.la

eventpipe_sources = \
ep.c \
ep.h \
ds-dump-protocol.c \
ds-dump-protocol.h \
ds-eventpipe-protocol.c \
ds-eventpipe-protocol.h \
ds-getter-setter.h \
ds-ipc.c \
ds-ipc.h \
ds-ipc-posix.c \
ds-ipc-posix.h \
ds-process-protocol.c \
ds-process-protocol.h \
ds-profiler-protocol.c \
ds-profiler-protocol.h \
ds-protocol.c \
ds-protocol.h \
ds-rt.h \
ds-rt-config.h \
ds-rt-mono.c \
ds-rt-mono.h \
ds-rt-types.h \
ds-rt-types-mono.h \
ds-server.c \
ds-server.h \
ds-types.h \
ep.c \
ep.h \
ep-block.c \
ep-block.h \
ep-buffer.c \
Expand Down
32 changes: 32 additions & 0 deletions src/mono/mono/eventpipe/ds-dump-protocol.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <config.h>

#ifdef ENABLE_PERFTRACING
#include "ds-rt-config.h"
#if !defined(DS_INCLUDE_SOURCE_FILES) || defined(DS_FORCE_INCLUDE_SOURCE_FILES)

#define DS_IMPL_DUMP_PROTOCOL_GETTER_SETTER
#include "ds-protocol.h"
#include "ds-dump-protocol.h"
#include "ds-rt.h"

void
ds_dump_protocol_helper_handle_ipc_message (
DiagnosticsIpcMessage *message,
DiagnosticsIpcStream *stream)
{
EP_ASSERT (message != NULL);
EP_ASSERT (stream != NULL);

// TODO: Implement.
DS_LOG_WARNING_0 ("Generate Core Dump not implemented\n");
ds_ipc_message_send_error (stream, DS_IPC_E_NOTSUPPORTED);
ds_ipc_stream_free (stream);
}

#endif /* !defined(DS_INCLUDE_SOURCE_FILES) || defined(DS_FORCE_INCLUDE_SOURCE_FILES) */
#endif /* ENABLE_PERFTRACING */

#ifndef DS_INCLUDE_SOURCE_FILES
extern const char quiet_linker_empty_file_warning_diagnostics_dump_protocol;
const char quiet_linker_empty_file_warning_diagnostics_dump_protocol = 0;
#endif
27 changes: 27 additions & 0 deletions src/mono/mono/eventpipe/ds-dump-protocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef __DIAGNOSTICS_DUMP_PROTOCOL_H__
#define __DIAGNOSTICS_DUMP_PROTOCOL_H__

#include <config.h>

#ifdef ENABLE_PERFTRACING
#include "ds-rt-config.h"
#include "ds-types.h"
#include "ds-ipc.h"

#undef DS_IMPL_GETTER_SETTER
#ifdef DS_IMPL_DUMP_PROTOCOL_GETTER_SETTER
#define DS_IMPL_GETTER_SETTER
#endif
#include "ds-getter-setter.h"

/*
* DiagnosticsDumpProtocolHelper.
*/

void
ds_dump_protocol_helper_handle_ipc_message (
DiagnosticsIpcMessage *message,
DiagnosticsIpcStream *stream);

#endif /* ENABLE_PERFTRACING */
#endif /* __DIAGNOSTICS_DUMP_PROTOCOL_H__ */
Loading

0 comments on commit 00955f4

Please sign in to comment.