Make fixes and improvements

- Document more compiler flags
- Expose new __print_maps() api
- Better overflow checking in mmap()
- Improve the shell example somewhat
- Fix minor runtime bugs regarding stacks
- Make kill() on fork()+execve()'d children work
- Support CLONE_CHILD_CLEARTID for proper joining
- Fix recent possible deadlock regression with --ftrace
This commit is contained in:
Justine Tunney 2022-05-19 16:57:49 -07:00
parent 6e52cba37a
commit ec2cb88058
68 changed files with 1211 additions and 431 deletions

View file

@ -35,6 +35,7 @@
#include "libc/nexgen32e/stackframe.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/pc.internal.h"
#include "libc/runtime/runtime.h"
/**
* @fileoverview Abnormal termination handling & GUI debugging.
@ -57,7 +58,6 @@ static const char kCpuFlags[12] forcealign(1) = "CVPRAKZSTIDO";
static const char kFpuExceptions[6] forcealign(1) = "IDZOUP";
int kCrashSigs[7];
struct sigaction g_oldcrashacts[7];
relegated static void ShowFunctionCalls(ucontext_t *ctx) {
struct StackFrame *bp;
@ -220,7 +220,7 @@ relegated void ShowCrashReport(int err, int sig, struct siginfo *si,
ShowSseRegisters(ctx);
}
kprintf("\n");
PrintMemoryIntervals(2, &_mmi);
__print_maps();
/* PrintSystemMappings(2); */
if (__argv) {
for (i = 0; i < __argc; ++i) {
@ -232,16 +232,6 @@ relegated void ShowCrashReport(int err, int sig, struct siginfo *si,
kprintf("\n");
}
relegated static void RestoreDefaultCrashSignalHandlers(void) {
size_t i;
sigset_t ss;
sigemptyset(&ss);
sigprocmask(SIG_SETMASK, &ss, NULL);
for (i = 0; i < ARRAYLEN(kCrashSigs); ++i) {
if (kCrashSigs[i]) sigaction(kCrashSigs[i], &g_oldcrashacts[i], NULL);
}
}
static wontreturn relegated noinstrument void __minicrash(int sig,
struct siginfo *si,
ucontext_t *ctx,