File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -558,6 +558,12 @@ void Debugger::dumpFunctions(Module *m) const {
558558void Debugger::dumpCallstack (Module *m) const {
559559 auto toVA = [m](uint8_t *addr) { return toVirtualAddress (addr, m); };
560560 this ->channel ->write (" \" callstack\" :[" );
561+
562+ if (m->csp < 0 ) {
563+ this ->channel ->write (" ]" );
564+ return ;
565+ }
566+
561567 for (int i = 0 ; i <= m->csp ; i++) {
562568 const Frame *f = &m->callstack [i];
563569 int callsite_retaddr = -1 ;
@@ -582,6 +588,12 @@ void Debugger::dumpCallstack(Module *m) const {
582588void Debugger::dumpLocals (const Module *m) const {
583589 // fflush(stdout);
584590 int firstFunFramePtr = m->csp ;
591+
592+ if (firstFunFramePtr < 0 ) {
593+ this ->channel ->write (" []" );
594+ return ;
595+ }
596+
585597 while (m->callstack [firstFunFramePtr].block ->block_type != 0 ) {
586598 firstFunFramePtr--;
587599 if (firstFunFramePtr < 0 ) {
You can’t perform that action at this time.
0 commit comments