I’m trying to debug some code that crashes Julia (yet, ironically, works perfectly fine in the debugger!). My problem is that it crashes the REPL, so I can’t see what’s going on. I went so far as to use QuickTime player to make a screen recording so that I could slow down the movie of the REPL before it crashed…
So I got the idea of writing some log functions to write information to disk so that I could inspect it post-crash. That’s when I stumbled across some problems.
For example, for the life of me, I can not figure out how to:
(1) Save a variable’s type as string. typeof()
returns a variables type, and I have not figured out how to typecast it as a string.
(2) Save a pointer’s address.
This is what I have tried:
logOut(logFile, String(typeof(surfaceStructPtr)) )
logOut(logFile, String(pointer(surfaceStructPtr)) )
And this is my extremely simple logging function:
function logOut(logFile, message)
dt = now()
dtString = Dates.format(dt, "yyyy-mm-dd HH:MM:SS")
message = dtString * ": " * message
write(logFile,message)
flush(logFile)
println(message)
end
P.S. I also tried to find a way to stream the REPL to disk, but none of the suggestions worked.