[gdb/testsuite] share jit-protocol.h by all jit tests
There was an existing jit-protocol.h defining common symbols needed for JIT-supporting application, however, it was only used by few tests. Others redeclared the same symbols. This unifies all tests to use jit-protocol.h gdb/testsuite/ChangeLog: 2020-02-18 Mihails Strasuns <mihails.strasuns@intel.com> * gdb.base/jit-attach-pie.c: Use jit-protocol.h. * gdb.base/jit-elf-main.c: Use jit-protocol.h. * gdb.base/jit-reader-host.c: Use jit-protocol.h. * gdb.base/jit-reader-simple-jit.c: Use jit-protocol.h. * gdb.base/jit-protocol.h: Update definitions to match all usage contexts.
This commit is contained in:
parent
922a7c7c5d
commit
946422b6a1
|
@ -19,29 +19,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
struct jit_code_entry
|
#include "jit-protocol.h"
|
||||||
{
|
|
||||||
struct jit_code_entry *next_entry;
|
|
||||||
struct jit_code_entry *prev_entry;
|
|
||||||
const char *symfile_addr;
|
|
||||||
uint64_t symfile_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct jit_descriptor
|
|
||||||
{
|
|
||||||
uint32_t version;
|
|
||||||
/* This type should be jit_actions_t, but we use uint32_t
|
|
||||||
to be explicit about the bitwidth. */
|
|
||||||
uint32_t action_flag;
|
|
||||||
struct jit_code_entry *relevant_entry;
|
|
||||||
struct jit_code_entry *first_entry;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
|
|
||||||
|
|
||||||
void __jit_debug_register_code()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
thread_proc (void *arg)
|
thread_proc (void *arg)
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "jit-protocol.h"
|
||||||
|
|
||||||
/* ElfW is coming from linux. On other platforms it does not exist.
|
/* ElfW is coming from linux. On other platforms it does not exist.
|
||||||
Let us define it here. */
|
Let us define it here. */
|
||||||
#ifndef ElfW
|
#ifndef ElfW
|
||||||
|
@ -42,38 +44,6 @@
|
||||||
#define _ElfW_1(e,w,t) e##w##t
|
#define _ElfW_1(e,w,t) e##w##t
|
||||||
#endif /* !ElfW */
|
#endif /* !ElfW */
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
JIT_NOACTION = 0,
|
|
||||||
JIT_REGISTER_FN,
|
|
||||||
JIT_UNREGISTER_FN
|
|
||||||
} jit_actions_t;
|
|
||||||
|
|
||||||
struct jit_code_entry
|
|
||||||
{
|
|
||||||
struct jit_code_entry *next_entry;
|
|
||||||
struct jit_code_entry *prev_entry;
|
|
||||||
const char *symfile_addr;
|
|
||||||
uint64_t symfile_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct jit_descriptor
|
|
||||||
{
|
|
||||||
uint32_t version;
|
|
||||||
/* This type should be jit_actions_t, but we use uint32_t
|
|
||||||
to be explicit about the bitwidth. */
|
|
||||||
uint32_t action_flag;
|
|
||||||
struct jit_code_entry *relevant_entry;
|
|
||||||
struct jit_code_entry *first_entry;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* GDB puts a breakpoint in this function. */
|
|
||||||
void __attribute__((noinline)) __jit_debug_register_code () { }
|
|
||||||
|
|
||||||
/* Make sure to specify the version statically, because the
|
|
||||||
debugger may check the version before we can set it. */
|
|
||||||
struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage (const char *const argv0)
|
usage (const char *const argv0)
|
||||||
{
|
{
|
||||||
|
@ -203,7 +173,7 @@ MAIN (int argc, char *argv[])
|
||||||
__jit_debug_descriptor.first_entry = entry;
|
__jit_debug_descriptor.first_entry = entry;
|
||||||
|
|
||||||
/* Notify GDB. */
|
/* Notify GDB. */
|
||||||
__jit_debug_descriptor.action_flag = JIT_REGISTER_FN;
|
__jit_debug_descriptor.action_flag = JIT_REGISTER;
|
||||||
__jit_debug_register_code ();
|
__jit_debug_register_code ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +195,7 @@ MAIN (int argc, char *argv[])
|
||||||
__jit_debug_descriptor.first_entry = NULL;
|
__jit_debug_descriptor.first_entry = NULL;
|
||||||
|
|
||||||
/* Notify GDB. */
|
/* Notify GDB. */
|
||||||
__jit_debug_descriptor.action_flag = JIT_UNREGISTER_FN;
|
__jit_debug_descriptor.action_flag = JIT_UNREGISTER;
|
||||||
__jit_debug_register_code ();
|
__jit_debug_register_code ();
|
||||||
|
|
||||||
__jit_debug_descriptor.relevant_entry = prev_entry;
|
__jit_debug_descriptor.relevant_entry = prev_entry;
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct jit_code_entry
|
||||||
{
|
{
|
||||||
struct jit_code_entry *next_entry;
|
struct jit_code_entry *next_entry;
|
||||||
struct jit_code_entry *prev_entry;
|
struct jit_code_entry *prev_entry;
|
||||||
void *symfile_addr;
|
const void *symfile_addr;
|
||||||
uint64_t symfile_size;
|
uint64_t symfile_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,4 +51,10 @@ struct jit_descriptor
|
||||||
struct jit_code_entry *first_entry;
|
struct jit_code_entry *first_entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
|
||||||
|
|
||||||
|
void __attribute__((noinline)) __jit_debug_register_code()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* JIT_PROTOCOL_H */
|
#endif /* JIT_PROTOCOL_H */
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
#include "jit-reader-host.h"
|
#include "jit-reader-host.h"
|
||||||
#include "jit-protocol.h"
|
#include "jit-protocol.h"
|
||||||
|
|
||||||
void __attribute__((noinline)) __jit_debug_register_code () { }
|
|
||||||
|
|
||||||
struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
|
|
||||||
struct jit_code_entry only_entry;
|
struct jit_code_entry only_entry;
|
||||||
|
|
||||||
typedef void (jit_function_stack_mangle_t) (void);
|
typedef void (jit_function_stack_mangle_t) (void);
|
||||||
|
|
|
@ -19,32 +19,9 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct jit_code_entry
|
|
||||||
{
|
|
||||||
struct jit_code_entry *next_entry;
|
|
||||||
struct jit_code_entry *prev_entry;
|
|
||||||
const char *symfile_addr;
|
|
||||||
uint64_t symfile_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct jit_descriptor
|
|
||||||
{
|
|
||||||
uint32_t version;
|
|
||||||
/* This type should be jit_actions_t, but we use uint32_t
|
|
||||||
to be explicit about the bitwidth. */
|
|
||||||
uint32_t action_flag;
|
|
||||||
struct jit_code_entry *relevant_entry;
|
|
||||||
struct jit_code_entry *first_entry;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef SPACER
|
#ifdef SPACER
|
||||||
/* This exists to change the address of __jit_debug_descriptor. */
|
/* This exists to change the address of __jit_debug_descriptor. */
|
||||||
int spacer = 4;
|
int spacer = 4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
|
#include "jit-protocol.h"
|
||||||
|
|
||||||
void
|
|
||||||
__jit_debug_register_code (void)
|
|
||||||
{
|
|
||||||
}
|
|
Loading…
Reference in New Issue