Skip to content

Commit

Permalink
dumpview.lobster
Browse files Browse the repository at this point in the history
  • Loading branch information
aardappel committed Oct 5, 2023
1 parent 152c16a commit e5cc3dd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions samples/tools/dumpview.lobster
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)

0 comments on commit e5cc3dd

Please sign in to comment.