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] Add "debug jit" for easier tracing of JIT support internals


On Wednesday 05 January 2011 23:15:31, Paul Pluzhnikov wrote:
> Right. It's actually specified as uint64_t in jit.h, not size_t ...
> 
> > while 'size_t' is about sizes of objects
> > on the host.  E.g., on a 32-bit GDB (cross) debugging a 64-bit
> > inferior, size_t will usually be a 32-bit type.  I think it'd be
> > better to make that a ULONGEST throughout (and then use phex
> > or pulongest)
> 
> Since this interface is frozen, and ULONGEST isn't available to clients,
> I'll just cast symfile_size to ULONGEST and print it with pulongest.

That's better than %z, but I don't see why making that uint64_t
be a ULONGEST would be a problem.  The definition of:

 struct jit_code_entry
 {
   CORE_ADDR next_entry;
   CORE_ADDR prev_entry;
   CORE_ADDR symfile_addr;
   uint64_t symfile_size;
 };

in jit.h, is not included by clients.

Clients should define it like so, as per the manual:

 struct jit_code_entry
 {
   struct jit_code_entry *next_entry;
   struct jit_code_entry *prev_entry;
   const char *symfile_addr;
   uint64_t symfile_size;
 };

GDB reads this out of the inferior like so:

  /* Fix the endianness to match the host.  */
  ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
  code_entry->next_entry = extract_typed_address (&entry_buf[0], ptr_type);
  code_entry->prev_entry =
      extract_typed_address (&entry_buf[ptr_size], ptr_type);
  code_entry->symfile_addr =
      extract_typed_address (&entry_buf[2 * ptr_size], ptr_type);
  code_entry->symfile_size =
      extract_unsigned_integer (&entry_buf[3 * ptr_size], 8, byte_order);

And, extract_unsigned_integer returns a ULONGEST...

-- 
Pedro Alves


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