2020-06-15 07:18:57 -07:00
|
|
|
#if 0
|
|
|
|
/*─────────────────────────────────────────────────────────────────╗
|
|
|
|
│ To the extent possible under law, Justine Tunney has waived │
|
|
|
|
│ all copyright and related or neighboring rights to this file, │
|
|
|
|
│ as it is written in the following disclaimers: │
|
|
|
|
│ • http://unlicense.org/ │
|
|
|
|
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
|
|
|
╚─────────────────────────────────────────────────────────────────*/
|
|
|
|
#endif
|
2022-10-17 11:02:04 -07:00
|
|
|
#include "libc/intrin/kprintf.h"
|
2023-06-04 08:19:45 -07:00
|
|
|
#include "libc/math.h"
|
2023-06-09 18:02:06 -07:00
|
|
|
#include "libc/runtime/runtime.h"
|
2022-05-16 13:20:08 -07:00
|
|
|
#include "libc/runtime/symbols.internal.h"
|
2020-06-15 07:18:57 -07:00
|
|
|
|
|
|
|
/**
|
2021-03-05 06:09:12 -08:00
|
|
|
* @fileoverview How to print backtraces and cpu state on crash.
|
2020-06-15 07:18:57 -07:00
|
|
|
*
|
2021-03-05 06:09:12 -08:00
|
|
|
* make -j8 -O o//examples/crashreport.com
|
|
|
|
* o//examples/crashreport.com
|
2020-06-15 07:18:57 -07:00
|
|
|
*
|
|
|
|
* To prevent the GDB GUI from popping up:
|
|
|
|
*
|
2021-03-05 06:09:12 -08:00
|
|
|
* export GDB=
|
|
|
|
* make -j8 -O o//examples/crashreport.com
|
|
|
|
* o//examples/crashreport.com
|
2020-06-15 07:18:57 -07:00
|
|
|
*/
|
|
|
|
|
2022-05-12 06:43:59 -07:00
|
|
|
noubsan int main(int argc, char *argv[]) {
|
2022-10-17 11:02:04 -07:00
|
|
|
kprintf("----------------\n");
|
|
|
|
kprintf(" THIS IS A TEST \n");
|
|
|
|
kprintf("SIMULATING CRASH\n");
|
|
|
|
kprintf("----------------\n");
|
|
|
|
|
2022-03-21 03:46:16 -07:00
|
|
|
ShowCrashReports();
|
2023-06-04 08:19:45 -07:00
|
|
|
|
|
|
|
volatile double a = 0;
|
|
|
|
volatile double b = 23;
|
|
|
|
volatile double c = exp(b) / a;
|
|
|
|
|
|
|
|
volatile int64_t x;
|
2021-03-05 06:09:12 -08:00
|
|
|
return 1 / (x = 0);
|
2020-06-15 07:18:57 -07:00
|
|
|
}
|