old-cross-binutils/gdb/testsuite/gdb.base/jit-dlmain.c
Joel Brobecker 3b2a0cf216 Fix JIT clang-lli regression (unable to read JIT descriptor from memory)
2011-07-06  Paul Pluzhnikov  <ppluzhnikov@google.com>

        * jit.c (jit_inferior_init): Forward declare.
        (jit_breakpoint_re_set_internal): Call jit_inferior_init.

testsuite/ChangeLog:

2011-07-06  Paul Pluzhnikov  <ppluzhnikov@google.com>

        * 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-06 21:40:17 +00:00

20 lines
470 B
C

#include <dlfcn.h>
#include <stdio.h>
int main (int argc, char *argv[])
{
/* jit_libname is updated by jit-so.exp */
const char *jit_libname = "jit-dlmain-so.so";
void *h;
int (*p_main) (int, char **);
h = NULL; /* break here before-dlopen */
h = dlopen (jit_libname, RTLD_LAZY);
if (h == NULL) return 1;
p_main = dlsym (h, "jit_dl_main");
if (p_main == NULL) return 2;
h = h; /* break here after-dlopen */
return (*p_main) (argc, argv);
}