mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-25 12:00:31 +00:00
Get Cosmopolitan into releasable state
A new rollup tool now exists for flattening out the headers in a way that works better for our purposes than cpp. A lot of the API clutter has been removed. APIs that aren't a sure thing in terms of general recommendation are now marked internal. There's now a smoke test for the amalgamation archive and gigantic header file. So we can now guarantee you can use this project on the easiest difficulty setting without the gigantic repository. A website is being created, which is currently a work in progress: https://justine.storage.googleapis.com/cosmopolitan/index.html
This commit is contained in:
parent
dba7552c1e
commit
ea0b5d9d1c
775 changed files with 6864 additions and 3963 deletions
|
@ -1,12 +1,20 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_LOG_GDB_H_
|
||||
#define COSMOPOLITAN_LIBC_LOG_GDB_H_
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/runtime/missioncritical.h"
|
||||
#include "libc/calls/wait4.h"
|
||||
#include "libc/sysv/consts/nr.h"
|
||||
#include "libc/sysv/consts/w.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/**
|
||||
* @fileoverview GDB Attach Support Code.
|
||||
*
|
||||
* The goal of these macros is to make the backtrace into the failing
|
||||
* code as short as possible. It also helps avoid GDB getting confused
|
||||
* about how we don't use its readability destroying unwind directives.
|
||||
*/
|
||||
|
||||
extern volatile int g_gdbsync;
|
||||
|
||||
int gdbexec(const char *);
|
||||
|
@ -15,21 +23,37 @@ int attachdebugger(intptr_t);
|
|||
#define attachdebugger(CONTINUE_TO_ADDR) /* shorten backtraces */ \
|
||||
SYNCHRONIZE_DEBUGGER((attachdebugger)(CONTINUE_TO_ADDR))
|
||||
|
||||
#define SYNCHRONIZE_DEBUGGER(PID) \
|
||||
({ \
|
||||
int Rc, Pid = (PID); \
|
||||
if (Pid != -1) { \
|
||||
while ((Rc = WAIT4(Pid, NULL, WNOHANG, NULL)) == 0) { \
|
||||
if (g_gdbsync) { \
|
||||
g_gdbsync = 0; \
|
||||
if (Rc > 0) Pid = 0; \
|
||||
break; \
|
||||
} else { \
|
||||
SCHED_YIELD(); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
Pid; \
|
||||
#define SYNCHRONIZE_DEBUGGER(PID) \
|
||||
({ \
|
||||
int Rc, Pid = (PID); \
|
||||
if (Pid != -1) { \
|
||||
while ((Rc = __inline_wait4(Pid, NULL, WNOHANG, NULL)) == 0) { \
|
||||
if (g_gdbsync) { \
|
||||
g_gdbsync = 0; \
|
||||
if (Rc > 0) Pid = 0; \
|
||||
break; \
|
||||
} else { \
|
||||
sched_yield(); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
Pid; \
|
||||
})
|
||||
|
||||
#define __inline_wait4(PID, OPT_OUT_WSTATUS, OPTIONS, OPT_OUT_RUSAGE) \
|
||||
({ \
|
||||
int64_t WaAx; \
|
||||
if (!IsWindows()) { \
|
||||
register void *Reg10 asm("r10") = (OPT_OUT_RUSAGE); \
|
||||
asm volatile("syscall" \
|
||||
: "=a"(WaAx) \
|
||||
: "0"(__NR_wait4), "D"(PID), "S"(OPT_OUT_WSTATUS), \
|
||||
"d"(OPTIONS), "r"(Reg10) \
|
||||
: "rcx", "r11", "cc", "memory"); \
|
||||
} else { \
|
||||
WaAx = wait4$nt(PID, OPT_OUT_WSTATUS, OPTIONS, OPT_OUT_RUSAGE); \
|
||||
} \
|
||||
WaAx; \
|
||||
})
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue