This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] jit-reader.h: describe interface implemented by the JIT readers.


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

Sanjoy> Generating ELF files in memory is usually too much work for JIT
Sanjoy> compilers, since they usually don't have the related routines (as
Sanjoy> opposed to a regular static compiler). One way to simplify this is to
Sanjoy> have the JIT vendor themselves provide a shared object which is loaded
Sanjoy> and used to parse the debug information. This patch exposes a
Sanjoy> simplified interface for the debug info parser.

The idea makes sense to me.  I'd like this to go in.

Sanjoy> This patch adds a header file (`jit-reader.h') which can be included
Sanjoy> and implemented in a shared object to build a working JIT
Sanjoy> debug-reader.

This header should be installed somewhere, I think $includedir/gdb/.

The whole header should have conditional 'extern "C"' wrapping, just in case.

Sanjoy> +#define GDB_JIT_SUCCESS          1
Sanjoy> +#define GDB_JIT_FAIL             0

Not an enum?

Sanjoy> +#ifndef __GDB__INTERNAL /* Only defined when being compiled in GDB. */
Sanjoy> +typedef long long CORE_ADDR;
Sanjoy> +#endif

I think long long isn't portable.  One approach would be to take the
configury stuff from gdb and put it into a new header with the
appropriate namespace prefixes.  The auto-configured bits could be done
at build time by extracting stuff from config.h.

We should be namespace-safe always, so it should be GDB_CORE_ADDR or
GDB_JIT_CORE_ADDR.

Sanjoy> +typedef void (gdbjit_symtab_add_line_mapping)
Sanjoy> +(struct gdbjit_symtab_callbacks * callbacks, struct gdbjit_symtab *symtab,

Indentation.

Sanjoy> +typedef struct gdbjit_reg_value (gdbjit_unwind_reg_get)
Sanjoy> +  (struct gdbjit_unwind_callbacks *callback, int regnum);

I would have expected this to take a frame as well.
Why doesn't it?

Maybe I don't understand the overall plan here.

Sanjoy> +/* Called once for each new inferior program. It should also initialize the
Sanjoy> +   private pointer (to which a pointer is passed here) if the it needs one.

s/the//

Sanjoy> +   Should return GDB_JIT_SUCESS on success and GDB_JIT_FAIL on error. */

Typo, "GDB_JIT_SUCCESS"

Sanjoy> +extern int gdbjit_read_debug_info (void *private,
Sanjoy> +                                   struct gdbjit_symtab_callbacks *callbacks,
Sanjoy> +                                   CORE_ADDR memory, long memory_sz);

I don't understand the point of this one.


This change needs a patch for the manual.

I already forgot... did we get you started on the copyright assignment
process?

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]