Fix to backtrace

This commit is contained in:
Christoffer Lerno
2023-11-20 12:39:20 +01:00
parent 337eac6d2f
commit 31538d5955
2 changed files with 5 additions and 3 deletions

View File

@@ -55,13 +55,15 @@ const CInt __W_CONTINUED = 0xffff;
const CInt WNOHANG = 1;
const CInt WUNTRACES = 2;
fn CInt backtrace(void** buffer, CInt size) @weak @extern("backtrace")
fn CInt backtrace(void** buffer, CInt size) @extern("backtrace") @weak
{
if (size < 1) return 0;
void*[128] buffer_first;
CInt i;
for (i = 0; (uptr)builtin::get_frameaddress(i + 1) > 1 && i < size; i++)
for (i = 0; i < size; i++)
{
uptr frame = (uptr)builtin::get_frameaddress(i + 1);
if (!frame || frame & 0x1) break;
buffer[i] = builtin::get_returnaddress(i);
if (!buffer[i]) break;
}

View File

@@ -1 +1 @@
#define COMPILER_VERSION "0.4.708"
#define COMPILER_VERSION "0.4.709"