From: Joel Brobecker Date: Wed, 6 Jul 2011 22:05:38 +0000 (+0000) Subject: Fix JIT clang-lli regression (unable to read JIT descriptor from memory) X-Git-Tag: gdb_7_3-2011-07-26-release~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61ac72a102387eca85fb589bd59dfc05537827b2;p=thirdparty%2Fbinutils-gdb.git Fix JIT clang-lli regression (unable to read JIT descriptor from memory) 2011-07-06 Paul Pluzhnikov * jit.c (jit_inferior_init): Forward declare. (jit_breakpoint_re_set_internal): Call jit_inferior_init. testsuite/ChangeLog: 2011-07-06 Paul Pluzhnikov * gdb.base/jit-so.exp: New test. * gdb.base/jit-dlmain.c: New file. * gdb.base/jit-main.c: Allow "main" to be elsewhere. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5c31f8c2df6..f2b2b5ac004 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2011-07-06 Paul Pluzhnikov + + * jit.c (jit_inferior_init): Forward declare. + (jit_breakpoint_re_set_internal): Call jit_inferior_init. + 2011-07-04 Jan Kratochvil Fix false GCC warning. diff --git a/gdb/jit.c b/gdb/jit.c index e451024c49b..9d6995c0981 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -40,6 +40,9 @@ static const char *const jit_descriptor_name = "__jit_debug_descriptor"; static const struct inferior_data *jit_inferior_data = NULL; +static void +jit_inferior_init (struct gdbarch *gdbarch); + /* Non-zero if we want to see trace of jit level stuff. */ static int jit_debug = 0; @@ -351,6 +354,11 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, inf_data->breakpoint_addr = SYMBOL_VALUE_ADDRESS (reg_symbol); if (inf_data->breakpoint_addr == 0) return 2; + + /* If we have not read the jit descriptor yet (e.g. because the JITer + itself is in a shared library which just got loaded), do so now. */ + if (inf_data->descriptor_addr == 0) + jit_inferior_init (gdbarch); } else return 0; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9d34153a30e..7141df783fd 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-07-06 Paul Pluzhnikov + + * gdb.base/jit-so.exp: New test. + * gdb.base/jit-dlmain.c: New file. + * gdb.base/jit-main.c: Allow "main" to be elsewhere. + 2011-07-02 Jan Kratochvil * gdb.cp/temargs.exp (set sixth breakpoint for temargs): Move the test diff --git a/gdb/testsuite/gdb.base/jit-main.c b/gdb/testsuite/gdb.base/jit-main.c index b20c516b6bc..f5b0ec1b363 100644 --- a/gdb/testsuite/gdb.base/jit-main.c +++ b/gdb/testsuite/gdb.base/jit-main.c @@ -117,8 +117,12 @@ update_locations (const void *const addr, int idx) } } +#ifndef MAIN +#define MAIN main +#endif + int -main (int argc, char *argv[]) +MAIN (int argc, char *argv[]) { /* These variables are here so they can easily be set from jit.exp. */ const char *libname = NULL;