Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plumbing for getting crashpad_handler's IPC pipe name #10

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,14 @@ SENTRY_API void sentry_options_set_database_pathw(
sentry_options_t *opts, const wchar_t *path);
SENTRY_API void sentry_options_set_database_pathw_n(
sentry_options_t *opts, const wchar_t *path, size_t path_len);

/**
* Returns the name of the named pipe where the Crashpad handler is listening
* for child connections if Crashpad is active backend.
*/
SENTRY_API const wchar_t *sentry_options_get_handler_ipc_pipew(
sentry_options_t *opts);

#endif

/**
Expand Down
5 changes: 5 additions & 0 deletions src/backends/sentry_backend_crashpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ crashpad_backend_startup(
annotations, arguments,
/* restartable */ true,
/* asynchronous_start */ false, attachments);
#ifdef SENTRY_PLATFORM_WINDOWS
std::wstring pipe_name = data->client->GetHandlerIPCPipe();
const_cast<sentry_options_t *>(options)->handler_ipc_pipe
= sentry__path_new(pipe_name.c_str());
#endif
sentry_free(minidump_url);
} else {
SENTRY_WARN(
Expand Down
6 changes: 6 additions & 0 deletions src/sentry_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,12 @@ sentry_options_set_database_pathw(sentry_options_t *opts, const wchar_t *path)
}
#endif

const wchar_t *
sentry_options_get_handler_ipc_pipew(sentry_options_t *opts)
{
return opts->handler_ipc_pipe ? opts->handler_ipc_pipe->path : NULL;
}

/**
* Sets the maximum number of spans that can be attached to a
* transaction.
Expand Down
5 changes: 5 additions & 0 deletions src/sentry_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ typedef struct sentry_options_s {
struct sentry_backend_s *backend;
sentry_session_t *session;

#ifdef SENTRY_PLATFORM_WINDOWS
/* Filled out after crashpad startup, only on Windows */
sentry_path_t* handler_ipc_pipe;
#endif

long user_consent;
long refcount;
uint64_t shutdown_timeout;
Expand Down
Loading