contrib/gdb-7/gdb/jit.c
static void
jit_read_descriptor (struct gdbarch *gdbarch,
		     struct jit_descriptor *descriptor,
		     CORE_ADDR descriptor_addr)
{
  int err;
  struct type *ptr_type;
  int ptr_size;
  int desc_size;
  gdb_byte *desc_buf;
  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);

  /* Figure out how big the descriptor is on the remote and how to read it.  */
  ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
  ptr_size = TYPE_LENGTH (ptr_type);
  desc_size = 8 + 2 * ptr_size;  /* Two 32-bit ints and two pointers.  */
  desc_buf = alloca (desc_size);

  /* Read the descriptor.  */
  err = target_read_memory (descriptor_addr, desc_buf, desc_size);
  if (err)
    error (_("Unable to read JIT descriptor from remote memory!"));

  /* Fix the endianness to match the host.  */
  descriptor->version = extract_unsigned_integer (&desc_buf[0], 4, byte_order);
  descriptor->action_flag =
      extract_unsigned_integer (&desc_buf[4], 4, byte_order);
  descriptor->relevant_entry = extract_typed_address (&desc_buf[8], ptr_type);
  descriptor->first_entry =
      extract_typed_address (&desc_buf[8 + ptr_size], ptr_type);
}
/* Helper function for reading the global JIT descriptor from remote
   memory.  */
Helper function for reading the global JIT descriptor from remote
memory.
Helper function for reading the global JIT descriptor from remote memory .
static void
jit_read_descriptor (struct gdbarch *gdbarch,
		     struct jit_descriptor *descriptor,
		     CORE_ADDR descriptor_addr)
{
  int err;
  struct type *ptr_type;
  int ptr_size;
  int desc_size;
  gdb_byte *desc_buf;
  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
  ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
  ptr_size = TYPE_LENGTH (ptr_type);
  desc_size = 8 + 2 * ptr_size;  
  desc_buf = alloca (desc_size);
  err = target_read_memory (descriptor_addr, desc_buf, desc_size);
  if (err)
    error (_("Unable to read JIT descriptor from remote memory!"));
  descriptor->version = extract_unsigned_integer (&desc_buf[0], 4, byte_order);
  descriptor->action_flag =
      extract_unsigned_integer (&desc_buf[4], 4, byte_order);
  descriptor->relevant_entry = extract_typed_address (&desc_buf[8], ptr_type);
  descriptor->first_entry =
      extract_typed_address (&desc_buf[8 + ptr_size], ptr_type);
}
static void jit_read_descriptor ( struct gdbarch * gdbarch , struct jit_descriptor * descriptor , CORE_ADDR descriptor_addr ) { int err ; struct type * ptr_type ; int ptr_size ; int desc_size ; gdb_byte * desc_buf ; enum bfd_endian byte_order = gdbarch_byte_order ( gdbarch ) ; ptr_type = builtin_type ( gdbarch ) -> builtin_data_ptr ; ptr_size = TYPE_LENGTH ( ptr_type ) ; desc_size = 8 + 2 * ptr_size ; desc_buf = alloca ( desc_size ) ; err = target_read_memory ( descriptor_addr , desc_buf , desc_size ) ; if ( err ) error ( _ ( " " ) ) ; descriptor -> version = extract_unsigned_integer ( & desc_buf [ 0 ] , 4 , byte_order ) ; descriptor -> action_flag = extract_unsigned_integer ( & desc_buf [ 4 ] , 4 , byte_order ) ; descriptor -> relevant_entry = extract_typed_address ( & desc_buf [ 8 ] , ptr_type ) ; descriptor -> first_entry = extract_typed_address ( & desc_buf [ 8 + ptr_size ] , ptr_type ) ; }
Helper function for reading the global JIT descriptor from remote
memory.
Helper function for reading the global JIT descriptor from remote memory .
/* Figure out how big the descriptor is on the remote and how to read it.  */ /* Two 32-bit ints and two pointers.  */ /* Read the descriptor.  */ /* Fix the endianness to match the host.  */