Skip to content

Commit

Permalink
add capture_minidump_n
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Oct 31, 2024
1 parent 0f1c8b6 commit 67bd3af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,8 @@ SENTRY_API sentry_uuid_t sentry_capture_event(sentry_value_t event);
*/
SENTRY_API void sentry_capture_minidump(
const char *dump_path, sentry_value_t event, int remove_dump_on_send);
SENTRY_API void sentry_capture_minidump_n(const char *dump_path,
size_t dump_path_len, sentry_value_t event, int remove_dump_on_send);

/**
* Captures an exception to be handled by the backend.
Expand Down
16 changes: 12 additions & 4 deletions src/sentry_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ sentry__prepare_event(const sentry_options_t *options, sentry_value_t event,

SENTRY_TRACE("adding attachments to envelope");
for (sentry_attachment_t *attachment = options->attachments; attachment;
attachment = attachment->next) {
attachment = attachment->next) {
sentry_envelope_item_t *item = sentry__envelope_add_from_path(
envelope, attachment->path, "attachment");
if (!item) {
Expand Down Expand Up @@ -1178,13 +1178,21 @@ sentry_clear_crashed_last_run(void)
void
sentry_capture_minidump(
const char *dump_path, sentry_value_t event, int remove_dump_on_send)
{
sentry_capture_minidump_n(dump_path, sentry__guarded_strlen(dump_path),
event, remove_dump_on_send);
}

void
sentry_capture_minidump_n(const char *dump_path, size_t dump_path_len,
sentry_value_t event, int remove_dump_on_send)
{
sentry_path_t *sentry_dump_path
= sentry__path_from_str_n(dump_path, strlen(dump_path));
= sentry__path_from_str_n(dump_path, dump_path_len);

if (sentry_dump_path == NULL) {
SENTRY_WARN(
"'sentry_capture_minidump' Failed due to null path to minidump");
"sentry_capture_minidump() failed due to null path to minidump");
return;
}

Expand All @@ -1200,7 +1208,7 @@ sentry_capture_minidump(

SENTRY_TRACE("adding attachments to envelope");
for (sentry_attachment_t *attachment = options->attachments; attachment;
attachment = attachment->next) {
attachment = attachment->next) {
sentry_envelope_item_t *item = sentry__envelope_add_from_path(
envelope, attachment->path, "attachment");
if (!item) {
Expand Down

0 comments on commit 67bd3af

Please sign in to comment.