{"action":"created","issue":{"url":"https://api.github.com/repos/hugsy/gef/issues/207","repository_url":"https://api.github.com/repos/hugsy/gef","labels_url":"https://api.github.com/repos/hugsy/gef/issues/207/labels{/name}","comments_url":"https://api.github.com/repos/hugsy/gef/issues/207/comments","events_url":"https://api.github.com/repos/hugsy/gef/issues/207/events","html_url":"https://github.com/hugsy/gef/issues/207","id":295228001,"number":207,"title":"GDB sigabrt when using breakpoint commands with continue","user":{"login":"Ninja3047","id":1284324,"avatar_url":"https://avatars2.githubusercontent.com/u/1284324?v=4","gravatar_id":"","url":"https://api.github.com/users/Ninja3047","html_url":"https://github.com/Ninja3047","followers_url":"https://api.github.com/users/Ninja3047/followers","following_url":"https://api.github.com/users/Ninja3047/following{/other_user}","gists_url":"https://api.github.com/users/Ninja3047/gists{/gist_id}","starred_url":"https://api.github.com/users/Ninja3047/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ninja3047/subscriptions","organizations_url":"https://api.github.com/users/Ninja3047/orgs","repos_url":"https://api.github.com/users/Ninja3047/repos","events_url":"https://api.github.com/users/Ninja3047/events{/privacy}","received_events_url":"https://api.github.com/users/Ninja3047/received_events","type":"User","site_admin":false},"labels":[{"id":733850925,"url":"https://api.github.com/repos/hugsy/gef/labels/not-a-bug","name":"not-a-bug","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-07T17:35:46Z","updated_at":"2018-02-07T19:34:35Z","closed_at":null,"author_association":"NONE","body":"### Step 1: Describe your environment\r\n\r\n  * Operating System: ArchLinux / Debian Stretch\r\n  * Architecture: x86_64\r\n  * GDB version (including the Python library version): GDB 8.1 + Python 3.6.1 (Arch Linux) GDB 7.12.0.20161007-git + Python 3.5.3 - final (Debian 9.3)\r\n\r\n\r\n### Step 2: Describe your problem\r\nWhen creating a breakpoint command that continues, gdb sigabrts.\r\n\r\n#### Steps to reproduce\r\n\r\n  1. `gef> break main`\r\n  2. ```\r\n      gef> command\r\n      continue\r\n      end\r\n     ```\r\n  3. `gef> run`\r\n\r\n#### Observed Results\r\n\r\n```\r\n[ Legend: Modified register | Code | Heap | Stack | String ]\r\n───────────────────────────────────────────────────────────────────────────────────[ registers ]────\r\nHello World[Inferior 1 (process 29506) exited normally]\r\n[*] Failed to read /proc/<PID>/maps, using GDB sections info: [Errno 2] No such file or directory: '/proc/29506/maps'\r\n$rax   : 0x000055555555464a\r\n\r\n─────────────────────────────── Exception raised ───────────────────────────────\r\nerror: No registers.\r\n───────────────────────────── Detailed stacktrace ──────────────────────────────\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 5756, in do_invoke()\r\n    →     reg = gdb.parse_and_eval(regname)\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 1994, in wrapper()\r\n    →     return f(*args, **kwargs)\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 3339, in invoke()\r\n    →     self.do_invoke(argv)\r\n───────────────────────────── Last 10 GDB commands ─────────────────────────────\r\n   43  backtrace 1\r\n   44  continue\r\n   45  end\r\n   46  run\r\n   47  br main\r\n   48  command\r\n   49  continue\r\n   50  end\r\n   51  gef config gef.debug 1\r\n   52  run\r\n───────────────────────────── Runtime environment ──────────────────────────────\r\n* GDB: 8.1\r\n* Python: 3.6.4 - final\r\n* OS: Linux - 4.14.14-1-ARCH (64bit) on arch  \r\n────────────────────────────────────────────────────────────────────────────────\r\n\r\n───────────────────────────────────────────────────────────────────────────────────────[ stack ]────\r\n\r\n─────────────────────────────── Exception raised ───────────────────────────────\r\nerror: No frame is currently selected.\r\n───────────────────────────── Detailed stacktrace ──────────────────────────────\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 2066, in get_register()\r\n    →     value = gdb.selected_frame().read_register(regname)\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 1338, in sp()\r\n    →     return get_register(\"$sp\")\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 6492, in context_stack()\r\n    →     sp = current_arch.sp\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 6395, in do_invoke()\r\n    →     layout_mapping[section]()\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 1994, in wrapper()\r\n    →     return f(*args, **kwargs)\r\n↳ File \"/home/wtan/.gdbinit-gef.py\", line 3339, in invoke()\r\n    →     self.do_invoke(argv)\r\n───────────────────────────── Last 10 GDB commands ─────────────────────────────\r\n   43  backtrace 1\r\n   44  continue\r\n   45  end\r\n   46  run\r\n   47  br main\r\n   48  command\r\n   49  continue\r\n   50  end\r\n   51  gef config gef.debug 1\r\n   52  run\r\n───────────────────────────── Runtime environment ──────────────────────────────\r\n* GDB: 8.1\r\n* Python: 3.6.4 - final\r\n* OS: Linux - 4.14.14-1-ARCH (64bit) on arch  \r\n────────────────────────────────────────────────────────────────────────────────\r\n\r\nthread.c:93: internal-error: thread_info* inferior_thread(): Assertion `tp' failed.\r\nA problem internal to GDB has been detected,\r\nfurther debugging may prove unreliable.\r\n\r\nThis is a bug, please report it.  For instructions, see:\r\n<http://www.gnu.org/software/gdb/bugs/>.\r\n```\r\n\r\n#### Expected results\r\n\r\ngdb shouldn't break\r\n\r\nGDB performs as expected without gef.\r\n\r\n#### Traces\r\n\r\n```\r\n#include <stdio.h>\r\n\r\nint main() {\r\n    printf(\"Hello World\");\r\n}\r\n```\r\n\r\nCompiled with `gcc test.c -o test -g`.\r\n"},"comment":{"url":"https://api.github.com/repos/hugsy/gef/issues/comments/363884604","html_url":"https://github.com/hugsy/gef/issues/207#issuecomment-363884604","issue_url":"https://api.github.com/repos/hugsy/gef/issues/207","id":363884604,"user":{"login":"hugsy","id":590234,"avatar_url":"https://avatars3.githubusercontent.com/u/590234?v=4","gravatar_id":"","url":"https://api.github.com/users/hugsy","html_url":"https://github.com/hugsy","followers_url":"https://api.github.com/users/hugsy/followers","following_url":"https://api.github.com/users/hugsy/following{/other_user}","gists_url":"https://api.github.com/users/hugsy/gists{/gist_id}","starred_url":"https://api.github.com/users/hugsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hugsy/subscriptions","organizations_url":"https://api.github.com/users/hugsy/orgs","repos_url":"https://api.github.com/users/hugsy/repos","events_url":"https://api.github.com/users/hugsy/events{/privacy}","received_events_url":"https://api.github.com/users/hugsy/received_events","type":"User","site_admin":false},"created_at":"2018-02-07T19:34:35Z","updated_at":"2018-02-07T19:34:35Z","author_association":"OWNER","body":"Quick'n dirty PoC\r\n\r\n```bash\r\n$ cat script.gdb << EOF\r\nb main\r\ncommand\r\ncontinue\r\nend\r\nr\r\nEOF\r\n$ cat poc.py << EOF\r\nimport gdb, time\r\n\r\nclass PoC(gdb.Command):\r\n  def __init__ (self):\r\n    super(PoC, self).__init__ (\"poc\", gdb.COMMAND_USER)\r\n\r\n  def invoke (self, arg, from_tty):\r\n    print(\"foobar\")\r\n    time.sleep(1)\r\n    print(gdb.selected_inferior().pid)\r\n    print(gdb.selected_frame())\r\n\r\ndef handler(event):\r\n    gdb.execute(\"poc\")\r\n\r\nPoC()\r\ngdb.events.stop.connect(handler)\r\nEOF```\r\n\r\nAnd when you run it:\r\n\r\n```bash\r\n[vagrant@archlinux ~]$ gdb -q -nx -ex 'source ./poc.py' -x s ./test\r\nReading symbols from ./test...done.\r\nBreakpoint 1 at 0x64e: file test.c, line 4.\r\nfoobar\r\n1270\r\n{stack=0x7fffffffe970,code=0x55555555464a,!special}\r\nHello World[Inferior 1 (process 1270) exited normally]\r\nthread.c:93: internal-error: thread_info* inferior_thread(): Assertion `tp' failed.\r\nA problem internal to GDB has been detected,\r\nfurther debugging may prove unreliable.\r\nQuit this debugging session? (y or n) [answered Y; input not from terminal]\r\n\r\nThis is a bug, please report it.  For instructions, see:\r\n<http://www.gnu.org/software/gdb/bugs/>.\r\n\r\nthread.c:93: internal-error: thread_info* inferior_thread(): Assertion `tp' failed.\r\nA problem internal to GDB has been detected,\r\nfurther debugging may prove unreliable.\r\nCreate a core file of GDB? (y or n) [answered Y; input not from terminal]\r\nAborted (core dumped)```"}}
{"actor":{"display_login":"hugsy"}}