I'm using a .gdbinit file that is supposed to print the values of all registers at every hook_stop, followed by the stack and data frames. However, when running many programs, there are often segment registers that are unavailable, which is causing me problems. The script aborts when it encounters such a register. I get the error message: Error while running hook_stop: value is not available. Because of the error, none of the remaining segment registers are printed, nor are the stack and data frames.
I want to know if there is a way to handle the error in the gdb scripting language, or better yet, just test if a register is available, and only print it if it is. I've tried:
if $ds
printf " %04X ", $ds
else
printf " ---- "
end
but that's still giving me the error. I read through the docs for hours and couldn't find anything that worked. Any ideas?