Skip to content

Commit 4094b64

Browse files
committed
Move runtime stack collection stuff to own file
1 parent 762cc91 commit 4094b64

File tree

4 files changed

+356
-332
lines changed

4 files changed

+356
-332
lines changed

runtime_stacks_quick_test.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,40 @@
77
3. Triggers a crash to test stack capture
88
"""
99

10+
import ctypes
1011
import os
1112
import sys
12-
import signal
1313
import time
14-
import ctypes
14+
1515

1616
def nested_function_3():
1717
"""Deepest function that will trigger a crash"""
1818
print("In nested_function_3 - about to crash!")
1919
# Trigger a segmentation fault
2020
ctypes.string_at(0)
2121

22+
2223
def nested_function_2():
2324
"""Middle function"""
2425
print("In nested_function_2")
2526
nested_function_3()
2627

28+
2729
def nested_function_1():
2830
"""Top-level function"""
2931
print("In nested_function_1")
3032
nested_function_2()
3133

34+
3235
def main():
3336
print("Setting up crashtracker test...")
3437

3538
# Enable crashtracking with runtime stacks
36-
os.environ['DD_CRASHTRACKING_ENABLED'] = 'true'
37-
os.environ['DD_CRASHTRACKING_EMIT_RUNTIME_STACKS'] = 'true'
39+
os.environ["DD_CRASHTRACKING_ENABLED"] = "true"
40+
os.environ["DD_CRASHTRACKING_EMIT_RUNTIME_STACKS"] = "true"
3841

3942
# Import and initialize crashtracker
4043
try:
41-
import ddtrace
4244
from ddtrace.internal.core import crashtracking
4345

4446
# Start crashtracking
@@ -71,5 +73,6 @@ def main():
7173
print("ERROR: Should have crashed by now!")
7274
return 1
7375

76+
7477
if __name__ == "__main__":
7578
sys.exit(main())

0 commit comments

Comments
 (0)