Segmentation fault debugging

Print the context stack on crash by storing it to a file:

```
$ python -m logstack myscript.py
Program terminated abruptly (segmentation fault)
Last known stack:
  File "test.py", line 32, in <module>
    foo()
  File "test.py", line 29, in foo
  (in_foo=True)
  (out_of_bar=True)
    baz()
  File "test.py", line 23, in baz
  (in_baz=True)
```