Various debugger fixes and enhancements

This fixes a couple of annoyances in the debugger. Thanks to pseudonym for his help with the memory access issues.