Add malloc logging tool

STATIC_YOINK("enable_memory_log");
This commit is contained in:
Justine Tunney 2022-05-26 23:17:19 -07:00
parent 7e9fb0a9f1
commit cb67223051
25 changed files with 502 additions and 78 deletions

View file

@ -19,6 +19,7 @@
#include "libc/calls/strace.internal.h"
#include "libc/dce.h"
#include "libc/intrin/setjmp.internal.h"
#include "libc/nexgen32e/threaded.h"
#include "libc/nt/thread.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/nr.h"
@ -32,8 +33,13 @@
* @noreturn
*/
privileged wontreturn void _Exit1(int rc) {
jmp_buf *jb;
struct WinThread *wt;
STRACE("_Exit1(%d)", rc);
if (__tls_enabled) {
jb = (jmp_buf *)(__get_tls() + 0x08);
longjmp(*jb, rc);
}
if (!IsWindows() && !IsMetal()) {
asm volatile("xor\t%%r10d,%%r10d\n\t"
"syscall"