Debug X by logging in with ssh and run it in gdb. When the other computer freezes just press Control-C in gdb and type bt to get the stacktrace. It's even better if you compiled X with debugging information then you can move around in the callstack and print the variables used.