mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-30 06:20:28 +00:00
Pay off more technical debt
This makes breaking changes to add underscores to many non-standard
function names provided by the c library. MODE=tiny is now tinier and
we now use smaller locks that are better for tiny apps in this mode.
Some headers have been renamed to be in the same folder as the build
package, so it'll be easier to know which build dependency is needed.
Certain old misguided interfaces have been removed. Intel intrinsics
headers are now listed in libc/isystem (but not in the amalgamation)
to help further improve open source compatibility. Header complexity
has also been reduced. Lastly, more shell scripts are now available.
Compared to 6f7d0cb1c3
, some tiny corrections were made in libc/intrin/g_fds.c and libc/zipos/open.c including double semi colons and incorrect indentation for existing vista changes that were manually pulled from this commit previously.
This commit is contained in:
parent
555260d2e5
commit
7b26b42769
959 changed files with 4065 additions and 4868 deletions
|
@ -25,19 +25,19 @@
|
|||
#include "libc/limits.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/mem/io.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/calls/copyfd.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/symbols.internal.h"
|
||||
#include "libc/stdio/append.internal.h"
|
||||
#include "libc/stdio/append.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "net/http/escape.h"
|
||||
|
||||
STATIC_YOINK("backtrace.com");
|
||||
|
@ -119,14 +119,14 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
|
|||
EXPECT_EQ(78, WEXITSTATUS(ws));
|
||||
if (!strstr(output, "UNFREED MEMORY")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't report leak\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (IsAsan()) {
|
||||
if (!OutputHasSymbol(output, "strdup") ||
|
||||
!OutputHasSymbol(output, "MemoryLeakCrash")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't backtrace allocation\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ TEST(ShowCrashReports, testStackOverrunCrash) {
|
|||
/* NULL is stopgap until we can copy symbol tablces into binary */
|
||||
if (!OutputHasSymbol(output, "StackOverrunCrash")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have backtrace\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (strstr(output, "'int' index 10 into 'char [10]' out of bounds")) {
|
||||
|
@ -206,12 +206,12 @@ TEST(ShowCrashReports, testStackOverrunCrash) {
|
|||
// asan nailed it
|
||||
if (!strstr(output, "☺☻♥♦♣♠•◘○")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have memory diagram\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (!strstr(output, "stack overrun")) {
|
||||
fprintf(stderr, "ERROR: crash report misclassified stack overrun\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ TEST(ShowCrashReports, testDivideByZero) {
|
|||
#ifdef __FNO_OMIT_FRAME_POINTER__
|
||||
if (!OutputHasSymbol(output, "FpuCrash")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have backtrace\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
#endif
|
||||
|
@ -314,29 +314,29 @@ TEST(ShowCrashReports, testDivideByZero) {
|
|||
// UBSAN handled it
|
||||
} else {
|
||||
// ShowCrashReports() handled it
|
||||
if (!strstr(output, gc(xasprintf("%d", pid)))) {
|
||||
if (!strstr(output, _gc(xasprintf("%d", pid)))) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have pid\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (!strstr(output, "SIGFPE")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have signal name\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (!strstr(output, "3.141")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have fpu register\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (!strstr(output, "0f0e0d0c0b0a09080706050403020100")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have sse register\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (!strstr(output, "3133731337")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have general register\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
}
|
||||
|
@ -384,31 +384,31 @@ TEST(ShowCrashReports, testStackOverflow) {
|
|||
#ifdef __FNO_OMIT_FRAME_POINTER__
|
||||
if (!OutputHasSymbol(output, "StackOverflow")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have backtrace\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
#endif
|
||||
// ShowCrashReports() handled it
|
||||
if (!strstr(output, gc(xasprintf("%d", pid)))) {
|
||||
if (!strstr(output, _gc(xasprintf("%d", pid)))) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have pid\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (!strstr(output, "SIGSEGV")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have signal name\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
if (!IsTiny()) {
|
||||
if (!strstr(output, "Stack Overflow")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have 'Stack Overflow'\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
} else {
|
||||
if (!strstr(output, "SEGV_MAPERR")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have 'SEGV_MAPERR'\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
}
|
||||
|
@ -499,14 +499,14 @@ TEST(ShowCrashReports, testBssOverrunCrash) {
|
|||
#ifdef __FNO_OMIT_FRAME_POINTER__
|
||||
if (!OutputHasSymbol(output, "BssOverrunCrash")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have backtrace\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
#endif
|
||||
if (!strstr(output, "'int' index 10 into 'char [10]' out of bounds") &&
|
||||
(!strstr(output, "☺☻♥♦♣♠•◘○") || !strstr(output, "global redzone"))) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have memory diagram\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
free(output);
|
||||
|
@ -576,13 +576,13 @@ TEST(ShowCrashReports, testNpeCrash) {
|
|||
/* NULL is stopgap until we can copy symbol tables into binary */
|
||||
if (!strstr(output, "null pointer")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't diagnose the problem\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
#ifdef __FNO_OMIT_FRAME_POINTER__
|
||||
if (!OutputHasSymbol(output, "NpeCrash")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have backtrace\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
#endif
|
||||
|
@ -592,7 +592,7 @@ TEST(ShowCrashReports, testNpeCrash) {
|
|||
// asan nailed it
|
||||
if (!strstr(output, "∅∅∅∅")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have shadow diagram\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
}
|
||||
|
@ -636,14 +636,14 @@ TEST(ShowCrashReports, testDataOverrunCrash) {
|
|||
#ifdef __FNO_OMIT_FRAME_POINTER__
|
||||
if (!OutputHasSymbol(output, "DataOverrunCrash")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have backtrace\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
#endif
|
||||
if (!strstr(output, "'int' index 10 into 'char [10]' out of bounds") &&
|
||||
(!strstr(output, "☺☻♥♦♣♠•◘○") || !strstr(output, "global redzone"))) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have memory diagram\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
free(output);
|
||||
|
@ -690,13 +690,13 @@ TEST(ShowCrashReports, testNpeCrashAfterFinalize) {
|
|||
/* NULL is stopgap until we can copy symbol tables into binary */
|
||||
if (!strstr(output, IsAsan() ? "null pointer" : "Uncaught SIGSEGV (SEGV_")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't diagnose the problem\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
#ifdef __FNO_OMIT_FRAME_POINTER__
|
||||
if (!OutputHasSymbol(output, "NpeCrash")) {
|
||||
fprintf(stderr, "ERROR: crash report didn't have backtrace\n%s\n",
|
||||
gc(IndentLines(output, -1, 0, 4)));
|
||||
_gc(IndentLines(output, -1, 0, 4)));
|
||||
__die();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue