geode icon indicating copy to clipboard operation
geode copied to clipboard

crashlog: add method names from bindings

Open Prevter opened this issue 1 year ago • 4 comments

Adds a basic system to read a "GeometryDash.bro" file (currently has to be placed manually into Geometry Dash/geode directory) and get function names from it to include them in the stacktrace. This change makes crashlog look like this: image

Unknown methods are also easier to find, because it prints the address where the method starts, instead of only the instruction address.

Some comments/questions:

  • What would be the best way to implement auto download of the bindings file (at which stage to do it, and where to actually save it)?
  • Maybe provide a toggleable option inside mod configuration to redownload bindings file automatically on every launch/crash?

Waiting for your feedback :)

Prevter avatar Mar 14 '24 00:03 Prevter

This is a pretty cool addition, very impressive! Although, I'm not sure if this is a good approach to implementing it: This requires us to ship the Broma binding with the loader, along with being kind of hacky about parsing it (we already have the broma parser library included in the source tree!) I think the appropriate way to go about implementing this would be for the codegen library to emit some sort of address-to-symbol table so you can just lookup an address directly instead. This would mean no extra code units shipped (it's just included in the loader DLL) and automatically handles platform issues (just use the parsed broma to emit only the correct bindings for the respective platform).

poweredbypie avatar Mar 14 '24 03:03 poweredbypie

Thanks for your feedback, I will try to implement your proposals.

I'm not sure if this is a good approach to implementing it

I agree, because I'm not familiar with internal structure of the project. That's why I wanted to hear some thoughts.

we already have the broma parser library included in the source tree

Didn't know about that, will check it. 😆

I think the appropriate way to go about implementing this would be for the codegen library to emit some sort of address-to-symbol table so you can just lookup an address directly instead

Yeah, this actually sounds like a more clean solution. The only downside is probably that bindings file would only be updated alongside loader updates, but I guess that it doesn't need to always have most up-to-date bindings to begin with. Also I don't think it would apply to anything other than Windows because of how bindings work on other platforms (maybe it might work on macOS, but I can't be sure).

Prevter avatar Mar 14 '24 11:03 Prevter

codegen generates a CodegenData.txt file, i think this can be embbeded instead

altalk23 avatar Apr 11 '24 17:04 altalk23

Figured out how to embed CodegenData.txt into the binary (codegen for codegen :0), so now it works without having to store the broma file locally.
CMake codegen function haven't increased configuration time at all for me, but crashlog.cpp may build for a few seconds longer now (i think this change is worth it in the long run).

Prevter avatar Apr 17 '24 14:04 Prevter