Fix a crash in jit.c
authorTom Tromey <tom@tromey.com>
Wed, 19 Dec 2018 18:44:28 +0000 (11:44 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 28 Dec 2018 21:08:03 +0000 (14:08 -0700)
commit2cd8cc0b66ca297bce4d08e4f712f86d9f1a2fb6
tree63ba4a2b4470df028bb65a11849ed5ba0259efd2
parent140a4bc099820c909da0eac1df0f56ec468ad3dd
Fix a crash in jit.c

A user at Mozilla pointed out a crash in jit.c.  In his situation, an
inferior using the JIT API exec'd an executable that did not use it.
This caused an assertion failure when jit.c:free_objfile_data called
delete_breakpoint with NULL.

This patch fixes the problem in the obvious way.  New test case
included.

gdb/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

* jit.c (free_objfile_data): Only delete breakpoint if non-null.

gdb/testsuite/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>
    Simon Marchi <simark@simark.ca>

* gdb.base/jit-exec.exp: New file.
* gdb.base/jit-exec.c: New file.
* gdb.base/jit-execd.c: New file.
gdb/ChangeLog
gdb/jit.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/jit-exec.c [new file with mode: 0644]
gdb/testsuite/gdb.base/jit-exec.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/jit-execd.c [new file with mode: 0644]