Exemple #1
0
void
c_language_arch_info(struct gdbarch *gdbarch,
		     struct language_arch_info *lai)
{
  const struct builtin_type *builtin = get_builtin_type(gdbarch);
  lai->string_char_type = builtin->builtin_char;
  lai->primitive_type_vector =
    GDBARCH_OBSTACK_CALLOC(gdbarch, (nr_c_primitive_types + 1),
			   struct type *);
  lai->primitive_type_vector[c_primitive_type_int] = builtin->builtin_int;
  lai->primitive_type_vector[c_primitive_type_long] = builtin->builtin_long;
  lai->primitive_type_vector[c_primitive_type_short] = builtin->builtin_short;
  lai->primitive_type_vector[c_primitive_type_char] = builtin->builtin_char;
  lai->primitive_type_vector[c_primitive_type_float] = builtin->builtin_float;
  lai->primitive_type_vector[c_primitive_type_double] = builtin->builtin_double;
  lai->primitive_type_vector[c_primitive_type_void] = builtin->builtin_void;
  lai->primitive_type_vector[c_primitive_type_long_long] = builtin->builtin_long_long;
  lai->primitive_type_vector[c_primitive_type_signed_char] = builtin->builtin_signed_char;
  lai->primitive_type_vector[c_primitive_type_unsigned_char] = builtin->builtin_unsigned_char;
  lai->primitive_type_vector[c_primitive_type_unsigned_short] = builtin->builtin_unsigned_short;
  lai->primitive_type_vector[c_primitive_type_unsigned_int] = builtin->builtin_unsigned_int;
  lai->primitive_type_vector[c_primitive_type_unsigned_long] = builtin->builtin_unsigned_long;
  lai->primitive_type_vector[c_primitive_type_unsigned_long_long] = builtin->builtin_unsigned_long_long;
  lai->primitive_type_vector[c_primitive_type_long_double] = builtin->builtin_long_double;
  lai->primitive_type_vector[c_primitive_type_complex] = builtin->builtin_complex;
  lai->primitive_type_vector[c_primitive_type_double_complex] = builtin->builtin_double_complex;
}/*;*/
Exemple #2
0
STATIC server_type *
get_server_type(char *game_type)
{
	server_type *result;

	result = get_builtin_type(game_type);
	if (result != NULL) {
		return (result);
	}

	return (get_config_type(game_type));
}
struct type *
linux_get_siginfo_type (struct gdbarch *gdbarch)
{
  struct type *int_type, *uint_type, *long_type, *void_ptr_type;
  struct type *uid_type, *pid_type;
  struct type *sigval_type, *clock_type;
  struct type *siginfo_type, *sifields_type;
  struct type *type;
  
  /* TODO: muck around in gdbtypes.[ch] until this all works: */

  int_type = arch_integer_type(gdbarch, gdbarch_int_bit(gdbarch),
			       0, "int");
  uint_type = arch_integer_type(gdbarch, gdbarch_int_bit(gdbarch),
				1, "unsigned int");
  long_type = arch_integer_type(gdbarch, gdbarch_long_bit(gdbarch),
				0, "long");
  void_ptr_type = lookup_pointer_type(get_builtin_type(gdbarch)->builtin_void);

  /* sigval_t */
  sigval_type = arch_composite_type(gdbarch, NULL, TYPE_CODE_UNION);
  TYPE_NAME(sigval_type) = xstrdup("sigval_t");
  append_composite_type_field(sigval_type, "sival_int", int_type);
  append_composite_type_field(sigval_type, "sival_ptr", void_ptr_type);

  /* __pid_t */
  pid_type = arch_type(gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH(int_type),
		       xstrdup("__pid_t"));
  TYPE_TARGET_TYPE(pid_type) = int_type;
  TYPE_TARGET_STUB(pid_type) = (struct type *)1;

  /* __uid_t */
  uid_type = arch_type(gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH(uint_type),
		       xstrdup("__uid_t"));
  TYPE_TARGET_TYPE(uid_type) = uint_type;
  TYPE_TARGET_STUB(uid_type) = (struct type *)1;

  /* __clock_t */
  clock_type = arch_type(gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH(long_type),
			 xstrdup("__clock_t"));
  TYPE_TARGET_TYPE(clock_type) = long_type;
  TYPE_TARGET_STUB(clock_type) = (struct type *)1;

  /* _sifields */
  sifields_type = arch_composite_type(gdbarch, NULL, TYPE_CODE_UNION);

  {
    const int si_max_size = 128;
    int si_pad_size;
    int size_of_int = (gdbarch_int_bit(gdbarch) / HOST_CHAR_BIT);

    /* _pad */
    if (gdbarch_ptr_bit(gdbarch) == 64)
      si_pad_size = ((si_max_size / size_of_int) - 4);
    else
      si_pad_size = ((si_max_size / size_of_int) - 3);
    append_composite_type_field(sifields_type, "_pad",
				init_vector_type(int_type, si_pad_size));
  }

  /* _kill */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_uid", uid_type);
  append_composite_type_field (sifields_type, "_kill", type);

  /* _timer */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_tid", int_type);
  append_composite_type_field (type, "si_overrun", int_type);
  append_composite_type_field (type, "si_sigval", sigval_type);
  append_composite_type_field (sifields_type, "_timer", type);

  /* _rt */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_uid", uid_type);
  append_composite_type_field (type, "si_sigval", sigval_type);
  append_composite_type_field (sifields_type, "_rt", type);

  /* _sigchld */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_uid", uid_type);
  append_composite_type_field (type, "si_status", int_type);
  append_composite_type_field (type, "si_utime", clock_type);
  append_composite_type_field (type, "si_stime", clock_type);
  append_composite_type_field (sifields_type, "_sigchld", type);

  /* _sigfault */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_addr", void_ptr_type);
  append_composite_type_field (sifields_type, "_sigfault", type);

  /* _sigpoll */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_band", long_type);
  append_composite_type_field (type, "si_fd", int_type);
  append_composite_type_field (sifields_type, "_sigpoll", type);

  /* struct siginfo */
  siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
  append_composite_type_field (siginfo_type, "si_signo", int_type);
  append_composite_type_field (siginfo_type, "si_errno", int_type);
  append_composite_type_field (siginfo_type, "si_code", int_type);
  append_composite_type_field_aligned (siginfo_type,
				       "_sifields", sifields_type,
				       TYPE_LENGTH (long_type));

  return siginfo_type;
}
static CORE_ADDR
lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
		      struct regcache *regcache, CORE_ADDR bp_addr,
		      int nargs, struct value **args, CORE_ADDR sp,
		      int struct_return, CORE_ADDR struct_addr)
{
  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
  int first_arg_reg = SIM_LM32_R1_REGNUM;
  int num_arg_regs = 8;
  int i;

  /* Set the return address.  */
  regcache_cooked_write_signed (regcache, SIM_LM32_RA_REGNUM, bp_addr);

  /* If we're returning a large struct, a pointer to the address to
     store it at is passed as a first hidden parameter.  */
  if (struct_return)
    {
      regcache_cooked_write_unsigned (regcache, first_arg_reg, struct_addr);
      first_arg_reg++;
      num_arg_regs--;
      sp -= 4;
    }

  /* Setup parameters.  */
  for (i = 0; i < nargs; i++)
    {
      struct value *arg = args[i];
      struct type *arg_type = check_typedef (value_type (arg));
      gdb_byte *contents;
      ULONGEST val;

      /* Promote small integer types to int.  */
      switch (TYPE_CODE (arg_type))
	{
	case TYPE_CODE_INT:
	case TYPE_CODE_BOOL:
	case TYPE_CODE_CHAR:
	case TYPE_CODE_RANGE:
	case TYPE_CODE_ENUM:
	  if (TYPE_LENGTH (arg_type) < 4)
	    {
	      arg_type = get_builtin_type(gdbarch)->builtin_int32;
	      arg = value_cast (arg_type, arg);
	    }
	  break;
	}

      /* FIXME: Handle structures.  */

      contents = (gdb_byte *) value_contents (arg);
      val = extract_unsigned_integer (contents, TYPE_LENGTH (arg_type),
				      byte_order);

      /* First num_arg_regs parameters are passed by registers, 
         and the rest are passed on the stack.  */
      if (i < num_arg_regs)
	regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val);
      else
	{
	  write_memory (sp, (void *) &val, TYPE_LENGTH (arg_type));
	  sp -= 4;
	}
    }

  /* Update stack pointer.  */
  regcache_cooked_write_signed (regcache, SIM_LM32_SP_REGNUM, sp);

  /* Return adjusted stack pointer.  */
  return sp;
}
static struct type *
lm32_register_type (struct gdbarch *gdbarch, int reg_nr)
{
  return get_builtin_type(gdbarch)->builtin_int32;
}