{"action":"created","issue":{"url":"https://api.github.com/repos/radare/radare2/issues/2390","labels_url":"https://api.github.com/repos/radare/radare2/issues/2390/labels{/name}","comments_url":"https://api.github.com/repos/radare/radare2/issues/2390/comments","events_url":"https://api.github.com/repos/radare/radare2/issues/2390/events","html_url":"https://github.com/radare/radare2/issues/2390","id":68978329,"number":2390,"title":"debug_gdb segfaults","user":{"login":"q6r","id":1616882,"avatar_url":"https://avatars.githubusercontent.com/u/1616882?v=3","gravatar_id":"","url":"https://api.github.com/users/q6r","html_url":"https://github.com/q6r","followers_url":"https://api.github.com/users/q6r/followers","following_url":"https://api.github.com/users/q6r/following{/other_user}","gists_url":"https://api.github.com/users/q6r/gists{/gist_id}","starred_url":"https://api.github.com/users/q6r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/q6r/subscriptions","organizations_url":"https://api.github.com/users/q6r/orgs","repos_url":"https://api.github.com/users/q6r/repos","events_url":"https://api.github.com/users/q6r/events{/privacy}","received_events_url":"https://api.github.com/users/q6r/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/radare/radare2/labels/blocker","name":"blocker","color":"eb6420"},{"url":"https://api.github.com/repos/radare/radare2/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/radare/radare2/labels/debug-info","name":"debug-info","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/radare/radare2/milestones/7","html_url":"https://github.com/radare/radare2/milestones/0.9.9","labels_url":"https://api.github.com/repos/radare/radare2/milestones/7/labels","id":684287,"number":7,"title":"0.9.9","description":"","creator":{"login":"jvoisin","id":325724,"avatar_url":"https://avatars.githubusercontent.com/u/325724?v=3","gravatar_id":"","url":"https://api.github.com/users/jvoisin","html_url":"https://github.com/jvoisin","followers_url":"https://api.github.com/users/jvoisin/followers","following_url":"https://api.github.com/users/jvoisin/following{/other_user}","gists_url":"https://api.github.com/users/jvoisin/gists{/gist_id}","starred_url":"https://api.github.com/users/jvoisin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvoisin/subscriptions","organizations_url":"https://api.github.com/users/jvoisin/orgs","repos_url":"https://api.github.com/users/jvoisin/repos","events_url":"https://api.github.com/users/jvoisin/events{/privacy}","received_events_url":"https://api.github.com/users/jvoisin/received_events","type":"User","site_admin":false},"open_issues":52,"closed_issues":71,"state":"open","created_at":"2014-06-08T01:35:57Z","updated_at":"2015-04-17T15:11:50Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-04-16T18:03:46Z","updated_at":"2015-04-17T18:16:19Z","closed_at":null,"body":"using `r2 gdb://localhost:...` doesn't automatically use debug_gdb it instead uses debug_native.\r\ndoing `r2 -e dbg.backend=gdb gdb://localhost:...` segfaults.\r\n\r\n```\r\ngdb$ bt\r\n#0  0x00007ffff5e2461a in send_command (g=0x0, command=0x7ffff5e2a4dd \"g\") at src/core.c:699\r\n#1  0x00007ffff5e2355f in gdbr_read_registers (g=0x0) at src/core.c:383\r\n#2  0x00007ffff6e4667f in r_debug_gdb_reg_read (dbg=0x6aa460, type=0x0, \r\n    buf=0x6cd410 \"\\270-\\027\\364\\377\\177\", size=0x134) at p/debug_gdb.c:27\r\n#3  0x00007ffff6e445f7 in r_debug_reg_sync (dbg=0x6aa460, type=0x0, write=0x0) at reg.c:37\r\n#4  0x00007ffff7b234b6 in cmd_debug_reg (core=0x607980 <r>, str=0x6fe252 \"*\") at cmd_debug.c:952\r\n#5  0x00007ffff7b26c3e in cmd_debug (data=0x607980 <r>, input=0x6fe251 \"r*\") at cmd_debug.c:1922\r\n#6  0x00007ffff7b7dde8 in r_cmd_call (cmd=0x6a74a0, input=0x6fe250 \"dr*\") at cmd_api.c:182\r\n#7  0x00007ffff7b5ad90 in r_core_cmd_subst_i (core=0x607980 <r>, cmd=0x6fe250 \"dr*\", colon=0x0)\r\n    at cmd.c:1530\r\n#8  0x00007ffff7b59282 in r_core_cmd_subst (core=0x607980 <r>, cmd=0x6fe250 \"dr*\") at cmd.c:1039\r\n#9  0x00007ffff7b5b77a in r_core_cmd (core=0x607980 <r>, cstr=0x6d9190 \"dr*\", log=0x0)\r\n    at cmd.c:1721\r\n#10 0x00007ffff7b5bfc7 in r_core_cmd_str (core=0x607980 <r>, cmd=0x6d9190 \"dr*\") at cmd.c:1902\r\n#11 0x00007ffff7b57565 in cmd_interpret (data=0x607980 <r>, input=0x6cc331 \"dr*\") at cmd.c:433\r\n#12 0x00007ffff7b7dde8 in r_cmd_call (cmd=0x6a74a0, input=0x6cc330 \".dr*\") at cmd_api.c:182\r\n#13 0x00007ffff7b5ad90 in r_core_cmd_subst_i (core=0x607980 <r>, cmd=0x6cc330 \".dr*\", colon=0x0)\r\n    at cmd.c:1530\r\n#14 0x00007ffff7b59282 in r_core_cmd_subst (core=0x607980 <r>, cmd=0x6cc330 \".dr*\") at cmd.c:1039\r\n#15 0x00007ffff7b5b77a in r_core_cmd (core=0x607980 <r>, cstr=0x6be0c0 \".dr*\", log=0x0)\r\n    at cmd.c:1721\r\n#16 0x00007ffff7b1d0ba in r_core_prompt (r=0x607980 <r>, sync=0x0) at core.c:1024\r\n#17 0x00000000004050ca in main (argc=0x4, argv=0x7fffffffd458, envp=0x7fffffffd480)\r\n    at radare2.c:764\r\n#18 0x00007ffff3df5800 in __libc_start_main () from /usr/lib/libc.so.6\r\n#19 0x0000000000402b79 in _start ()\r\n```\r\n\r\nso it seems 'desc' in debug_gdb is always null here. I'm not sure if this is the right way to do this."},"comment":{"url":"https://api.github.com/repos/radare/radare2/issues/comments/94043394","html_url":"https://github.com/radare/radare2/issues/2390#issuecomment-94043394","issue_url":"https://api.github.com/repos/radare/radare2/issues/2390","id":94043394,"user":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"created_at":"2015-04-17T18:16:19Z","updated_at":"2015-04-17T18:16:19Z","body":"you can’t load a local binary into a remote target. in fact i think\ngdbserver doesnt supports that. you can use r2agent and remote debug with\nr2 without gdbserver at all. you can force the 32bits with -b32 (which does\nthe same as -e asm.bits=32 but shorter) . bear in mind that gdb protocol is\nprobably one of the *worst* designed protocols. with multiple\nimplementations and several workarounds depending on the version and such.\n\nthat regread error is because the reg profile size differs somehow,\nprobably because in linux you have 3 different register profiles\n\n64bit\n32bit\n32bit on 64bit\n\nand iirc we only support the first two. you can workaounrd this patching\nthe size condition or changing the regprofile to match the size and see if\nthat fixes the issue. im just leaving those notes here if someone wants to\nhelp on that. maybe defragger can find some time to enhace the gdb plugin a\nbit.\n\nthanks for pointing those issues.\n\n\nOn 16 Apr 2015, at 20:20, Essa Alkuwari <notifications@github.com> wrote:\n\nrunning r2 on x86_64. Tested on 32bit/64bit binaries. gdbserver version 7.9\n\nAnother problem here.. Testing with a 32bit binary\n\nI run\n\nzeus:r2dbg # r2 -D gdb gdb://localhost:1234/\nRemote debugging from host 127.0.0.1\nr_debug_select: 6 6\nXWJSTEP TOFALSE\npid = 35740352 tid = 1\nr_debug_select: 35740352 1\n -- Add comments using the ';' key in visual mode or the 'C' command\nfrom the radare2 shell\n[0x00000000]> dr\nrax = 0x00000000\nrbx = 0x00000000\nrcx = 0xffffc6a0\nrdx = 0x00000000\nrsi = 0x200f7fdbb50\nrdi = 0x2b00000023\nrbp = 0x2b0000002b\nrsp = 0x00000000\nr8 = 0x00000000\nr9 = 0x00000000\nr10 = 0x00000000\nr11 = 0x00000000\nr12 = 0x00000000\nr13 = 0x00000000\nr14 = 0x00000000\nr15 = 0x00000000\nrip = 0x00000000\n\nIt seems that I should also set it to 32bit manually for things to work.\nI'm not sure if there's a way via gdbserver to determine information about\nthe binary, or a way for radare to load the binary and does gdbserver. like\nhow gdb does.\n\nr2 -e asm.arch=x86 -e asm.bits=32 -D gdb gdb://localhost:1234/\n\nwhich actually does work just a lot of r_debug_gdb_reg_read: small buffer\n308 vs 312 and r_reg_get_value: Bit size 128 not supported warnings/errors.\n\n—\nReply to this email directly or view it on GitHub\n<https://github.com/radare/radare2/issues/2390#issuecomment-93807076>.\n"}}