/*
* The source of test/support/fixtures/native/crash, the ELF the native
* symbolication tests upload with sentry-cli. Rebuild with:
*
* cc -g -O2 -fPIE -pie -fno-omit-frame-pointer -Wl,--build-id=sha1 \
* -ffile-prefix-map="$PWD"=/vigil \
* -o test/support/fixtures/native/crash test/support/fixtures/native/crash.c
*
* `scale` is always inlined into `compute`, so a lookup inside it comes
* back as two frames.
*/
#include <stdio.h>
#include <stdlib.h>
static inline __attribute__((always_inline)) int scale(volatile int *p, int by) {
return *p * by;
}
__attribute__((noinline)) int compute(volatile int *p, int by) {
int r = scale(p, by);
return r + 1;
}
__attribute__((noinline)) int run(int argc) {
volatile int *p = argc > 5 ? (int *)malloc(sizeof(int)) : NULL;
return compute(p, argc);
}
int main(int argc, char **argv) {
(void)argv;
printf("%d\n", run(argc));
return 0;
}
neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions queued · Badges · Packages
⭐
Log in to mark this repository.
939 B · text
History
573fef1