Print call stack if an error occurs in a user-defined function.

This commit is contained in:
Dianne Skoll
2022-03-25 14:03:06 -04:00
parent 10f5802069
commit df9ef6e13a
6 changed files with 35 additions and 8 deletions
+10 -1
View File
@@ -237,9 +237,18 @@ print_callstack(FILE *fp)
int done = 0;
cs *entry = callstack;
while(entry) {
(void) fprintf(fp, "%s(%d): %s\n", entry->filename, entry->lineno, entry->func);
(void) fprintf(fp, "%s(%d): In function `%s'\n", entry->filename, entry->lineno, entry->func);
done = 1;
entry = entry->next;
}
return done;
}
void
pop_call(void)
{
cs *entry = callstack;
if (entry) {
callstack = entry->next;
destroy_cs(entry);
}
}