troubleshotting the backtrace code

This commit is contained in:
2025-09-06 01:32:41 +09:00
parent d8113efc28
commit 36a10b382c
3 changed files with 28 additions and 25 deletions

View File

@ -2414,7 +2414,8 @@ static HAK_INLINE int do_throw (hak_t* hak, hak_oop_t val, hak_ooi_t ip)
/* output backtrace */ /* output backtrace */
HAK_LOG0(hak, HAK_LOG_IC | HAK_LOG_INFO, "[BACKTRACE]\n"); HAK_LOG0(hak, HAK_LOG_IC | HAK_LOG_INFO, "[BACKTRACE]\n");
c = hak->active_context; c = hak->active_context;
while ((hak_oop_t)c != hak->_nil) { while ((hak_oop_t)c != hak->_nil)
{
f = c->base; f = c->base;
if (f->dbgi != hak->_nil) if (f->dbgi != hak->_nil)
{ {
@ -2425,7 +2426,8 @@ static HAK_INLINE int do_throw (hak_t* hak, hak_oop_t val, hak_ooi_t ip)
hak_loc_t loc; hak_loc_t loc;
hak_ooi_t cip; hak_ooi_t cip;
cip = HAK_OOP_TO_SMOOI(c->ip); /* use the given ip for the active context instead of the value from the ip field */
cip = (c == hak->active_context)? ip: HAK_OOP_TO_SMOOI(c->ip);
dbgi = (hak_dbgi_t*)HAK_OBJ_GET_BYTE_SLOT(f->dbgi); dbgi = (hak_dbgi_t*)HAK_OBJ_GET_BYTE_SLOT(f->dbgi);
HAK_MEMSET(&loc, 0, HAK_SIZEOF(loc)); HAK_MEMSET(&loc, 0, HAK_SIZEOF(loc));
loc.file = dbgi[cip].fname; loc.file = dbgi[cip].fname;

View File

@ -166,14 +166,15 @@ printf "%O\n" (k:basicAt 20)
} }
} }
try { ##try {
printf ">>>>>>>>>>>>>>>\n"
(Q:k) (Q:k)
} catch (e) { ##} catch (e) {
printf "EXCEPTION: %O\n" e printf "EXCEPTION: %O\n" e
try { ## try {
throw 10000 throw 10000
} catch (e) { ## } catch (e) {
printf "EXCEPTION-X: %O\n" e ## printf "EXCEPTION-X: %O\n" e
} ## }
} ##}