Add frame pointer on "enable stacktrace". Set no-trapping-math. Update fmuladd.

This commit is contained in:
Christoffer Lerno
2023-09-06 14:03:14 +02:00
parent e3412da033
commit 50e99b571f
14 changed files with 106 additions and 31 deletions

View File

@@ -122,13 +122,25 @@ fn usz! Formatter.out_str(&self, any arg) @private
case SIGNED_INT:
case UNSIGNED_INT:
PrintFlags flags = self.flags;
defer self.flags = flags;
uint width = self.width;
defer
{
self.flags = flags;
self.width = width;
}
self.flags = {};
self.width = 0;
return self.ntoa_any(arg, 10);
case FLOAT:
PrintFlags flags = self.flags;
defer self.flags = flags;
uint width = self.width;
defer
{
self.flags = flags;
self.width = width;
}
self.flags = {};
self.width = 0;
return self.ftoa(float_from_any(arg)!!);
case BOOL:
return self.out_substr(*(bool*)arg.ptr ? "true" : "false");
@@ -170,14 +182,26 @@ fn usz! Formatter.out_str(&self, any arg) @private
return self.out_str(any { arg.ptr, arg.type.inner });
case POINTER:
PrintFlags flags = self.flags;
uint width = self.width;
defer
{
self.flags = flags;
self.width = width;
}
self.flags = {};
defer self.flags = flags;
self.width = 0;
return self.ntoa_any(arg, 16);
case ARRAY:
// this is SomeType[*] so grab the "SomeType"
PrintFlags flags = self.flags;
defer self.flags = flags;
uint width = self.width;
defer
{
self.flags = flags;
self.width = width;
}
self.flags = {};
self.width = 0;
typeid inner = arg.type.inner;
usz size = inner.sizeof;
usz alen = arg.type.len;
@@ -194,8 +218,14 @@ fn usz! Formatter.out_str(&self, any arg) @private
return len;
case VECTOR:
PrintFlags flags = self.flags;
defer self.flags = flags;
uint width = self.width;
defer
{
self.flags = flags;
self.width = width;
}
self.flags = {};
self.width = 0;
// this is SomeType[*] so grab the "SomeType"
typeid inner = arg.type.inner;
usz size = inner.sizeof;
@@ -220,8 +250,14 @@ fn usz! Formatter.out_str(&self, any arg) @private
}
if (inner == void.typeid) inner = char.typeid;
PrintFlags flags = self.flags;
defer self.flags = flags;
uint width = self.width;
defer
{
self.flags = flags;
self.width = width;
}
self.flags = {};
self.width = 0;
usz size = inner.sizeof;
// Pretend this is a String
String* temp = (void*)arg.ptr;

View File

@@ -1,3 +1,4 @@
module std::os::posix;
extern ZString* environ;
extern ZString* environ;

View File

@@ -37,7 +37,9 @@ def spawn = posix_spawn;
extern fn CInt kill(Pid_t pid, CInt sig);
extern fn Pid_t waitpid(Pid_t pid, CInt* stat_loc, int options);
extern fn CInt raise(CInt sig);
extern fn CInt backtrace(void **buffer, CInt size);
extern fn ZString* backtrace_symbols(void** buffer, CInt size);
extern fn void backtrace_symbols_fd(void** buffer, CInt size, CInt fd);
macro CInt wEXITSTATUS(CInt status) => (status & 0xff00) >> 8;
macro CInt wTERMSIG(CInt status) => status & 0x7f;
macro CInt wSTOPSIG(CInt status) => wEXITSTATUS(status);
@@ -52,3 +54,4 @@ const CInt __WCOREFLAG = 0x80;
const CInt __W_CONTINUED = 0xffff;
const CInt WNOHANG = 1;
const CInt WUNTRACES = 2;