libriscv / godot-sandbox

Sandboxing that enables safe modding for Godot games
BSD 3-Clause "New" or "Revised" License
89 stars 7 forks source link

Use addr2line for exceptions #63

Closed fwsGonzo closed 4 days ago

fwsGonzo commented 3 weeks ago

We have access to RISC-V addr2line from the docker containers, and using that we should be able to produce code lines from the call stack of an exception

fire commented 1 week ago

Can you sketch a design?

fwsGonzo commented 1 week ago

Sketched here: https://github.com/libriscv/godot-sandbox/blob/main/src/sandbox.cpp#L354-L361

fire commented 1 week ago

Closing as complete?

fwsGonzo commented 1 week ago

No, it needs integration for people without addr2line installed on their system. It doesn't use docker either, atm.

fire commented 1 week ago

https://packages.msys2.org/package/mingw-w64-x86_64-binutils addr2line exists here.

I'm sure we can easily get it for other operating systems.

See also https://github.com/godotengine/buildroot/releases/tag/godot-2023.08.x-4

fwsGonzo commented 1 week ago

It's even more specific: It's the riscv64-linux-gnu-addr2line version. That said, maybe clang has a version that is more architecture independent? Or perhaps there's an open source utility that just does it without needing a custom version. Definitely worth investigating.

I think for now, we should just try to reach the docker version.

fire commented 1 week ago

Like https://llvm.org/docs/CommandGuide/llvm-addr2line.html ?

fire commented 1 week ago

https://llvm.org/docs/CommandGuide/llvm-symbolizer.html

--default-arch ?

fire commented 1 week ago

See /clang64/bin/riscv64-unknown-elf-addr2line.exe

https://packages.msys2.org/package/mingw-w64-clang-x86_64-riscv64-unknown-elf-binutils?repo=clang64

fwsGonzo commented 1 week ago

That might work yes

fwsGonzo commented 5 days ago

Note to self: We can know the language of the ELF now, due to versioning. That said, we really only need one container with the --addr parameter to build.sh. It might be possible to always use the CPP container for addr2line, in which case we can consider this solved.

fwsGonzo commented 4 days ago

Implementation here: https://github.com/libriscv/godot-sandbox/commit/3495bae456352c2cb6ff8f57ba22d8b5d53542d5