clementgallet / libTAS

GNU/Linux software to (hopefully) give TAS tools to games
GNU General Public License v3.0
496 stars 56 forks source link

Hooking can fail if debugger takes too long #462

Open InfoTeddy opened 2 years ago

InfoTeddy commented 2 years ago

GDB has a bit of a problem, in that by default, it will attempt to read the debug symbols of basically every library a game uses, upon launch. I rectified this by making a ~/.gdbinit with the contents set auto-solib-add 0.

If GDB takes too long to launch, then libTAS's 10 attempts to connect to the socket will be quickly exhausted, and will never hook to the game. Maybe instead, the tool should block and wait for the debugger to finish loading all the debug symbols?

InfoTeddy commented 2 years ago

The situation is also complicated further that by default on Fedora, GDB will prompt you to enable debuginfod for this session. When it does this, it hasn't launched the game yet, so libTAS is stuck retrying its attempts to connect to the socket until you answer the prompt. There is of course a workaround (that GDB even prints out) where you add set debuginfod enabled on to .gdbinit, but it's not ideal that libTAS keeps trying and failing to connect when the game hasn't even started yet.

clementgallet commented 2 years ago

Not sure how I would detect when gdb has finished loading :(