Overhaul process spawning

This commit is contained in:
Justine Tunney 2023-09-10 08:12:43 -07:00
parent 99dc1281f5
commit 26e254fb4d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
96 changed files with 1848 additions and 1541 deletions

View file

@ -18,22 +18,30 @@
*/
#include "libc/intrin/describebacktrace.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h"
#include "libc/nexgen32e/stackframe.h"
#define N 64
#define N 100
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *(DescribeBacktrace)(char buf[N], struct StackFrame *fr) {
int o = 0;
dontinstrument dontasan const char *(DescribeBacktrace)(char buf[N],
struct StackFrame *fr) {
bool gotsome = false;
char *p = buf;
char *pe = p + N;
while (fr) {
if (gotsome) {
append(" ");
if (p + 1 < pe) {
*p++ = ' ';
*p = 0;
}
} else {
gotsome = true;
}
append("%x", fr->addr);
if (p + 17 <= pe) {
p = __hexcpy(p, fr->addr);
}
fr = fr->next;
}
return buf;