Crashes with rr
I am trying to use SublimeGDB with rr, and strangely it worked 1-2 times but mostly is crashing the whole Sublime Text on connection to remote gdb server (after a 20 second timeout, it seems).
I start the server like this:
$ rr replay -s 8000
Launch gdb with
gdb '-l' '10000' '-ex' 'set sysroot /' '-ex' 'target extended-remote 127.0.0.1:8000' /home/skirmis/.local/share/rr/parse_test-f1b69114f02a9cb8-0/mmap_hardlink_3_parse_test-f1b69114f02a9cb8
then configure SublimeGDB:
"workingdir": "/some_dir",
"commandline": "gdb --interpreter=mi -ex 'set sysroot /' -ex 'target extended-remote 127.0.0.1:8000' /home/skirmis/.local/share/rr/parse_test-f1b69114f02a9cb8-0/mmap_hardlink_3_parse_test-f1b69114f02a9cb8",
"exec_cmd": "-exec-continue",
"run_after_init": false,
"attach_cmd" : "-gdb-set mi-async on",
"debug_file": "/some_dir/debug.log",
"debug_ext" : true,
"debug": true,
Here is the debug log I get:
Running: gdb --interpreter=mi -ex 'set sysroot /' -ex 'target extended-remote 127.0.0.1:8000' /home/skirmis/.local/share/rr/parse_test-f1b69114f02a9cb8-0/mmap_hardlink_3_parse_test-f1b69114f02a9cb8
In directory: /home/skirmis/Work/CoreWar/RustCoreWar/corewars-parser
Process: <subprocess.Popen object at 0x7f48b36b7e90>
pty: 5, tty: None, name: /tmp/tmphy4ur1
1-gdb-show interpreter
gdb_stdout: =thread-group-added,id="i1"
gdb_stdout: ~"GNU gdb (GDB) 10.2\n"
gdb_stdout: ~"Copyright (C) 2021 Free Software Foundation, Inc.\n"
gdb_stdout: ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
gdb_stdout: ~"\nType \"show copying\" and \"show warranty\" for details.\n"
gdb_stdout: ~"This GDB was configured as \"x86_64-pc-linux-gnu\".\n"
gdb_stdout: ~"Type \"show configuration\" for configuration details.\n"
gdb_stdout: ~"For bug reporting instructions, please see:\n"
gdb_stdout: ~"<https://www.gnu.org/software/gdb/bugs/>.\n"
gdb_stdout: ~"Find the GDB manual and other documentation resources online at:\n <http://www.gnu.org/software/gdb/documentation/>."
gdb_stdout: ~"\n\n"
gdb_stdout: ~"For help, type \"help\".\n"
gdb_stdout: ~"Type \"apropos word\" to search for commands related to \"word\"...\n"
gdb_stdout: =cmd-param-changed,param="history save",value="on"
gdb_stdout: =cmd-param-changed,param="print pretty",value="on"
gdb_stdout: =cmd-param-changed,param="print array-indexes",value="on"
gdb_stdout: =cmd-param-changed,param="python print-stack",value="full"
gdb_stdout: =cmd-param-changed,param="disassembly-flavor",value="intel"
gdb_stdout: =cmd-param-changed,param="pagination",value="off"
gdb_stdout: ~"Reading symbols from /home/skirmis/.local/share/rr/parse_test-f1b69114f02a9cb8-0/mmap_hardlink_3_parse_test-f1b69114f02a9cb8...\n"
gdb_stdout: &"warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts\nof file "
gdb_stdout: &"/home/skirmis/.local/share/rr/parse_test-f1b69114f02a9cb8-0/mmap_hardlink_3_parse_test-f1b69114f02a9cb8.\nUse `info auto-load "
gdb_stdout: &"python-scripts [REGEXP]' to list them.\n"
gdb_stdout: =cmd-param-changed,param="sysroot",value="/"
gdb_stdout: ~"Remote debugging using 127.0.0.1:8000\n"
gdb_stdout: =thread-group-started,id="i1",pid="59184"
gdb_stdout: =thread-created,id="1",group-id="i1"
gdb_stdout: =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007f5d22b95090",to="0x00007f5d22bb80f6"}]
gdb_stdout: ~"Reading symbols from /lib64/ld-linux-x86-64.so.2...\n"
gdb_stdout: ~"(No debugging symbols found in /lib64/ld-linux-x86-64.so.2)\n"
gdb_stdout: ~"0x00007f5d22b95090 in _start () from /lib64/ld-linux-x86-64.so.2\n"
gdb_stdout: *stopped,frame={addr="0x00007f5d22b95090",func="_start",args=[],from="/lib64/ld-linux-x86-64.so.2",arch="i386:x86-64"},thread-id="1",stopped-threads="all"
2-thread-select 1
gdb_stdout: ~"\e[36m\224\200\224\200\224\200\e[0m \e[1;33mAssembly\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n \e[1;32m0x00007f5d22b95090\e[0m\e[1;32m \e[0m\e[1;32m\e[0m\e[1;32m?\e[0m\e[1;32m mov rdi,rsp\e[0m\n \e[1;30m0x00007f5d22b95093\e[0m \e[1;30m?\e[0m call 0x7f5d22b95e20 <_dl_start>\n \e[1;30m0x00007f5d22b95098\e[0m \e[1;30m?\e[0m mov r12,rax\n \e[1;30m0x00007f5d22b9509b\e[0m \e[1;30m?\e[0m mov eax,DWORD PTR [rip+0x2dc17] # 0x7f5d22bc2cb8 <_dl_skip_args>\n \e[1;30m0x00007f5d22b950a1\e[0m \e[1;30m?\e[0m pop rdx\n \e[1;30m0x00007f5d22b950a2\e[0m \e[1;30m?\e[0m lea rsp,[rsp+rax*8]\n \e[1;30m0x00007f5d22b950a6\e[0m \e[1;30m?\e[0m sub edx,eax\n \e[1;30m0x00007f5d22b950a8\e[0m \e[1;30m?\e[0m push rdx\n \e[1;30m0x00007f5d22b950a9\e[0m \e[1;30m?\e[0m mov rsi,rdx\n \e[1;30m0x00007f5d22b950ac\e[0m \e[1;30m?\e[0m mov r13,rsp\n \e[1;30m0x00007f5d22b950af\e[0m \e[1;30m?\e[0m and rsp,0xfffffffffffffff0\n \e[1;30m0x00007f5d22b950b3\e[0m \e[1;30m?\e[0m mov rdi,QWORD PTR [rip+0x2ef46] # 0x7f5d22bc4000 <_rtld_local>\n \e[1;30m0x00007f5d22b950ba\e[0m \e[1;30m?\e[0m lea rcx,[r13+rdx*8+0x10]\n \e[1;30m0x00007f5d22b950bf\e[0m \e[1;30m?\e[0m lea rdx,[r13+0x8]\n \e[1;30m0x00007f5d22b950c3\e[0m \e[1;30m?\e[0m xor ebp,ebp\n \e[1;30m0x00007f5d22b950c5\e[0m \e[1;30m?\e[0m call 0x7f5d22ba3ea0 <_dl_init>\n \e[1;30m0x00007f5d22b950ca\e[0m \e[1;30m?\e[0m lea rdx,[rip+0xeeff] # 0x7f5d22ba3fd0 <_dl_fini>\n \e[1;30m0x00007f5d22b950d1\e[0m \e[1;30m?\e[0m mov rsp,r13\n \e[1;30m0x00007f5d22b950d4\e[0m \e[1;30m?\e[0m jmp r12\n \e[1;30m0x00007f5d22b950d7\e[0m \e[1;30m?\e[0m nop WORD PTR [rax+rax*1+0x0]\n \e[1;30m0x00007f5d22b950e0\e[0m \e[1;30m?\e[0m endbr64 \n \e[1;30m0x00007f5d22b950e4\e[0m \e[1;30m?\e[0m add DWORD PTR [rdi+0x4],0x1\n \e[1;30m0x00007f5d22b950e8\e[0m \e[1;30m?\e[0m ret \n \e[1;30m0x00007f5d22b950e9\e[0m \e[1;30m?\e[0m nop DWORD PTR [rax+0x0]\n \e[1;30m0x00007f5d22b950f0\e[0m \e[1;30m?\e[0m endbr64 \n \e[1;30m0x00007f5d22b950f4\e[0m \e[1;30m?\e[0m sub DWORD PTR [rdi+0x4],0x1\n \e[1;30m0x00007f5d22b950f8\e[0m \e[1;30m?\e[0m ret \n \e[1;30m0x00007f5d22b950f9\e[0m \e[1;30m?\e[0m nop DWORD PTR [rax+0x0]\n \e[1;30m0x00007f5d22b95100\e[0m \e[1;30m?\e[0m push r15\n \e[1;30m0x00007f5d22b95102\e[0m \e[1;30m?\e[0m push r14\n\e[36m\224\200\224\200\224\200\e[0m \e[33mBreakpoints\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n\e[36m\224\200\224\200\224\200\e[0m \e[33mExpressions\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n\e[36m\224\200\224\200\224\200\e[0m \e[33mHistory\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n\e[36m\224\200\224\200\224\200\e[0m \e[33mMemory\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n\e[36m\224\200\224\200\224\200\e[0m \e[1;33mRegisters\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n \e[1;30mrax\e[0m \e[1;32m0x0000000000000000\e[0m \e[1;30mrbx\e[0m \e[1;32m0x0000000000000000\e[0m\n \e[1;30mrcx\e[0m \e[1;32m0xffffffffffffffff\e[0m \e[1;30mrdx\e[0m \e[1;32m0x0000000000000000\e[0m\n \e[1;30mrsi\e[0m \e[1;32m0x0000000000000000\e[0m \e[1;30mrdi\e[0m \e[1;32m0x0000000000000000\e[0m\n \e[1;30mrbp\e[0m \e[1;32m0x0000000000000000\e[0m \e[1;30mrsp\e[0m \e[1;32m0x00007ffd1ad2cd40\e[0m\n \e[1;30mr8\e[0m \e[1;32m0x0000000000000000\e[0m \e[1;30mr9\e[0m \e[1;32m0x0000000000000000\e[0m\n \e[1;30mr10\e[0m \e[1;32m0x0000000000000000\e[0m \e[1;30mr11\e[0m \e[1;32m0x0000000000000246\e[0m\n \e[1;30mr12\e[0m \e[1;32m0x0000000000000000\e[0m \e[1;30mr13\e[0m \e[1;32m0x0000000000000000\e[0m\n \e[1;30mr14\e[0m \e[1;32m0x0000000000000000\e[0m \e[1;30mr15\e[0m \e[1;32m0x0000000000000000\e[0m\n \e[1;30mrip\e[0m \e[1;32m0x00007f5d22b95090\e[0m \e[1;30meflags\e[0m \e[1;32m[ PF ZF IF ]\e[0m \n \e[1;30mcs\e[0m \e[1;32m0x00000033\e[0m \e[1;30mss\e[0m \e[1;32m0x0000002b\e[0m \n \e[1;30mds\e[0m \e[1;32m0x00000000\e[0m \e[1;30mes\e[0m \e[1;32m0x00000000\e[0m \n \e[1;30mfs\e[0m \e[1;32m0x00000000\e[0m \e[1;30mgs\e[0m \e[1;32m0x00000000\e[0m \n \e[1;30mfs_base\e[0m \e[1;32m0x0000000000000000\e[0m \e[1;30mgs_base\e[0m \e[1;32m0x0000000000000000\e[0m\n\e[36m\224\200\224\200\224\200\e[0m \e[33mSource\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n\e[36m\224\200\224\200\224\200\e[0m \e[1;33mStack\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n[\e[1;32m0\e[0m] from \e[1;32m0x00007f5d22b95090\e[0m\n[\e[32m1\e[0m] from \e[32m0x0000000000000001\e[0m\n[\e[32m2\e[0m] from \e[32m0x00007ffd1ad2dadd\e[0m\n[\e[32m3\e[0m] from \e[32m0x0000000000000000\e[0m\n\e[36m\224\200\224\200\224\200\e[0m \e[1;33mThreads\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n[\e[1;32m1\e[0m] id \e[1;32m59184\e[0m from \e[1;32m0x00007f5d22b95090\e[0m\n\e[36m\224\200\224\200\224\200\e[0m \e[33mVariables\e[0m \e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n\e[36m\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\224\200\e[0m\n"
gdb_stdout: (gdb)
gdb_stdout: 1^error,msg="Undefined show command: \"interpreter\". Try \"help show\"."
gdb_stdout: (gdb)
gdb_stdout: 2^done,new-thread-id="1",frame={level="0",addr="0x00007f5d22b95090",func="_start",args=[],from="/lib64/ld-linux-x86-64.so.2",arch="i386:x86-64"}
gdb_stdout: (gdb)
Any advice how to debug this?
Debugged some. In both failure and success runs, run_cmd('-inferior-tty-set /tmp/tmp******') times out after 10 seconds. In failure case, the code crashes on gdboutput() line line = pipe.readline(); in success case it continues running happily. Will try to increase the timeout for inferior-tty-set but why would it be talking such a long time?
With 30 second timeout, still crashes ~50% of the time. May be imagining things but noticed that moving the mouse cursor outside of Sublime Text window while SublimeGDB is starting makes it much more likely to time out.