https://github.com/eldesh/sml_stacktrace
stack trace demo for SML/NJ
https://github.com/eldesh/sml_stacktrace
Last synced: 9 months ago
JSON representation
stack trace demo for SML/NJ
- Host: GitHub
- URL: https://github.com/eldesh/sml_stacktrace
- Owner: eldesh
- Created: 2014-11-28T00:53:06.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-28T00:53:47.000Z (about 11 years ago)
- Last Synced: 2025-01-26T20:47:08.186Z (11 months ago)
- Language: Standard ML
- Size: 97.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# SML/NJ stack trace Demo
A sample program using backtrace feature of SML/NJ.
## Running Demo
For running demo project, just call test.sh .
```sh
$ ./test.sh
```
You would get back trace log like below:
..(snip)..
[TEST] run sample program...
..(snip)..
*** BACK-TRACE ***
GOTO stacktrace.sml:7.7-7.42: StackTrace.error[2]
(from: stacktrace.sml:8.18-8.26: StackTrace.wrap1[2])
GOTO stacktrace.sml:8.7-8.26: StackTrace.wrap1[2]
(from: stacktrace.sml:9.18-9.26: StackTrace.wrap2[2])
GOTO stacktrace.sml:9.7-9.26: StackTrace.wrap2[2]
(from: stacktrace.sml:10.18-10.26: StackTrace.wrap3[2])
..(snip)..
[TEST] done.
## Step to backtracing your project
For detailed backtraces,
1. use the BackTrace module.
```sml
fun main (name, args) =
BackTrace.monitor(fn () => main'(name, args))
```
2. add reference to BackTrace module ($smlnj-tdp/plugins.cm) to your CM file
```
group is
..
$smlnj-tdp/plugins.cm
..
```
3. build your project with some special arguments
```sh
$ ml-build -Ctdp.instrument=true \$smlnj-tdp/back-trace.cm stacktrace.cm StackTrace.main stacktrace
```
In general form,
```sh
$ ml-build -Ctdp.instrument=true \$smlnj-tdp/back-trace.cm
```
4. execute your program using generated heapfile
```sh
$ sml @SMLload= [any options...]
```
--------------------------------
For more details, see [whither stack traces?](http://sourceforge.net/p/smlnj/mailman/message/1408396/ "mainling list archive of SML/NJ project").