Fix a crash in jit.c

Message ID 882f1e5f-61c3-09ce-17c7-c4c1e28a5d91@simark.ca
State New, archived
Headers

Commit Message

Simon Marchi Dec. 23, 2018, 3:20 p.m. UTC
  On 2018-12-21 1:54 p.m., Tom Tromey wrote:
> 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.

The fix itself LGTM.  Using "run" in the test, however, makes it not work
with the native-gdbserver board.  Changing it to this works for me:




Simon
  

Comments

Tom Tromey Dec. 28, 2018, 9:07 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> The fix itself LGTM.  Using "run" in the test, however, makes it not work
Simon> with the native-gdbserver board.  Changing it to this works for me:

Thanks.  I'm checking it in with that change.

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.base/jit-exec.exp b/gdb/testsuite/gdb.base/jit-exec.exp
index 74c6fa7a430f..514e01ffeaed 100644
--- a/gdb/testsuite/gdb.base/jit-exec.exp
+++ b/gdb/testsuite/gdb.base/jit-exec.exp
@@ -43,7 +43,10 @@  if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \

 clean_restart $binfile

-runto_main
-delete_breakpoints
+if ![runto_main] {
+    fail "can't run to main"
+    return
+}

+delete_breakpoints
 gdb_test "continue" "Inferior .* exited normally.*"