OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [linux-tdep.c] - Diff between revs 834 and 842

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 834 Rev 842
/* Target-dependent code for GNU/Linux, architecture independent.
/* Target-dependent code for GNU/Linux, architecture independent.
 
 
   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
#include "defs.h"
#include "defs.h"
#include "gdbtypes.h"
#include "gdbtypes.h"
#include "linux-tdep.h"
#include "linux-tdep.h"
#include "auxv.h"
#include "auxv.h"
#include "target.h"
#include "target.h"
#include "elf/common.h"
#include "elf/common.h"
 
 
/* This function is suitable for architectures that don't
/* This function is suitable for architectures that don't
   extend/override the standard siginfo structure.  */
   extend/override the standard siginfo structure.  */
 
 
struct type *
struct type *
linux_get_siginfo_type (struct gdbarch *gdbarch)
linux_get_siginfo_type (struct gdbarch *gdbarch)
{
{
  struct type *int_type, *uint_type, *long_type, *void_ptr_type;
  struct type *int_type, *uint_type, *long_type, *void_ptr_type;
  struct type *uid_type, *pid_type;
  struct type *uid_type, *pid_type;
  struct type *sigval_type, *clock_type;
  struct type *sigval_type, *clock_type;
  struct type *siginfo_type, *sifields_type;
  struct type *siginfo_type, *sifields_type;
  struct type *type;
  struct type *type;
 
 
  int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
  int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
                                0, "int");
                                0, "int");
  uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
  uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
                                 1, "unsigned int");
                                 1, "unsigned int");
  long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
  long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
                                 0, "long");
                                 0, "long");
  void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
  void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
 
 
  /* sival_t */
  /* sival_t */
  sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
  sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
  TYPE_NAME (sigval_type) = xstrdup ("sigval_t");
  TYPE_NAME (sigval_type) = xstrdup ("sigval_t");
  append_composite_type_field (sigval_type, "sival_int", int_type);
  append_composite_type_field (sigval_type, "sival_int", int_type);
  append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
  append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
 
 
  /* __pid_t */
  /* __pid_t */
  pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int_type),
  pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int_type),
                        xstrdup ("__pid_t"));
                        xstrdup ("__pid_t"));
  TYPE_TARGET_TYPE (pid_type) = int_type;
  TYPE_TARGET_TYPE (pid_type) = int_type;
  TYPE_TARGET_STUB (pid_type) = 1;
  TYPE_TARGET_STUB (pid_type) = 1;
 
 
  /* __uid_t */
  /* __uid_t */
  uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (uint_type),
  uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (uint_type),
                        xstrdup ("__uid_t"));
                        xstrdup ("__uid_t"));
  TYPE_TARGET_TYPE (uid_type) = uint_type;
  TYPE_TARGET_TYPE (uid_type) = uint_type;
  TYPE_TARGET_STUB (uid_type) = 1;
  TYPE_TARGET_STUB (uid_type) = 1;
 
 
  /* __clock_t */
  /* __clock_t */
  clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (long_type),
  clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (long_type),
                          xstrdup ("__clock_t"));
                          xstrdup ("__clock_t"));
  TYPE_TARGET_TYPE (clock_type) = long_type;
  TYPE_TARGET_TYPE (clock_type) = long_type;
  TYPE_TARGET_STUB (clock_type) = 1;
  TYPE_TARGET_STUB (clock_type) = 1;
 
 
  /* _sifields */
  /* _sifields */
  sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
  sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
 
 
  {
  {
    const int si_max_size = 128;
    const int si_max_size = 128;
    int si_pad_size;
    int si_pad_size;
    int size_of_int = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
    int size_of_int = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
 
 
    /* _pad */
    /* _pad */
    if (gdbarch_ptr_bit (gdbarch) == 64)
    if (gdbarch_ptr_bit (gdbarch) == 64)
      si_pad_size = (si_max_size / size_of_int) - 4;
      si_pad_size = (si_max_size / size_of_int) - 4;
    else
    else
      si_pad_size = (si_max_size / size_of_int) - 3;
      si_pad_size = (si_max_size / size_of_int) - 3;
    append_composite_type_field (sifields_type, "_pad",
    append_composite_type_field (sifields_type, "_pad",
                                 init_vector_type (int_type, si_pad_size));
                                 init_vector_type (int_type, si_pad_size));
  }
  }
 
 
  /* _kill */
  /* _kill */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_uid", uid_type);
  append_composite_type_field (type, "si_uid", uid_type);
  append_composite_type_field (sifields_type, "_kill", type);
  append_composite_type_field (sifields_type, "_kill", type);
 
 
  /* _timer */
  /* _timer */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_tid", int_type);
  append_composite_type_field (type, "si_tid", int_type);
  append_composite_type_field (type, "si_overrun", int_type);
  append_composite_type_field (type, "si_overrun", int_type);
  append_composite_type_field (type, "si_sigval", sigval_type);
  append_composite_type_field (type, "si_sigval", sigval_type);
  append_composite_type_field (sifields_type, "_timer", type);
  append_composite_type_field (sifields_type, "_timer", type);
 
 
  /* _rt */
  /* _rt */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_uid", uid_type);
  append_composite_type_field (type, "si_uid", uid_type);
  append_composite_type_field (type, "si_sigval", sigval_type);
  append_composite_type_field (type, "si_sigval", sigval_type);
  append_composite_type_field (sifields_type, "_rt", type);
  append_composite_type_field (sifields_type, "_rt", type);
 
 
  /* _sigchld */
  /* _sigchld */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_pid", pid_type);
  append_composite_type_field (type, "si_uid", uid_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_status", int_type);
  append_composite_type_field (type, "si_utime", clock_type);
  append_composite_type_field (type, "si_utime", clock_type);
  append_composite_type_field (type, "si_stime", clock_type);
  append_composite_type_field (type, "si_stime", clock_type);
  append_composite_type_field (sifields_type, "_sigchld", type);
  append_composite_type_field (sifields_type, "_sigchld", type);
 
 
  /* _sigfault */
  /* _sigfault */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_addr", void_ptr_type);
  append_composite_type_field (type, "si_addr", void_ptr_type);
  append_composite_type_field (sifields_type, "_sigfault", type);
  append_composite_type_field (sifields_type, "_sigfault", type);
 
 
  /* _sigpoll */
  /* _sigpoll */
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  append_composite_type_field (type, "si_band", long_type);
  append_composite_type_field (type, "si_band", long_type);
  append_composite_type_field (type, "si_fd", int_type);
  append_composite_type_field (type, "si_fd", int_type);
  append_composite_type_field (sifields_type, "_sigpoll", type);
  append_composite_type_field (sifields_type, "_sigpoll", type);
 
 
  /* struct siginfo */
  /* struct siginfo */
  siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
  TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
  TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
  append_composite_type_field (siginfo_type, "si_signo", int_type);
  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_errno", int_type);
  append_composite_type_field (siginfo_type, "si_code", int_type);
  append_composite_type_field (siginfo_type, "si_code", int_type);
  append_composite_type_field_aligned (siginfo_type,
  append_composite_type_field_aligned (siginfo_type,
                                       "_sifields", sifields_type,
                                       "_sifields", sifields_type,
                                       TYPE_LENGTH (long_type));
                                       TYPE_LENGTH (long_type));
 
 
  return siginfo_type;
  return siginfo_type;
}
}
 
 
int
int
linux_has_shared_address_space (void)
linux_has_shared_address_space (void)
{
{
  /* Determine whether we are running on uClinux or normal Linux
  /* Determine whether we are running on uClinux or normal Linux
     kernel.  */
     kernel.  */
  CORE_ADDR dummy;
  CORE_ADDR dummy;
  int target_is_uclinux;
  int target_is_uclinux;
 
 
  target_is_uclinux
  target_is_uclinux
    = (target_auxv_search (&current_target, AT_NULL, &dummy) > 0
    = (target_auxv_search (&current_target, AT_NULL, &dummy) > 0
       && target_auxv_search (&current_target, AT_PAGESZ, &dummy) == 0);
       && target_auxv_search (&current_target, AT_PAGESZ, &dummy) == 0);
 
 
  return target_is_uclinux;
  return target_is_uclinux;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.