Re: [PATCH 1/7] Introduce header (jit-reader.h.in) and modify build system.

Tom Tromey
2011-08-10T20:57:04Z

>>>>> "Sanjoy" == Sanjoy Das <sanjoy@playingwithpointers.com> writes:

Sanjoy> jit-reader.h.in will host the interface to be implemented and the API
Sanjoy> to be used by the reader. The file needs to be processed by
Sanjoy> ./configure to produce `jit.reader.h'; so that GDB_CORE_ADDR is
Sanjoy> defined correctly.

This looks pretty good.

Sanjoy> + -DLOCALEDIR="\"$(localedir)\"" $(DEFS) -DLIBDIR="\"@libdir@\""

I want to note that LIBDIR should be relocated at runtime.

Sanjoy> +#define GDB_DECLARE_GPL_COMPATIBLE_READER \
Sanjoy> + extern "C" { \
Sanjoy> + extern int plugin_is_GPL_compatible (void) \
Sanjoy> + { \
Sanjoy> + return 0; \
Sanjoy> + } \
Sanjoy> + }

This define isn't ok, because the including source code might be C.
You can just make two separate defines, one for C and one for C++.

Sanjoy> +struct gdb_reader_funcs
Sanjoy> +{
Sanjoy> + gdb_read_debug_info *read;
Sanjoy> + gdb_unwind_frame *unwind;
Sanjoy> + gdb_get_frame_id *get_frame_id;
Sanjoy> + gdb_destroy_reader *destroy;
Sanjoy> + /* Must be set to GDB_READER_INTERFACE_VERSION */
Sanjoy> + int reader_version;

Put the version first. That gives maximum freedom for rearranging the
structure in future versions.

Tom