mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
Cleanup printing of call history
This commit is contained in:
parent
36252090d3
commit
7c8823f333
2 changed files with 9 additions and 4 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
Features
|
Features
|
||||||
- Added definitions from SRFI 162 (comparators sublibrary) to the `(srfi 128)` library.
|
- Added definitions from SRFI 162 (comparators sublibrary) to the `(srfi 128)` library.
|
||||||
|
- Cleaned up printing of call history to make it more obvious which functions were called most recently.
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
|
|
||||||
|
|
12
runtime.c
12
runtime.c
|
@ -406,12 +406,16 @@ void Cyc_st_print(void *data, FILE * out)
|
||||||
not be an issue in practice? a bit risky to ignore though
|
not be an issue in practice? a bit risky to ignore though
|
||||||
*/
|
*/
|
||||||
gc_thread_data *thd = (gc_thread_data *) data;
|
gc_thread_data *thd = (gc_thread_data *) data;
|
||||||
int i = (thd->stack_trace_idx + 1) % MAX_STACK_TRACES;
|
int n = 1;
|
||||||
|
int i = (thd->stack_trace_idx - 1);
|
||||||
|
if (i < 0) { i = MAX_STACK_TRACES - 1; }
|
||||||
|
|
||||||
while (i != thd->stack_trace_idx) {
|
while (i != thd->stack_trace_idx) {
|
||||||
if (thd->stack_traces[i]) {
|
if (thd->stack_traces[i]) {
|
||||||
fprintf(out, "%s\n", thd->stack_traces[i]);
|
fprintf(out, "[%d] %s\n", n++, thd->stack_traces[i]);
|
||||||
}
|
}
|
||||||
i = (i + 1) % MAX_STACK_TRACES;
|
i = (i - 1);
|
||||||
|
if (i < 0) { i = MAX_STACK_TRACES - 1; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,7 +682,7 @@ object Cyc_default_exception_handler(void *data, int argc, closure _,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "\nCall history:\n");
|
fprintf(stderr, "\nCall history, most recent first:\n");
|
||||||
Cyc_st_print(data, stderr);
|
Cyc_st_print(data, stderr);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
//raise(SIGINT); // break into debugger, unix only
|
//raise(SIGINT); // break into debugger, unix only
|
||||||
|
|
Loading…
Add table
Reference in a new issue