-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
This tool allows you to view the contents of memory dump files generated by Lobster's | ||
--runtime-memory-dump mode. | ||
This is very useful to be able to debug crashes that may happen on a client's machine. | ||
Make sure they run with the above flag, then when it crashes, have them send you the | ||
.flex file it writes, and load up that file with this program, that allows you to | ||
browse the full program state from a stack trace! | ||
|
||
Example: | ||
bin/lobster.exe --runtime-memory-dump my_buggy_program_that_asserts.lobster | ||
bin/lobster.exe samples/tools/dumpview.lobster -- crash_stack_trace_memory_dump_2023-10-04-12-16-50.flex | ||
|
||
*/ | ||
|
||
import vec | ||
import color | ||
import gl | ||
import imgui | ||
import gl | ||
|
||
let args = command_line_arguments() | ||
if args.length != 1: | ||
fatal("dumpview: expecting exactly 1 argument, the dump file name.") | ||
|
||
let fb = read_file(args[0]) | ||
if not fb: | ||
fatal("dumpview: can\'t read file: " + args[0]) | ||
assert fb | ||
|
||
fatal(gl.window("Crash dump viewer", 640, 1024)) | ||
|
||
im.init(false, im.config_docking_enable, 3.0) | ||
assert im.add_font("data/fonts/Droid_Sans/DroidSans.ttf", 20.0) | ||
|
||
while gl.frame(): | ||
gl.clear(color_grey) | ||
im.frame(): | ||
im.next_window_pos(float2_0, float2_0) | ||
im.next_window_size(float(gl.window_size())) | ||
im.window_dock("Crash dump viewer", im.window_no_collapse | im.window_no_titlebar | | ||
im.window_no_resize | im.window_no_move): | ||
im.show_flexbuffer(fb) |