Cycling74 / min-devkit

Tools, documentation, and reference implementation of a Max Package built using the Min-API.
MIT License
163 stars 31 forks source link

request for better debug support, see API on call stack, perhaps PDB files for Windows #91

Closed diablodale closed 5 years ago

diablodale commented 7 years ago

My request is better debug support from the core Max api to enable API call tracing in debuggers. Specifically, to be able to see the cascade of API calls on the call stack.

One approach on the Windows platform might be to distribute PDB or stripped-PDB files with the libraries. Windows SDKs themselves have long done this. Yes, you support different platforms/compilers/debuggers. Easy-breezy. Automate the build with CI and it will deliver to you debug things for every box in your supported matrix. Distribution tools like NuGet are ready to manage such debug files. With the manual library install method, provide the debug files in separate labeled directories alongside the .lib's and doc it.

Attached is a screenshot of an exception I recently had. Nothing useful on the call stack. Nothing useful in the debug output. The only thing I had to go on was VS itself told me the exception type (access violation) and that it was trying to read 0x0032. That suggested to me the error was related to an offset of 32 rather than something reading 32 directly. I had little idea the sequence of events before the exception. No UI was rendered yet. I didn't know if I made a call that led to this or if this was in Max's code.

I isolated the problem with what you might describe as a binary-search-with-text-debug-output-markers. The bug was mine; how I had created my class hierarchy and how that interacted with the C++ runtime and Max. Much time/effort would have been saved if I saw in the call stack:

Helpful 😊 class_new() or object_alloc() or max_jit_obex_new() Not helpful 😕Max.exe!0000000001406ed859()

crash

tap commented 7 years ago

@robsussman any thoughts?

tap commented 5 years ago

Max symbols being unavailable is a topic related to Max itself rather than the Min API for accessing Max. Problems in this domain are best directed to support@cycling74.com.