From: nobody <> Date: Sat, 15 Jun 2002 12:26:34 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create tag X-Git-Tag: kseitz_interps-20020528-branchpoint X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5b67c51d76a9890eff2c1eddccdebfa28eef756;p=thirdparty%2Fbinutils-gdb.git This commit was manufactured by cvs2svn to create tag 'kseitz_interps-20020528-branchpoint'. Sprout from kseitz_interps-20020528-branch 2002-06-15 12:26:33 UTC nobody 'This commit was manufactured by cvs2svn to create branch' Cherrypick from kseitz_interps-20020528-branch 2002-05-28 18:43:09 UTC nobody 'This commit was manufactured by cvs2svn to create branch': gdb/ChangeLog gdb/Makefile.in gdb/defs.h gdb/event-loop.c gdb/event-top.c gdb/event-top.h gdb/main.c gdb/mi/mi-cmds.c gdb/mi/mi-cmds.h gdb/mi/mi-main.c gdb/top.c gdb/wrapper.c gdb/wrapper.h Delete: bfd/elf32-i386qnx.c bfd/elf32-sh64-com.c bfd/elf32-sh64-nbsd.c bfd/elf32-vax.c bfd/elf64-sh64-nbsd.c bfd/vax1knetbsd.c gdb/ada-exp.tab.c gdb/ada-exp.y gdb/ada-lang.h gdb/ada-lex.c gdb/ada-lex.l gdb/ada-tasks.c gdb/ada-typeprint.c gdb/ada-valprint.c gdb/cli/cli-interp.c gdb/config/sparc/nbsd64.mh gdb/config/sparc/nbsd64.mt gdb/config/sparc/tm-nbsd64.h gdb/gdbserver/acinclude.m4 gdb/gdbserver/proc-service.c gdb/gdbserver/thread-db.c gdb/i386-linux-tdep.h gdb/interps.c gdb/interps.h gdb/mi/mi-events.c gdb/mi/mi-interp.c gdb/mi/mi.h gdb/ppc-sysv-tdep.c gdb/sim-regno.h gdb/sparc64nbsd-nat.c gdb/sparcnbsd-nat.c gdb/sparcnbsd-tdep.c gdb/sparcnbsd-tdep.h gdb/testsuite/gdb.asm/x86_64.inc gdb/testsuite/gdb.base/macscp.exp gdb/testsuite/gdb.base/macscp1.c gdb/testsuite/gdb.base/macscp2.h gdb/testsuite/gdb.base/macscp3.h gdb/testsuite/gdb.base/macscp4.h gdb/testsuite/gdb.c++/m-static.cc gdb/testsuite/gdb.c++/m-static.exp include/elf/vax.h include/gdb/callback.h include/gdb/remote-sim.h sim/mips/cp1.h sim/mips/mdmx.igen sim/mips/mips3d.igen sim/mips/sb1.igen --- diff --git a/bfd/elf32-i386qnx.c b/bfd/elf32-i386qnx.c deleted file mode 100644 index 5f2e1113f4c..00000000000 --- a/bfd/elf32-i386qnx.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Intel 80386/80486 QNX specific support for 32-bit ELF - Copyright 2002 - Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define ELF32_I386_C_INCLUDED -#include "elf32-i386.c" - - /* Returns the end address of the segment + 1. */ -#define SEGMENT_END(segment, start) \ - (start + (segment->p_memsz > segment->p_filesz \ - ? segment->p_memsz : segment->p_filesz)) - -static boolean elf_i386qnx_copy_private_bfd_data_p - PARAMS ((bfd *, asection *, bfd *, asection *)); -static boolean elf_i386qnx_is_contained_by_filepos - PARAMS ((asection *, Elf_Internal_Phdr *)); -static void elf_i386qnx_set_nonloadable_filepos - PARAMS ((bfd *, Elf_Internal_Phdr *)); - -static boolean -elf_i386qnx_copy_private_bfd_data_p (ibfd, isec, obfd, osec) - bfd *ibfd; - asection *isec; - bfd *obfd; - asection *osec; -{ - /* We don't use these parameters, but another target might. */ - ibfd = ibfd; - obfd = obfd; - osec = osec; - return isec->next == NULL; -} - -static boolean -elf_i386qnx_is_contained_by_filepos (section, segment) - asection *section; - Elf_Internal_Phdr *segment; -{ - return ((bfd_vma) section->filepos >= segment->p_offset - && ((bfd_vma) section->filepos + section->_raw_size - <= SEGMENT_END (segment, segment->p_offset))); -} - -static void -elf_i386qnx_set_nonloadable_filepos (abfd, phdrs) - bfd *abfd; - Elf_Internal_Phdr *phdrs; -{ - struct elf_segment_map *m; - Elf_Internal_Phdr *p; - file_ptr off = 0; - - for (m = elf_tdata (abfd)->segment_map, p = phdrs; - m != NULL; - m = m->next, p++) - { - unsigned int i; - asection **secpp; - - for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) - { - asection *sec; - - sec = *secpp; - - if (p->p_type == PT_LOAD) - off = sec->filepos; - else - { - if (i == 0) - { - if (sec->filepos) - p->p_offset = sec->filepos; - else - p->p_offset = off; - } - if (!sec->filepos) - { - off += sec->_raw_size; - p->p_filesz += sec->_raw_size; - } - } - } - } - return; -} - -#undef TARGET_LITTLE_SYM -#define TARGET_LITTLE_SYM bfd_elf32_i386qnx_vec - -#define elf_backend_set_nonloadable_filepos elf_i386qnx_set_nonloadable_filepos -#define elf_backend_is_contained_by_filepos elf_i386qnx_is_contained_by_filepos -#define elf_backend_copy_private_bfd_data_p elf_i386qnx_copy_private_bfd_data_p - -#include "elf32-target.h" diff --git a/bfd/elf32-sh64-com.c b/bfd/elf32-sh64-com.c deleted file mode 100644 index ae2cab4e690..00000000000 --- a/bfd/elf32-sh64-com.c +++ /dev/null @@ -1,264 +0,0 @@ -/* Hitachi SH64-specific support for 32-bit ELF - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define SH64_ELF - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "elf-bfd.h" -#include "elf/sh.h" -#include "../opcodes/sh64-opc.h" - -static boolean sh64_address_in_cranges - PARAMS ((asection *cranges, bfd_vma, sh64_elf_crange *)); - -/* Ordering functions of a crange, for the qsort and bsearch calls and for - different endianness. */ - -int -_bfd_sh64_crange_qsort_cmpb (p1, p2) - const PTR p1; - const PTR p2; -{ - bfd_vma a1 = bfd_getb32 (p1); - bfd_vma a2 = bfd_getb32 (p2); - - /* Preserve order if there's ambiguous contents. */ - if (a1 == a2) - return (char *) p1 - (char *) p2; - - return a1 - a2; -} - -int -_bfd_sh64_crange_qsort_cmpl (p1, p2) - const PTR p1; - const PTR p2; -{ - bfd_vma a1 = (bfd_vma) bfd_getl32 (p1); - bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); - - /* Preserve order if there's ambiguous contents. */ - if (a1 == a2) - return (char *) p1 - (char *) p2; - - return a1 - a2; -} - -int -_bfd_sh64_crange_bsearch_cmpb (p1, p2) - const PTR p1; - const PTR p2; -{ - bfd_vma a1 = *(bfd_vma *) p1; - bfd_vma a2 = (bfd_vma) bfd_getb32 (p2); - bfd_size_type size - = (bfd_size_type) bfd_getb32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2); - - if (a1 >= a2 + size) - return 1; - if (a1 < a2) - return -1; - return 0; -} - -int -_bfd_sh64_crange_bsearch_cmpl (p1, p2) - const PTR p1; - const PTR p2; -{ - bfd_vma a1 = *(bfd_vma *) p1; - bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); - bfd_size_type size - = (bfd_size_type) bfd_getl32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2); - - if (a1 >= a2 + size) - return 1; - if (a1 < a2) - return -1; - return 0; -} - -/* Check whether a specific address is specified within a .cranges - section. Return FALSE if not found, and TRUE if found, and the region - filled into RANGEP if non-NULL. */ - -static boolean -sh64_address_in_cranges (cranges, addr, rangep) - asection *cranges; - bfd_vma addr; - sh64_elf_crange *rangep; -{ - bfd_byte *cranges_contents; - bfd_byte *found_rangep; - bfd_size_type cranges_size = bfd_section_size (cranges->owner, cranges); - - /* If the size is not a multiple of the cranges entry size, then - something is badly wrong. */ - if ((cranges_size % SH64_CRANGE_SIZE) != 0) - return false; - - /* If this section has relocations, then we can't do anything sane. */ - if (bfd_get_section_flags (cranges->owner, cranges) & SEC_RELOC) - return false; - - /* Has some kind soul (or previous call) left processed, sorted contents - for us? */ - if ((bfd_get_section_flags (cranges->owner, cranges) & SEC_IN_MEMORY) - && elf_section_data (cranges)->this_hdr.sh_type == SHT_SH5_CR_SORTED) - cranges_contents = cranges->contents; - else - { - cranges_contents - = bfd_malloc (cranges->_cooked_size == 0 - ? cranges->_cooked_size : cranges->_raw_size); - if (cranges_contents == NULL) - return false; - - if (! bfd_get_section_contents (cranges->owner, cranges, - cranges_contents, (file_ptr) 0, - cranges_size)) - goto error_return; - - /* Is it sorted? */ - if (elf_section_data (cranges)->this_hdr.sh_type - != SHT_SH5_CR_SORTED) - /* Nope. Lets sort it. */ - qsort (cranges_contents, cranges_size / SH64_CRANGE_SIZE, - SH64_CRANGE_SIZE, - bfd_big_endian (cranges->owner) - ? _bfd_sh64_crange_qsort_cmpb : _bfd_sh64_crange_qsort_cmpl); - - /* Let's keep it around. */ - cranges->contents = cranges_contents; - bfd_set_section_flags (cranges->owner, cranges, - bfd_get_section_flags (cranges->owner, cranges) - | SEC_IN_MEMORY); - - /* It's sorted now. */ - elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED; - } - - /* Try and find a matching range. */ - found_rangep - = bsearch (&addr, cranges_contents, cranges_size / SH64_CRANGE_SIZE, - SH64_CRANGE_SIZE, - bfd_big_endian (cranges->owner) - ? _bfd_sh64_crange_bsearch_cmpb - : _bfd_sh64_crange_bsearch_cmpl); - - /* Fill in a few return values if we found a matching range. */ - if (found_rangep) - { - enum sh64_elf_cr_type cr_type - = bfd_get_16 (cranges->owner, - SH64_CRANGE_CR_TYPE_OFFSET + found_rangep); - bfd_vma cr_addr - = bfd_get_32 (cranges->owner, - SH64_CRANGE_CR_ADDR_OFFSET - + (char *) found_rangep); - bfd_size_type cr_size - = bfd_get_32 (cranges->owner, - SH64_CRANGE_CR_SIZE_OFFSET - + (char *) found_rangep); - - rangep->cr_addr = cr_addr; - rangep->cr_size = cr_size; - rangep->cr_type = cr_type; - - return true; - } - - /* There is a .cranges section, but it does not have a descriptor - matching this address. */ - return false; - -error_return: - free (cranges_contents); - return false; -} - -/* Determine what ADDR points to in SEC, and fill in a range descriptor in - *RANGEP if it's non-NULL. */ - -enum sh64_elf_cr_type -sh64_get_contents_type (sec, addr, rangep) - asection *sec; - bfd_vma addr; - sh64_elf_crange *rangep; -{ - asection *cranges; - - /* Fill in the range with the boundaries of the section as a default. */ - if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour - && elf_elfheader (sec->owner)->e_type == ET_EXEC) - { - rangep->cr_addr = bfd_get_section_vma (sec->owner, sec); - rangep->cr_size = bfd_section_size (sec->owner, sec); - rangep->cr_type = CRT_NONE; - } - else - return false; - - /* If none of the pertinent bits are set, then it's a SHcompact (or at - least not SHmedia). */ - if ((elf_section_data (sec)->this_hdr.sh_flags - & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == 0) - { - enum sh64_elf_cr_type cr_type - = ((bfd_get_section_flags (sec->owner, sec) & SEC_CODE) != 0 - ? CRT_SH5_ISA16 : CRT_DATA); - rangep->cr_type = cr_type; - return cr_type; - } - - /* If only the SHF_SH5_ISA32 bit is set, then we have SHmedia. */ - if ((elf_section_data (sec)->this_hdr.sh_flags - & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == SHF_SH5_ISA32) - { - rangep->cr_type = CRT_SH5_ISA32; - return CRT_SH5_ISA32; - } - - /* Otherwise, we have to look up the .cranges section. */ - cranges = bfd_get_section_by_name (sec->owner, SH64_CRANGES_SECTION_NAME); - - if (cranges == NULL) - /* A mixed section but there's no .cranges section. This is probably - bad input; it does not comply to specs. */ - return CRT_NONE; - - /* If this call fails, we will still have CRT_NONE in rangep->cr_type - and that will be suitable to return. */ - sh64_address_in_cranges (cranges, addr, rangep); - - return rangep->cr_type; -} - -/* This is a simpler exported interface for the benefit of gdb et al. */ - -boolean -sh64_address_is_shmedia (sec, addr) - asection *sec; - bfd_vma addr; -{ - sh64_elf_crange dummy; - return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32; -} diff --git a/bfd/elf32-sh64-nbsd.c b/bfd/elf32-sh64-nbsd.c deleted file mode 100644 index 2d3e3d99dbd..00000000000 --- a/bfd/elf32-sh64-nbsd.c +++ /dev/null @@ -1,29 +0,0 @@ -/* SuperH SH64 specific support for 32-bit NetBSD - Copyright 2002 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_BIG_SYM bfd_elf32_sh64nbsd_vec -#define TARGET_BIG_NAME "elf32-sh64-nbsd" -#define TARGET_LITTLE_SYM bfd_elf32_sh64lnbsd_vec -#define TARGET_LITTLE_NAME "elf32-sh64l-nbsd" -#define ELF_ARCH bfd_arch_sh -#define ELF_MACHINE_CODE EM_SH -#define ELF_MAXPAGESIZE 0x10000 -#define elf_symbol_leading_char 0 - -#include "elf32-sh64.c" diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c deleted file mode 100644 index 8901188b7c6..00000000000 --- a/bfd/elf32-vax.c +++ /dev/null @@ -1,2214 +0,0 @@ -/* VAX series support for 32-bit ELF - Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. - Contributed by Matt Thomas . - -This file is part of BFD, the Binary File Descriptor library. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libbfd.h" -#include "elf-bfd.h" -#include "elf/vax.h" - -static reloc_howto_type *reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void rtype_to_howto - PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); -static struct bfd_hash_entry *elf_vax_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static struct bfd_link_hash_table *elf_vax_link_hash_table_create - PARAMS ((bfd *)); -static boolean elf_vax_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static asection *elf_vax_gc_mark_hook - PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static boolean elf_vax_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static boolean elf_vax_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static boolean elf_vax_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean elf_vax_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static boolean elf_vax_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -static boolean elf_vax_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); - -static boolean elf32_vax_set_private_flags - PARAMS ((bfd *, flagword)); -static boolean elf32_vax_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); -static boolean elf32_vax_print_private_bfd_data - PARAMS ((bfd *, PTR)); - -static reloc_howto_type howto_table[] = { - HOWTO (R_VAX_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0x00000000, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_VAX_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_VAX_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_VAX_8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_8", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0x000000ff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_VAX_PC32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_PC32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - true), /* pcrel_offset */ - - HOWTO (R_VAX_PC16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_PC16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - true), /* pcrel_offset */ - - HOWTO (R_VAX_PC8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_PC8", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0x000000ff, /* dst_mask */ - true), /* pcrel_offset */ - - HOWTO (R_VAX_GOT32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_GOT32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - true), /* pcrel_offset */ - - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - - HOWTO (R_VAX_PLT32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_PLT32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - true), /* pcrel_offset */ - - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - - HOWTO (R_VAX_COPY, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_COPY", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_VAX_GLOB_DAT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_GLOB_DAT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_VAX_JMP_SLOT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_JMP_SLOT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_VAX_RELATIVE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_VAX_RELATIVE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GNU extension to record C++ vtable hierarchy */ - HOWTO (R_VAX_GNU_VTINHERIT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ - "R_VAX_GNU_VTINHERIT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* GNU extension to record C++ vtable member usage */ - HOWTO (R_VAX_GNU_VTENTRY, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_elf_rel_vtable_reloc_fn, /* special_function */ - "R_VAX_GNU_VTENTRY", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ -}; - -static void -rtype_to_howto (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; -{ - BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_VAX_max); - cache_ptr->howto = &howto_table[ELF32_R_TYPE(dst->r_info)]; -} - -#define elf_info_to_howto rtype_to_howto - -static const struct -{ - bfd_reloc_code_real_type bfd_val; - int elf_val; -} reloc_map[] = { - { BFD_RELOC_NONE, R_VAX_NONE }, - { BFD_RELOC_32, R_VAX_32 }, - { BFD_RELOC_16, R_VAX_16 }, - { BFD_RELOC_8, R_VAX_8 }, - { BFD_RELOC_32_PCREL, R_VAX_PC32 }, - { BFD_RELOC_16_PCREL, R_VAX_PC16 }, - { BFD_RELOC_8_PCREL, R_VAX_PC8 }, - { BFD_RELOC_32_GOT_PCREL, R_VAX_GOT32 }, - { BFD_RELOC_32_PLT_PCREL, R_VAX_PLT32 }, - { BFD_RELOC_NONE, R_VAX_COPY }, - { BFD_RELOC_VAX_GLOB_DAT, R_VAX_GLOB_DAT }, - { BFD_RELOC_VAX_JMP_SLOT, R_VAX_JMP_SLOT }, - { BFD_RELOC_VAX_RELATIVE, R_VAX_RELATIVE }, - { BFD_RELOC_CTOR, R_VAX_32 }, - { BFD_RELOC_VTABLE_INHERIT, R_VAX_GNU_VTINHERIT }, - { BFD_RELOC_VTABLE_ENTRY, R_VAX_GNU_VTENTRY }, -}; - -static reloc_howto_type * -reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - unsigned int i; - for (i = 0; i < sizeof (reloc_map) / sizeof (reloc_map[0]); i++) - { - if (reloc_map[i].bfd_val == code) - return &howto_table[reloc_map[i].elf_val]; - } - return 0; -} - -#define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup -#define ELF_ARCH bfd_arch_vax -/* end code generated by elf.el */ - -#define USE_RELA - -/* Functions for the VAX ELF linker. */ - -/* The name of the dynamic interpreter. This is put in the .interp - section. */ - -#define ELF_DYNAMIC_INTERPRETER "/usr/libexec/ld.elf_so" - -/* The size in bytes of an entry in the procedure linkage table. */ - -#define PLT_ENTRY_SIZE 12 - -/* The first entry in a procedure linkage table looks like this. See - the SVR4 ABI VAX supplement to see how this works. */ - -static const bfd_byte elf_vax_plt0_entry[PLT_ENTRY_SIZE] = -{ - 0xdd, 0xef, /* pushl l^ */ - 0, 0, 0, 0, /* offset to .plt.got + 4 */ - 0x17, 0xff, /* jmp @L^(pc) */ - 0, 0, 0, 0, /* offset to .plt.got + 8 */ -}; - -/* Subsequent entries in a procedure linkage table look like this. */ - -static const bfd_byte elf_vax_plt_entry[PLT_ENTRY_SIZE] = -{ - 0x40, 0x00, /* .word ^M */ - 0x16, 0xef, /* jsb L^(pc) */ - 0, 0, 0, 0, /* replaced with offset to start of .plt */ - 0, 0, 0, 0, /* index into .rela.plt */ -}; - -/* The VAX linker needs to keep track of the number of relocs that it - decides to copy in check_relocs for each symbol. This is so that it - can discard PC relative relocs if it doesn't need them when linking - with -Bsymbolic. We store the information in a field extending the - regular ELF linker hash table. */ - -/* This structure keeps track of the number of PC relative relocs we have - copied for a given symbol. */ - -struct elf_vax_pcrel_relocs_copied -{ - /* Next section. */ - struct elf_vax_pcrel_relocs_copied *next; - /* A section in dynobj. */ - asection *section; - /* Number of relocs copied in this section. */ - bfd_size_type count; -}; - -/* VAX ELF linker hash entry. */ - -struct elf_vax_link_hash_entry -{ - struct elf_link_hash_entry root; - - /* Number of PC relative relocs copied for this symbol. */ - struct elf_vax_pcrel_relocs_copied *pcrel_relocs_copied; - - bfd_vma got_addend; -}; - -/* VAX ELF linker hash table. */ - -struct elf_vax_link_hash_table -{ - struct elf_link_hash_table root; -}; - -/* Declare this now that the above structures are defined. */ - -static boolean elf_vax_discard_copies - PARAMS ((struct elf_vax_link_hash_entry *, PTR)); - -/* Traverse an VAX ELF linker hash table. */ - -#define elf_vax_link_hash_traverse(table, func, info) \ - (elf_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the VAX ELF linker hash table from a link_info structure. */ - -#define elf_vax_hash_table(p) \ - ((struct elf_vax_link_hash_table *) (p)->hash) - -/* Create an entry in an VAX ELF linker hash table. */ - -static struct bfd_hash_entry * -elf_vax_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct elf_vax_link_hash_entry *ret = - (struct elf_vax_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct elf_vax_link_hash_entry *) NULL) - ret = ((struct elf_vax_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf_vax_link_hash_entry))); - if (ret == (struct elf_vax_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct elf_vax_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct elf_vax_link_hash_entry *) NULL) - { - ret->pcrel_relocs_copied = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Create an VAX ELF linker hash table. */ - -static struct bfd_link_hash_table * -elf_vax_link_hash_table_create (abfd) - bfd *abfd; -{ - struct elf_vax_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_vax_link_hash_table); - - ret = (struct elf_vax_link_hash_table *) bfd_malloc (amt); - if (ret == (struct elf_vax_link_hash_table *) NULL) - return NULL; - - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - elf_vax_link_hash_newfunc)) - { - free (ret); - return NULL; - } - - return &ret->root.root; -} - -/* Keep vax-specific flags in the ELF header */ -static boolean -elf32_vax_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; -{ - elf_elfheader (abfd)->e_flags = flags; - elf_flags_init (abfd) = true; - return true; -} - -/* Merge backend specific data from an object file to the output - object file when linking. */ -static boolean -elf32_vax_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - flagword out_flags; - flagword in_flags; - - if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - in_flags = elf_elfheader (ibfd)->e_flags; - out_flags = elf_elfheader (obfd)->e_flags; - - if (!elf_flags_init (obfd)) - { - elf_flags_init (obfd) = true; - elf_elfheader (obfd)->e_flags = in_flags; - } - - return true; -} - -/* Display the flags field */ -static boolean -elf32_vax_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; -{ - FILE *file = (FILE *) ptr; - - BFD_ASSERT (abfd != NULL && ptr != NULL); - - /* Print normal ELF private data. */ - _bfd_elf_print_private_bfd_data (abfd, ptr); - - /* Ignore init flag - it may not be set, despite the flags field containing valid data. */ - - /* xgettext:c-format */ - fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); - - if (elf_elfheader (abfd)->e_flags & EF_NONPIC) - fprintf (file, _(" [nonpic]")); - - if (elf_elfheader (abfd)->e_flags & EF_DFLOAT) - fprintf (file, _(" [d-float]")); - - if (elf_elfheader (abfd)->e_flags & EF_GFLOAT) - fprintf (file, _(" [g-float]")); - - fputc ('\n', file); - - return true; -} -/* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. */ - -static boolean -elf_vax_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - bfd *dynobj; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; - const Elf_Internal_Rela *rel; - const Elf_Internal_Rela *rel_end; - asection *sgot; - asection *srelgot; - asection *sreloc; - - if (info->relocateable) - return true; - - dynobj = elf_hash_table (info)->dynobj; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - - sgot = NULL; - srelgot = NULL; - sreloc = NULL; - - rel_end = relocs + sec->reloc_count; - for (rel = relocs; rel < rel_end; rel++) - { - unsigned long r_symndx; - struct elf_link_hash_entry *h; - - r_symndx = ELF32_R_SYM (rel->r_info); - - if (r_symndx < symtab_hdr->sh_info) - h = NULL; - else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_VAX_GOT32: - if (h != NULL - && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) - break; - - /* This symbol requires a global offset table entry. */ - - if (dynobj == NULL) - { - /* Create the .got section. */ - elf_hash_table (info)->dynobj = dynobj = abfd; - if (!_bfd_elf_create_got_section (dynobj, info)) - return false; - } - - if (sgot == NULL) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } - - if (srelgot == NULL - && (h != NULL || info->shared)) - { - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - if (srelgot == NULL) - { - srelgot = bfd_make_section (dynobj, ".rela.got"); - if (srelgot == NULL - || !bfd_set_section_flags (dynobj, srelgot, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (dynobj, srelgot, 2)) - return false; - } - } - - if (h != NULL) - { - struct elf_vax_link_hash_entry *eh; - - eh = (struct elf_vax_link_hash_entry *) h; - if (h->got.refcount == -1) - { - h->got.refcount = 1; - eh->got_addend = rel->r_addend; - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (!bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - - /* Allocate space in the .got section. */ - sgot->_raw_size += 4; - /* Allocate relocation space. */ - srelgot->_raw_size += sizeof (Elf32_External_Rela); - } - else - { - h->got.refcount++; - if (eh->got_addend != (bfd_vma) rel->r_addend) - (*_bfd_error_handler) - (_("%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld"), - bfd_get_filename (abfd), rel->r_addend, - h->root.root.string, - eh->got_addend); - - } - } - break; - - case R_VAX_PLT32: - /* This symbol requires a procedure linkage table entry. We - actually build the entry in adjust_dynamic_symbol, - because this might be a case of linking PIC code which is - never referenced by a dynamic object, in which case we - don't need to generate a procedure linkage table entry - after all. */ - - /* If this is a local symbol, we resolve it directly without - creating a procedure linkage table entry. */ - if (h == NULL) - continue; - - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; - break; - - case R_VAX_PC8: - case R_VAX_PC16: - case R_VAX_PC32: - /* If we are creating a shared library and this is not a local - symbol, we need to copy the reloc into the shared library. - However when linking with -Bsymbolic and this is a global - symbol which is defined in an object we are including in the - link (i.e., DEF_REGULAR is set), then we can resolve the - reloc directly. At this point we have not seen all the input - files, so it is possible that DEF_REGULAR is not set now but - will be set later (it is never cleared). We account for that - possibility below by storing information in the - pcrel_relocs_copied field of the hash table entry. */ - if (!(info->shared - && (sec->flags & SEC_ALLOC) != 0 - && h != NULL - && (!info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) - { - if (h != NULL) - { - /* Make sure a plt entry is created for this symbol if - it turns out to be a function defined by a dynamic - object. */ - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; - } - break; - } - /* Fall through. */ - case R_VAX_8: - case R_VAX_16: - case R_VAX_32: - if (h != NULL) - { - /* Make sure a plt entry is created for this symbol if it - turns out to be a function defined by a dynamic object. */ - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; - } - - /* If we are creating a shared library, we need to copy the - reloc into the shared library. */ - if (info->shared - && (sec->flags & SEC_ALLOC) != 0) - { - /* When creating a shared object, we must copy these - reloc types into the output file. We create a reloc - section in dynobj and make room for this reloc. */ - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name)); - if (name == NULL) - return false; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - sreloc = bfd_make_section (dynobj, name); - if (sreloc == NULL - || !bfd_set_section_flags (dynobj, sreloc, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (dynobj, sreloc, 2)) - return false; - } - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; - } - - sreloc->_raw_size += sizeof (Elf32_External_Rela); - - /* If we are linking with -Bsymbolic, we count the number of - PC relative relocations we have entered for this symbol, - so that we can discard them again if the symbol is later - defined by a regular object. Note that this function is - only called if we are using an vaxelf linker hash table, - which means that h is really a pointer to an - elf_vax_link_hash_entry. */ - if ((ELF32_R_TYPE (rel->r_info) == R_VAX_PC8 - || ELF32_R_TYPE (rel->r_info) == R_VAX_PC16 - || ELF32_R_TYPE (rel->r_info) == R_VAX_PC32) - && info->symbolic) - { - struct elf_vax_link_hash_entry *eh; - struct elf_vax_pcrel_relocs_copied *p; - - eh = (struct elf_vax_link_hash_entry *) h; - - for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) - if (p->section == sreloc) - break; - - if (p == NULL) - { - p = ((struct elf_vax_pcrel_relocs_copied *) - bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); - if (p == NULL) - return false; - p->next = eh->pcrel_relocs_copied; - eh->pcrel_relocs_copied = p; - p->section = sreloc; - p->count = 0; - } - - ++p->count; - } - } - - break; - - /* This relocation describes the C++ object vtable hierarchy. - Reconstruct it for later use during GC. */ - case R_VAX_GNU_VTINHERIT: - if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return false; - break; - - /* This relocation describes which C++ vtable entries are actually - used. Record for later use during GC. */ - case R_VAX_GNU_VTENTRY: - if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) - return false; - break; - - default: - break; - } - } - - return true; -} - -/* Return the section that should be marked against GC for a given - relocation. */ - -static asection * -elf_vax_gc_mark_hook (abfd, info, rel, h, sym) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_VAX_GNU_VTINHERIT: - case R_VAX_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - default: - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - } - } - } - else - { - return bfd_section_from_elf_index (abfd, sym->st_shndx); - } - - return NULL; -} - -/* Update the got entry reference counts for the section being removed. */ - -static boolean -elf_vax_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; - const Elf_Internal_Rela *rel, *relend; - unsigned long r_symndx; - struct elf_link_hash_entry *h; - bfd *dynobj; - asection *sgot; - asection *srelgot; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - - dynobj = elf_hash_table (info)->dynobj; - if (dynobj == NULL) - return true; - - sgot = bfd_get_section_by_name (dynobj, ".got"); - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - - relend = relocs + sec->reloc_count; - for (rel = relocs; rel < relend; rel++) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_VAX_GOT32: - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - if (h->got.refcount > 0) - { - --h->got.refcount; - if (h->got.refcount == 0) - { - /* We don't need the .got entry any more. */ - sgot->_raw_size -= 4; - srelgot->_raw_size -= sizeof (Elf32_External_Rela); - } - } - } - else if (local_got_refcounts != NULL) - { - if (local_got_refcounts[r_symndx] > 0) - { - --local_got_refcounts[r_symndx]; - if (local_got_refcounts[r_symndx] == 0) - { - /* We don't need the .got entry any more. */ - sgot->_raw_size -= 4; - if (info->shared) - srelgot->_raw_size -= sizeof (Elf32_External_Rela); - } - } - } - break; - - case R_VAX_PLT32: - case R_VAX_PC8: - case R_VAX_PC16: - case R_VAX_PC32: - case R_VAX_8: - case R_VAX_16: - case R_VAX_32: - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - if (h->plt.refcount > 0) - --h->plt.refcount; - } - break; - - default: - break; - } - } - - return true; -} - -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -static boolean -elf_vax_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - bfd *dynobj; - asection *s; - unsigned int power_of_two; - - dynobj = elf_hash_table (info)->dynobj; - - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - - /* If this is a function, put it in the procedure linkage table. We - will fill in the contents of the procedure linkage table later, - when we know the address of the .got section. */ - if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 - /* We must always create the plt entry if it was referenced - by a PLTxxO relocation. In this case we already recorded - it as a dynamic symbol. */ - && h->dynindx == -1) - { - /* This case can occur if we saw a PLTxx reloc in an input - file, but the symbol was never referred to by a dynamic - object. In such a case, we don't actually need to build - a procedure linkage table, and we can just do a PCxx - reloc instead. */ - BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); - h->plt.offset = (bfd_vma) -1; - return true; - } - - /* GC may have rendered this entry unused. */ - if (h->plt.refcount <= 0) - { - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - h->plt.offset = (bfd_vma) -1; - return true; - } - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - - /* If this is the first .plt entry, make room for the special - first entry. */ - if (s->_raw_size == 0) - { - s->_raw_size += PLT_ENTRY_SIZE; - } - - /* If this symbol is not defined in a regular file, and we are - not generating a shared library, then set the symbol to this - location in the .plt. This is required to make function - pointers compare as equal between the normal executable and - the shared library. */ - if (!info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - } - - h->plt.offset = s->_raw_size; - - /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; - - /* We also need to make an entry in the .got.plt section, which - will be placed in the .got section by the linker script. */ - - s = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += 4; - - /* We also need to make an entry in the .rela.plt section. */ - - s = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf32_External_Rela); - - return true; - } - - /* Reinitialize the plt offset now that it is not used as a reference - count any more. */ - h->plt.offset = (bfd_vma) -1; - - /* If this is a weak symbol, and there is a real definition, the - processor independent code will have arranged for us to see the - real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) - { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; - return true; - } - - /* This is a reference to a symbol defined by a dynamic object which - is not a function. */ - - /* If we are creating a shared library, we must presume that the - only references to the symbol are via the global offset table. - For such cases we need not do anything here; the relocations will - be handled correctly by relocate_section. */ - if (info->shared) - return true; - - /* We must allocate the symbol in our .dynbss section, which will - become part of the .bss section of the executable. There will be - an entry for this symbol in the .dynsym section. The dynamic - object will contain position independent code, so all references - from the dynamic object to this symbol will go through the global - offset table. The dynamic linker will use the .dynsym entry to - determine the address it must put in the global offset table, so - both the dynamic object and the regular object will refer to the - same memory location for the variable. */ - - s = bfd_get_section_by_name (dynobj, ".dynbss"); - BFD_ASSERT (s != NULL); - - /* We must generate a R_VAX_COPY reloc to tell the dynamic linker to - copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) - { - asection *srel; - - srel = bfd_get_section_by_name (dynobj, ".rela.bss"); - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf32_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; - } - - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 3) - power_of_two = 3; - - /* Apply the required alignment. */ - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) - { - if (!bfd_set_section_alignment (dynobj, s, power_of_two)) - return false; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - - /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; - - return true; -} - -/* Set the sizes of the dynamic sections. */ - -static boolean -elf_vax_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *s; - boolean plt; - boolean relocs; - boolean reltext; - - dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Set the contents of the .interp section to the interpreter. */ - if (!info->shared) - { - s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; - s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; - } - } - else - { - /* We may have created entries in the .rela.got and .got sections. - However, if we are not creating the dynamic sections, we will - not actually use these entries. Reset the size of .rela.got - and .got, which will cause it to get stripped from the output - file below. */ - s = bfd_get_section_by_name (dynobj, ".rela.got"); - if (s != NULL) - s->_raw_size = 0; - s = bfd_get_section_by_name (dynobj, ".got.plt"); - if (s != NULL) - s->_raw_size = 0; - s = bfd_get_section_by_name (dynobj, ".got"); - if (s != NULL) - s->_raw_size = 0; - } - - /* If this is a -Bsymbolic shared link, then we need to discard all PC - relative relocs against symbols defined in a regular object. We - allocated space for them in the check_relocs routine, but we will not - fill them in in the relocate_section routine. */ - if (info->shared && info->symbolic) - elf_vax_link_hash_traverse (elf_vax_hash_table (info), - elf_vax_discard_copies, - (PTR) NULL); - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - plt = false; - relocs = false; - reltext = false; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - boolean strip; - - if ((s->flags & SEC_LINKER_CREATED) == 0) - continue; - - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - strip = false; - - if (strcmp (name, ".plt") == 0) - { - if (s->_raw_size == 0) - { - /* Strip this section if we don't need it; see the - comment below. */ - strip = true; - } - else - { - /* Remember whether there is a PLT. */ - plt = true; - } - } - else if (strncmp (name, ".rela", 5) == 0) - { - if (s->_raw_size == 0) - { - /* If we don't need this section, strip it from the - output file. This is mostly to handle .rela.bss and - .rela.plt. We must create both sections in - create_dynamic_sections, because they must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - strip = true; - } - else - { - asection *target; - - /* Remember whether there are any reloc sections other - than .rela.plt. */ - if (strcmp (name, ".rela.plt") != 0) - { - const char *outname; - - relocs = true; - - /* If this relocation section applies to a read only - section, then we probably need a DT_TEXTREL - entry. .rela.plt is actually associated with - .got.plt, which is never readonly. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 5); - if (target != NULL - && (target->flags & SEC_READONLY) != 0 - && (target->flags & SEC_ALLOC) != 0) - reltext = true; - } - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } - } - else if (strncmp (name, ".got", 4) != 0) - { - /* It's not one of our sections, so don't allocate space. */ - continue; - } - - if (strip) - { - _bfd_strip_section_from_output (info, s); - continue; - } - - /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in elf_vax_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ -#define add_dynamic_entry(TAG, VAL) \ - bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) - - if (!info->shared) - { - if (!add_dynamic_entry (DT_DEBUG, 0)) - return false; - } - - if (plt) - { - if (!add_dynamic_entry (DT_PLTGOT, 0) - || !add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_RELA) - || !add_dynamic_entry (DT_JMPREL, 0)) - return false; - } - - if (relocs) - { - if (!add_dynamic_entry (DT_RELA, 0) - || !add_dynamic_entry (DT_RELASZ, 0) - || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) - return false; - } - - if (reltext || (info->flags & DF_TEXTREL) != 0) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return false; - } - } -#undef add_dynamic_entry - - return true; -} - -/* This function is called via elf_vax_link_hash_traverse if we are - creating a shared object with -Bsymbolic. It discards the space - allocated to copy PC relative relocs against symbols which are defined - in regular objects. We allocated space for them in the check_relocs - routine, but we won't fill them in in the relocate_section routine. */ - -/*ARGSUSED*/ -static boolean -elf_vax_discard_copies (h, ignore) - struct elf_vax_link_hash_entry *h; - PTR ignore ATTRIBUTE_UNUSED; -{ - struct elf_vax_pcrel_relocs_copied *s; - - if (h->root.root.type == bfd_link_hash_warning) - h = (struct elf_vax_link_hash_entry *) h->root.root.u.i.link; - - /* We only discard relocs for symbols defined in a regular object. */ - if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - return true; - - for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) - s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela); - - return true; -} - -/* Relocate an VAX ELF section. */ - -static boolean -elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; -{ - bfd *dynobj; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_vma *local_got_offsets; - bfd_vma plt_index; - bfd_vma got_offset; - asection *sgot; - asection *splt; - asection *sgotplt; - asection *sreloc; - Elf_Internal_Rela *rel; - Elf_Internal_Rela *relend; - - dynobj = elf_hash_table (info)->dynobj; - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - local_got_offsets = elf_local_got_offsets (input_bfd); - - sgot = NULL; - splt = NULL; - sgotplt = NULL; - sreloc = NULL; - - rel = relocs; - relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++) - { - int r_type; - reloc_howto_type *howto; - unsigned long r_symndx; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; - asection *sec; - bfd_vma relocation; - bfd_reloc_status_type r; - - r_type = ELF32_R_TYPE (rel->r_info); - if (r_type < 0 || r_type >= (int) R_VAX_max) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - howto = howto_table + r_type; - - r_symndx = ELF32_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ - h = NULL; - sym = NULL; - sec = NULL; - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); - } - else - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - if ((r_type == R_VAX_PLT32 - && h->plt.offset != (bfd_vma) -1 - && elf_hash_table (info)->dynamic_sections_created) - || (r_type == R_VAX_GOT32 - && strcmp (h->root.root.string, - "_GLOBAL_OFFSET_TABLE_") != 0 - && elf_hash_table (info)->dynamic_sections_created - && (! info->shared - || (! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - || (info->shared - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) - && ((input_section->flags & SEC_ALLOC) != 0 - /* DWARF will emit R_VAX_32 relocations in its - sections against symbols defined externally - in shared libraries. We can't do anything - with them here. */ - - || ((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) - && (r_type == R_VAX_8 - || r_type == R_VAX_16 - || r_type == R_VAX_32 - || r_type == R_VAX_PC8 - || r_type == R_VAX_PC16 - || r_type == R_VAX_PC32))) - { - /* In these cases, we don't need the relocation - value. We check specially because in some - obscure cases sec->output_section will be NULL. */ - relocation = 0; - } - else - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else if (h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else if (info->shared - && (!info->symbolic || info->allow_shlib_undefined) - && !info->no_undefined - && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) - relocation = 0; - else - { - if (!(info->callbacks->undefined_symbol - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, - (!info->shared || info->no_undefined - || ELF_ST_VISIBILITY (h->other))))) - return false; - relocation = 0; - } - } - - switch (r_type) - { - case R_VAX_GOT32: - /* Relocation is to the address of the entry for this symbol - in the global offset table. */ - if (h != NULL - && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) - break; - - /* Relocation is the offset of the entry for this symbol in - the global offset table. */ - - { - bfd_vma off; - - if (!elf_hash_table (info)->dynamic_sections_created - || (h == NULL) - || (info->shared - && info->symbolic - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a -Bsymbolic link - and the symbol is defined locally or there is no symbol. - Change the GOT32 entry to a PC32 entry. */ - break; - } - - if (sgot == NULL) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } - - BFD_ASSERT (h != NULL); - off = h->got.offset; - BFD_ASSERT (off != (bfd_vma) -1); - - if (info->shared - && h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - { - /* The symbol was forced to be local - because of a version file.. We must initialize - this entry in the global offset table. Since - the offset must always be a multiple of 4, we - use the least significant bit to record whether - we have initialized it already. - - When doing a dynamic link, we create a .rela.got - relocation entry to initialize the value. This - is done in the finish_dynamic_symbol routine. */ - if ((off & 1) != 0) - off &= ~1; - else - { - bfd_put_32 (output_bfd, relocation + rel->r_addend, - sgot->contents + off); - h->got.offset |= 1; - } - } else { - bfd_put_32 (output_bfd, rel->r_addend, sgot->contents + off); - } - - relocation = sgot->output_offset + off; - /* Neither GOT relocation uses the addend. */ - rel->r_addend = 0; - - if (r_type == R_VAX_GOT32) - { - /* Change the reference to be indirect */ - contents[rel->r_offset - 1] |= 0x10; - relocation += sgot->output_section->vma; - } - } - break; - - case R_VAX_PLT32: - /* Relocation is to the entry for this symbol in the - procedure linkage table. */ - - /* Resolve a PLTxx reloc against a local symbol directly, - without using the procedure linkage table. */ - if (h == NULL) - break; - - if (h->plt.offset == (bfd_vma) -1 - || !elf_hash_table (info)->dynamic_sections_created) - { - /* We didn't make a PLT entry for this symbol. This - happens when statically linking PIC code, or when - using -Bsymbolic. */ - break; - } - - if (splt == NULL) - { - splt = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (splt != NULL); - } - - if (sgotplt == NULL) - { - sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (splt != NULL); - } - - plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; - - /* Get the offset into the .got table of the entry that - corresponds to this function. Each .got entry is 4 bytes. - The first two are reserved. */ - got_offset = (plt_index + 3) * 4; - - /* We want the relocate to point into the .got.plt instead - of the plt itself. */ - relocation = (sgotplt->output_section->vma - + sgotplt->output_offset - + got_offset); - contents[rel->r_offset-1] |= 0x10; /* make indirect */ - if (rel->r_addend == 2) - { - h->plt.offset |= 1; - } - else if (rel->r_addend != 0) - (*_bfd_error_handler) - (_("%s: warning: PLT addend of %d to `%s' from %s section ignored"), - bfd_get_filename (input_bfd), rel->r_addend, - h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); - rel->r_addend = 0; - - break; - - case R_VAX_PC8: - case R_VAX_PC16: - case R_VAX_PC32: - if (h == NULL) - break; - /* Fall through. */ - case R_VAX_8: - case R_VAX_16: - case R_VAX_32: - if (info->shared - && r_symndx != 0 - && (input_section->flags & SEC_ALLOC) != 0 - && ((r_type != R_VAX_PC8 - && r_type != R_VAX_PC16 - && r_type != R_VAX_PC32) - || (!info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) - { - Elf_Internal_Rela outrel; - boolean skip, relocate; - - /* When generating a shared object, these relocations - are copied into the output file to be resolved at run - time. */ - - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return false; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - - skip = false; - relocate = false; - - outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, - rel->r_offset); - if (outrel.r_offset == (bfd_vma) -1) - skip = true; - if (outrel.r_offset == (bfd_vma) -2) - skip = true, relocate = true; - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - - if (skip) - memset (&outrel, 0, sizeof outrel); - /* h->dynindx may be -1 if the symbol was marked to - become local. */ - else if (h != NULL - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - BFD_ASSERT (h->dynindx != -1); - outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); - outrel.r_addend = relocation + rel->r_addend; - } - else - { - if (r_type == R_VAX_32) - { - relocate = true; - outrel.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE); - BFD_ASSERT (bfd_get_signed_32 (input_bfd, - &contents[rel->r_offset]) == 0); - outrel.r_addend = relocation + rel->r_addend; - } - else - { - long indx; - - if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) - indx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - asection *osec; - - osec = sec->output_section; - indx = elf_section_data (osec)->dynindx; - BFD_ASSERT (indx > 0); - } - - outrel.r_info = ELF32_R_INFO (indx, r_type); - outrel.r_addend = relocation + rel->r_addend; - } - } - - if (!strcmp (bfd_get_section_name (input_bfd, input_section), - ".text") != 0 || - (info->shared - && ELF32_R_TYPE(outrel.r_info) != R_VAX_32 - && ELF32_R_TYPE(outrel.r_info) != R_VAX_RELATIVE - && ELF32_R_TYPE(outrel.r_info) != R_VAX_COPY - && ELF32_R_TYPE(outrel.r_info) != R_VAX_JMP_SLOT - && ELF32_R_TYPE(outrel.r_info) != R_VAX_GLOB_DAT)) - { - if (h != NULL) - (*_bfd_error_handler) - (_("%s: warning: %s relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), howto->name, - h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); - else - (*_bfd_error_handler) - (_("%s: warning: %s relocation to 0x%x from %s section"), - bfd_get_filename (input_bfd), howto->name, - outrel.r_addend, - bfd_get_section_name (input_bfd, input_section)); - } - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (((Elf32_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; - - /* This reloc will be computed at runtime, so there's no - need to do anything now, except for R_VAX_32 - relocations that have been turned into - R_VAX_RELATIVE. */ - if (!relocate) - continue; - } - - break; - - case R_VAX_GNU_VTINHERIT: - case R_VAX_GNU_VTENTRY: - /* These are no-ops in the end. */ - continue; - - default: - break; - } - - /* VAX PCREL relocations are from the end of relocation, not the start */ - if (howto->pc_relative && howto->pcrel_offset) - { - relocation -= bfd_get_reloc_size(howto); - } - - r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, - relocation, rel->r_addend); - - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - { - name = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); - if (name == NULL) - return false; - if (*name == '\0') - name = bfd_section_name (input_bfd, sec); - } - if (!(info->callbacks->reloc_overflow - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return false; - } - break; - } - } - } - - return true; -} - -/* Finish up dynamic symbol handling. We set the contents of various - dynamic sections here. */ - -static boolean -elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym) - bfd *output_bfd; - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - bfd *dynobj; - - dynobj = elf_hash_table (info)->dynobj; - - if (h->plt.offset != (bfd_vma) -1) - { - asection *splt; - asection *sgot; - asection *srela; - bfd_vma plt_index; - bfd_vma got_offset; - bfd_vma addend; - Elf_Internal_Rela rela; - - /* This symbol has an entry in the procedure linkage table. Set - it up. */ - - BFD_ASSERT (h->dynindx != -1); - - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - srela = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); - - addend = 2 * (h->plt.offset & 1); - h->plt.offset &= ~1; - - /* Get the index in the procedure linkage table which - corresponds to this symbol. This is the index of this symbol - in all the symbols for which we are making plt entries. The - first entry in the procedure linkage table is reserved. */ - plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; - - /* Get the offset into the .got table of the entry that - corresponds to this function. Each .got entry is 4 bytes. - The first two are reserved. */ - got_offset = (plt_index + 3) * 4; - - /* Fill in the entry in the procedure linkage table. */ - memcpy (splt->contents + h->plt.offset, elf_vax_plt_entry, - PLT_ENTRY_SIZE); - - /* The offset is relative to the first extension word. */ - bfd_put_32 (output_bfd, - -(h->plt.offset + 8), - splt->contents + h->plt.offset + 4); - - bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), - splt->contents + h->plt.offset + 8); - - /* Fill in the entry in the global offset table. */ - bfd_put_32 (output_bfd, - (splt->output_section->vma - + splt->output_offset - + h->plt.offset) + addend, - sgot->contents + got_offset); - - /* Fill in the entry in the .rela.plt section. */ - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset - + got_offset); - rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_JMP_SLOT); - rela.r_addend = addend; - bfd_elf32_swap_reloca_out (output_bfd, &rela, - ((Elf32_External_Rela *) srela->contents - + plt_index)); - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ - sym->st_shndx = SHN_UNDEF; - } - } - - if (h->got.offset != (bfd_vma) -1) - { - asection *sgot; - asection *srela; - Elf_Internal_Rela rela; - - /* This symbol has an entry in the global offset table. Set it - up. */ - - sgot = bfd_get_section_by_name (dynobj, ".got"); - srela = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (sgot != NULL && srela != NULL); - - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset - + (h->got.offset &~ 1)); - - /* If the symbol was forced to be local because of a version file - locally we just want to emit a RELATIVE reloc. The entry in - the global offset table will already have been initialized in - the relocate_section function. */ - if (info->shared - && h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - { - rela.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE); - } - else - { - rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_GLOB_DAT); - } - rela.r_addend = bfd_get_signed_32 (output_bfd, - (sgot->contents - + (h->got.offset & ~1))); - - bfd_elf32_swap_reloca_out (output_bfd, &rela, - ((Elf32_External_Rela *) srela->contents - + srela->reloc_count)); - ++srela->reloc_count; - } - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) - { - asection *s; - Elf_Internal_Rela rela; - - /* This symbol needs a copy reloc. Set it up. */ - - BFD_ASSERT (h->dynindx != -1 - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)); - - s = bfd_get_section_by_name (h->root.u.def.section->owner, - ".rela.bss"); - BFD_ASSERT (s != NULL); - - rela.r_offset = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_COPY); - rela.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &rela, - ((Elf32_External_Rela *) s->contents - + s->reloc_count)); - ++s->reloc_count; - } - - /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ - if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) - sym->st_shndx = SHN_ABS; - - return true; -} - -/* Finish up the dynamic sections. */ - -static boolean -elf_vax_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *sgot; - asection *sdyn; - - dynobj = elf_hash_table (info)->dynobj; - - sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (sgot != NULL); - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - - if (elf_hash_table (info)->dynamic_sections_created) - { - asection *splt; - Elf32_External_Dyn *dyncon, *dynconend; - - splt = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (splt != NULL && sdyn != NULL); - - dyncon = (Elf32_External_Dyn *) sdyn->contents; - dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - const char *name; - asection *s; - - bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); - - switch (dyn.d_tag) - { - default: - break; - - case DT_PLTGOT: - name = ".got"; - goto get_vma; - case DT_JMPREL: - name = ".rela.plt"; - get_vma: - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); - break; - - case DT_PLTRELSZ: - s = bfd_get_section_by_name (output_bfd, ".rela.plt"); - BFD_ASSERT (s != NULL); - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; - else - dyn.d_un.d_val = s->_raw_size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); - break; - - case DT_RELASZ: - /* The procedure linkage table relocs (DT_JMPREL) should - not be included in the overall relocs (DT_RELA). - Therefore, we override the DT_RELASZ entry here to - make it not include the JMPREL relocs. Since the - linker script arranges for .rela.plt to follow all - other relocation sections, we don't have to worry - about changing the DT_RELA entry. */ - s = bfd_get_section_by_name (output_bfd, ".rela.plt"); - if (s != NULL) - { - if (s->_cooked_size != 0) - dyn.d_un.d_val -= s->_cooked_size; - else - dyn.d_un.d_val -= s->_raw_size; - } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); - break; - } - } - - /* Fill in the first entry in the procedure linkage table. */ - if (splt->_raw_size > 0) - { - memcpy (splt->contents, elf_vax_plt0_entry, PLT_ENTRY_SIZE); - bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset + 4 - - (splt->output_section->vma + 6)), - splt->contents + 2); - bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset + 8 - - (splt->output_section->vma + 12)), - splt->contents + 8); - elf_section_data (splt->output_section)->this_hdr.sh_entsize - = PLT_ENTRY_SIZE; - } - } - - /* Fill in the first three entries in the global offset table. */ - if (sgot->_raw_size > 0) - { - if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); - else - bfd_put_32 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - sgot->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); - } - - elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; - - return true; -} - -#define TARGET_LITTLE_SYM bfd_elf32_vax_vec -#define TARGET_LITTLE_NAME "elf32-vax" -#define ELF_MACHINE_CODE EM_VAX -#define ELF_MAXPAGESIZE 0x1000 - -#define elf_backend_create_dynamic_sections \ - _bfd_elf_create_dynamic_sections -#define bfd_elf32_bfd_link_hash_table_create \ - elf_vax_link_hash_table_create -#define bfd_elf32_bfd_final_link _bfd_elf32_gc_common_final_link - -#define elf_backend_check_relocs elf_vax_check_relocs -#define elf_backend_adjust_dynamic_symbol \ - elf_vax_adjust_dynamic_symbol -#define elf_backend_size_dynamic_sections \ - elf_vax_size_dynamic_sections -#define elf_backend_relocate_section elf_vax_relocate_section -#define elf_backend_finish_dynamic_symbol \ - elf_vax_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections \ - elf_vax_finish_dynamic_sections -#define elf_backend_gc_mark_hook elf_vax_gc_mark_hook -#define elf_backend_gc_sweep_hook elf_vax_gc_sweep_hook -#define bfd_elf32_bfd_merge_private_bfd_data \ - elf32_vax_merge_private_bfd_data -#define bfd_elf32_bfd_set_private_flags \ - elf32_vax_set_private_flags -#define bfd_elf32_bfd_print_private_bfd_data \ - elf32_vax_print_private_bfd_data - -#define elf_backend_can_gc_sections 1 -#define elf_backend_want_got_plt 1 -#define elf_backend_plt_readonly 1 -#define elf_backend_want_plt_sym 0 -#define elf_backend_got_header_size 16 - -#include "elf32-target.h" diff --git a/bfd/elf64-sh64-nbsd.c b/bfd/elf64-sh64-nbsd.c deleted file mode 100644 index 43e4eaf42ed..00000000000 --- a/bfd/elf64-sh64-nbsd.c +++ /dev/null @@ -1,29 +0,0 @@ -/* SuperH SH64 specific support for 64-bit NetBSD - Copyright 2002 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_BIG_SYM bfd_elf64_sh64nbsd_vec -#define TARGET_BIG_NAME "elf64-sh64-nbsd" -#define TARGET_LITTLE_SYM bfd_elf64_sh64lnbsd_vec -#define TARGET_LITTLE_NAME "elf64-sh64l-nbsd" -#define ELF_ARCH bfd_arch_sh -#define ELF_MACHINE_CODE EM_SH -#define ELF_MAXPAGESIZE 0x10000 -#define elf_symbol_leading_char 0 - -#include "elf64-sh64.c" diff --git a/bfd/vax1knetbsd.c b/bfd/vax1knetbsd.c deleted file mode 100644 index e20cd171d86..00000000000 --- a/bfd/vax1knetbsd.c +++ /dev/null @@ -1,37 +0,0 @@ -/* BFD back-end for NetBSD/VAX (1K page size) a.out-ish binaries. - Copyright 1998, 2000, 2001, 2002 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define BYTES_IN_WORD 4 -#undef TARGET_IS_BIG_ENDIAN_P - -#define TARGET_PAGE_SIZE 1024 -#define SEGMENT_SIZE TARGET_PAGE_SIZE - -#define DEFAULT_ARCH bfd_arch_vax -#define DEFAULT_MID M_VAX_NETBSD - -/* Do not "beautify" the CONCAT* macro args. Traditional C will not - remove whitespace added here, and thus will fail to concatenate - the tokens. */ -#define MY(OP) CONCAT2 (vax1knetbsd_,OP) - -/* This needs to start with a.out so GDB knows it is an a.out variant. */ -#define TARGETNAME "a.out-vax1k-netbsd" - -#include "netbsd.h" diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6745068e53b..35913de558f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,49 +1,3 @@ -2002-05-28 Keith Seitz - - * cli/cli-interp.c: New file. Almost entirely from Apple's - sources. Collected and moved here. - * mi/mi-interp.c: Ditto. - * mi/mi-events.c: Ditto. - * mi/mi.h: New file. - * Makefile.in: Add new files. - Update dependencies on interps.h. - * defs.h (selected_frame_level_changed_hook): Add declaration. - * wrapper.c (captured_execute_command): New function. - (do_captured_execute_command): New function. - * wrapper.h (captured_execute_command): Declare. - * top.c (catcher): If the caught command changes the uiout on us, - try to do something sane, like using the current interpreter's - uiout. - * mi/mi-main.c (captured_execute_command): Use catch_exception - instead of catch_errors. - (mi_execute_command_wrapper): Remove. Using catch_errors now. - (mi_input): Make global. - (mi_load_progress): Ditto. - Use interpreter functions instead of interpreter_p. - (mi_command_loop): Moved to mi-interp.c - (mi0_command_loop): Ditto. - (mi1_command_loop): Ditto. - (mi_init_ui): Remove. - (_initialize_mi_main): Remove. No longer needed. - - From Jim Ingham : - * event-loop.c (start_event_loop): Poll the interpreter's event loop - as well as gdb... - * event-top.c (gdb_setup_readline, gdb_disable_readline): New functions, - used by console & mi to grab & relinquish control of the readline input. - * event-top.h (gdb_setup_readline, gdb_disable_readline): Declare. - * main.c (captured_main): Copy the interpreter name, since we will - eventually use it as a set variable. - * top.c (gdb_init): Use the interpreter mechanism to startup the stdin - handling. - * interps.c: New file. (Originally called interpreter.c by Apple) - * interps.h: New file. (Originally called interpreter.h by Apple) - * mi/mi-cmds.c, mi/mi-cmds.h: Add mi commands -interpreter-set and - -interpreter-exec. - * mi/mi-main.c: Add the interpreter functions. - (mi_execute_command): Don't print the prompt if the command return - is MI_CMD_QUIET. - 2002-05-28 Jason Thorpe * ppcnbsd-nat.c: Rewrite. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 64b76f01623..da4e25e27b9 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -137,11 +137,11 @@ INTL_CFLAGS = -I$(INTL_DIR) -I$(INTL_SRC) # CLI sub directory definitons # SUBDIR_CLI_OBS = \ - cli-dump.o cli-decode.o \ - cli-interp.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o + cli-dump.o \ + cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o SUBDIR_CLI_SRCS = \ - cli/cli-dump.c cli/cli-decode.c \ - cli/cli-interp.c cli/cli-script.c cli/cli-cmds.c cli/cli-setshow.c \ + cli/cli-dump.c \ + cli/cli-decode.c cli/cli-script.c cli/cli-cmds.c cli/cli-setshow.c \ cli/cli-utils.c SUBDIR_CLI_DEPS = SUBDIR_CLI_INITS = \ @@ -159,13 +159,13 @@ SUBDIR_CLI_UNINSTALL= SUBDIR_MI_OBS = \ mi-out.o mi-console.o \ mi-cmds.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \ - mi-cmd-disas.o mi-events.o mi-interp.o \ + mi-cmd-disas.o \ mi-main.o mi-parse.o mi-getopt.o SUBDIR_MI_SRCS = \ mi/mi-out.c mi/mi-console.c \ mi/mi-cmds.c \ mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \ - mi/mi-cmd-disas.c mi/mi-events.c mi/mi-interp.c \ + mi/mi-cmd-disas.c \ mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c SUBDIR_MI_DEPS = SUBDIR_MI_INITS = \ @@ -533,7 +533,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \ findvar.c regcache.c gdbarch.c arch-utils.c gdbtypes.c osabi.c \ inf-loop.c infcmd.c inflow.c infrun.c language.c \ kod.c kod-cisco.c \ - ui-out.c cli-out.c interps.c \ + ui-out.c cli-out.c \ varobj.c wrapper.c \ jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \ m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \ @@ -637,7 +637,6 @@ gdbthread_h = gdbthread.h $(breakpoint_h) gdbtypes_h = gdbtypes.h inf_loop_h = inf-loop.h inferior_h = inferior.h $(breakpoint_h) -interps_h = interps.h language_h = language.h linespec_h = linespec.h macroexp_h = macroexp.h @@ -737,7 +736,7 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ dbxread.o coffread.o elfread.o \ dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \ c-lang.o ch-exp.o ch-lang.o f-lang.o \ - ui-out.o cli-out.o interps.o \ + ui-out.o cli-out.o \ varobj.o wrapper.o \ jv-lang.o jv-valprint.o jv-typeprint.o \ m2-lang.o p-lang.o p-typeprint.o p-valprint.o \ @@ -1451,7 +1450,7 @@ event-loop.o: event-loop.c $(defs_h) $(top_h) $(event_loop_h) $(event_top_h) event-top.o: event-top.c $(top_h) $(readline_headers) \ $(defs_h) $(inferior_h) $(event_loop_h) $(event_top_h) $(terminal_h) \ - $(gdbcmd_h) $(target_h) $(cli_decode_h) $(interps_h) + $(gdbcmd_h) $(target_h) $(cli_decode_h) inf-loop.o: inf-loop.c $(defs_h) $(inferior_h) $(inf_loop_h) $(event_loop_h) \ $(event_top_h) @@ -2185,7 +2184,7 @@ top.o: top.c $(top_h) $(bfd_h) $(getopt_h) $(readline_headers) $(call_cmds_h) \ $(defs_h) $(gdbcmd_h) $(inferior_h) $(language_h) \ $(remote_utils_h) $(gdb_string_h) $(event_loop_h) $(event_top_h) \ $(completer_h) $(version_h) $(ui_out_h) $(doublest_h) \ - $(serial_h) $(interps_h) + $(serial_h) typeprint.o: typeprint.c $(defs_h) $(expression_h) $(gdbcmd_h) \ $(gdbcore_h) $(gdbtypes_h) $(language_h) $(symtab_h) $(target_h) \ @@ -2280,9 +2279,8 @@ p-exp.tab.o: p-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \ gdb-events.o: gdb-events.c $(gdb_events_h) $(defs_h) $(gdbcmd_h) ui-out.o: ui-out.c $(defs_h) $(ui_out_h) $(expression_h) $(language_h) -cli-out.o: cli-out.c $(defs_h) $(ui_out_h) $(cli_out_h) $(interps_h) -inters.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \ - $(event_top_h) $(interps_h) $(gdb_h) $(wrapper_h) +cli-out.o: cli-out.c $(defs_h) $(ui_out_h) $(cli_out_h) + varobj.o: varobj.c $(defs_h) $(frame_h) $(value_h) \ $(language_h) $(valprint_h) $(varobj_h) $(wrapper_h) @@ -2308,10 +2306,6 @@ cli-dump.o: $(srcdir)/cli/cli-dump.c $(defs_h) $(gdb_string_h) $(command_h) \ $(value_h) $(gdbcmd_h) $(completer_h) $(cli_dump_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-dump.c -cli-interp.o: $(srcdir)/cli/cli-interp.c $(defs_h) $(interps_h) \ - $(wrapper_h) $(event_top_h) $(ui_out_h) $(cli_out_h) - $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-interp.c - cli-setshow.o: $(srcdir)/cli/cli-setshow.c $(cli_setshow_h) \ $(cli_decode_h) $(cli_cmds_h) $(defs_h) \ $(value_h) $(ui_out_h) @@ -2331,7 +2325,6 @@ cli-utils.o: $(srcdir)/cli/cli-utils.c $(cli_utils_h) $(defs_h) # Need to explicitly specify the compile rule as make will do nothing # or try to compile the object file into the mi directory. -mi_h = $(srcdir)/mi/mi.h mi_cmds_h = $(srcdir)/mi/mi-cmds.h mi_out_h = $(srcdir)/mi/mi-out.h mi_parse_h = $(srcdir)/mi/mi-parse.h @@ -2353,13 +2346,6 @@ mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \ mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(mi_cmds_h) \ $(ui_out_h) $(value_h) $(target_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c -mi-events.o: $(srcdir)/mi/mi-events.c $(defs_h) $(ui_out_h) $(interps_h) \ - $(gdb_h) $(breakpoint_h) $(mi_h) - $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-events.c -mi-interp.o: $(srcdir)/mi/mi-interp.c $(defs_h) $(interps_h) \ - $(event_top_h) $(event_loop_h) $(inferior_h) $(ui_out_h) \ - $(top_h) $(mi_h) $(mi_cmds_h) $(mi_out_h) $(mi_console_h) - $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-interp.c mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(top_h) $(mi_cmds_h) $(ui_out_h) \ $(mi_console_h) $(mi_getopt_h) $(event_loop_h) $(event_top_h) \ $(mi_getopt_h) $(regcache_h) $(gdb_h) $(target_h) \ diff --git a/gdb/ada-exp.tab.c b/gdb/ada-exp.tab.c deleted file mode 100644 index bb6d29bf276..00000000000 --- a/gdb/ada-exp.tab.c +++ /dev/null @@ -1,2389 +0,0 @@ -/* A Bison parser, made from ./ada-exp.y - by GNU bison 1.35. */ - -#define YYBISON 1 /* Identify Bison output. */ - -# define INT 257 -# define NULL_PTR 258 -# define CHARLIT 259 -# define FLOAT 260 -# define TYPENAME 261 -# define BLOCKNAME 262 -# define STRING 263 -# define NAME 264 -# define DOT_ID 265 -# define OBJECT_RENAMING 266 -# define DOT_ALL 267 -# define LAST 268 -# define REGNAME 269 -# define INTERNAL_VARIABLE 270 -# define ASSIGN 271 -# define _AND_ 272 -# define OR 273 -# define XOR 274 -# define THEN 275 -# define ELSE 276 -# define NOTEQUAL 277 -# define LEQ 278 -# define GEQ 279 -# define IN 280 -# define DOTDOT 281 -# define UNARY 282 -# define MOD 283 -# define REM 284 -# define STARSTAR 285 -# define ABS 286 -# define NOT 287 -# define TICK_ACCESS 288 -# define TICK_ADDRESS 289 -# define TICK_FIRST 290 -# define TICK_LAST 291 -# define TICK_LENGTH 292 -# define TICK_MAX 293 -# define TICK_MIN 294 -# define TICK_MODULUS 295 -# define TICK_POS 296 -# define TICK_RANGE 297 -# define TICK_SIZE 298 -# define TICK_TAG 299 -# define TICK_VAL 300 -# define ARROW 301 -# define NEW 302 - -#line 38 "./ada-exp.y" - - -#include "defs.h" -#include -#include -#include "expression.h" -#include "value.h" -#include "parser-defs.h" -#include "language.h" -#include "ada-lang.h" -#include "bfd.h" /* Required by objfiles.h. */ -#include "symfile.h" /* Required by objfiles.h. */ -#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ -#include "frame.h" - -/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), - as well as gratuitiously global symbol names, so we can have multiple - yacc generated parsers in gdb. These are only the variables - produced by yacc. If other parser generators (bison, byacc, etc) produce - additional global names that conflict at link time, then those parser - generators need to be fixed instead of adding those names to this list. */ - -/* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix - options. I presume we are maintaining it to accommodate systems - without BISON? (PNH) */ - -#define yymaxdepth ada_maxdepth -#define yyparse _ada_parse /* ada_parse calls this after initialization */ -#define yylex ada_lex -#define yyerror ada_error -#define yylval ada_lval -#define yychar ada_char -#define yydebug ada_debug -#define yypact ada_pact -#define yyr1 ada_r1 -#define yyr2 ada_r2 -#define yydef ada_def -#define yychk ada_chk -#define yypgo ada_pgo -#define yyact ada_act -#define yyexca ada_exca -#define yyerrflag ada_errflag -#define yynerrs ada_nerrs -#define yyps ada_ps -#define yypv ada_pv -#define yys ada_s -#define yy_yys ada_yys -#define yystate ada_state -#define yytmp ada_tmp -#define yyv ada_v -#define yy_yyv ada_yyv -#define yyval ada_val -#define yylloc ada_lloc -#define yyreds ada_reds /* With YYDEBUG defined */ -#define yytoks ada_toks /* With YYDEBUG defined */ - -#ifndef YYDEBUG -#define YYDEBUG 0 /* Default to no yydebug support */ -#endif - -struct name_info { - struct symbol* sym; - struct minimal_symbol* msym; - struct block* block; - struct stoken stoken; -}; - -/* If expression is in the context of TYPE'(...), then TYPE, else - * NULL. */ -static struct type* type_qualifier; - -int yyparse (void); - -static int yylex (void); - -void yyerror (char *); - -static struct stoken string_to_operator (struct stoken); - -static void write_attribute_call0 (enum ada_attribute); - -static void write_attribute_call1 (enum ada_attribute, LONGEST); - -static void write_attribute_calln (enum ada_attribute, int); - -static void write_object_renaming (struct block*, struct symbol*); - -static void write_var_from_name (struct block*, struct name_info); - -static LONGEST -convert_char_literal (struct type*, LONGEST); - -#line 131 "./ada-exp.y" -#ifndef YYSTYPE -typedef union - { - LONGEST lval; - struct { - LONGEST val; - struct type *type; - } typed_val; - struct { - DOUBLEST dval; - struct type *type; - } typed_val_float; - struct type *tval; - struct stoken sval; - struct name_info ssym; - int voidval; - struct block *bval; - struct internalvar *ivar; - - } yystype; -# define YYSTYPE yystype -# define YYSTYPE_IS_TRIVIAL 1 -#endif -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - - - -#define YYFINAL 184 -#define YYFLAG -32768 -#define YYNTBASE 68 - -/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 302 ? yytranslate[x] : 82) - -/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ -static const char yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 34, 63, - 57, 62, 36, 32, 64, 33, 56, 37, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 61, - 25, 23, 26, 2, 31, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 58, 2, 67, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 65, 2, 66, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 24, 27, 28, - 29, 30, 35, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 59, 60 -}; - -#if YYDEBUG -static const short yyprhs[] = -{ - 0, 0, 2, 4, 6, 10, 13, 16, 21, 26, - 27, 35, 36, 43, 47, 49, 51, 53, 55, 57, - 61, 64, 67, 70, 73, 74, 76, 80, 84, 90, - 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, - 135, 139, 143, 149, 155, 159, 166, 173, 178, 182, - 186, 190, 194, 199, 203, 208, 212, 215, 218, 222, - 226, 230, 233, 236, 244, 252, 258, 262, 266, 270, - 276, 279, 280, 284, 286, 288, 289, 291, 293, 295, - 297, 299, 302, 304, 307, 309, 312, 314, 316, 318, - 320, 323, 325, 328, 331, 335, 338, 341 -}; -static const short yyrhs[] = -{ - 69, 0, 81, 0, 73, 0, 69, 61, 73, 0, - 70, 13, 0, 70, 11, 0, 70, 57, 74, 62, - 0, 81, 57, 73, 62, 0, 0, 81, 63, 72, - 71, 57, 73, 62, 0, 0, 70, 57, 73, 30, - 73, 62, 0, 57, 69, 62, 0, 78, 0, 15, - 0, 16, 0, 70, 0, 14, 0, 73, 17, 73, - 0, 33, 73, 0, 32, 73, 0, 42, 73, 0, - 41, 73, 0, 0, 73, 0, 79, 59, 73, 0, - 74, 64, 73, 0, 74, 64, 79, 59, 73, 0, - 65, 81, 66, 73, 0, 73, 40, 73, 0, 73, - 36, 73, 0, 73, 37, 73, 0, 73, 39, 73, - 0, 73, 38, 73, 0, 73, 31, 73, 0, 73, - 32, 73, 0, 73, 34, 73, 0, 73, 33, 73, - 0, 73, 23, 73, 0, 73, 24, 73, 0, 73, - 27, 73, 0, 73, 29, 73, 30, 73, 0, 73, - 29, 73, 52, 75, 0, 73, 29, 7, 0, 73, - 42, 29, 73, 30, 73, 0, 73, 42, 29, 73, - 52, 75, 0, 73, 42, 29, 7, 0, 73, 28, - 73, 0, 73, 25, 73, 0, 73, 26, 73, 0, - 73, 18, 73, 0, 73, 18, 21, 73, 0, 73, - 19, 73, 0, 73, 19, 22, 73, 0, 73, 20, - 73, 0, 70, 43, 0, 70, 44, 0, 70, 45, - 75, 0, 70, 46, 75, 0, 70, 47, 75, 0, - 70, 53, 0, 70, 54, 0, 77, 49, 57, 73, - 64, 73, 62, 0, 77, 48, 57, 73, 64, 73, - 62, 0, 77, 51, 57, 73, 62, 0, 76, 45, - 75, 0, 76, 46, 75, 0, 76, 47, 75, 0, - 76, 55, 57, 73, 62, 0, 76, 50, 0, 0, - 57, 3, 62, 0, 7, 0, 76, 0, 0, 3, - 0, 5, 0, 6, 0, 4, 0, 9, 0, 60, - 7, 0, 10, 0, 80, 10, 0, 12, 0, 80, - 12, 0, 10, 0, 7, 0, 12, 0, 8, 0, - 80, 8, 0, 7, 0, 80, 7, 0, 7, 43, - 0, 80, 7, 43, 0, 36, 73, 0, 34, 73, - 0, 73, 58, 73, 67, 0 -}; - -#endif - -#if YYDEBUG -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const short yyrline[] = -{ - 0, 203, 204, 210, 211, 216, 220, 227, 235, 243, - 243, 254, 256, 261, 264, 267, 274, 282, 285, 292, - 296, 300, 304, 308, 312, 315, 317, 319, 321, 325, - 335, 339, 343, 347, 351, 355, 359, 363, 367, 371, - 375, 379, 383, 387, 393, 400, 405, 413, 423, 427, - 431, 435, 439, 443, 447, 451, 455, 457, 463, 465, - 467, 469, 471, 473, 475, 477, 479, 481, 483, 485, - 487, 491, 493, 497, 504, 506, 513, 521, 533, 541, - 548, 575, 579, 580, 582, 583, 587, 588, 589, 592, - 594, 599, 600, 601, 603, 610, 612, 614 -}; -#endif - - -#if (YYDEBUG) || defined YYERROR_VERBOSE - -/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ -static const char *const yytname[] = -{ - "$", "error", "$undefined.", "INT", "NULL_PTR", "CHARLIT", "FLOAT", - "TYPENAME", "BLOCKNAME", "STRING", "NAME", "DOT_ID", "OBJECT_RENAMING", - "DOT_ALL", "LAST", "REGNAME", "INTERNAL_VARIABLE", "ASSIGN", "_AND_", - "OR", "XOR", "THEN", "ELSE", "'='", "NOTEQUAL", "'<'", "'>'", "LEQ", - "GEQ", "IN", "DOTDOT", "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'", - "'/'", "MOD", "REM", "STARSTAR", "ABS", "NOT", "TICK_ACCESS", - "TICK_ADDRESS", "TICK_FIRST", "TICK_LAST", "TICK_LENGTH", "TICK_MAX", - "TICK_MIN", "TICK_MODULUS", "TICK_POS", "TICK_RANGE", "TICK_SIZE", - "TICK_TAG", "TICK_VAL", "'.'", "'('", "'['", "ARROW", "NEW", "';'", - "')'", "'\\''", "','", "'{'", "'}'", "']'", "start", "exp1", - "simple_exp", "@1", "save_qualifier", "exp", "arglist", "tick_arglist", - "type_prefix", "opt_type_prefix", "variable", "any_name", "block", - "type", 0 -}; -#endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const short yyr1[] = -{ - 0, 68, 68, 69, 69, 70, 70, 70, 70, 71, - 70, 72, 70, 70, 70, 70, 70, 73, 70, 73, - 73, 73, 73, 73, 74, 74, 74, 74, 74, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 75, 75, 76, 77, 77, 73, 73, 73, 73, - 73, 73, 78, 78, 78, 78, 79, 79, 79, 80, - 80, 81, 81, 81, 81, 73, 73, 73 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const short yyr2[] = -{ - 0, 1, 1, 1, 3, 2, 2, 4, 4, 0, - 7, 0, 6, 3, 1, 1, 1, 1, 1, 3, - 2, 2, 2, 2, 0, 1, 3, 3, 5, 4, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 5, 5, 3, 6, 6, 4, 3, 3, - 3, 3, 4, 3, 4, 3, 2, 2, 3, 3, - 3, 2, 2, 7, 7, 5, 3, 3, 3, 5, - 2, 0, 3, 1, 1, 0, 1, 1, 1, 1, - 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, - 2, 1, 2, 2, 3, 2, 2, 4 -}; - -/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE - doesn't specify something else to do. Zero means the default is an - error. */ -static const short yydefact[] = -{ - 75, 76, 79, 77, 78, 73, 89, 80, 82, 84, - 18, 15, 16, 75, 75, 75, 75, 75, 75, 75, - 0, 0, 1, 17, 3, 74, 0, 14, 0, 2, - 93, 21, 0, 20, 96, 95, 23, 22, 0, 81, - 91, 0, 0, 75, 6, 5, 56, 57, 71, 71, - 71, 61, 62, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 0, 75, 71, 71, 71, 70, - 0, 0, 0, 0, 92, 90, 83, 85, 75, 11, - 13, 75, 4, 0, 58, 59, 60, 73, 82, 84, - 25, 0, 0, 19, 75, 51, 75, 53, 55, 39, - 40, 49, 50, 41, 48, 44, 0, 35, 36, 38, - 37, 31, 32, 34, 33, 30, 75, 0, 66, 67, - 68, 75, 75, 75, 75, 94, 0, 9, 29, 0, - 75, 7, 75, 75, 52, 54, 75, 71, 47, 0, - 97, 0, 0, 0, 0, 8, 0, 72, 0, 27, - 0, 26, 42, 43, 75, 71, 69, 75, 75, 65, - 75, 12, 75, 45, 46, 0, 0, 0, 28, 64, - 63, 10, 0, 0, 0 -}; - -static const short yydefgoto[] = -{ - 182, 22, 23, 156, 137, 24, 101, 94, 25, 26, - 27, 102, 28, 32 -}; - -static const short yypact[] = -{ - 251,-32768,-32768,-32768,-32768, 20,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 251, 251, 251, 251, 251, 251, 251, - 2, 79, -47, 53, 958, -23, 54,-32768, 104, -32, - -32768, 31, -32, 31, -22, -22, 31, 31, 33,-32768, - -5, 101, -27, 251,-32768,-32768,-32768,-32768, 4, 4, - 4,-32768,-32768, 131, 251, 171, 211, 251, 251, 251, - 251, 251, 251, 251, 291, 251, 251, 251, 251, 251, - 251, 251, 251, 251, 47, 251, 4, 4, 4,-32768, - 23, 25, 27, 35, 45,-32768,-32768,-32768, 251,-32768, - -32768, 251, 958, 98,-32768,-32768,-32768, 22, 56, 58, - 930, -36, 64, 986, 251, 1009, 251, 1009, 1009, -21, - -21, -21, -21, -21, -21, 534, 858, 387, 31, 31, - 31, 32, 32, 32, 32, 32, 331, 415,-32768,-32768, - -32768, 251, 251, 251, 251,-32768, 536,-32768, -22, 62, - 251,-32768, 371, 251, 1009, 1009, 251, 4, 534, 894, - -32768, 582, 452, 494, 628,-32768, 68,-32768, 674, 958, - 67, 958, -21,-32768, 251, 4,-32768, 251, 251,-32768, - 251,-32768, 251, -21,-32768, 720, 766, 812, 958,-32768, - -32768,-32768, 128, 132,-32768 -}; - -static const short yypgoto[] = -{ - -32768, 112,-32768,-32768,-32768, -13,-32768, -43,-32768,-32768, - -32768, 0, 123, 8 -}; - - -#define YYLAST 1067 - - -static const short yytable[] = -{ - 31, 33, 34, 35, 36, 37, 95, 96, 29, 39, - 65, 66, 67, 68, 43, 69, 70, 71, 72, 73, - -91, 74, 76, 77, 78, 88, 141, 79, 142, 42, - 92, 89, 80, 128, 129, 130, 75, 75, 30, 91, - 100, 103, 105, 107, 108, 109, 110, 111, 112, 113, - 114, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 93, 127, 30, 44, 30, 45, 69, 70, 71, - 72, 73, 73, 74, 74, 136, 126, -91, 138, -91, - 131, -87, 132, -91, 133, -91, 40, 6, 135, 75, - 75, 144, 134, 145, 43, 90, 46, 47, 48, 49, - 50, 139, 81, 82, 163, 83, 51, 52, 84, 85, - 53, 84, 85, 149, 86, -86, 87, -88, 151, 152, - 153, 154, 174, 143, 157, 170, 172, 158, 183, 159, - 161, 38, 184, 162, 1, 2, 3, 4, 97, 6, - 7, 98, 160, 99, 41, 10, 11, 12, 0, 0, - 0, 173, 0, 0, 175, 176, 0, 177, 0, 178, - 0, 0, 0, 13, 14, 15, 0, 16, 0, 0, - 0, 0, 17, 18, 1, 2, 3, 4, 5, 6, - 7, 8, 0, 9, 0, 10, 11, 12, 19, 0, - 0, 20, 104, -24, 0, -24, 21, 0, 0, 0, - 0, 0, 0, 13, 14, 15, 0, 16, 0, 0, - 0, 0, 17, 18, 1, 2, 3, 4, 5, 6, - 7, 8, 0, 9, 0, 10, 11, 12, 19, 0, - 0, 20, 0, 106, 0, 0, 21, 0, 0, 0, - 0, 0, 0, 13, 14, 15, 0, 16, 0, 0, - 0, 0, 17, 18, 1, 2, 3, 4, 5, 6, - 7, 8, 0, 9, 0, 10, 11, 12, 19, 0, - 0, 20, 0, 0, 0, 0, 21, 0, 0, 0, - 0, 0, 0, 13, 14, 15, 0, 16, 0, 0, - 0, 0, 17, 18, 1, 2, 3, 4, 115, 6, - 7, 8, 0, 9, 0, 10, 11, 12, 19, 0, - 0, 20, 0, 0, 0, 0, 21, 0, 0, 0, - 0, 0, 0, 13, 14, 15, 0, 16, 0, 0, - 0, 0, 17, 18, 1, 2, 3, 4, 148, 6, - 7, 8, 0, 9, 0, 10, 11, 12, 19, 0, - 0, 20, 0, 0, 0, 0, 21, 0, 0, 0, - 0, 0, 0, 13, 14, 15, 0, 16, 0, 0, - 0, 0, 17, 18, 1, 2, 3, 4, 97, 6, - 7, 98, 0, 99, 0, 10, 11, 12, 19, 0, - 0, 20, 0, 0, 0, 0, 21, 0, 0, 0, - 0, 0, 0, 13, 14, 15, 0, 16, 0, 0, - 0, 0, 17, 18, 0, 0, 0, 0, 0, 66, - 67, 68, 0, 69, 70, 71, 72, 73, 19, 74, - 0, 20, 54, 55, 56, 57, 21, 0, 58, 59, - 60, 61, 62, 63, 64, 75, 65, 66, 67, 68, - 0, 69, 70, 71, 72, 73, 0, 74, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, - 55, 56, 57, 75, 0, 58, 59, 60, 61, 62, - 63, 64, 150, 65, 66, 67, 68, 0, 69, 70, - 71, 72, 73, 0, 74, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 54, 55, 56, 57, 0, 167, 58, 59, 60, - 61, 62, 63, 64, 0, 65, 66, 67, 68, 0, - 69, 70, 71, 72, 73, 0, 74, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 54, 55, 56, 57, 0, 168, 58, - 59, 60, 61, 62, 63, 64, 0, 65, 66, 67, - 68, 0, 69, 70, 71, 72, 73, 30, 74, -73, - -73, -73, -73, -73, -73, -73, 0, 0, 0, -73, - 0, -91, 0, 0, 75, 0, 0, -91, 155, 54, - 55, 56, 57, 0, 0, 58, 59, 60, 61, 62, - 63, 64, 0, 65, 66, 67, 68, 0, 69, 70, - 71, 72, 73, 0, 74, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 0, 0, 0, 166, 54, 55, 56, 57, 0, - 0, 58, 59, 60, 61, 62, 63, 64, 0, 65, - 66, 67, 68, 0, 69, 70, 71, 72, 73, 0, - 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, - 169, 54, 55, 56, 57, 0, 0, 58, 59, 60, - 61, 62, 63, 64, 0, 65, 66, 67, 68, 0, - 69, 70, 71, 72, 73, 0, 74, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 0, 0, 0, 171, 54, 55, 56, - 57, 0, 0, 58, 59, 60, 61, 62, 63, 64, - 0, 65, 66, 67, 68, 0, 69, 70, 71, 72, - 73, 0, 74, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, - 0, 0, 179, 54, 55, 56, 57, 0, 0, 58, - 59, 60, 61, 62, 63, 64, 0, 65, 66, 67, - 68, 0, 69, 70, 71, 72, 73, 0, 74, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 0, 0, 0, 180, 54, - 55, 56, 57, 0, 0, 58, 59, 60, 61, 62, - 63, 64, 0, 65, 66, 67, 68, 0, 69, 70, - 71, 72, 73, 0, 74, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 0, 0, 0, 181, 54, 55, 56, 57, 0, - 0, 58, 59, 60, 61, 62, 63, 64, 146, 65, - 66, 67, 68, 0, 69, 70, 71, 72, 73, 0, - 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 147, 54, 55, 56, 57, 0, 75, 58, 59, 60, - 61, 62, 63, 64, 164, 65, 66, 67, 68, 0, - 69, 70, 71, 72, 73, 0, 74, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 165, 54, 55, 56, - 57, 0, 75, 58, 59, 60, 61, 62, 63, 64, - 140, 65, 66, 67, 68, 0, 69, 70, 71, 72, - 73, 0, 74, 0, 0, 54, 55, 56, 57, 0, - 0, 58, 59, 60, 61, 62, 63, 64, 75, 65, - 66, 67, 68, 0, 69, 70, 71, 72, 73, 0, - 74, 0, 0,-32768, 55, 56, 57, 0, 0, 58, - 59, 60, 61, 62, 63, 64, 75, 65, 66, 67, - 68, 0, 69, 70, 71, 72, 73, 0, 74, 0, - 0, 0, 58, 59, 60, 61, 62, 63, 64, 0, - 65, 66, 67, 68, 75, 69, 70, 71, 72, 73, - 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 75 -}; - -static const short yycheck[] = -{ - 13, 14, 15, 16, 17, 18, 49, 50, 0, 7, - 31, 32, 33, 34, 61, 36, 37, 38, 39, 40, - 0, 42, 45, 46, 47, 57, 62, 50, 64, 21, - 43, 63, 55, 76, 77, 78, 58, 58, 43, 66, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 57, 75, 43, 11, 43, 13, 36, 37, 38, - 39, 40, 40, 42, 42, 88, 29, 57, 91, 57, - 57, 59, 57, 63, 57, 63, 7, 8, 43, 58, - 58, 104, 57, 106, 61, 62, 43, 44, 45, 46, - 47, 3, 48, 49, 147, 51, 53, 54, 7, 8, - 57, 7, 8, 126, 10, 59, 12, 59, 131, 132, - 133, 134, 165, 59, 62, 57, 59, 140, 0, 142, - 143, 19, 0, 146, 3, 4, 5, 6, 7, 8, - 9, 10, 142, 12, 21, 14, 15, 16, -1, -1, - -1, 164, -1, -1, 167, 168, -1, 170, -1, 172, - -1, -1, -1, 32, 33, 34, -1, 36, -1, -1, - -1, -1, 41, 42, 3, 4, 5, 6, 7, 8, - 9, 10, -1, 12, -1, 14, 15, 16, 57, -1, - -1, 60, 21, 62, -1, 64, 65, -1, -1, -1, - -1, -1, -1, 32, 33, 34, -1, 36, -1, -1, - -1, -1, 41, 42, 3, 4, 5, 6, 7, 8, - 9, 10, -1, 12, -1, 14, 15, 16, 57, -1, - -1, 60, -1, 22, -1, -1, 65, -1, -1, -1, - -1, -1, -1, 32, 33, 34, -1, 36, -1, -1, - -1, -1, 41, 42, 3, 4, 5, 6, 7, 8, - 9, 10, -1, 12, -1, 14, 15, 16, 57, -1, - -1, 60, -1, -1, -1, -1, 65, -1, -1, -1, - -1, -1, -1, 32, 33, 34, -1, 36, -1, -1, - -1, -1, 41, 42, 3, 4, 5, 6, 7, 8, - 9, 10, -1, 12, -1, 14, 15, 16, 57, -1, - -1, 60, -1, -1, -1, -1, 65, -1, -1, -1, - -1, -1, -1, 32, 33, 34, -1, 36, -1, -1, - -1, -1, 41, 42, 3, 4, 5, 6, 7, 8, - 9, 10, -1, 12, -1, 14, 15, 16, 57, -1, - -1, 60, -1, -1, -1, -1, 65, -1, -1, -1, - -1, -1, -1, 32, 33, 34, -1, 36, -1, -1, - -1, -1, 41, 42, 3, 4, 5, 6, 7, 8, - 9, 10, -1, 12, -1, 14, 15, 16, 57, -1, - -1, 60, -1, -1, -1, -1, 65, -1, -1, -1, - -1, -1, -1, 32, 33, 34, -1, 36, -1, -1, - -1, -1, 41, 42, -1, -1, -1, -1, -1, 32, - 33, 34, -1, 36, 37, 38, 39, 40, 57, 42, - -1, 60, 17, 18, 19, 20, 65, -1, 23, 24, - 25, 26, 27, 28, 29, 58, 31, 32, 33, 34, - -1, 36, 37, 38, 39, 40, -1, 42, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, - 18, 19, 20, 58, -1, 23, 24, 25, 26, 27, - 28, 29, 67, 31, 32, 33, 34, -1, 36, 37, - 38, 39, 40, -1, 42, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 58, 17, 18, 19, 20, -1, 64, 23, 24, 25, - 26, 27, 28, 29, -1, 31, 32, 33, 34, -1, - 36, 37, 38, 39, 40, -1, 42, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 58, 17, 18, 19, 20, -1, 64, 23, - 24, 25, 26, 27, 28, 29, -1, 31, 32, 33, - 34, -1, 36, 37, 38, 39, 40, 43, 42, 45, - 46, 47, 48, 49, 50, 51, -1, -1, -1, 55, - -1, 57, -1, -1, 58, -1, -1, 63, 62, 17, - 18, 19, 20, -1, -1, 23, 24, 25, 26, 27, - 28, 29, -1, 31, 32, 33, 34, -1, 36, 37, - 38, 39, 40, -1, 42, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 58, -1, -1, -1, 62, 17, 18, 19, 20, -1, - -1, 23, 24, 25, 26, 27, 28, 29, -1, 31, - 32, 33, 34, -1, 36, 37, 38, 39, 40, -1, - 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, - 62, 17, 18, 19, 20, -1, -1, 23, 24, 25, - 26, 27, 28, 29, -1, 31, 32, 33, 34, -1, - 36, 37, 38, 39, 40, -1, 42, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 58, -1, -1, -1, 62, 17, 18, 19, - 20, -1, -1, 23, 24, 25, 26, 27, 28, 29, - -1, 31, 32, 33, 34, -1, 36, 37, 38, 39, - 40, -1, 42, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, - -1, -1, 62, 17, 18, 19, 20, -1, -1, 23, - 24, 25, 26, 27, 28, 29, -1, 31, 32, 33, - 34, -1, 36, 37, 38, 39, 40, -1, 42, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 58, -1, -1, -1, 62, 17, - 18, 19, 20, -1, -1, 23, 24, 25, 26, 27, - 28, 29, -1, 31, 32, 33, 34, -1, 36, 37, - 38, 39, 40, -1, 42, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 58, -1, -1, -1, 62, 17, 18, 19, 20, -1, - -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, -1, 36, 37, 38, 39, 40, -1, - 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 52, 17, 18, 19, 20, -1, 58, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, - 36, 37, 38, 39, 40, -1, 42, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 52, 17, 18, 19, - 20, -1, 58, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, 36, 37, 38, 39, - 40, -1, 42, -1, -1, 17, 18, 19, 20, -1, - -1, 23, 24, 25, 26, 27, 28, 29, 58, 31, - 32, 33, 34, -1, 36, 37, 38, 39, 40, -1, - 42, -1, -1, 17, 18, 19, 20, -1, -1, 23, - 24, 25, 26, 27, 28, 29, 58, 31, 32, 33, - 34, -1, 36, 37, 38, 39, 40, -1, 42, -1, - -1, -1, 23, 24, 25, 26, 27, 28, 29, -1, - 31, 32, 33, 34, 58, 36, 37, 38, 39, 40, - -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 58 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/local/share/bison/bison.simple" - -/* Skeleton output parser for bison, - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software - Foundation, Inc. - - 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser when - the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) - -/* The parser invokes alloca or xmalloc; define the necessary symbols. */ - -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -# define YYSTACK_ALLOC xmalloc -# define YYSTACK_FREE free -# endif -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ - - -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - short yyss; - YYSTYPE yyvs; -# if YYLSP_NEEDED - YYLTYPE yyls; -# endif -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# if YYLSP_NEEDED -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAX) -# else -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAX) -# endif - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - register YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (0) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - - -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror ("syntax error: cannot back up"); \ - YYERROR; \ - } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). - - When YYLLOC_DEFAULT is run, CURRENT is set the location of the - first token. By default, to implement support for ranges, extend - its range to the last symbol. */ - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#if YYPURE -# if YYLSP_NEEDED -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval, &yylloc) -# endif -# else /* !YYLSP_NEEDED */ -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval) -# endif -# endif /* !YYLSP_NEEDED */ -#else /* !YYPURE */ -# define YYLEX yylex () -#endif /* !YYPURE */ - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -#endif /* !YYDEBUG */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#if YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - -#ifdef YYERROR_VERBOSE - -# ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) -yystrlen (const char *yystr) -# else -yystrlen (yystr) - const char *yystr; -# endif -{ - register const char *yys = yystr; - - while (*yys++ != '\0') - continue; - - return yys - yystr - 1; -} -# endif -# endif - -# ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -# if defined (__STDC__) || defined (__cplusplus) -yystpcpy (char *yydest, const char *yysrc) -# else -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif -{ - register char *yyd = yydest; - register const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif -#endif - -#line 315 "/usr/local/share/bison/bison.simple" - - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -# define YYPARSE_PARAM_DECL -# else -# define YYPARSE_PARAM_ARG YYPARSE_PARAM -# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -# endif -#else /* !YYPARSE_PARAM */ -# define YYPARSE_PARAM_ARG -# define YYPARSE_PARAM_DECL -#endif /* !YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -# ifdef YYPARSE_PARAM -int yyparse (void *); -# else -int yyparse (void); -# endif -#endif - -/* YY_DECL_VARIABLES -- depending whether we use a pure parser, - variables are global, or local to YYPARSE. */ - -#define YY_DECL_NON_LSP_VARIABLES \ -/* The lookahead symbol. */ \ -int yychar; \ - \ -/* The semantic value of the lookahead symbol. */ \ -YYSTYPE yylval; \ - \ -/* Number of parse errors so far. */ \ -int yynerrs; - -#if YYLSP_NEEDED -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES \ - \ -/* Location data for the lookahead symbol. */ \ -YYLTYPE yylloc; -#else -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES -#endif - - -/* If nonreentrant, generate the variables here. */ - -#if !YYPURE -YY_DECL_VARIABLES -#endif /* !YYPURE */ - -int -yyparse (YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - /* If reentrant, generate the variables here. */ -#if YYPURE - YY_DECL_VARIABLES -#endif /* !YYPURE */ - - register int yystate; - register int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ - int yychar1 = 0; - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to xreallocate them elsewhere. */ - - /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; - -#if YYLSP_NEEDED - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#endif - -#if YYLSP_NEEDED -# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -# define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - YYSIZE_T yystacksize = YYINITDEPTH; - - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; -#if YYLSP_NEEDED - YYLTYPE yyloc; -#endif - - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; -#if YYLSP_NEEDED - yylsp = yyls; -#endif - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to xreallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. */ -# if YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), - &yystacksize); - yyls = yyls1; -# else - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); -# endif - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyoverflowlab; -# else - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - goto yyoverflowlab; - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; - - { - short *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyoverflowlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); -# if YYLSP_NEEDED - YYSTACK_RELOCATE (yyls); -# endif -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; -#if YYLSP_NEEDED - yylsp = yyls + yysize - 1; -#endif - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yychar1 = YYTRANSLATE (yychar); - -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables - which are defined only if `YYDEBUG' is set. */ - if (yydebug) - { - YYFPRINTF (stderr, "Next token is %d (%s", - yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise - meaning of a token, for further debugging info. */ -# ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -# endif - YYFPRINTF (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %d (%s), ", - yychar, yytname[yychar1])); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#if YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - yystate = yyn; - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to the semantic value of - the lookahead token. This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - -#if YYLSP_NEEDED - /* Similarly for the default location. Let the user run additional - commands if for instance locations are ranges. */ - yyloc = yylsp[1-yylen]; - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); -#endif - -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables which - are defined only if `YYDEBUG' is set. */ - if (yydebug) - { - int yyi; - - YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - switch (yyn) { - -case 2: -#line 204 "./ada-exp.y" -{ write_exp_elt_opcode (OP_TYPE); - write_exp_elt_type (yyvsp[0].tval); - write_exp_elt_opcode (OP_TYPE); } - break; -case 4: -#line 212 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_COMMA); } - break; -case 5: -#line 217 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_IND); } - break; -case 6: -#line 221 "./ada-exp.y" -{ write_exp_elt_opcode (STRUCTOP_STRUCT); - write_exp_string (yyvsp[0].ssym.stoken); - write_exp_elt_opcode (STRUCTOP_STRUCT); - } - break; -case 7: -#line 228 "./ada-exp.y" -{ - write_exp_elt_opcode (OP_FUNCALL); - write_exp_elt_longcst (yyvsp[-1].lval); - write_exp_elt_opcode (OP_FUNCALL); - } - break; -case 8: -#line 236 "./ada-exp.y" -{ - write_exp_elt_opcode (UNOP_CAST); - write_exp_elt_type (yyvsp[-3].tval); - write_exp_elt_opcode (UNOP_CAST); - } - break; -case 9: -#line 243 "./ada-exp.y" -{ type_qualifier = yyvsp[-2].tval; } - break; -case 10: -#line 244 "./ada-exp.y" -{ - /* write_exp_elt_opcode (UNOP_QUAL); */ - /* FIXME: UNOP_QUAL should be defined in expression.h */ - write_exp_elt_type (yyvsp[-6].tval); - /* write_exp_elt_opcode (UNOP_QUAL); */ - /* FIXME: UNOP_QUAL should be defined in expression.h */ - type_qualifier = yyvsp[-4].tval; - } - break; -case 11: -#line 254 "./ada-exp.y" -{ yyval.tval = type_qualifier; } - break; -case 12: -#line 258 "./ada-exp.y" -{ write_exp_elt_opcode (TERNOP_SLICE); } - break; -case 13: -#line 261 "./ada-exp.y" -{ } - break; -case 15: -#line 268 "./ada-exp.y" -{ write_exp_elt_opcode (OP_REGISTER); - write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); - write_exp_elt_opcode (OP_REGISTER); - } - break; -case 16: -#line 275 "./ada-exp.y" -{ write_exp_elt_opcode (OP_INTERNALVAR); - write_exp_elt_intern (yyvsp[0].ivar); - write_exp_elt_opcode (OP_INTERNALVAR); - } - break; -case 18: -#line 286 "./ada-exp.y" -{ write_exp_elt_opcode (OP_LAST); - write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); - write_exp_elt_opcode (OP_LAST); - } - break; -case 19: -#line 293 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_ASSIGN); } - break; -case 20: -#line 297 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_NEG); } - break; -case 21: -#line 301 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_PLUS); } - break; -case 22: -#line 305 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); } - break; -case 23: -#line 309 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_ABS); } - break; -case 24: -#line 312 "./ada-exp.y" -{ yyval.lval = 0; } - break; -case 25: -#line 316 "./ada-exp.y" -{ yyval.lval = 1; } - break; -case 26: -#line 318 "./ada-exp.y" -{ yyval.lval = 1; } - break; -case 27: -#line 320 "./ada-exp.y" -{ yyval.lval = yyvsp[-2].lval + 1; } - break; -case 28: -#line 322 "./ada-exp.y" -{ yyval.lval = yyvsp[-4].lval + 1; } - break; -case 29: -#line 327 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_MEMVAL); - write_exp_elt_type (yyvsp[-2].tval); - write_exp_elt_opcode (UNOP_MEMVAL); - } - break; -case 30: -#line 336 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_EXP); } - break; -case 31: -#line 340 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_MUL); } - break; -case 32: -#line 344 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_DIV); } - break; -case 33: -#line 348 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_REM); } - break; -case 34: -#line 352 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_MOD); } - break; -case 35: -#line 356 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_REPEAT); } - break; -case 36: -#line 360 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_ADD); } - break; -case 37: -#line 364 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_CONCAT); } - break; -case 38: -#line 368 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_SUB); } - break; -case 39: -#line 372 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_EQUAL); } - break; -case 40: -#line 376 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_NOTEQUAL); } - break; -case 41: -#line 380 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_LEQ); } - break; -case 42: -#line 384 "./ada-exp.y" -{ /*write_exp_elt_opcode (TERNOP_MBR); */ } - break; -case 43: -#line 388 "./ada-exp.y" -{ /*write_exp_elt_opcode (BINOP_MBR); */ - /* FIXME: BINOP_MBR should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); - /*write_exp_elt_opcode (BINOP_MBR); */ - } - break; -case 44: -#line 394 "./ada-exp.y" -{ /*write_exp_elt_opcode (UNOP_MBR); */ - /* FIXME: UNOP_QUAL should be defined in expression.h */ - write_exp_elt_type (yyvsp[0].tval); - /* write_exp_elt_opcode (UNOP_MBR); */ - /* FIXME: UNOP_MBR should be defined in expression.h */ - } - break; -case 45: -#line 401 "./ada-exp.y" -{ /*write_exp_elt_opcode (TERNOP_MBR); */ - /* FIXME: TERNOP_MBR should be defined in expression.h */ - write_exp_elt_opcode (UNOP_LOGICAL_NOT); - } - break; -case 46: -#line 406 "./ada-exp.y" -{ /* write_exp_elt_opcode (BINOP_MBR); */ - /* FIXME: BINOP_MBR should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); - /*write_exp_elt_opcode (BINOP_MBR);*/ - /* FIXME: BINOP_MBR should be defined in expression.h */ - write_exp_elt_opcode (UNOP_LOGICAL_NOT); - } - break; -case 47: -#line 414 "./ada-exp.y" -{ /*write_exp_elt_opcode (UNOP_MBR);*/ - /* FIXME: UNOP_MBR should be defined in expression.h */ - write_exp_elt_type (yyvsp[0].tval); - /* write_exp_elt_opcode (UNOP_MBR);*/ - /* FIXME: UNOP_MBR should be defined in expression.h */ - write_exp_elt_opcode (UNOP_LOGICAL_NOT); - } - break; -case 48: -#line 424 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_GEQ); } - break; -case 49: -#line 428 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_LESS); } - break; -case 50: -#line 432 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_GTR); } - break; -case 51: -#line 436 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_BITWISE_AND); } - break; -case 52: -#line 440 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_LOGICAL_AND); } - break; -case 53: -#line 444 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_BITWISE_IOR); } - break; -case 54: -#line 448 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_LOGICAL_OR); } - break; -case 55: -#line 452 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_BITWISE_XOR); } - break; -case 56: -#line 456 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_ADDR); } - break; -case 57: -#line 458 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_ADDR); - write_exp_elt_opcode (UNOP_CAST); - write_exp_elt_type (builtin_type_ada_system_address); - write_exp_elt_opcode (UNOP_CAST); - } - break; -case 58: -#line 464 "./ada-exp.y" -{ write_attribute_call1 (ATR_FIRST, yyvsp[0].lval); } - break; -case 59: -#line 466 "./ada-exp.y" -{ write_attribute_call1 (ATR_LAST, yyvsp[0].lval); } - break; -case 60: -#line 468 "./ada-exp.y" -{ write_attribute_call1 (ATR_LENGTH, yyvsp[0].lval); } - break; -case 61: -#line 470 "./ada-exp.y" -{ write_attribute_call0 (ATR_SIZE); } - break; -case 62: -#line 472 "./ada-exp.y" -{ write_attribute_call0 (ATR_TAG); } - break; -case 63: -#line 474 "./ada-exp.y" -{ write_attribute_calln (ATR_MIN, 2); } - break; -case 64: -#line 476 "./ada-exp.y" -{ write_attribute_calln (ATR_MAX, 2); } - break; -case 65: -#line 478 "./ada-exp.y" -{ write_attribute_calln (ATR_POS, 1); } - break; -case 66: -#line 480 "./ada-exp.y" -{ write_attribute_call1 (ATR_FIRST, yyvsp[0].lval); } - break; -case 67: -#line 482 "./ada-exp.y" -{ write_attribute_call1 (ATR_LAST, yyvsp[0].lval); } - break; -case 68: -#line 484 "./ada-exp.y" -{ write_attribute_call1 (ATR_LENGTH, yyvsp[0].lval); } - break; -case 69: -#line 486 "./ada-exp.y" -{ write_attribute_calln (ATR_VAL, 1); } - break; -case 70: -#line 488 "./ada-exp.y" -{ write_attribute_call0 (ATR_MODULUS); } - break; -case 71: -#line 492 "./ada-exp.y" -{ yyval.lval = 1; } - break; -case 72: -#line 494 "./ada-exp.y" -{ yyval.lval = yyvsp[-1].typed_val.val; } - break; -case 73: -#line 499 "./ada-exp.y" -{ write_exp_elt_opcode (OP_TYPE); - write_exp_elt_type (yyvsp[0].tval); - write_exp_elt_opcode (OP_TYPE); } - break; -case 75: -#line 507 "./ada-exp.y" -{ write_exp_elt_opcode (OP_TYPE); - write_exp_elt_type (builtin_type_void); - write_exp_elt_opcode (OP_TYPE); } - break; -case 76: -#line 514 "./ada-exp.y" -{ write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (yyvsp[0].typed_val.type); - write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val)); - write_exp_elt_opcode (OP_LONG); - } - break; -case 77: -#line 522 "./ada-exp.y" -{ write_exp_elt_opcode (OP_LONG); - if (type_qualifier == NULL) - write_exp_elt_type (yyvsp[0].typed_val.type); - else - write_exp_elt_type (type_qualifier); - write_exp_elt_longcst - (convert_char_literal (type_qualifier, yyvsp[0].typed_val.val)); - write_exp_elt_opcode (OP_LONG); - } - break; -case 78: -#line 534 "./ada-exp.y" -{ write_exp_elt_opcode (OP_DOUBLE); - write_exp_elt_type (yyvsp[0].typed_val_float.type); - write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval); - write_exp_elt_opcode (OP_DOUBLE); - } - break; -case 79: -#line 542 "./ada-exp.y" -{ write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst ((LONGEST)(0)); - write_exp_elt_opcode (OP_LONG); - } - break; -case 80: -#line 549 "./ada-exp.y" -{ /* Ada strings are converted into array constants - a lower bound of 1. Thus, the array upper bound - is the string length. */ - char *sp = yyvsp[0].sval.ptr; int count; - if (yyvsp[0].sval.length == 0) - { /* One dummy character for the type */ - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_ada_char); - write_exp_elt_longcst ((LONGEST)(0)); - write_exp_elt_opcode (OP_LONG); - } - for (count = yyvsp[0].sval.length; count > 0; count -= 1) - { - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_ada_char); - write_exp_elt_longcst ((LONGEST)(*sp)); - sp += 1; - write_exp_elt_opcode (OP_LONG); - } - write_exp_elt_opcode (OP_ARRAY); - write_exp_elt_longcst ((LONGEST) 1); - write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length)); - write_exp_elt_opcode (OP_ARRAY); - } - break; -case 81: -#line 576 "./ada-exp.y" -{ error ("NEW not implemented."); } - break; -case 82: -#line 579 "./ada-exp.y" -{ write_var_from_name (NULL, yyvsp[0].ssym); } - break; -case 83: -#line 581 "./ada-exp.y" -{ write_var_from_name (yyvsp[-1].bval, yyvsp[0].ssym); } - break; -case 84: -#line 582 "./ada-exp.y" -{ write_object_renaming (NULL, yyvsp[0].ssym.sym); } - break; -case 85: -#line 584 "./ada-exp.y" -{ write_object_renaming (yyvsp[-1].bval, yyvsp[0].ssym.sym); } - break; -case 86: -#line 587 "./ada-exp.y" -{ } - break; -case 87: -#line 588 "./ada-exp.y" -{ } - break; -case 88: -#line 589 "./ada-exp.y" -{ } - break; -case 89: -#line 593 "./ada-exp.y" -{ yyval.bval = yyvsp[0].bval; } - break; -case 90: -#line 595 "./ada-exp.y" -{ yyval.bval = yyvsp[0].bval; } - break; -case 91: -#line 599 "./ada-exp.y" -{ yyval.tval = yyvsp[0].tval; } - break; -case 92: -#line 600 "./ada-exp.y" -{ yyval.tval = yyvsp[0].tval; } - break; -case 93: -#line 602 "./ada-exp.y" -{ yyval.tval = lookup_pointer_type (yyvsp[-1].tval); } - break; -case 94: -#line 604 "./ada-exp.y" -{ yyval.tval = lookup_pointer_type (yyvsp[-1].tval); } - break; -case 95: -#line 611 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_IND); } - break; -case 96: -#line 613 "./ada-exp.y" -{ write_exp_elt_opcode (UNOP_ADDR); } - break; -case 97: -#line 615 "./ada-exp.y" -{ write_exp_elt_opcode (BINOP_SUBSCRIPT); } - break; -} - -#line 705 "/usr/local/share/bison/bison.simple" - - - yyvsp -= yylen; - yyssp -= yylen; -#if YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG - if (yydebug) - { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; -#if YYLSP_NEEDED - *++yylsp = yyloc; -#endif - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - YYSIZE_T yysize = 0; - char *yymsg; - int yyx, yycount; - - yycount = 0; - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) - if (yycheck[yyx + yyn] == yyx) - yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("parse error, unexpected ") + 1; - yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "parse error, unexpected "); - yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); - - if (yycount < 5) - { - yycount = 0; - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); - yyx++) - if (yycheck[yyx + yyn] == yyx) - { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); - yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - yyerror ("parse error; also virtual memory exhausted"); - } - else -#endif /* defined (YYERROR_VERBOSE) */ - yyerror ("parse error"); - } - goto yyerrlab1; - - -/*--------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action | -`--------------------------------------------------*/ -yyerrlab1: - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - YYDPRINTF ((stderr, "Discarding token %d (%s).\n", - yychar, yytname[yychar1])); - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - - -/*-------------------------------------------------------------------. -| yyerrdefault -- current state does not do anything special for the | -| error token. | -`-------------------------------------------------------------------*/ -yyerrdefault: -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - - /* If its default is to accept any token, ok. Otherwise pop it. */ - yyn = yydefact[yystate]; - if (yyn) - goto yydefault; -#endif - - -/*---------------------------------------------------------------. -| yyerrpop -- pop the current state because it cannot handle the | -| error token | -`---------------------------------------------------------------*/ -yyerrpop: - if (yyssp == yyss) - YYABORT; - yyvsp--; - yystate = *--yyssp; -#if YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG - if (yydebug) - { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "Error: state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); - } -#endif - -/*--------------. -| yyerrhandle. | -`--------------*/ -yyerrhandle: - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - - YYDPRINTF ((stderr, "Shifting error token, ")); - - *++yyvsp = yylval; -#if YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -/*---------------------------------------------. -| yyoverflowab -- parser overflow comes here. | -`---------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); - yyresult = 2; - /* Fall through. */ - -yyreturn: -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif - return yyresult; -} -#line 618 "./ada-exp.y" - - -/* yylex defined in ada-lex.c: Reads one token, getting characters */ -/* through lexptr. */ - -/* Remap normal flex interface names (yylex) as well as gratuitiously */ -/* global symbol names, so we can have multiple flex-generated parsers */ -/* in gdb. */ - -/* (See note above on previous definitions for YACC.) */ - -#define yy_create_buffer ada_yy_create_buffer -#define yy_delete_buffer ada_yy_delete_buffer -#define yy_init_buffer ada_yy_init_buffer -#define yy_load_buffer_state ada_yy_load_buffer_state -#define yy_switch_to_buffer ada_yy_switch_to_buffer -#define yyrestart ada_yyrestart -#define yytext ada_yytext -#define yywrap ada_yywrap - -/* The following kludge was found necessary to prevent conflicts between */ -/* defs.h and non-standard stdlib.h files. */ -#define qsort __qsort__dummy -#include "ada-lex.c" - -int -ada_parse () -{ - lexer_init (yyin); /* (Re-)initialize lexer. */ - left_block_context = NULL; - type_qualifier = NULL; - - return _ada_parse (); -} - -void -yyerror (msg) - char *msg; -{ - error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr); -} - -/* The operator name corresponding to operator symbol STRING (adds - quotes and maps to lower-case). Destroys the previous contents of - the array pointed to by STRING.ptr. Error if STRING does not match - a valid Ada operator. Assumes that STRING.ptr points to a - null-terminated string and that, if STRING is a valid operator - symbol, the array pointed to by STRING.ptr contains at least - STRING.length+3 characters. */ - -static struct stoken -string_to_operator (string) - struct stoken string; -{ - int i; - - for (i = 0; ada_opname_table[i].mangled != NULL; i += 1) - { - if (string.length == strlen (ada_opname_table[i].demangled)-2 - && strncasecmp (string.ptr, ada_opname_table[i].demangled+1, - string.length) == 0) - { - strncpy (string.ptr, ada_opname_table[i].demangled, - string.length+2); - string.length += 2; - return string; - } - } - error ("Invalid operator symbol `%s'", string.ptr); -} - -/* Emit expression to access an instance of SYM, in block BLOCK (if - * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */ -static void -write_var_from_sym (orig_left_context, block, sym) - struct block* orig_left_context; - struct block* block; - struct symbol* sym; -{ - if (orig_left_context == NULL && symbol_read_needs_frame (sym)) - { - if (innermost_block == 0 || - contained_in (block, innermost_block)) - innermost_block = block; - } - - write_exp_elt_opcode (OP_VAR_VALUE); - /* We want to use the selected frame, not another more inner frame - which happens to be in the same block */ - write_exp_elt_block (NULL); - write_exp_elt_sym (sym); - write_exp_elt_opcode (OP_VAR_VALUE); -} - -/* Emit expression to access an instance of NAME. */ -static void -write_var_from_name (orig_left_context, name) - struct block* orig_left_context; - struct name_info name; -{ - if (name.msym != NULL) - { - write_exp_msymbol (name.msym, - lookup_function_type (builtin_type_int), - builtin_type_int); - } - else if (name.sym == NULL) - { - /* Multiple matches: record name and starting block for later - resolution by ada_resolve. */ - /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */ - /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */ - write_exp_elt_block (name.block); - /* write_exp_elt_name (name.stoken.ptr); */ - /* FIXME: write_exp_elt_name should be defined in defs.h, located in parse.c */ - /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */ - /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */ - } - else - write_var_from_sym (orig_left_context, name.block, name.sym); -} - -/* Write a call on parameterless attribute ATR. */ - -static void -write_attribute_call0 (atr) - enum ada_attribute atr; -{ - /* write_exp_elt_opcode (OP_ATTRIBUTE); */ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) 0); - write_exp_elt_longcst ((LONGEST) atr); - /* write_exp_elt_opcode (OP_ATTRIBUTE); */ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ -} - -/* Write a call on an attribute ATR with one constant integer - * parameter. */ - -static void -write_attribute_call1 (atr, arg) - enum ada_attribute atr; - LONGEST arg; -{ - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst (arg); - write_exp_elt_opcode (OP_LONG); - /*write_exp_elt_opcode (OP_ATTRIBUTE);*/ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) 1); - write_exp_elt_longcst ((LONGEST) atr); - /*write_exp_elt_opcode (OP_ATTRIBUTE);*/ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ -} - -/* Write a call on an attribute ATR with N parameters, whose code must have - * been generated previously. */ - -static void -write_attribute_calln (atr, n) - enum ada_attribute atr; - int n; -{ - /*write_exp_elt_opcode (OP_ATTRIBUTE);*/ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) n); - write_exp_elt_longcst ((LONGEST) atr); - /* write_exp_elt_opcode (OP_ATTRIBUTE);*/ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ -} - -/* Emit expression corresponding to the renamed object designated by - * the type RENAMING, which must be the referent of an object renaming - * type, in the context of ORIG_LEFT_CONTEXT (?). */ -static void -write_object_renaming (orig_left_context, renaming) - struct block* orig_left_context; - struct symbol* renaming; -{ - const char* qualification = SYMBOL_NAME (renaming); - const char* simple_tail; - const char* expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0); - const char* suffix; - char* name; - struct symbol* sym; - enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state; - - /* if orig_left_context is null, then use the currently selected - block, otherwise we might fail our symbol lookup below */ - if (orig_left_context == NULL) - orig_left_context = get_selected_block (NULL); - - for (simple_tail = qualification + strlen (qualification); - simple_tail != qualification; simple_tail -= 1) - { - if (*simple_tail == '.') - { - simple_tail += 1; - break; - } - else if (STREQN (simple_tail, "__", 2)) - { - simple_tail += 2; - break; - } - } - - suffix = strstr (expr, "___XE"); - if (suffix == NULL) - goto BadEncoding; - - name = (char*) xmalloc (suffix - expr + 1); - /* add_name_string_cleanup (name); */ - /* FIXME: add_name_string_cleanup should be defined in - parser-defs.h, implemented in parse.c */ - strncpy (name, expr, suffix-expr); - name[suffix-expr] = '\000'; - sym = lookup_symbol (name, orig_left_context, VAR_NAMESPACE, 0, NULL); - /* if (sym == NULL) - error ("Could not find renamed variable: %s", ada_demangle (name)); - */ - /* FIXME: ada_demangle should be defined in defs.h, implemented in ada-lang.c */ - write_var_from_sym (orig_left_context, block_found, sym); - - suffix += 5; - slice_state = SIMPLE_INDEX; - while (*suffix == 'X') - { - suffix += 1; - - switch (*suffix) { - case 'L': - slice_state = LOWER_BOUND; - case 'S': - suffix += 1; - if (isdigit (*suffix)) - { - char* next; - long val = strtol (suffix, &next, 10); - if (next == suffix) - goto BadEncoding; - suffix = next; - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_ada_int); - write_exp_elt_longcst ((LONGEST) val); - write_exp_elt_opcode (OP_LONG); - } - else - { - const char* end; - char* index_name; - int index_len; - struct symbol* index_sym; - - end = strchr (suffix, 'X'); - if (end == NULL) - end = suffix + strlen (suffix); - - index_len = simple_tail - qualification + 2 + (suffix - end) + 1; - index_name = (char*) xmalloc (index_len); - memset (index_name, '\000', index_len); - /* add_name_string_cleanup (index_name);*/ - /* FIXME: add_name_string_cleanup should be defined in - parser-defs.h, implemented in parse.c */ - strncpy (index_name, qualification, simple_tail - qualification); - index_name[simple_tail - qualification] = '\000'; - strncat (index_name, suffix, suffix-end); - suffix = end; - - index_sym = - lookup_symbol (index_name, NULL, VAR_NAMESPACE, 0, NULL); - if (index_sym == NULL) - error ("Could not find %s", index_name); - write_var_from_sym (NULL, block_found, sym); - } - if (slice_state == SIMPLE_INDEX) - { - write_exp_elt_opcode (OP_FUNCALL); - write_exp_elt_longcst ((LONGEST) 1); - write_exp_elt_opcode (OP_FUNCALL); - } - else if (slice_state == LOWER_BOUND) - slice_state = UPPER_BOUND; - else if (slice_state == UPPER_BOUND) - { - write_exp_elt_opcode (TERNOP_SLICE); - slice_state = SIMPLE_INDEX; - } - break; - - case 'R': - { - struct stoken field_name; - const char* end; - suffix += 1; - - if (slice_state != SIMPLE_INDEX) - goto BadEncoding; - end = strchr (suffix, 'X'); - if (end == NULL) - end = suffix + strlen (suffix); - field_name.length = end - suffix; - field_name.ptr = (char*) xmalloc (end - suffix + 1); - strncpy (field_name.ptr, suffix, end - suffix); - field_name.ptr[end - suffix] = '\000'; - suffix = end; - write_exp_elt_opcode (STRUCTOP_STRUCT); - write_exp_string (field_name); - write_exp_elt_opcode (STRUCTOP_STRUCT); - break; - } - - default: - goto BadEncoding; - } - } - if (slice_state == SIMPLE_INDEX) - return; - - BadEncoding: - error ("Internal error in encoding of renaming declaration: %s", - SYMBOL_NAME (renaming)); -} - -/* Convert the character literal whose ASCII value would be VAL to the - appropriate value of type TYPE, if there is a translation. - Otherwise return VAL. Hence, in an enumeration type ('A', 'B'), - the literal 'A' (VAL == 65), returns 0. */ -static LONGEST -convert_char_literal (struct type* type, LONGEST val) -{ - char name[7]; - int f; - - if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM) - return val; - sprintf (name, "QU%02x", (int) val); - for (f = 0; f < TYPE_NFIELDS (type); f += 1) - { - if (STREQ (name, TYPE_FIELD_NAME (type, f))) - return TYPE_FIELD_BITPOS (type, f); - } - return val; -} diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y deleted file mode 100644 index 7d46dd2cf8b..00000000000 --- a/gdb/ada-exp.y +++ /dev/null @@ -1,962 +0,0 @@ -/* YACC parser for Ada expressions, for GDB. - Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1997, 2000 - Free Software Foundation, Inc. - -This file is part of GDB. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Parse an Ada expression from text in a string, - and return the result as a struct expression pointer. - That structure contains arithmetic operations in reverse polish, - with constants represented by operations that are followed by special data. - See expression.h for the details of the format. - What is important here is that it can be built up sequentially - during the process of parsing; the lower levels of the tree always - come first in the result. - - malloc's and realloc's in this file are transformed to - xmalloc and xrealloc respectively by the same sed command in the - makefile that remaps any other malloc/realloc inserted by the parser - generator. Doing this with #defines and trying to control the interaction - with include files ( and for example) just became - too messy, particularly when such includes can be inserted at random - times by the parser generator. */ - -%{ - -#include "defs.h" -#include -#include -#include "expression.h" -#include "value.h" -#include "parser-defs.h" -#include "language.h" -#include "ada-lang.h" -#include "bfd.h" /* Required by objfiles.h. */ -#include "symfile.h" /* Required by objfiles.h. */ -#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ -#include "frame.h" - -/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), - as well as gratuitiously global symbol names, so we can have multiple - yacc generated parsers in gdb. These are only the variables - produced by yacc. If other parser generators (bison, byacc, etc) produce - additional global names that conflict at link time, then those parser - generators need to be fixed instead of adding those names to this list. */ - -/* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix - options. I presume we are maintaining it to accommodate systems - without BISON? (PNH) */ - -#define yymaxdepth ada_maxdepth -#define yyparse _ada_parse /* ada_parse calls this after initialization */ -#define yylex ada_lex -#define yyerror ada_error -#define yylval ada_lval -#define yychar ada_char -#define yydebug ada_debug -#define yypact ada_pact -#define yyr1 ada_r1 -#define yyr2 ada_r2 -#define yydef ada_def -#define yychk ada_chk -#define yypgo ada_pgo -#define yyact ada_act -#define yyexca ada_exca -#define yyerrflag ada_errflag -#define yynerrs ada_nerrs -#define yyps ada_ps -#define yypv ada_pv -#define yys ada_s -#define yy_yys ada_yys -#define yystate ada_state -#define yytmp ada_tmp -#define yyv ada_v -#define yy_yyv ada_yyv -#define yyval ada_val -#define yylloc ada_lloc -#define yyreds ada_reds /* With YYDEBUG defined */ -#define yytoks ada_toks /* With YYDEBUG defined */ - -#ifndef YYDEBUG -#define YYDEBUG 0 /* Default to no yydebug support */ -#endif - -struct name_info { - struct symbol* sym; - struct minimal_symbol* msym; - struct block* block; - struct stoken stoken; -}; - -/* If expression is in the context of TYPE'(...), then TYPE, else - * NULL. */ -static struct type* type_qualifier; - -int yyparse (void); - -static int yylex (void); - -void yyerror (char *); - -static struct stoken string_to_operator (struct stoken); - -static void write_attribute_call0 (enum ada_attribute); - -static void write_attribute_call1 (enum ada_attribute, LONGEST); - -static void write_attribute_calln (enum ada_attribute, int); - -static void write_object_renaming (struct block*, struct symbol*); - -static void write_var_from_name (struct block*, struct name_info); - -static LONGEST -convert_char_literal (struct type*, LONGEST); -%} - -%union - { - LONGEST lval; - struct { - LONGEST val; - struct type *type; - } typed_val; - struct { - DOUBLEST dval; - struct type *type; - } typed_val_float; - struct type *tval; - struct stoken sval; - struct name_info ssym; - int voidval; - struct block *bval; - struct internalvar *ivar; - - } - -%type exp exp1 simple_exp start variable -%type type - -%token INT NULL_PTR CHARLIT -%token FLOAT -%token TYPENAME -%token BLOCKNAME - -/* Both NAME and TYPENAME tokens represent symbols in the input, - and both convey their data as strings. - But a TYPENAME is a string that happens to be defined as a typedef - or builtin type name (such as int or char) - and a NAME is any other symbol. - Contexts where this distinction is not important can use the - nonterminal "name", which matches either NAME or TYPENAME. */ - -%token STRING -%token NAME DOT_ID OBJECT_RENAMING -%type block -%type arglist tick_arglist - -%type save_qualifier - -%token DOT_ALL - -/* Special type cases, put in to allow the parser to distinguish different - legal basetypes. */ -%token LAST REGNAME - -%token INTERNAL_VARIABLE - -%nonassoc ASSIGN -%left _AND_ OR XOR THEN ELSE -%left '=' NOTEQUAL '<' '>' LEQ GEQ IN DOTDOT -%left '@' -%left '+' '-' '&' -%left UNARY -%left '*' '/' MOD REM -%right STARSTAR ABS NOT - /* The following are right-associative only so that reductions at this - precedence have lower precedence than '.' and '('. The syntax still - forces a.b.c, e.g., to be LEFT-associated. */ -%right TICK_ACCESS TICK_ADDRESS TICK_FIRST TICK_LAST TICK_LENGTH -%right TICK_MAX TICK_MIN TICK_MODULUS -%right TICK_POS TICK_RANGE TICK_SIZE TICK_TAG TICK_VAL -%right '.' '(' '[' DOT_ID DOT_ALL - -%token ARROW NEW - - -%% - -start : exp1 - | type { write_exp_elt_opcode (OP_TYPE); - write_exp_elt_type ($1); - write_exp_elt_opcode (OP_TYPE); } - ; - -/* Expressions, including the sequencing operator. */ -exp1 : exp - | exp1 ';' exp - { write_exp_elt_opcode (BINOP_COMMA); } - ; - -/* Expressions, not including the sequencing operator. */ -simple_exp : simple_exp DOT_ALL - { write_exp_elt_opcode (UNOP_IND); } - ; - -simple_exp : simple_exp DOT_ID - { write_exp_elt_opcode (STRUCTOP_STRUCT); - write_exp_string ($2.stoken); - write_exp_elt_opcode (STRUCTOP_STRUCT); - } - ; - -simple_exp : simple_exp '(' arglist ')' - { - write_exp_elt_opcode (OP_FUNCALL); - write_exp_elt_longcst ($3); - write_exp_elt_opcode (OP_FUNCALL); - } - ; - -simple_exp : type '(' exp ')' - { - write_exp_elt_opcode (UNOP_CAST); - write_exp_elt_type ($1); - write_exp_elt_opcode (UNOP_CAST); - } - ; - -simple_exp : type '\'' save_qualifier { type_qualifier = $1; } '(' exp ')' - { - /* write_exp_elt_opcode (UNOP_QUAL); */ - /* FIXME: UNOP_QUAL should be defined in expression.h */ - write_exp_elt_type ($1); - /* write_exp_elt_opcode (UNOP_QUAL); */ - /* FIXME: UNOP_QUAL should be defined in expression.h */ - type_qualifier = $3; - } - ; - -save_qualifier : { $$ = type_qualifier; } - -simple_exp : - simple_exp '(' exp DOTDOT exp ')' - { write_exp_elt_opcode (TERNOP_SLICE); } - ; - -simple_exp : '(' exp1 ')' { } - ; - -simple_exp : variable - ; - -simple_exp: REGNAME /* GDB extension */ - { write_exp_elt_opcode (OP_REGISTER); - write_exp_elt_longcst ((LONGEST) $1); - write_exp_elt_opcode (OP_REGISTER); - } - ; - -simple_exp: INTERNAL_VARIABLE /* GDB extension */ - { write_exp_elt_opcode (OP_INTERNALVAR); - write_exp_elt_intern ($1); - write_exp_elt_opcode (OP_INTERNALVAR); - } - ; - - -exp : simple_exp - ; - -simple_exp: LAST - { write_exp_elt_opcode (OP_LAST); - write_exp_elt_longcst ((LONGEST) $1); - write_exp_elt_opcode (OP_LAST); - } - ; - -exp : exp ASSIGN exp /* Extension for convenience */ - { write_exp_elt_opcode (BINOP_ASSIGN); } - ; - -exp : '-' exp %prec UNARY - { write_exp_elt_opcode (UNOP_NEG); } - ; - -exp : '+' exp %prec UNARY - { write_exp_elt_opcode (UNOP_PLUS); } - ; - -exp : NOT exp %prec UNARY - { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } - ; - -exp : ABS exp %prec UNARY - { write_exp_elt_opcode (UNOP_ABS); } - ; - -arglist : { $$ = 0; } - ; - -arglist : exp - { $$ = 1; } - | any_name ARROW exp - { $$ = 1; } - | arglist ',' exp - { $$ = $1 + 1; } - | arglist ',' any_name ARROW exp - { $$ = $1 + 1; } - ; - -exp : '{' type '}' exp %prec '.' - /* GDB extension */ - { write_exp_elt_opcode (UNOP_MEMVAL); - write_exp_elt_type ($2); - write_exp_elt_opcode (UNOP_MEMVAL); - } - ; - -/* Binary operators in order of decreasing precedence. */ - -exp : exp STARSTAR exp - { write_exp_elt_opcode (BINOP_EXP); } - ; - -exp : exp '*' exp - { write_exp_elt_opcode (BINOP_MUL); } - ; - -exp : exp '/' exp - { write_exp_elt_opcode (BINOP_DIV); } - ; - -exp : exp REM exp /* May need to be fixed to give correct Ada REM */ - { write_exp_elt_opcode (BINOP_REM); } - ; - -exp : exp MOD exp - { write_exp_elt_opcode (BINOP_MOD); } - ; - -exp : exp '@' exp /* GDB extension */ - { write_exp_elt_opcode (BINOP_REPEAT); } - ; - -exp : exp '+' exp - { write_exp_elt_opcode (BINOP_ADD); } - ; - -exp : exp '&' exp - { write_exp_elt_opcode (BINOP_CONCAT); } - ; - -exp : exp '-' exp - { write_exp_elt_opcode (BINOP_SUB); } - ; - -exp : exp '=' exp - { write_exp_elt_opcode (BINOP_EQUAL); } - ; - -exp : exp NOTEQUAL exp - { write_exp_elt_opcode (BINOP_NOTEQUAL); } - ; - -exp : exp LEQ exp - { write_exp_elt_opcode (BINOP_LEQ); } - ; - -exp : exp IN exp DOTDOT exp - { /*write_exp_elt_opcode (TERNOP_MBR); */ } - /* FIXME: TERNOP_MBR should be defined in - expression.h */ - | exp IN exp TICK_RANGE tick_arglist - { /*write_exp_elt_opcode (BINOP_MBR); */ - /* FIXME: BINOP_MBR should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) $5); - /*write_exp_elt_opcode (BINOP_MBR); */ - } - | exp IN TYPENAME %prec TICK_ACCESS - { /*write_exp_elt_opcode (UNOP_MBR); */ - /* FIXME: UNOP_QUAL should be defined in expression.h */ - write_exp_elt_type ($3); - /* write_exp_elt_opcode (UNOP_MBR); */ - /* FIXME: UNOP_MBR should be defined in expression.h */ - } - | exp NOT IN exp DOTDOT exp - { /*write_exp_elt_opcode (TERNOP_MBR); */ - /* FIXME: TERNOP_MBR should be defined in expression.h */ - write_exp_elt_opcode (UNOP_LOGICAL_NOT); - } - | exp NOT IN exp TICK_RANGE tick_arglist - { /* write_exp_elt_opcode (BINOP_MBR); */ - /* FIXME: BINOP_MBR should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) $6); - /*write_exp_elt_opcode (BINOP_MBR);*/ - /* FIXME: BINOP_MBR should be defined in expression.h */ - write_exp_elt_opcode (UNOP_LOGICAL_NOT); - } - | exp NOT IN TYPENAME %prec TICK_ACCESS - { /*write_exp_elt_opcode (UNOP_MBR);*/ - /* FIXME: UNOP_MBR should be defined in expression.h */ - write_exp_elt_type ($4); - /* write_exp_elt_opcode (UNOP_MBR);*/ - /* FIXME: UNOP_MBR should be defined in expression.h */ - write_exp_elt_opcode (UNOP_LOGICAL_NOT); - } - ; - -exp : exp GEQ exp - { write_exp_elt_opcode (BINOP_GEQ); } - ; - -exp : exp '<' exp - { write_exp_elt_opcode (BINOP_LESS); } - ; - -exp : exp '>' exp - { write_exp_elt_opcode (BINOP_GTR); } - ; - -exp : exp _AND_ exp /* Fix for Ada elementwise AND. */ - { write_exp_elt_opcode (BINOP_BITWISE_AND); } - ; - -exp : exp _AND_ THEN exp %prec _AND_ - { write_exp_elt_opcode (BINOP_LOGICAL_AND); } - ; - -exp : exp OR exp /* Fix for Ada elementwise OR */ - { write_exp_elt_opcode (BINOP_BITWISE_IOR); } - ; - -exp : exp OR ELSE exp - { write_exp_elt_opcode (BINOP_LOGICAL_OR); } - ; - -exp : exp XOR exp /* Fix for Ada elementwise XOR */ - { write_exp_elt_opcode (BINOP_BITWISE_XOR); } - ; - -simple_exp : simple_exp TICK_ACCESS - { write_exp_elt_opcode (UNOP_ADDR); } - | simple_exp TICK_ADDRESS - { write_exp_elt_opcode (UNOP_ADDR); - write_exp_elt_opcode (UNOP_CAST); - write_exp_elt_type (builtin_type_ada_system_address); - write_exp_elt_opcode (UNOP_CAST); - } - | simple_exp TICK_FIRST tick_arglist - { write_attribute_call1 (ATR_FIRST, $3); } - | simple_exp TICK_LAST tick_arglist - { write_attribute_call1 (ATR_LAST, $3); } - | simple_exp TICK_LENGTH tick_arglist - { write_attribute_call1 (ATR_LENGTH, $3); } - | simple_exp TICK_SIZE - { write_attribute_call0 (ATR_SIZE); } - | simple_exp TICK_TAG - { write_attribute_call0 (ATR_TAG); } - | opt_type_prefix TICK_MIN '(' exp ',' exp ')' - { write_attribute_calln (ATR_MIN, 2); } - | opt_type_prefix TICK_MAX '(' exp ',' exp ')' - { write_attribute_calln (ATR_MAX, 2); } - | opt_type_prefix TICK_POS '(' exp ')' - { write_attribute_calln (ATR_POS, 1); } - | type_prefix TICK_FIRST tick_arglist - { write_attribute_call1 (ATR_FIRST, $3); } - | type_prefix TICK_LAST tick_arglist - { write_attribute_call1 (ATR_LAST, $3); } - | type_prefix TICK_LENGTH tick_arglist - { write_attribute_call1 (ATR_LENGTH, $3); } - | type_prefix TICK_VAL '(' exp ')' - { write_attribute_calln (ATR_VAL, 1); } - | type_prefix TICK_MODULUS - { write_attribute_call0 (ATR_MODULUS); } - ; - -tick_arglist : %prec '(' - { $$ = 1; } - | '(' INT ')' - { $$ = $2.val; } - ; - -type_prefix : - TYPENAME - { write_exp_elt_opcode (OP_TYPE); - write_exp_elt_type ($1); - write_exp_elt_opcode (OP_TYPE); } - ; - -opt_type_prefix : - type_prefix - | /* EMPTY */ - { write_exp_elt_opcode (OP_TYPE); - write_exp_elt_type (builtin_type_void); - write_exp_elt_opcode (OP_TYPE); } - ; - - -exp : INT - { write_exp_elt_opcode (OP_LONG); - write_exp_elt_type ($1.type); - write_exp_elt_longcst ((LONGEST)($1.val)); - write_exp_elt_opcode (OP_LONG); - } - ; - -exp : CHARLIT - { write_exp_elt_opcode (OP_LONG); - if (type_qualifier == NULL) - write_exp_elt_type ($1.type); - else - write_exp_elt_type (type_qualifier); - write_exp_elt_longcst - (convert_char_literal (type_qualifier, $1.val)); - write_exp_elt_opcode (OP_LONG); - } - - -exp : FLOAT - { write_exp_elt_opcode (OP_DOUBLE); - write_exp_elt_type ($1.type); - write_exp_elt_dblcst ($1.dval); - write_exp_elt_opcode (OP_DOUBLE); - } - ; - -exp : NULL_PTR - { write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst ((LONGEST)(0)); - write_exp_elt_opcode (OP_LONG); - } - -exp : STRING - { /* Ada strings are converted into array constants - a lower bound of 1. Thus, the array upper bound - is the string length. */ - char *sp = $1.ptr; int count; - if ($1.length == 0) - { /* One dummy character for the type */ - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_ada_char); - write_exp_elt_longcst ((LONGEST)(0)); - write_exp_elt_opcode (OP_LONG); - } - for (count = $1.length; count > 0; count -= 1) - { - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_ada_char); - write_exp_elt_longcst ((LONGEST)(*sp)); - sp += 1; - write_exp_elt_opcode (OP_LONG); - } - write_exp_elt_opcode (OP_ARRAY); - write_exp_elt_longcst ((LONGEST) 1); - write_exp_elt_longcst ((LONGEST) ($1.length)); - write_exp_elt_opcode (OP_ARRAY); - } - ; - -exp : NEW TYPENAME - { error ("NEW not implemented."); } - ; - -variable: NAME { write_var_from_name (NULL, $1); } - | block NAME /* GDB extension */ - { write_var_from_name ($1, $2); } - | OBJECT_RENAMING { write_object_renaming (NULL, $1.sym); } - | block OBJECT_RENAMING - { write_object_renaming ($1, $2.sym); } - ; - -any_name : NAME { } - | TYPENAME { } - | OBJECT_RENAMING { } - ; - -block : BLOCKNAME /* GDB extension */ - { $$ = $1; } - | block BLOCKNAME /* GDB extension */ - { $$ = $2; } - ; - - -type : TYPENAME { $$ = $1; } - | block TYPENAME { $$ = $2; } - | TYPENAME TICK_ACCESS - { $$ = lookup_pointer_type ($1); } - | block TYPENAME TICK_ACCESS - { $$ = lookup_pointer_type ($2); } - ; - -/* Some extensions borrowed from C, for the benefit of those who find they - can't get used to Ada notation in GDB. */ - -exp : '*' exp %prec '.' - { write_exp_elt_opcode (UNOP_IND); } - | '&' exp %prec '.' - { write_exp_elt_opcode (UNOP_ADDR); } - | exp '[' exp ']' - { write_exp_elt_opcode (BINOP_SUBSCRIPT); } - ; - -%% - -/* yylex defined in ada-lex.c: Reads one token, getting characters */ -/* through lexptr. */ - -/* Remap normal flex interface names (yylex) as well as gratuitiously */ -/* global symbol names, so we can have multiple flex-generated parsers */ -/* in gdb. */ - -/* (See note above on previous definitions for YACC.) */ - -#define yy_create_buffer ada_yy_create_buffer -#define yy_delete_buffer ada_yy_delete_buffer -#define yy_init_buffer ada_yy_init_buffer -#define yy_load_buffer_state ada_yy_load_buffer_state -#define yy_switch_to_buffer ada_yy_switch_to_buffer -#define yyrestart ada_yyrestart -#define yytext ada_yytext -#define yywrap ada_yywrap - -/* The following kludge was found necessary to prevent conflicts between */ -/* defs.h and non-standard stdlib.h files. */ -#define qsort __qsort__dummy -#include "ada-lex.c" - -int -ada_parse () -{ - lexer_init (yyin); /* (Re-)initialize lexer. */ - left_block_context = NULL; - type_qualifier = NULL; - - return _ada_parse (); -} - -void -yyerror (msg) - char *msg; -{ - error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr); -} - -/* The operator name corresponding to operator symbol STRING (adds - quotes and maps to lower-case). Destroys the previous contents of - the array pointed to by STRING.ptr. Error if STRING does not match - a valid Ada operator. Assumes that STRING.ptr points to a - null-terminated string and that, if STRING is a valid operator - symbol, the array pointed to by STRING.ptr contains at least - STRING.length+3 characters. */ - -static struct stoken -string_to_operator (string) - struct stoken string; -{ - int i; - - for (i = 0; ada_opname_table[i].mangled != NULL; i += 1) - { - if (string.length == strlen (ada_opname_table[i].demangled)-2 - && strncasecmp (string.ptr, ada_opname_table[i].demangled+1, - string.length) == 0) - { - strncpy (string.ptr, ada_opname_table[i].demangled, - string.length+2); - string.length += 2; - return string; - } - } - error ("Invalid operator symbol `%s'", string.ptr); -} - -/* Emit expression to access an instance of SYM, in block BLOCK (if - * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */ -static void -write_var_from_sym (orig_left_context, block, sym) - struct block* orig_left_context; - struct block* block; - struct symbol* sym; -{ - if (orig_left_context == NULL && symbol_read_needs_frame (sym)) - { - if (innermost_block == 0 || - contained_in (block, innermost_block)) - innermost_block = block; - } - - write_exp_elt_opcode (OP_VAR_VALUE); - /* We want to use the selected frame, not another more inner frame - which happens to be in the same block */ - write_exp_elt_block (NULL); - write_exp_elt_sym (sym); - write_exp_elt_opcode (OP_VAR_VALUE); -} - -/* Emit expression to access an instance of NAME. */ -static void -write_var_from_name (orig_left_context, name) - struct block* orig_left_context; - struct name_info name; -{ - if (name.msym != NULL) - { - write_exp_msymbol (name.msym, - lookup_function_type (builtin_type_int), - builtin_type_int); - } - else if (name.sym == NULL) - { - /* Multiple matches: record name and starting block for later - resolution by ada_resolve. */ - /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */ - /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */ - write_exp_elt_block (name.block); - /* write_exp_elt_name (name.stoken.ptr); */ - /* FIXME: write_exp_elt_name should be defined in defs.h, located in parse.c */ - /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */ - /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */ - } - else - write_var_from_sym (orig_left_context, name.block, name.sym); -} - -/* Write a call on parameterless attribute ATR. */ - -static void -write_attribute_call0 (atr) - enum ada_attribute atr; -{ - /* write_exp_elt_opcode (OP_ATTRIBUTE); */ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) 0); - write_exp_elt_longcst ((LONGEST) atr); - /* write_exp_elt_opcode (OP_ATTRIBUTE); */ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ -} - -/* Write a call on an attribute ATR with one constant integer - * parameter. */ - -static void -write_attribute_call1 (atr, arg) - enum ada_attribute atr; - LONGEST arg; -{ - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst (arg); - write_exp_elt_opcode (OP_LONG); - /*write_exp_elt_opcode (OP_ATTRIBUTE);*/ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) 1); - write_exp_elt_longcst ((LONGEST) atr); - /*write_exp_elt_opcode (OP_ATTRIBUTE);*/ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ -} - -/* Write a call on an attribute ATR with N parameters, whose code must have - * been generated previously. */ - -static void -write_attribute_calln (atr, n) - enum ada_attribute atr; - int n; -{ - /*write_exp_elt_opcode (OP_ATTRIBUTE);*/ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ - write_exp_elt_longcst ((LONGEST) n); - write_exp_elt_longcst ((LONGEST) atr); - /* write_exp_elt_opcode (OP_ATTRIBUTE);*/ - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */ -} - -/* Emit expression corresponding to the renamed object designated by - * the type RENAMING, which must be the referent of an object renaming - * type, in the context of ORIG_LEFT_CONTEXT (?). */ -static void -write_object_renaming (orig_left_context, renaming) - struct block* orig_left_context; - struct symbol* renaming; -{ - const char* qualification = SYMBOL_NAME (renaming); - const char* simple_tail; - const char* expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0); - const char* suffix; - char* name; - struct symbol* sym; - enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state; - - /* if orig_left_context is null, then use the currently selected - block, otherwise we might fail our symbol lookup below */ - if (orig_left_context == NULL) - orig_left_context = get_selected_block (NULL); - - for (simple_tail = qualification + strlen (qualification); - simple_tail != qualification; simple_tail -= 1) - { - if (*simple_tail == '.') - { - simple_tail += 1; - break; - } - else if (STREQN (simple_tail, "__", 2)) - { - simple_tail += 2; - break; - } - } - - suffix = strstr (expr, "___XE"); - if (suffix == NULL) - goto BadEncoding; - - name = (char*) malloc (suffix - expr + 1); - /* add_name_string_cleanup (name); */ - /* FIXME: add_name_string_cleanup should be defined in - parser-defs.h, implemented in parse.c */ - strncpy (name, expr, suffix-expr); - name[suffix-expr] = '\000'; - sym = lookup_symbol (name, orig_left_context, VAR_NAMESPACE, 0, NULL); - /* if (sym == NULL) - error ("Could not find renamed variable: %s", ada_demangle (name)); - */ - /* FIXME: ada_demangle should be defined in defs.h, implemented in ada-lang.c */ - write_var_from_sym (orig_left_context, block_found, sym); - - suffix += 5; - slice_state = SIMPLE_INDEX; - while (*suffix == 'X') - { - suffix += 1; - - switch (*suffix) { - case 'L': - slice_state = LOWER_BOUND; - case 'S': - suffix += 1; - if (isdigit (*suffix)) - { - char* next; - long val = strtol (suffix, &next, 10); - if (next == suffix) - goto BadEncoding; - suffix = next; - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_ada_int); - write_exp_elt_longcst ((LONGEST) val); - write_exp_elt_opcode (OP_LONG); - } - else - { - const char* end; - char* index_name; - int index_len; - struct symbol* index_sym; - - end = strchr (suffix, 'X'); - if (end == NULL) - end = suffix + strlen (suffix); - - index_len = simple_tail - qualification + 2 + (suffix - end) + 1; - index_name = (char*) malloc (index_len); - memset (index_name, '\000', index_len); - /* add_name_string_cleanup (index_name);*/ - /* FIXME: add_name_string_cleanup should be defined in - parser-defs.h, implemented in parse.c */ - strncpy (index_name, qualification, simple_tail - qualification); - index_name[simple_tail - qualification] = '\000'; - strncat (index_name, suffix, suffix-end); - suffix = end; - - index_sym = - lookup_symbol (index_name, NULL, VAR_NAMESPACE, 0, NULL); - if (index_sym == NULL) - error ("Could not find %s", index_name); - write_var_from_sym (NULL, block_found, sym); - } - if (slice_state == SIMPLE_INDEX) - { - write_exp_elt_opcode (OP_FUNCALL); - write_exp_elt_longcst ((LONGEST) 1); - write_exp_elt_opcode (OP_FUNCALL); - } - else if (slice_state == LOWER_BOUND) - slice_state = UPPER_BOUND; - else if (slice_state == UPPER_BOUND) - { - write_exp_elt_opcode (TERNOP_SLICE); - slice_state = SIMPLE_INDEX; - } - break; - - case 'R': - { - struct stoken field_name; - const char* end; - suffix += 1; - - if (slice_state != SIMPLE_INDEX) - goto BadEncoding; - end = strchr (suffix, 'X'); - if (end == NULL) - end = suffix + strlen (suffix); - field_name.length = end - suffix; - field_name.ptr = (char*) malloc (end - suffix + 1); - strncpy (field_name.ptr, suffix, end - suffix); - field_name.ptr[end - suffix] = '\000'; - suffix = end; - write_exp_elt_opcode (STRUCTOP_STRUCT); - write_exp_string (field_name); - write_exp_elt_opcode (STRUCTOP_STRUCT); - break; - } - - default: - goto BadEncoding; - } - } - if (slice_state == SIMPLE_INDEX) - return; - - BadEncoding: - error ("Internal error in encoding of renaming declaration: %s", - SYMBOL_NAME (renaming)); -} - -/* Convert the character literal whose ASCII value would be VAL to the - appropriate value of type TYPE, if there is a translation. - Otherwise return VAL. Hence, in an enumeration type ('A', 'B'), - the literal 'A' (VAL == 65), returns 0. */ -static LONGEST -convert_char_literal (struct type* type, LONGEST val) -{ - char name[7]; - int f; - - if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM) - return val; - sprintf (name, "QU%02x", (int) val); - for (f = 0; f < TYPE_NFIELDS (type); f += 1) - { - if (STREQ (name, TYPE_FIELD_NAME (type, f))) - return TYPE_FIELD_BITPOS (type, f); - } - return val; -} diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h deleted file mode 100644 index e5353f8524b..00000000000 --- a/gdb/ada-lang.h +++ /dev/null @@ -1,365 +0,0 @@ -/* Ada language support definitions for GDB, the GNU debugger. - Copyright 1992, 1997 Free Software Foundation, Inc. - -This file is part of GDB. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#if !defined (ADA_LANG_H) -#define ADA_LANG_H 1 - -#include "value.h" -#include "gdbtypes.h" - -/* A macro to reorder the bytes of an address depending on the endiannes - of the target */ -#define EXTRACT_ADDRESS(x) ((void *) extract_address (&(x), sizeof (x))) -/* A macro to reorder the bytes of an int depending on the endiannes - of the target */ -#define EXTRACT_INT(x) ((int) extract_signed_integer (&(x), sizeof (x))) - -/* Chain of cleanups for arguments of OP_UNRESOLVED_VALUE names. Created in - yyparse and freed in ada_resolve. */ -extern struct cleanup* unresolved_names; - -/* Corresponding mangled/demangled names and opcodes for Ada user-definable - operators. */ -struct ada_opname_map { - const char* mangled; - const char* demangled; - enum exp_opcode op; -}; - -/* Table of Ada operators in mangled and demangled forms. */ -/* Defined in ada-lang.c */ -extern const struct ada_opname_map ada_opname_table[]; - -/* The maximum number of tasks known to the Ada runtime */ -extern const int MAX_NUMBER_OF_KNOWN_TASKS; - -/* Identifiers for Ada attributes that need special processing. Be sure - to update the table attribute_names in ada-lang.c whenever you change this. - */ - -enum ada_attribute { - /* Invalid attribute for error checking. */ - ATR_INVALID, - - ATR_FIRST, - ATR_LAST, - ATR_LENGTH, - ATR_IMAGE, - ATR_IMG, - ATR_MAX, - ATR_MIN, - ATR_MODULUS, - ATR_POS, - ATR_SIZE, - ATR_TAG, - ATR_VAL, - - /* Dummy last attribute. */ - ATR_END -}; - -enum task_states { - Unactivated, - Runnable, - Terminated, - Activator_Sleep, - Acceptor_Sleep, - Entry_Caller_Sleep, - Async_Select_Sleep, - Delay_Sleep, - Master_Completion_Sleep, - Master_Phase_2_Sleep -}; - -extern char *ada_task_states[]; - -typedef struct { - char *P_ARRAY; - int *P_BOUNDS; -} fat_string; - -typedef struct entry_call { - void *self; -} *entry_call_link; - -struct task_fields -{ - int entry_num; -#if (defined (VXWORKS_TARGET) || !defined (i386)) \ - && !(defined (VXWORKS_TARGET) && defined (M68K_TARGET)) - int pad1; -#endif - char state; -#if (defined (VXWORKS_TARGET) && defined (M68K_TARGET)) - char pad_8bits; -#endif - void *parent; - int priority; - int current_priority; - fat_string image; - entry_call_link call; -#if (defined (sun) && defined (__SVR4)) && !defined (VXWORKS_TARGET) - int pad2; - unsigned thread; - unsigned lwp; -#else - void *thread; - void *lwp; -#endif -} -#if (defined (VXWORKS_TARGET) && defined (M68K_TARGET)) -__attribute__ ((packed)) -#endif -; - -struct task_entry -{ - void *task_id; - int task_num; - int known_tasks_index; - struct task_entry *next_task; - void *thread; - void *lwp; - int stack_per; -}; - -extern struct type* builtin_type_ada_int; -extern struct type* builtin_type_ada_short; -extern struct type* builtin_type_ada_long; -extern struct type* builtin_type_ada_long_long; -extern struct type* builtin_type_ada_char; -extern struct type* builtin_type_ada_float; -extern struct type* builtin_type_ada_double; -extern struct type* builtin_type_ada_long_double; -extern struct type* builtin_type_ada_natural; -extern struct type* builtin_type_ada_positive; -extern struct type* builtin_type_ada_system_address; - -/* Assuming V points to an array of S objects, make sure that it contains at - least M objects, updating V and S as necessary. */ - -#define GROW_VECT(v, s, m) \ - if ((s) < (m)) grow_vect ((void**) &(v), &(s), (m), sizeof(*(v))); - -extern void grow_vect (void**, size_t*, size_t, int); - -extern int ada_parse (void); /* Defined in ada-exp.y */ - -extern void ada_error (char *); /* Defined in ada-exp.y */ - - /* Defined in ada-typeprint.c */ -extern void ada_print_type (struct type*, char*, struct ui_file*, int, int); - -extern int ada_val_print (struct type*, char*, int, CORE_ADDR, - struct ui_file*, int, int, int, enum val_prettyprint); - -extern int ada_value_print (struct value*, struct ui_file*, int, - enum val_prettyprint); - - /* Defined in ada-lang.c */ - -extern struct value* value_from_contents_and_address (struct type*, char*, CORE_ADDR); - -extern void ada_emit_char (int, struct ui_file *, int, int); - -extern void ada_printchar (int, struct ui_file*); - -extern void ada_printstr (struct ui_file*, char *, unsigned int, int, int); - -extern void ada_convert_actuals (struct value*, int, struct value**, CORE_ADDR*); - -extern struct value* ada_value_subscript (struct value*, int, struct value**); - -extern struct type* ada_array_element_type (struct type*, int); - -extern int ada_array_arity (struct type*); - -struct type* ada_type_of_array (struct value*, int); - -extern struct value* ada_coerce_to_simple_array (struct value*); - -extern struct value* ada_coerce_to_simple_array_ptr (struct value*); - -extern int ada_is_simple_array (struct type*); - -extern int ada_is_array_descriptor (struct type*); - -extern int ada_is_bogus_array_descriptor (struct type*); - -extern struct type* ada_index_type (struct type*, int); - -extern struct value* ada_array_bound (struct value*, int, int); - -extern int ada_lookup_symbol_list (const char*, struct block*, namespace_enum, - struct symbol***, struct block***); - -extern char* ada_fold_name (const char*); - -extern struct symbol* ada_lookup_symbol (const char*, struct block*, namespace_enum); - -extern struct minimal_symbol* ada_lookup_minimal_symbol (const char*); - -extern void ada_resolve (struct expression**, struct type*); - -extern int ada_resolve_function (struct symbol**, struct block**, int, - struct value**, int, const char*, struct type*); - -extern void ada_fill_in_ada_prototype (struct symbol*); - -extern int user_select_syms (struct symbol**, struct block**, int, int); - -extern int get_selections (int*, int, int, int, char*); - -extern char* ada_start_decode_line_1 (char*); - -extern struct symtabs_and_lines ada_finish_decode_line_1 (char**, struct symtab*, int, char***); - -extern int ada_scan_number (const char*, int, LONGEST*, int*); - -extern struct type* ada_parent_type (struct type*); - -extern int ada_is_ignored_field (struct type*, int); - -extern int ada_is_packed_array_type (struct type*); - -extern struct value* ada_value_primitive_packed_val (struct value*, char*, long, int, - int, struct type*); - -extern struct type* ada_coerce_to_simple_array_type (struct type*); - -extern int ada_is_character_type (struct type*); - -extern int ada_is_string_type (struct type*); - -extern int ada_is_tagged_type (struct type*); - -extern struct type* ada_tag_type (struct value*); - -extern struct value* ada_value_tag (struct value*); - -extern int ada_is_parent_field (struct type*, int); - -extern int ada_is_wrapper_field (struct type*, int); - -extern int ada_is_variant_part (struct type*, int); - -extern struct type* ada_variant_discrim_type (struct type*, struct type*); - -extern int ada_is_others_clause (struct type*, int); - -extern int ada_in_variant (LONGEST, struct type*, int); - -extern char* ada_variant_discrim_name (struct type*); - -extern struct type* ada_lookup_struct_elt_type (struct type*, char*, int, int*); - -extern struct value* ada_value_struct_elt (struct value*, char*, char*); - -extern struct value* ada_search_struct_field (char*, struct value*, int, struct type*); - -extern int ada_is_aligner_type (struct type*); - -extern struct type* ada_aligned_type (struct type*); - -extern char* ada_aligned_value_addr (struct type*, char*); - -extern const char* ada_attribute_name (int); - -extern int ada_is_fixed_point_type (struct type*); - -extern DOUBLEST ada_delta (struct type*); - -extern DOUBLEST ada_fixed_to_float (struct type *, LONGEST); - -extern LONGEST ada_float_to_fixed (struct type*, DOUBLEST); - -extern int ada_is_vax_floating_type (struct type*); - -extern int ada_vax_float_type_suffix (struct type*); - -extern struct value* ada_vax_float_print_function (struct type*); - -extern struct type* ada_system_address_type (void); - -extern int ada_which_variant_applies (struct type*, struct type*, char*); - -extern struct value* ada_to_fixed_value (struct type*, char*, CORE_ADDR, struct value*); - -extern struct type* ada_to_fixed_type (struct type*, char*, CORE_ADDR, struct value*); - -extern int ada_name_prefix_len (const char*); - -extern char* ada_type_name (struct type*); - -extern struct type* ada_find_parallel_type (struct type*, const char *suffix); - -extern LONGEST get_int_var_value (char*, char*, int* ); - -extern struct type* ada_find_any_type (const char *name); - -extern int ada_prefer_type (struct type*, struct type*); - -extern struct type* ada_get_base_type (struct type*); - -extern struct type* ada_completed_type (struct type*); - -extern char* ada_mangle (const char*); - -extern const char* ada_enum_name (const char*); - -extern int ada_is_modular_type (struct type*); - -extern LONGEST ada_modulus (struct type*); - -extern struct value* ada_value_ind (struct value*); - -extern void ada_print_scalar (struct type*, LONGEST, struct ui_file*); - -extern int ada_is_range_type_name (const char*); - -extern const char* ada_renaming_type (struct type*); - -extern int ada_is_object_renaming (struct symbol*); - -extern const char* ada_simple_renamed_entity (struct symbol*); - -extern char* ada_breakpoint_rewrite (char*, int*); - -/* Tasking-related: ada-tasks.c */ - -extern int valid_task_id (int); - -extern int get_current_task (void); - -extern void init_task_list (void); - -extern void* get_self_id (void); - -extern int get_current_task (void); - -extern int get_entry_number (void*); - -extern void ada_report_exception_break (struct breakpoint *); - -extern int ada_maybe_exception_partial_symbol (struct partial_symbol* sym); - -extern int ada_is_exception_sym (struct symbol* sym); - - -#endif diff --git a/gdb/ada-lex.c b/gdb/ada-lex.c deleted file mode 100644 index 9538f76b0cb..00000000000 --- a/gdb/ada-lex.c +++ /dev/null @@ -1,3174 +0,0 @@ -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header$ - * $FreeBSD: src/usr.bin/lex/flex.skl,v 1.4 1999/10/27 07:56:44 obrien Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -#define YY_USES_REJECT -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 57 -#define YY_END_OF_BUFFER 58 -static yyconst short int yy_acclist[386] = - { 0, - 58, 56, 57, 1, 56, 57, 1, 57, 15, 56, - 57, 53, 56, 57, 41, 56, 57, 56, 57, 43, - 56, 57, 44, 56, 57, 41, 56, 57, 42, 56, - 57, 41, 56, 57, 41, 56, 57, 41, 56, 57, - 4, 56, 57, 4, 56, 57, 41, 56, 57, 41, - 56, 57, 41, 56, 57, 41, 56, 57, 50, 56, - 57, 47, 56, 57, 47, 56, 57, 47, 56, 57, - 47, 56, 57, 47, 56, 57, 47, 56, 57, 47, - 56, 57, 47, 56, 57, 47, 56, 57, 47, 56, - 57, 1, 56, 57, 56, 57, 16, 56, 57, 53, - - 56, 57, 41, 56, 57, 56, 57, 43, 56, 57, - 44, 56, 57, 41, 56, 57, 42, 56, 57, 41, - 56, 57, 41, 56, 57, 41, 56, 57, 4, 56, - 57, 4, 56, 57, 41, 56, 57, 41, 56, 57, - 41, 56, 57, 41, 56, 57, 50, 56, 57, 41, - 56, 57, 47, 56, 57, 47, 56, 57, 47, 56, - 57, 47, 56, 57, 47, 56, 57, 47, 56, 57, - 47, 56, 57, 47, 56, 57, 47, 56, 57, 47, - 56, 57, 56, 57, 40, 56, 57, 51, 55, 54, - 55, 55, 35, 2, 34, 46, 46, 37, 4, 36, - - 38, 33, 39, 47, 47, 47, 47, 47, 19, 47, - 23, 47, 47, 47, 47, 47, 28, 47, 47, 47, - 47, 16, 51, 55, 54, 55, 55, 16, 35, 2, - 34, 46, 46, 37, 4, 36, 38, 33, 39, 16, - 47, 47, 47, 47, 47, 19, 47, 23, 47, 47, - 47, 47, 47, 28, 47, 47, 47, 47,16398, 52, - 55, 12, 12, 32, 2, 46, 46, 9, 3, 7, - 47, 47, 49, 20, 47, 21, 47, 47, 24, 47, - 25, 47, 26, 47, 47, 29, 47, 47, 31, 47, - 52, 55, 16, 32, 2, 2, 16, 2, 46, 46, - - 9, 3, 7, 47, 16, 47, 49, 20, 47, 21, - 47, 47, 24, 47, 25, 47, 26, 47, 47, 29, - 47, 47, 31, 47, 8206, 46, 45, 46, 6, 9, - 3, 47, 22, 47, 27, 47, 30, 47, 2, 16, - 46, 45, 46, 6, 9, 3, 47, 22, 47, 27, - 47, 30, 47, 48, 47, 48, 2, 2, 18, 47, - 5, 11, 8, 18, 2, 2, 5, 11, 8, 17, - 5, 8, 17, 2, 18, 2, 5, 8, 13, 2, - 17, 10, 10, 10, 10 - } ; - -static yyconst short int yy_accept[364] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 2, 4, 7, - 9, 12, 15, 18, 20, 23, 26, 29, 32, 35, - 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, - 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, - 97, 100, 103, 106, 108, 111, 114, 117, 120, 123, - 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, - 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, - 185, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 190, 192, 193, 193, 193, 193, 193, - 193, 193, 193, 194, 195, 195, 196, 196, 197, 198, - - 199, 199, 199, 200, 200, 200, 201, 202, 202, 203, - 204, 204, 204, 205, 205, 206, 206, 207, 208, 209, - 211, 213, 214, 215, 216, 217, 219, 220, 221, 222, - 222, 223, 223, 225, 227, 228, 228, 228, 229, 229, - 229, 230, 231, 231, 232, 232, 233, 234, 235, 235, - 235, 236, 236, 236, 237, 238, 238, 239, 240, 241, - 241, 242, 242, 243, 243, 244, 245, 246, 248, 250, - 251, 252, 253, 254, 256, 257, 258, 259, 259, 260, - 260, 260, 260, 260, 260, 260, 262, 262, 263, 264, - 264, 265, 266, 266, 267, 268, 268, 269, 269, 270, - - 271, 271, 272, 272, 272, 272, 273, 274, 276, 278, - 279, 281, 283, 285, 286, 288, 289, 291, 293, 293, - 294, 295, 296, 298, 299, 299, 300, 301, 301, 302, - 302, 303, 304, 304, 305, 305, 305, 305, 306, 306, - 307, 308, 310, 312, 313, 315, 317, 319, 320, 322, - 323, 325, 325, 326, 326, 326, 326, 326, 327, 329, - 330, 330, 330, 331, 331, 332, 332, 332, 332, 332, - 332, 332, 332, 332, 332, 332, 332, 332, 333, 335, - 337, 339, 339, 339, 339, 339, 341, 341, 342, 344, - 345, 345, 345, 346, 346, 347, 347, 347, 347, 348, - - 350, 352, 354, 355, 355, 355, 355, 355, 356, 356, - 356, 356, 356, 356, 356, 356, 357, 357, 357, 358, - 359, 359, 359, 359, 360, 360, 360, 361, 361, 361, - 362, 363, 363, 364, 365, 365, 366, 367, 367, 368, - 369, 369, 370, 371, 371, 372, 372, 373, 374, 376, - 377, 378, 378, 379, 380, 380, 382, 382, 383, 384, - 385, 386, 386 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 5, 6, 7, 8, 5, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, - 24, 25, 5, 26, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 36, 36, 39, 40, 41, 42, 36, - 36, 43, 44, 45, 46, 36, 47, 48, 36, 36, - 27, 5, 28, 5, 29, 5, 30, 31, 32, 33, - - 34, 35, 36, 37, 38, 36, 36, 39, 40, 41, - 42, 36, 36, 43, 44, 45, 46, 36, 47, 48, - 36, 36, 26, 22, 26, 5, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[49] = - { 0, - 1, 2, 3, 4, 5, 6, 7, 8, 5, 9, - 5, 5, 5, 5, 5, 5, 10, 5, 11, 11, - 9, 5, 12, 13, 14, 5, 5, 5, 15, 16, - 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17 - } ; - -static yyconst short int yy_base[385] = - { 0, - 0, 0, 48, 0, 91, 92, 1405, 1771, 1771, 1771, - 94, 96, 1771, 142, 1771, 1771, 1391, 1771, 1387, 189, - 1378, 188, 194, 1377, 1376, 1374, 1361, 1771, 222, 242, - 82, 91, 89, 196, 68, 163, 179, 97, 100, 194, - 0, 280, 223, 328, 227, 228, 234, 229, 235, 375, - 242, 418, 1335, 243, 463, 247, 251, 252, 254, 510, - 168, 1343, 161, 1333, 234, 1331, 1336, 1323, 1316, 0, - 558, 1340, 127, 258, 420, 422, 398, 1299, 1285, 1258, - 1266, 1257, 411, 413, 0, 605, 1288, 1287, 1286, 1285, - 119, 644, 1771, 0, 691, 1771, 0, 0, 1255, 1771, - - 0, 421, 690, 429, 0, 1771, 1771, 1244, 1771, 1771, - 608, 696, 1771, 699, 419, 1247, 420, 422, 582, 583, - 586, 587, 624, 625, 591, 590, 627, 628, 684, 430, - 1771, 705, 653, 1256, 710, 1252, 731, 0, 1254, 750, - 710, 798, 1222, 717, 802, 832, 1199, 720, 875, 730, - 1189, 732, 892, 733, 795, 924, 796, 797, 1230, 971, - 800, 997, 0, 876, 1183, 1191, 1176, 0, 0, 1174, - 1151, 1150, 1097, 0, 1095, 1100, 1089, 1096, 805, 1043, - 1047, 1043, 1023, 1016, 1010, 439, 808, 883, 1771, 1027, - 1041, 0, 971, 0, 952, 736, 864, 614, 799, 0, - - 965, 976, 1046, 1061, 0, 1061, 1771, 714, 717, 858, - 774, 789, 859, 1042, 860, 953, 954, 1047, 1086, 1108, - 0, 1092, 0, 1094, 1140, 0, 950, 1182, 1091, 1110, - 1199, 1210, 0, 1244, 981, 0, 0, 0, 1243, 1273, - 890, 0, 0, 949, 0, 0, 0, 943, 0, 935, - 0, 1120, 1771, 1188, 900, 1303, 895, 1771, 0, 882, - 0, 1098, 1174, 440, 1177, 909, 421, 1048, 1093, 1102, - 1169, 846, 818, 814, 822, 779, 792, 1249, 1190, 1191, - 1192, 1322, 1228, 750, 1331, 1361, 0, 1106, 0, 1229, - 1378, 0, 1325, 1326, 1349, 726, 725, 1410, 0, 0, - - 0, 0, 1771, 722, 839, 713, 644, 1369, 668, 671, - 663, 615, 617, 576, 591, 1198, 540, 459, 456, 1440, - 1462, 1483, 1458, 1771, 414, 0, 1517, 249, 794, 1238, - 237, 258, 1310, 0, 203, 190, 209, 1460, 1477, 1350, - 0, 1480, 1771, 131, 1328, 726, 1472, 0, 0, 86, - 1516, 1523, 1522, 1385, 835, 0, 1505, 1511, 1527, 1533, - 1549, 1771, 1571, 1587, 1592, 1608, 1622, 1639, 1642, 1649, - 89, 187, 1656, 1672, 1689, 1701, 1707, 1718, 1720, 1736, - 902, 903, 1743, 1754 - } ; - -static yyconst short int yy_def[385] = - { 0, - 362, 1, 362, 3, 1, 1, 362, 362, 362, 362, - 362, 363, 362, 362, 362, 362, 362, 362, 362, 364, - 362, 362, 362, 362, 365, 362, 362, 362, 366, 366, - 30, 30, 30, 30, 30, 30, 30, 30, 367, 367, - 11, 362, 367, 362, 367, 367, 367, 367, 367, 362, - 367, 367, 52, 367, 362, 367, 367, 367, 367, 362, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 11, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 363, 363, 363, 71, 71, 71, 86, 362, - 86, 86, 362, 368, 364, 362, 369, 370, 370, 362, - - 371, 362, 362, 362, 372, 362, 362, 373, 362, 362, - 362, 362, 362, 374, 30, 362, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 367, - 362, 367, 42, 42, 42, 44, 44, 86, 137, 137, - 367, 375, 50, 367, 55, 145, 146, 367, 367, 367, - 52, 367, 149, 367, 367, 362, 367, 367, 376, 367, - 367, 362, 60, 367, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 92, 362, 362, - 362, 362, 362, 362, 362, 363, 362, 362, 362, 86, - 92, 368, 377, 370, 370, 378, 362, 362, 362, 372, - - 373, 362, 374, 362, 379, 380, 362, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 42, 367, 86, - 140, 375, 368, 375, 362, 146, 146, 149, 367, 367, - 367, 149, 156, 367, 362, 381, 162, 204, 145, 60, - 367, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 362, 362, 362, 362, 86, 377, 362, 370, 362, - 382, 378, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 383, 380, 30, 30, - 30, 367, 367, 86, 86, 368, 225, 367, 146, 367, - 149, 228, 367, 367, 367, 362, 362, 362, 240, 60, - - 60, 60, 362, 86, 362, 384, 362, 362, 362, 362, - 362, 362, 362, 362, 383, 367, 86, 86, 368, 368, - 367, 149, 367, 362, 362, 298, 367, 86, 362, 362, - 362, 384, 362, 86, 86, 368, 368, 367, 367, 367, - 322, 367, 362, 86, 362, 362, 362, 86, 368, 368, - 367, 367, 367, 362, 362, 368, 367, 362, 367, 362, - 367, 0, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362 - } ; - -static yyconst short int yy_nxt[1820] = - { 0, - 8, 9, 10, 9, 8, 11, 8, 12, 13, 14, - 15, 16, 17, 13, 18, 19, 20, 21, 22, 23, - 24, 13, 25, 26, 27, 28, 13, 13, 29, 30, - 29, 29, 29, 31, 29, 29, 29, 32, 29, 33, - 34, 35, 36, 29, 37, 29, 29, 38, 8, 9, - 10, 39, 40, 41, 40, 42, 43, 44, 45, 46, - 47, 43, 48, 49, 50, 51, 52, 53, 54, 43, - 55, 56, 57, 58, 59, 43, 60, 61, 60, 60, - 60, 62, 60, 60, 60, 63, 60, 64, 65, 66, - 67, 60, 68, 60, 60, 69, 70, 70, 115, 196, - - 71, 71, 72, 83, 196, 131, 73, 72, 115, 72, - 126, 74, 115, 356, 84, 84, 75, 72, 76, 115, - 119, 115, 115, 77, 190, 120, 132, 115, 188, 115, - 122, 121, 179, 78, 79, 80, 81, 115, 129, 72, - 354, 82, 86, 87, 87, 88, 89, 89, 89, 89, - 89, 90, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 91, 89, - 89, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 95, 95, 95, 115, 101, 168, 127, 200, 165, 131, - - 101, 169, 200, 115, 102, 96, 103, 103, 166, 115, - 102, 97, 103, 103, 350, 128, 103, 349, 99, 115, - 132, 104, 103, 111, 111, 112, 115, 104, 131, 123, - 348, 113, 131, 131, 131, 105, 115, 124, 114, 131, - 131, 125, 116, 111, 111, 112, 141, 131, 131, 132, - 142, 113, 131, 132, 132, 132, 131, 131, 114, 159, - 132, 132, 116, 179, 331, 148, 154, 171, 132, 132, - 346, 157, 117, 132, 158, 172, 344, 132, 132, 173, - 132, 72, 118, 130, 130, 131, 130, 133, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 134, 134, - - 130, 130, 130, 130, 130, 130, 132, 130, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 86, 87, - 87, 136, 137, 138, 137, 137, 137, 130, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 139, 137, 137, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 95, 95, 143, 130, - 131, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 144, 130, 130, 130, 130, 130, 145, 130, 130, - - 130, 132, 130, 146, 147, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 131, 149, 179, 308, 179, 180, 186, - 186, 84, 84, 266, 150, 131, 151, 151, 181, 197, - 197, 343, 198, 72, 132, 72, 151, 199, 199, 115, - 115, 152, 115, 307, 209, 307, 132, 186, 186, 115, - 115, 336, 115, 208, 335, 153, 130, 130, 131, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 155, 130, 130, 132, - 130, 156, 156, 156, 156, 156, 156, 156, 156, 156, - - 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 111, 111, 160, 130, 131, 130, 130, 130, 161, - 130, 130, 130, 130, 130, 130, 162, 130, 163, 163, - 164, 130, 130, 130, 130, 130, 132, 130, 163, 163, - 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, - 163, 163, 163, 163, 163, 163, 163, 163, 86, 87, - 87, 87, 86, 86, 86, 86, 86, 334, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - - 178, 178, 178, 178, 178, 178, 86, 86, 86, 111, - 111, 111, 115, 115, 187, 308, 115, 115, 266, 211, - 115, 115, 115, 115, 114, 210, 115, 115, 116, 214, - 115, 115, 199, 199, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 188, 115, 115, 266, 115, 115, 266, - 135, 216, 333, 333, 115, 115, 215, 115, 115, 213, - 212, 218, 218, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 95, 95, 95, 266, 101, 111, 111, 112, - - 203, 203, 203, 266, 204, 113, 102, 362, 103, 103, - 159, 266, 114, 97, 115, 131, 116, 135, 103, 331, - 99, 205, 131, 104, 115, 131, 217, 328, 135, 135, - 325, 132, 86, 86, 137, 131, 132, 131, 131, 355, - 219, 355, 260, 132, 115, 230, 132, 115, 229, 229, - 231, 231, 261, 324, 115, 317, 132, 115, 132, 132, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 192, 192, - - 131, 131, 131, 223, 115, 131, 252, 252, 252, 254, - 254, 254, 330, 330, 115, 253, 308, 265, 265, 115, - 314, 132, 132, 132, 224, 130, 132, 265, 255, 115, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 226, 226, 329, 358, 358, 313, 266, 330, 330, 312, - 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, - 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, - 131, 131, 263, 263, 254, 254, 254, 311, 115, 115, - 115, 279, 263, 228, 228, 131, 241, 264, 115, 115, - - 115, 132, 132, 255, 228, 228, 228, 228, 228, 228, - 232, 232, 297, 306, 308, 305, 132, 297, 306, 258, - 303, 232, 232, 232, 232, 232, 232, 130, 130, 131, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 233, 233, 130, 130, 130, 130, 234, 130, - 132, 130, 233, 233, 233, 233, 233, 233, 233, 233, - 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, - 233, 233, 111, 111, 160, 302, 131, 111, 111, 112, - 161, 301, 300, 115, 115, 113, 296, 162, 289, 202, - 259, 164, 114, 281, 115, 258, 116, 132, 203, 203, - - 237, 130, 238, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 239, - 130, 130, 130, 132, 130, 240, 240, 240, 240, 240, - 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, - 240, 240, 240, 240, 240, 256, 256, 203, 203, 203, - 187, 204, 72, 308, 135, 72, 256, 256, 256, 256, - 256, 256, 111, 111, 112, 218, 218, 72, 205, 266, - 113, 266, 115, 267, 266, 72, 266, 114, 268, 72, - 280, 116, 115, 269, 266, 270, 72, 254, 254, 282, - 271, 131, 192, 192, 192, 192, 131, 223, 308, 286, - - 272, 273, 274, 275, 260, 187, 283, 308, 276, 293, - 293, 131, 132, 284, 261, 131, 266, 132, 224, 293, - 224, 252, 252, 252, 294, 266, 285, 285, 231, 231, - 253, 251, 132, 250, 249, 248, 132, 285, 285, 285, - 285, 285, 285, 130, 130, 131, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 287, 287, - 130, 130, 130, 130, 288, 130, 132, 130, 287, 287, - 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, - 287, 287, 287, 287, 287, 287, 287, 287, 290, 254, - 254, 254, 263, 263, 247, 265, 265, 246, 291, 309, - - 292, 292, 263, 131, 131, 265, 245, 264, 255, 310, - 292, 292, 292, 292, 292, 292, 292, 295, 295, 244, - 115, 115, 115, 243, 132, 132, 242, 295, 232, 232, - 115, 115, 115, 131, 131, 235, 130, 227, 130, 232, - 232, 232, 232, 232, 232, 111, 111, 160, 316, 131, - 111, 111, 112, 161, 132, 132, 345, 345, 113, 220, - 162, 219, 321, 135, 164, 114, 345, 207, 202, 116, - 132, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 299, 299, 195, 189, 188, 188, 187, 185, 184, - - 72, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 304, 304, 254, 254, 282, 183, 131, 347, 347, - 131, 131, 304, 304, 304, 304, 304, 304, 347, 323, - 182, 323, 283, 293, 293, 179, 345, 345, 132, 318, - 318, 132, 132, 293, 131, 131, 345, 177, 294, 176, - 318, 318, 318, 318, 318, 318, 319, 295, 295, 175, - 111, 111, 112, 174, 170, 132, 132, 295, 113, 320, - 320, 167, 130, 352, 110, 114, 254, 254, 254, 116, - 320, 320, 320, 320, 320, 320, 322, 322, 109, 107, - - 106, 100, 94, 93, 362, 255, 362, 322, 322, 322, - 322, 322, 322, 130, 130, 131, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 326, 326, - 130, 130, 130, 130, 327, 130, 132, 130, 326, 326, - 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, - 326, 326, 326, 326, 326, 326, 326, 326, 337, 337, - 362, 362, 362, 131, 362, 131, 362, 131, 362, 337, - 337, 337, 337, 337, 337, 338, 342, 342, 339, 339, - 339, 339, 131, 362, 132, 131, 132, 362, 132, 340, - 347, 347, 362, 362, 362, 351, 351, 362, 353, 353, - - 347, 341, 341, 132, 362, 351, 132, 362, 353, 362, - 131, 341, 341, 341, 341, 341, 341, 341, 111, 111, - 160, 131, 131, 359, 359, 362, 161, 131, 131, 360, - 360, 132, 131, 162, 351, 351, 357, 164, 357, 360, - 353, 353, 132, 132, 351, 361, 361, 362, 132, 132, - 353, 360, 360, 132, 131, 361, 362, 362, 362, 362, - 362, 360, 362, 362, 362, 362, 362, 361, 361, 362, - 362, 362, 362, 362, 362, 132, 362, 361, 85, 362, - 362, 85, 362, 362, 362, 85, 85, 85, 98, 98, - 98, 362, 362, 362, 362, 362, 98, 362, 98, 362, - - 362, 98, 98, 98, 108, 362, 108, 108, 108, 115, - 115, 115, 362, 362, 362, 362, 115, 115, 115, 362, - 362, 362, 115, 115, 115, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 192, - 192, 362, 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 193, 193, 193, 194, - 362, 362, 362, 194, 194, 194, 201, 362, 362, 201, - 201, 201, 201, 206, 206, 206, 362, 206, 362, 362, - 362, 362, 362, 206, 362, 362, 206, 206, 206, 222, - 222, 362, 222, 222, 222, 222, 222, 222, 222, 222, - - 222, 222, 222, 222, 222, 222, 236, 362, 362, 362, - 362, 236, 362, 362, 362, 362, 236, 257, 362, 362, - 257, 257, 257, 257, 262, 362, 362, 262, 262, 362, - 362, 362, 262, 262, 277, 277, 277, 278, 278, 278, - 362, 362, 362, 362, 278, 278, 278, 362, 362, 362, - 278, 278, 278, 315, 362, 362, 315, 315, 315, 315, - 332, 362, 362, 362, 332, 362, 362, 362, 332, 332, - 7, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362 - } ; - -static yyconst short int yy_chk[1820] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 5, 6, 35, 371, - - 5, 6, 11, 12, 371, 39, 11, 11, 35, 11, - 35, 11, 31, 350, 12, 12, 11, 11, 11, 33, - 31, 32, 31, 11, 91, 32, 39, 38, 91, 33, - 33, 32, 73, 11, 11, 11, 11, 38, 38, 73, - 344, 11, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 20, 20, 20, 36, 22, 63, 36, 372, 61, 40, - - 23, 63, 372, 36, 22, 20, 22, 22, 61, 37, - 23, 20, 23, 23, 337, 37, 22, 336, 20, 37, - 40, 22, 23, 29, 29, 29, 34, 23, 43, 34, - 335, 29, 45, 46, 48, 22, 34, 34, 29, 47, - 49, 34, 29, 30, 30, 30, 47, 51, 54, 43, - 49, 30, 56, 45, 46, 48, 57, 58, 30, 59, - 47, 49, 30, 74, 332, 51, 54, 65, 51, 54, - 331, 56, 30, 56, 57, 65, 328, 57, 58, 65, - 59, 74, 30, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 52, 52, 75, 267, 76, 77, 83, - 83, 84, 84, 267, 52, 130, 52, 52, 77, 102, - 102, 325, 104, 75, 52, 76, 52, 104, 104, 115, - 117, 52, 118, 264, 118, 264, 130, 186, 186, 115, - 117, 319, 118, 117, 318, 52, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 317, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - - 71, 71, 71, 71, 71, 71, 86, 86, 86, 111, - 111, 111, 119, 120, 86, 315, 121, 122, 314, 122, - 126, 125, 119, 120, 111, 119, 121, 122, 111, 125, - 126, 125, 198, 198, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 92, 123, 124, 313, 127, 128, 312, - 133, 128, 307, 307, 123, 124, 127, 127, 128, 124, - 123, 133, 133, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 95, 95, 95, 311, 103, 112, 112, 112, - - 114, 114, 114, 310, 114, 112, 103, 95, 103, 103, - 132, 309, 112, 95, 129, 141, 112, 135, 103, 306, - 95, 114, 144, 103, 129, 148, 129, 304, 135, 135, - 297, 132, 137, 137, 137, 150, 141, 152, 154, 346, - 137, 346, 196, 144, 208, 152, 148, 209, 150, 150, - 152, 152, 196, 296, 208, 284, 150, 209, 152, 154, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 142, 142, - - 155, 157, 158, 142, 211, 161, 179, 179, 179, 187, - 187, 187, 329, 329, 211, 179, 277, 199, 199, 212, - 276, 155, 157, 158, 142, 145, 161, 199, 187, 212, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 146, 146, 305, 355, 355, 275, 274, 305, 305, 273, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 149, 164, 197, 197, 188, 188, 188, 272, 210, 213, - 215, 210, 197, 149, 149, 241, 164, 197, 210, 213, - - 215, 149, 164, 188, 149, 149, 149, 149, 149, 149, - 153, 153, 381, 382, 266, 260, 241, 381, 382, 257, - 255, 153, 153, 153, 153, 153, 153, 156, 156, 156, - 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, - 156, 156, 160, 160, 160, 250, 160, 202, 202, 202, - 160, 248, 244, 216, 217, 202, 235, 160, 227, 201, - 195, 160, 202, 216, 217, 193, 202, 160, 162, 162, - - 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 190, 190, 203, 203, 203, - 191, 203, 185, 268, 218, 184, 190, 190, 190, 190, - 190, 190, 206, 206, 206, 218, 218, 183, 203, 204, - 206, 268, 214, 204, 204, 182, 204, 206, 204, 181, - 214, 206, 214, 204, 204, 204, 180, 219, 219, 219, - 204, 219, 222, 222, 224, 224, 229, 222, 269, 224, - - 204, 204, 204, 204, 262, 178, 219, 270, 204, 229, - 229, 288, 219, 220, 262, 230, 269, 229, 222, 229, - 224, 252, 252, 252, 229, 270, 220, 220, 230, 230, - 252, 177, 288, 176, 175, 173, 230, 220, 220, 220, - 220, 220, 220, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 228, 254, - 254, 254, 263, 263, 172, 265, 265, 171, 228, 271, - - 228, 228, 263, 316, 231, 265, 170, 263, 254, 271, - 228, 228, 228, 228, 228, 228, 228, 231, 231, 167, - 279, 280, 281, 166, 316, 231, 165, 231, 232, 232, - 279, 280, 281, 283, 290, 159, 151, 147, 143, 232, - 232, 232, 232, 232, 232, 234, 234, 234, 283, 234, - 278, 278, 278, 234, 283, 290, 330, 330, 278, 139, - 234, 136, 290, 134, 234, 278, 330, 116, 108, 278, - 234, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 240, 240, 99, 90, 89, 88, 87, 82, 81, - - 80, 240, 240, 240, 240, 240, 240, 240, 240, 240, - 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, - 240, 256, 256, 282, 282, 282, 79, 282, 333, 333, - 293, 294, 256, 256, 256, 256, 256, 256, 333, 294, - 78, 294, 282, 293, 293, 72, 345, 345, 282, 285, - 285, 293, 294, 293, 295, 340, 345, 69, 293, 68, - 285, 285, 285, 285, 285, 285, 286, 295, 295, 67, - 308, 308, 308, 66, 64, 295, 340, 295, 308, 286, - 286, 62, 53, 340, 27, 308, 354, 354, 354, 308, - 286, 286, 286, 286, 286, 286, 291, 291, 26, 25, - - 24, 21, 19, 17, 7, 354, 0, 291, 291, 291, - 291, 291, 291, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 320, 320, - 0, 0, 0, 323, 0, 338, 0, 321, 0, 320, - 320, 320, 320, 320, 320, 321, 323, 323, 338, 338, - 321, 321, 339, 0, 323, 342, 338, 0, 321, 322, - 347, 347, 0, 0, 0, 339, 339, 0, 342, 342, - - 347, 322, 322, 339, 0, 339, 342, 0, 342, 0, - 357, 322, 322, 322, 322, 322, 322, 322, 327, 327, - 327, 351, 327, 357, 357, 0, 327, 353, 352, 358, - 358, 357, 359, 327, 351, 351, 352, 327, 352, 358, - 353, 353, 351, 327, 351, 359, 359, 0, 353, 352, - 353, 360, 360, 359, 361, 359, 0, 0, 0, 0, - 0, 360, 0, 0, 0, 0, 0, 361, 361, 0, - 0, 0, 0, 0, 0, 361, 0, 361, 363, 0, - 0, 363, 0, 0, 0, 363, 363, 363, 364, 364, - 364, 0, 0, 0, 0, 0, 364, 0, 364, 0, - - 0, 364, 364, 364, 365, 0, 365, 365, 365, 366, - 366, 366, 0, 0, 0, 0, 366, 366, 366, 0, - 0, 0, 366, 366, 366, 367, 367, 367, 367, 367, - 367, 367, 367, 367, 367, 367, 367, 367, 367, 368, - 368, 0, 368, 368, 368, 368, 368, 368, 368, 368, - 368, 368, 368, 368, 368, 368, 369, 369, 369, 370, - 0, 0, 0, 370, 370, 370, 373, 0, 0, 373, - 373, 373, 373, 374, 374, 374, 0, 374, 0, 0, - 0, 0, 0, 374, 0, 0, 374, 374, 374, 375, - 375, 0, 375, 375, 375, 375, 375, 375, 375, 375, - - 375, 375, 375, 375, 375, 375, 376, 0, 0, 0, - 0, 376, 0, 0, 0, 0, 376, 377, 0, 0, - 377, 377, 377, 377, 378, 0, 0, 378, 378, 0, - 0, 0, 378, 378, 379, 379, 379, 380, 380, 380, - 0, 0, 0, 0, 380, 380, 380, 0, 0, 0, - 380, 380, 380, 383, 0, 0, 383, 383, 383, 383, - 384, 0, 0, 0, 384, 0, 0, 0, 384, 384, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - - 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362 - } ; - -static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; -static char *yy_full_match; -static int yy_lp; -static int yy_looking_for_trail_begin = 0; -static int yy_full_lp; -static int *yy_full_state; -#define YY_TRAILING_MASK 0x2000 -#define YY_TRAILING_HEAD_MASK 0x4000 -#define REJECT \ -{ \ -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ -yy_cp = yy_full_match; /* restore poss. backed-over text */ \ -yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \ -yy_state_ptr = yy_full_state; /* restore orig. state */ \ -yy_current_state = *yy_state_ptr; /* restore curr. state */ \ -++yy_lp; \ -goto find_rule; \ -} -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "./ada-lex.l" -#define INITIAL 0 -/* FLEX lexer for Ada expressions, for GDB. - Copyright (C) 1994, 1997, 2000 - Free Software Foundation, Inc. - -This file is part of GDB. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/*----------------------------------------------------------------------*/ -/* The converted version of this file is to be included in ada-exp.y, */ -/* the Ada parser for gdb. The function yylex obtains characters from */ -/* the global pointer lexptr. It returns a syntactic category for */ -/* each successive token and places a semantic value into yylval */ -/* (ada-lval), defined by the parser. */ -/* Run flex with (at least) the -i option (case-insensitive), and the -I */ -/* option (interactive---no unnecessary lookahead). */ -#line 48 "./ada-lex.l" -#define NUMERAL_WIDTH 256 -#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1)) - -/* Temporary staging for numeric literals. */ -static char numbuf[NUMERAL_WIDTH]; - static void canonicalizeNumeral (char* s1, const char*); -static int processInt (const char*, const char*, const char*); -static int processReal (const char*); -static int processId (const char*, int); -static int processAttribute (const char*); -static int find_dot_all (const char*); - -#undef YY_DECL -#define YY_DECL static int yylex ( void ) - -#undef YY_INPUT -#define YY_INPUT(BUF, RESULT, MAX_SIZE) \ - if ( *lexptr == '\000' ) \ - (RESULT) = YY_NULL; \ - else \ - { \ - *(BUF) = *lexptr; \ - (RESULT) = 1; \ - lexptr += 1; \ - } - -static char *tempbuf = NULL; -static int tempbufsize = 0; -static int tempbuf_len; -static struct block* left_block_context; - -static void resize_tempbuf (unsigned int); - -static void block_lookup (char*, char*); - -static int name_lookup (char*, char*, int*); - -static int find_dot_all (const char*); - -#define IN_STRING 1 -#define BEFORE_QUAL_QUOTE 2 - - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 91 "./ada-lex.l" - - - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 363 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 1771 ); - -yy_find_action: - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; -find_rule: /* we branch to this label when backing up */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[yy_lp]; - if ( yy_act & YY_TRAILING_HEAD_MASK || - yy_looking_for_trail_begin ) - { - if ( yy_act == yy_looking_for_trail_begin ) - { - yy_looking_for_trail_begin = 0; - yy_act &= ~YY_TRAILING_HEAD_MASK; - break; - } - } - else if ( yy_act & YY_TRAILING_MASK ) - { - yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; - yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; - } - else - { - yy_full_match = yy_cp; - yy_full_state = yy_state_ptr; - yy_full_lp = yy_lp; - break; - } - ++yy_lp; - goto find_rule; - } - --yy_cp; - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ -case 1: -YY_RULE_SETUP -#line 93 "./ada-lex.l" -{ } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 95 "./ada-lex.l" -{ yyterminate(); } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 97 "./ada-lex.l" -{ - canonicalizeNumeral (numbuf, yytext); - return processInt (NULL, numbuf, strrchr(numbuf, 'e')+1); - } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 102 "./ada-lex.l" -{ - canonicalizeNumeral (numbuf, yytext); - return processInt (NULL, numbuf, NULL); - } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 107 "./ada-lex.l" -{ - canonicalizeNumeral (numbuf, yytext); - return processInt (numbuf, - strchr (numbuf, '#') + 1, - strrchr(numbuf, '#') + 1); - } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 114 "./ada-lex.l" -{ - canonicalizeNumeral (numbuf, yytext); - return processInt (numbuf, strchr (numbuf, '#') + 1, NULL); - } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 119 "./ada-lex.l" -{ - canonicalizeNumeral (numbuf, yytext+2); - return processInt ("16#", numbuf, NULL); - } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 125 "./ada-lex.l" -{ - canonicalizeNumeral (numbuf, yytext); - return processReal (numbuf); - } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 130 "./ada-lex.l" -{ - canonicalizeNumeral (numbuf, yytext); - return processReal (numbuf); - } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 135 "./ada-lex.l" -{ - error ("Based real literals not implemented yet."); - } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 139 "./ada-lex.l" -{ - error ("Based real literals not implemented yet."); - } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 143 "./ada-lex.l" -{ - yylval.typed_val.type = builtin_type_ada_char; - yylval.typed_val.val = yytext[1]; - return CHARLIT; - } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 149 "./ada-lex.l" -{ - int v; - yylval.typed_val.type = builtin_type_ada_char; - sscanf (yytext+3, "%2x", &v); - yylval.typed_val.val = v; - return CHARLIT; - } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 157 "./ada-lex.l" -{ return processId (yytext, yyleng); } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 159 "./ada-lex.l" -{ - tempbuf_len = 0; - BEGIN IN_STRING; - } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 164 "./ada-lex.l" -{ - resize_tempbuf (yyleng+tempbuf_len); - strncpy (tempbuf+tempbuf_len, yytext, yyleng-1); - tempbuf_len += yyleng-1; - yylval.sval.ptr = tempbuf; - yylval.sval.length = tempbuf_len; - BEGIN INITIAL; - return STRING; - } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 174 "./ada-lex.l" -{ - int n; - resize_tempbuf (yyleng-5+tempbuf_len+1); - strncpy (tempbuf+tempbuf_len, yytext, yyleng-6); - sscanf(yytext+yyleng-4, "%2x", &n); - tempbuf[yyleng-6+tempbuf_len] = (char) n; - tempbuf_len += yyleng-5; - } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 183 "./ada-lex.l" -{ - int n; - resize_tempbuf (yyleng-4+tempbuf_len+1); - strncpy (tempbuf+tempbuf_len, yytext, yyleng-6); - tempbuf[yyleng-5+tempbuf_len] = '"'; - tempbuf_len += yyleng-4; - } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 191 "./ada-lex.l" -{ - while (*lexptr != 'i' && *lexptr != 'I') - lexptr -= 1; - yyrestart(NULL); - return 0; - } - YY_BREAK -/* ADA KEYWORDS */ -case 20: -YY_RULE_SETUP -#line 200 "./ada-lex.l" -{ return ABS; } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 201 "./ada-lex.l" -{ return _AND_; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 202 "./ada-lex.l" -{ return ELSE; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 203 "./ada-lex.l" -{ return IN; } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 204 "./ada-lex.l" -{ return MOD; } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 205 "./ada-lex.l" -{ return NEW; } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 206 "./ada-lex.l" -{ return NOT; } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 207 "./ada-lex.l" -{ return NULL_PTR; } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 208 "./ada-lex.l" -{ return OR; } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 209 "./ada-lex.l" -{ return REM; } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 210 "./ada-lex.l" -{ return THEN; } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 211 "./ada-lex.l" -{ return XOR; } - YY_BREAK -/* ATTRIBUTES */ -case 32: -YY_RULE_SETUP -#line 215 "./ada-lex.l" -{ return processAttribute (yytext+1); } - YY_BREAK -/* PUNCTUATION */ -case 33: -YY_RULE_SETUP -#line 219 "./ada-lex.l" -{ return ARROW; } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 220 "./ada-lex.l" -{ return DOTDOT; } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 221 "./ada-lex.l" -{ return STARSTAR; } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 222 "./ada-lex.l" -{ return ASSIGN; } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 223 "./ada-lex.l" -{ return NOTEQUAL; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 224 "./ada-lex.l" -{ return LEQ; } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 225 "./ada-lex.l" -{ return GEQ; } - YY_BREAK -case 40: -YY_RULE_SETUP -#line 227 "./ada-lex.l" -{ BEGIN INITIAL; return '\''; } - YY_BREAK -case 41: -YY_RULE_SETUP -#line 229 "./ada-lex.l" -{ return yytext[0]; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 231 "./ada-lex.l" -{ if (paren_depth == 0 && comma_terminates) - { - lexptr -= 1; - yyrestart(NULL); - return 0; - } - else - return ','; - } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 241 "./ada-lex.l" -{ paren_depth += 1; return '('; } - YY_BREAK -case 44: -YY_RULE_SETUP -#line 242 "./ada-lex.l" -{ if (paren_depth == 0) - { - lexptr -= 1; - yyrestart(NULL); - return 0; - } - else - { - paren_depth -= 1; - return ')'; - } - } - YY_BREAK -case 45: -YY_RULE_SETUP -#line 255 "./ada-lex.l" -{ return DOT_ALL; } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 257 "./ada-lex.l" -{ - processId (yytext+1, yyleng-1); - return DOT_ID; - } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 262 "./ada-lex.l" -{ - int all_posn = find_dot_all (yytext); - int token_type, segments, k; - int quote_follows; - - if (all_posn == -1 && yytext[yyleng-1] == '\'') - { - quote_follows = 1; - do { - yyless (yyleng-1); - } while (yytext[yyleng-1] == ' '); - } - else - quote_follows = 0; - - if (all_posn >= 0) - yyless (all_posn); - processId(yytext, yyleng); - segments = name_lookup (ada_mangle (yylval.ssym.stoken.ptr), - yylval.ssym.stoken.ptr, &token_type); - left_block_context = NULL; - for (k = yyleng; segments > 0 && k > 0; k -= 1) - { - if (yytext[k-1] == '.') - segments -= 1; - quote_follows = 0; - } - if (k <= 0) - error ("confused by name %s", yytext); - yyless (k); - if (quote_follows) - BEGIN BEFORE_QUAL_QUOTE; - return token_type; - } - YY_BREAK -/* GDB EXPRESSION CONSTRUCTS */ -case 48: -YY_RULE_SETUP -#line 300 "./ada-lex.l" -{ - processId(yytext, yyleng-2); - block_lookup (yylval.ssym.stoken.ptr, yylval.ssym.stoken.ptr); - return BLOCKNAME; - } - YY_BREAK -case 49: -YY_RULE_SETUP -#line 306 "./ada-lex.l" -{ - processId(yytext, yyleng-2); - block_lookup (ada_mangle (yylval.ssym.stoken.ptr), - yylval.ssym.stoken.ptr); - return BLOCKNAME; - } - YY_BREAK -case 50: -YY_RULE_SETUP -#line 313 "./ada-lex.l" -{ return yytext[0]; } - YY_BREAK -case 51: -YY_RULE_SETUP -#line 315 "./ada-lex.l" -{ yylval.lval = -1; return LAST; } - YY_BREAK -case 52: -YY_RULE_SETUP -#line 316 "./ada-lex.l" -{ yylval.lval = -atoi(yytext+2); return LAST; } - YY_BREAK -case 53: -YY_RULE_SETUP -#line 317 "./ada-lex.l" -{ yylval.lval = 0; return LAST; } - YY_BREAK -case 54: -YY_RULE_SETUP -#line 318 "./ada-lex.l" -{ yylval.lval = atoi(yytext+1); return LAST; } - YY_BREAK -/* REGISTERS AND GDB CONVENIENCE VARIABLES */ -case 55: -YY_RULE_SETUP -#line 323 "./ada-lex.l" -{ - int c; - for (c = 0; c < NUM_REGS; c++) - if (REGISTER_NAME (c) && - strcmp (yytext + 1, REGISTER_NAME (c)) == 0) - { - yylval.lval = c; - return REGNAME; - } - yylval.sval.ptr = yytext; - yylval.sval.length = yyleng; - yylval.ivar = - lookup_internalvar (copy_name (yylval.sval) + 1); - return INTERNAL_VARIABLE; - } - YY_BREAK -/* CATCH-ALL ERROR CASE */ -case 56: -YY_RULE_SETUP -#line 341 "./ada-lex.l" -{ error ("Invalid character '%s' in expression.", yytext); } - YY_BREAK -case 57: -YY_RULE_SETUP -#line 342 "./ada-lex.l" -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(IN_STRING): - case YY_STATE_EOF(BEFORE_QUAL_QUOTE): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 363 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - - register YY_CHAR yy_c = 1; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 363 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 362); - if ( ! yy_is_jam ) - *yy_state_ptr++ = yy_current_state; - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 342 "./ada-lex.l" - - -#include -#include - -/* Initialize the lexer for processing new expression */ -void -lexer_init (FILE* inp) -{ - BEGIN INITIAL; - yyrestart (inp); -} - - -/* Make sure that tempbuf points at an array at least N characters long. */ - -static void -resize_tempbuf (n) - unsigned int n; -{ - if (tempbufsize < n) - { - tempbufsize = (n+63) & ~63; - tempbuf = (char*) xrealloc (tempbuf, tempbufsize); - } -} - -/* Copy S2 to S1, removing all underscores, and downcasing all letters. */ - -static void -canonicalizeNumeral (s1,s2) - char* s1; - const char* s2; -{ - for (; *s2 != '\000'; s2 += 1) - { - if (*s2 != '_') - { - *s1 = tolower(*s2); - s1 += 1; - } - } - s1[0] = '\000'; -} - -#define HIGH_BYTE_POSN ((sizeof (ULONGEST) - 1) * HOST_CHAR_BIT) - -/* True (non-zero) iff DIGIT is a valid digit in radix BASE, - where 2 <= BASE <= 16. */ - -static int -is_digit_in_base (digit, base) - unsigned char digit; - int base; -{ - if (!isxdigit (digit)) - return 0; - if (base <= 10) - return (isdigit (digit) && digit < base + '0'); - else - return (isdigit (digit) || tolower (digit) < base - 10 + 'a'); -} - -static int -digit_to_int (c) - unsigned char c; -{ - if (isdigit (c)) - return c - '0'; - else - return tolower (c) - 'a' + 10; -} - -/* As for strtoul, but for ULONGEST results. */ -ULONGEST -strtoulst (num, trailer, base) - const char *num; - const char **trailer; - int base; -{ - unsigned int high_part; - ULONGEST result; - int i; - unsigned char lim; - - if (base < 2 || base > 16) - { - errno = EINVAL; - return 0; - } - lim = base - 1 + '0'; - - result = high_part = 0; - for (i = 0; is_digit_in_base (num[i], base); i += 1) - { - result = result*base + digit_to_int (num[i]); - high_part = high_part*base + (unsigned int) (result >> HIGH_BYTE_POSN); - result &= ((ULONGEST) 1 << HIGH_BYTE_POSN) - 1; - if (high_part > 0xff) - { - errno = ERANGE; - result = high_part = 0; - break; - } - } - - if (trailer != NULL) - *trailer = &num[i]; - - return result + ((ULONGEST) high_part << HIGH_BYTE_POSN); -} - - - -/* Interprets the prefix of NUM that consists of digits of the given BASE - as an integer of that BASE, with the string EXP as an exponent. - Puts value in yylval, and returns INT, if the string is valid. Causes - an error if the number is improperly formated. BASE, if NULL, defaults - to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'. */ - -static int -processInt (base0, num0, exp0) - const char* num0; - const char* base0; - const char* exp0; -{ - ULONGEST result; - long exp; - int base; - - char* trailer; - - if (base0 == NULL) - base = 10; - else - { - base = strtol (base0, (char**) NULL, 10); - if (base < 2 || base > 16) - error ("Invalid base: %d.", base); - } - - if (exp0 == NULL) - exp = 0; - else - exp = strtol(exp0, (char**) NULL, 10); - - errno = 0; - result = strtoulst (num0, &trailer, base); - if (errno == ERANGE) - error ("Integer literal out of range"); - if (isxdigit(*trailer)) - error ("Invalid digit `%c' in based literal", *trailer); - - while (exp > 0) - { - if (result > (ULONG_MAX / base)) - error ("Integer literal out of range"); - result *= base; - exp -= 1; - } - - if ((result >> (TARGET_INT_BIT-1)) == 0) - yylval.typed_val.type = builtin_type_ada_int; - else if ((result >> (TARGET_LONG_BIT-1)) == 0) - yylval.typed_val.type = builtin_type_ada_long; - else if (((result >> (TARGET_LONG_BIT-1)) >> 1) == 0) - { - /* We have a number representable as an unsigned integer quantity. - For consistency with the C treatment, we will treat it as an - anonymous modular (unsigned) quantity. Alas, the types are such - that we need to store .val as a signed quantity. Sorry - for the mess, but C doesn't officially guarantee that a simple - assignment does the trick (no, it doesn't; read the reference manual). - */ - yylval.typed_val.type = builtin_type_unsigned_long; - if (result & LONGEST_SIGN) - yylval.typed_val.val = - (LONGEST) (result & ~LONGEST_SIGN) - - (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1); - else - yylval.typed_val.val = (LONGEST) result; - return INT; - } - else - yylval.typed_val.type = builtin_type_ada_long_long; - - yylval.typed_val.val = (LONGEST) result; - return INT; -} - -static int -processReal (num0) - const char* num0; -{ - if (sizeof (DOUBLEST) <= sizeof (float)) - sscanf (num0, "%g", &yylval.typed_val_float.dval); - else if (sizeof (DOUBLEST) <= sizeof (double)) - sscanf (num0, "%lg", &yylval.typed_val_float.dval); - else - { -#ifdef PRINTF_HAS_LONG_DOUBLE - sscanf (num0, "%Lg", &yylval.typed_val_float.dval); -#else - /* Scan it into a double, then convert and assign it to the - long double. This at least wins with values representable - in the range of doubles. */ - double temp; - sscanf (num0, "%lg", &temp); - yylval.typed_val_float.dval = temp; -#endif - } - - yylval.typed_val_float.type = builtin_type_ada_float; - if (sizeof(DOUBLEST) >= TARGET_DOUBLE_BIT / TARGET_CHAR_BIT) - yylval.typed_val_float.type = builtin_type_ada_double; - if (sizeof(DOUBLEST) >= TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT) - yylval.typed_val_float.type = builtin_type_ada_long_double; - - return FLOAT; -} - -static int -processId (name0, len) - const char *name0; - int len; -{ - char* name = xmalloc (len + 11); - int i0, i; - -/* add_name_string_cleanup (name); */ -/* FIXME: add_name_string_cleanup should be defined in parse.c */ - while (len > 0 && isspace (name0[len-1])) - len -= 1; - i = i0 = 0; - while (i0 < len) - { - if (isalnum (name0[i0])) - { - name[i] = tolower (name0[i0]); - i += 1; i0 += 1; - } - else switch (name0[i0]) - { - default: - name[i] = name0[i0]; - i += 1; i0 += 1; - break; - case ' ': case '\t': - i0 += 1; - break; - case '\'': - i0 += 1; - while (i0 < len && name0[i0] != '\'') - { - name[i] = name0[i0]; - i += 1; i0 += 1; - } - i0 += 1; - break; - case '<': - i0 += 1; - while (i0 < len && name0[i0] != '>') - { - name[i] = name0[i0]; - i += 1; i0 += 1; - } - i0 += 1; - break; - } - } - name[i] = '\000'; - - yylval.ssym.sym = NULL; - yylval.ssym.stoken.ptr = name; - yylval.ssym.stoken.length = i; - return NAME; -} - -static void -block_lookup (name, err_name) - char* name; - char* err_name; -{ - struct symbol** syms; - struct block** blocks; - int nsyms; - struct symtab *symtab; - nsyms = ada_lookup_symbol_list (name, left_block_context, - VAR_NAMESPACE, &syms, &blocks); - if (left_block_context == NULL && - (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK)) - symtab = lookup_symtab (name); - else - symtab = NULL; - - if (symtab != NULL) - left_block_context = yylval.bval = - BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK); - else if (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK) - { - if (left_block_context == NULL) - error ("No file or function \"%s\".", err_name); - else - error ("No function \"%s\" in specified context.", err_name); - } - else - { - left_block_context = yylval.bval = SYMBOL_BLOCK_VALUE (syms[0]); - if (nsyms > 1) - warning ("Function name \"%s\" ambiguous here", err_name); - } -} - -/* Look up NAME0 (assumed to be mangled) as a name in VAR_NAMESPACE, - setting *TOKEN_TYPE to NAME or TYPENAME, depending on what is - found. Try first the entire name, then the name without the last - segment (i.e., after the last .id), etc., and return the number of - segments that had to be removed to get a match. Calls error if no - matches are found, using ERR_NAME in any error message. When - exactly one symbol match is found, it is placed in yylval. */ - -static int -name_lookup (name0, err_name, token_type) - char* name0; - char* err_name; - int* token_type; -{ - struct symbol** syms; - struct block** blocks; - struct type* type; - int len0 = strlen (name0); - char* name = savestring (name0, len0); - int nsyms; - int segments; - -/* add_name_string_cleanup (name);*/ -/* FIXME: add_name_string_cleanup should be defined in parse.c */ - yylval.ssym.stoken.ptr = name; - yylval.ssym.stoken.length = strlen (name); - for (segments = 0; ; segments += 1) - { - struct type* preferred_type; - int i, preferred_index; - - if (left_block_context == NULL) - nsyms = ada_lookup_symbol_list (name, expression_context_block, - VAR_NAMESPACE, &syms, &blocks); - else - nsyms = ada_lookup_symbol_list (name, left_block_context, - VAR_NAMESPACE, &syms, &blocks); - - /* Check for a type definition. */ - - /* Look for a symbol that doesn't denote void. This is (I think) a */ - /* temporary kludge to get around problems in GNAT output. */ - preferred_index = -1; preferred_type = NULL; - for (i = 0; i < nsyms; i += 1) - switch (SYMBOL_CLASS (syms[i])) - { - case LOC_TYPEDEF: - if (ada_prefer_type (SYMBOL_TYPE (syms[i]), preferred_type)) - { - preferred_index = i; - preferred_type = SYMBOL_TYPE (syms[i]); - } - break; - case LOC_REGISTER: - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_LOCAL: - case LOC_LOCAL_ARG: - case LOC_BASEREG: - case LOC_BASEREG_ARG: - goto NotType; - default: - break; - } - if (preferred_type != NULL) - { -/* if (TYPE_CODE (preferred_type) == TYPE_CODE_VOID) - error ("`%s' matches only void type name(s)", - ada_demangle (name)); -*/ -/* FIXME: ada_demangle should be defined in defs.h, and is located in ada-lang.c */ -/* else*/ if (ada_is_object_renaming (syms[preferred_index])) - { - yylval.ssym.sym = syms[preferred_index]; - *token_type = OBJECT_RENAMING; - return segments; - } - else if (ada_renaming_type (SYMBOL_TYPE (syms[preferred_index])) - != NULL) - { - int result; - const char* renaming = - ada_simple_renamed_entity (syms[preferred_index]); - char* new_name = xmalloc (strlen (renaming) + len0 - - yylval.ssym.stoken.length + 1); -/* add_name_string_cleanup (new_name);*/ -/* FIXME: add_name_string_cleanup should be defined in parse.c */ - strcpy (new_name, renaming); - strcat (new_name, name0 + yylval.ssym.stoken.length); - result = name_lookup (new_name, err_name, token_type); - if (result > segments) - error ("Confused by renamed symbol."); - return result; - } - else if (segments == 0) - { - yylval.tval = preferred_type; - *token_type = TYPENAME; - return 0; - } - } - - if (segments == 0) - { - type = lookup_primitive_typename (name); - if (type == NULL && STREQ ("system__address", name)) - type = builtin_type_ada_system_address; - if (type != NULL) - { - yylval.tval = type; - *token_type = TYPENAME; - return 0; - } - } - - NotType: - if (nsyms == 1) - { - *token_type = NAME; - yylval.ssym.sym = syms[0]; - yylval.ssym.msym = NULL; - yylval.ssym.block = blocks[0]; - return segments; - } - else if (nsyms == 0) { - int i; - yylval.ssym.msym = ada_lookup_minimal_symbol (name); - if (yylval.ssym.msym != NULL) - { - yylval.ssym.sym = NULL; - yylval.ssym.block = NULL; - *token_type = NAME; - return segments; - } - - for (i = yylval.ssym.stoken.length - 1; i > 0; i -= 1) - { - if (name[i] == '.') - { - name[i] = '\0'; - yylval.ssym.stoken.length = i; - break; - } - else if (name[i] == '_' && name[i-1] == '_') - { - i -= 1; - name[i] = '\0'; - yylval.ssym.stoken.length = i; - break; - } - } - if (i <= 0) - { - if (!have_full_symbols () && !have_partial_symbols () - && left_block_context == NULL) - error ("No symbol table is loaded. Use the \"file\" command."); - if (left_block_context == NULL) - error ("No definition of \"%s\" in current context.", - err_name); - else - error ("No definition of \"%s\" in specified context.", - err_name); - } - } - else - { - *token_type = NAME; - yylval.ssym.sym = NULL; - yylval.ssym.msym = NULL; - if (left_block_context == NULL) - yylval.ssym.block = expression_context_block; - else - yylval.ssym.block = left_block_context; - return segments; - } - } -} - -/* Returns the position within STR of the '.' in a - '.{WHITE}*all' component of a dotted name, or -1 if there is none. */ -static int -find_dot_all (str) - const char* str; -{ - int i; - for (i = 0; str[i] != '\000'; i += 1) - { - if (str[i] == '.') - { - int i0 = i; - do - i += 1; - while (isspace (str[i])); - if (strcmp (str+i, "all") == 0 - && ! isalnum (str[i+3]) && str[i+3] != '_') - return i0; - } - } - return -1; -} - -/* Returns non-zero iff string SUBSEQ matches a subsequence of STR, ignoring - case. */ - -static int -subseqMatch (subseq, str) - const char* subseq; - const char* str; -{ - if (subseq[0] == '\0') - return 1; - else if (str[0] == '\0') - return 0; - else if (tolower (subseq[0]) == tolower (str[0])) - return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1); - else - return subseqMatch (subseq, str+1); -} - - -static struct { const char* name; int code; } -attributes[] = { - { "address", TICK_ADDRESS }, - { "unchecked_access", TICK_ACCESS }, - { "unrestricted_access", TICK_ACCESS }, - { "access", TICK_ACCESS }, - { "first", TICK_FIRST }, - { "last", TICK_LAST }, - { "length", TICK_LENGTH }, - { "max", TICK_MAX }, - { "min", TICK_MIN }, - { "modulus", TICK_MODULUS }, - { "pos", TICK_POS }, - { "range", TICK_RANGE }, - { "size", TICK_SIZE }, - { "tag", TICK_TAG }, - { "val", TICK_VAL }, - { NULL, -1 } -}; - -/* Return the syntactic code corresponding to the attribute name or - abbreviation STR. */ - -static int -processAttribute (str) - const char* str; -{ - int i, k; - - for (i = 0; attributes[i].code != -1; i += 1) - if (strcasecmp (str, attributes[i].name) == 0) - return attributes[i].code; - - for (i = 0, k = -1; attributes[i].code != -1; i += 1) - if (subseqMatch (str, attributes[i].name)) - { - if (k == -1) - k = i; - else - error ("ambiguous attribute name: `%s'", str); - } - if (k == -1) - error ("unrecognized attribute: `%s'", str); - - return attributes[k].code; -} - -int -yywrap() -{ - return 1; -} diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l deleted file mode 100644 index 2252d526a52..00000000000 --- a/gdb/ada-lex.l +++ /dev/null @@ -1,928 +0,0 @@ -/* FLEX lexer for Ada expressions, for GDB. - Copyright (C) 1994, 1997, 2000 - Free Software Foundation, Inc. - -This file is part of GDB. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/*----------------------------------------------------------------------*/ - -/* The converted version of this file is to be included in ada-exp.y, */ -/* the Ada parser for gdb. The function yylex obtains characters from */ -/* the global pointer lexptr. It returns a syntactic category for */ -/* each successive token and places a semantic value into yylval */ -/* (ada-lval), defined by the parser. */ - -/* Run flex with (at least) the -i option (case-insensitive), and the -I */ -/* option (interactive---no unnecessary lookahead). */ - -DIG [0-9] -NUM10 ({DIG}({DIG}|_)*) -HEXDIG [0-9a-f] -NUM16 ({HEXDIG}({HEXDIG}|_)*) -OCTDIG [0-7] -LETTER [a-z_] -ID ({LETTER}({LETTER}|{DIG})*|"<"{LETTER}({LETTER}|{DIG})*">") -WHITE [ \t\n] -TICK ("'"{WHITE}*) -GRAPHIC [a-z0-9 #&'()*+,-./:;<>=_|!$%?@\[\]\\^`{}~] -OPER ([-+*/=<>&]|"<="|">="|"**"|"/="|"and"|"or"|"xor"|"not"|"mod"|"rem"|"abs") - -EXP (e[+-]{NUM10}) -POSEXP (e"+"?{NUM10}) - -%{ -#define NUMERAL_WIDTH 256 -#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1)) - -/* Temporary staging for numeric literals. */ -static char numbuf[NUMERAL_WIDTH]; - static void canonicalizeNumeral (char* s1, const char*); -static int processInt (const char*, const char*, const char*); -static int processReal (const char*); -static int processId (const char*, int); -static int processAttribute (const char*); -static int find_dot_all (const char*); - -#undef YY_DECL -#define YY_DECL static int yylex ( void ) - -#undef YY_INPUT -#define YY_INPUT(BUF, RESULT, MAX_SIZE) \ - if ( *lexptr == '\000' ) \ - (RESULT) = YY_NULL; \ - else \ - { \ - *(BUF) = *lexptr; \ - (RESULT) = 1; \ - lexptr += 1; \ - } - -static char *tempbuf = NULL; -static int tempbufsize = 0; -static int tempbuf_len; -static struct block* left_block_context; - -static void resize_tempbuf (unsigned int); - -static void block_lookup (char*, char*); - -static int name_lookup (char*, char*, int*); - -static int find_dot_all (const char*); - -%} - -%s IN_STRING BEFORE_QUAL_QUOTE - -%% - -{WHITE} { } - -"--".* { yyterminate(); } - -{NUM10}{POSEXP} { - canonicalizeNumeral (numbuf, yytext); - return processInt (NULL, numbuf, strrchr(numbuf, 'e')+1); - } - -{NUM10} { - canonicalizeNumeral (numbuf, yytext); - return processInt (NULL, numbuf, NULL); - } - -{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#"{POSEXP} { - canonicalizeNumeral (numbuf, yytext); - return processInt (numbuf, - strchr (numbuf, '#') + 1, - strrchr(numbuf, '#') + 1); - } - -{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#" { - canonicalizeNumeral (numbuf, yytext); - return processInt (numbuf, strchr (numbuf, '#') + 1, NULL); - } - -"0x"{HEXDIG}+ { - canonicalizeNumeral (numbuf, yytext+2); - return processInt ("16#", numbuf, NULL); - } - - -{NUM10}"."{NUM10}{EXP} { - canonicalizeNumeral (numbuf, yytext); - return processReal (numbuf); - } - -{NUM10}"."{NUM10} { - canonicalizeNumeral (numbuf, yytext); - return processReal (numbuf); - } - -{NUM10}"#"{NUM16}"."{NUM16}"#"{EXP} { - error ("Based real literals not implemented yet."); - } - -{NUM10}"#"{NUM16}"."{NUM16}"#" { - error ("Based real literals not implemented yet."); - } - -"'"({GRAPHIC}|\")"'" { - yylval.typed_val.type = builtin_type_ada_char; - yylval.typed_val.val = yytext[1]; - return CHARLIT; - } - -"'[\""{HEXDIG}{2}"\"]'" { - int v; - yylval.typed_val.type = builtin_type_ada_char; - sscanf (yytext+3, "%2x", &v); - yylval.typed_val.val = v; - return CHARLIT; - } - -\"{OPER}\"/{WHITE}*"(" { return processId (yytext, yyleng); } - -\" { - tempbuf_len = 0; - BEGIN IN_STRING; - } - -{GRAPHIC}*\" { - resize_tempbuf (yyleng+tempbuf_len); - strncpy (tempbuf+tempbuf_len, yytext, yyleng-1); - tempbuf_len += yyleng-1; - yylval.sval.ptr = tempbuf; - yylval.sval.length = tempbuf_len; - BEGIN INITIAL; - return STRING; - } - -{GRAPHIC}*"[\""{HEXDIG}{2}"\"]" { - int n; - resize_tempbuf (yyleng-5+tempbuf_len+1); - strncpy (tempbuf+tempbuf_len, yytext, yyleng-6); - sscanf(yytext+yyleng-4, "%2x", &n); - tempbuf[yyleng-6+tempbuf_len] = (char) n; - tempbuf_len += yyleng-5; - } - -{GRAPHIC}*"[\"\"\"]" { - int n; - resize_tempbuf (yyleng-4+tempbuf_len+1); - strncpy (tempbuf+tempbuf_len, yytext, yyleng-6); - tempbuf[yyleng-5+tempbuf_len] = '"'; - tempbuf_len += yyleng-4; - } - -if { - while (*lexptr != 'i' && *lexptr != 'I') - lexptr -= 1; - yyrestart(NULL); - return 0; - } - - /* ADA KEYWORDS */ - -abs { return ABS; } -and { return _AND_; } -else { return ELSE; } -in { return IN; } -mod { return MOD; } -new { return NEW; } -not { return NOT; } -null { return NULL_PTR; } -or { return OR; } -rem { return REM; } -then { return THEN; } -xor { return XOR; } - - /* ATTRIBUTES */ - -{TICK}[a-zA-Z][a-zA-Z]+ { return processAttribute (yytext+1); } - - /* PUNCTUATION */ - -"=>" { return ARROW; } -".." { return DOTDOT; } -"**" { return STARSTAR; } -":=" { return ASSIGN; } -"/=" { return NOTEQUAL; } -"<=" { return LEQ; } -">=" { return GEQ; } - -"'" { BEGIN INITIAL; return '\''; } - -[-&*+./:<>=|;\[\]] { return yytext[0]; } - -"," { if (paren_depth == 0 && comma_terminates) - { - lexptr -= 1; - yyrestart(NULL); - return 0; - } - else - return ','; - } - -"(" { paren_depth += 1; return '('; } -")" { if (paren_depth == 0) - { - lexptr -= 1; - yyrestart(NULL); - return 0; - } - else - { - paren_depth -= 1; - return ')'; - } - } - -"."{WHITE}*all { return DOT_ALL; } - -"."{WHITE}*{ID} { - processId (yytext+1, yyleng-1); - return DOT_ID; - } - -{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*(" "*"'")? { - int all_posn = find_dot_all (yytext); - int token_type, segments, k; - int quote_follows; - - if (all_posn == -1 && yytext[yyleng-1] == '\'') - { - quote_follows = 1; - do { - yyless (yyleng-1); - } while (yytext[yyleng-1] == ' '); - } - else - quote_follows = 0; - - if (all_posn >= 0) - yyless (all_posn); - processId(yytext, yyleng); - segments = name_lookup (ada_mangle (yylval.ssym.stoken.ptr), - yylval.ssym.stoken.ptr, &token_type); - left_block_context = NULL; - for (k = yyleng; segments > 0 && k > 0; k -= 1) - { - if (yytext[k-1] == '.') - segments -= 1; - quote_follows = 0; - } - if (k <= 0) - error ("confused by name %s", yytext); - yyless (k); - if (quote_follows) - BEGIN BEFORE_QUAL_QUOTE; - return token_type; - } - - /* GDB EXPRESSION CONSTRUCTS */ - - -"'"[^']+"'"{WHITE}*:: { - processId(yytext, yyleng-2); - block_lookup (yylval.ssym.stoken.ptr, yylval.ssym.stoken.ptr); - return BLOCKNAME; - } - -{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*{WHITE}*:: { - processId(yytext, yyleng-2); - block_lookup (ada_mangle (yylval.ssym.stoken.ptr), - yylval.ssym.stoken.ptr); - return BLOCKNAME; - } - -[{}@] { return yytext[0]; } - -"$$" { yylval.lval = -1; return LAST; } -"$$"{DIG}+ { yylval.lval = -atoi(yytext+2); return LAST; } -"$" { yylval.lval = 0; return LAST; } -"$"{DIG}+ { yylval.lval = atoi(yytext+1); return LAST; } - - - /* REGISTERS AND GDB CONVENIENCE VARIABLES */ - -"$"({LETTER}|{DIG}|"$")+ { - int c; - for (c = 0; c < NUM_REGS; c++) - if (REGISTER_NAME (c) && - strcmp (yytext + 1, REGISTER_NAME (c)) == 0) - { - yylval.lval = c; - return REGNAME; - } - yylval.sval.ptr = yytext; - yylval.sval.length = yyleng; - yylval.ivar = - lookup_internalvar (copy_name (yylval.sval) + 1); - return INTERNAL_VARIABLE; - } - - /* CATCH-ALL ERROR CASE */ - -. { error ("Invalid character '%s' in expression.", yytext); } -%% - -#include -#include - -/* Initialize the lexer for processing new expression */ -void -lexer_init (FILE* inp) -{ - BEGIN INITIAL; - yyrestart (inp); -} - - -/* Make sure that tempbuf points at an array at least N characters long. */ - -static void -resize_tempbuf (n) - unsigned int n; -{ - if (tempbufsize < n) - { - tempbufsize = (n+63) & ~63; - tempbuf = (char*) xrealloc (tempbuf, tempbufsize); - } -} - -/* Copy S2 to S1, removing all underscores, and downcasing all letters. */ - -static void -canonicalizeNumeral (s1,s2) - char* s1; - const char* s2; -{ - for (; *s2 != '\000'; s2 += 1) - { - if (*s2 != '_') - { - *s1 = tolower(*s2); - s1 += 1; - } - } - s1[0] = '\000'; -} - -#define HIGH_BYTE_POSN ((sizeof (ULONGEST) - 1) * HOST_CHAR_BIT) - -/* True (non-zero) iff DIGIT is a valid digit in radix BASE, - where 2 <= BASE <= 16. */ - -static int -is_digit_in_base (digit, base) - unsigned char digit; - int base; -{ - if (!isxdigit (digit)) - return 0; - if (base <= 10) - return (isdigit (digit) && digit < base + '0'); - else - return (isdigit (digit) || tolower (digit) < base - 10 + 'a'); -} - -static int -digit_to_int (c) - unsigned char c; -{ - if (isdigit (c)) - return c - '0'; - else - return tolower (c) - 'a' + 10; -} - -/* As for strtoul, but for ULONGEST results. */ -ULONGEST -strtoulst (num, trailer, base) - const char *num; - const char **trailer; - int base; -{ - unsigned int high_part; - ULONGEST result; - int i; - unsigned char lim; - - if (base < 2 || base > 16) - { - errno = EINVAL; - return 0; - } - lim = base - 1 + '0'; - - result = high_part = 0; - for (i = 0; is_digit_in_base (num[i], base); i += 1) - { - result = result*base + digit_to_int (num[i]); - high_part = high_part*base + (unsigned int) (result >> HIGH_BYTE_POSN); - result &= ((ULONGEST) 1 << HIGH_BYTE_POSN) - 1; - if (high_part > 0xff) - { - errno = ERANGE; - result = high_part = 0; - break; - } - } - - if (trailer != NULL) - *trailer = &num[i]; - - return result + ((ULONGEST) high_part << HIGH_BYTE_POSN); -} - - - -/* Interprets the prefix of NUM that consists of digits of the given BASE - as an integer of that BASE, with the string EXP as an exponent. - Puts value in yylval, and returns INT, if the string is valid. Causes - an error if the number is improperly formated. BASE, if NULL, defaults - to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'. */ - -static int -processInt (base0, num0, exp0) - const char* num0; - const char* base0; - const char* exp0; -{ - ULONGEST result; - long exp; - int base; - - char* trailer; - - if (base0 == NULL) - base = 10; - else - { - base = strtol (base0, (char**) NULL, 10); - if (base < 2 || base > 16) - error ("Invalid base: %d.", base); - } - - if (exp0 == NULL) - exp = 0; - else - exp = strtol(exp0, (char**) NULL, 10); - - errno = 0; - result = strtoulst (num0, &trailer, base); - if (errno == ERANGE) - error ("Integer literal out of range"); - if (isxdigit(*trailer)) - error ("Invalid digit `%c' in based literal", *trailer); - - while (exp > 0) - { - if (result > (ULONG_MAX / base)) - error ("Integer literal out of range"); - result *= base; - exp -= 1; - } - - if ((result >> (TARGET_INT_BIT-1)) == 0) - yylval.typed_val.type = builtin_type_ada_int; - else if ((result >> (TARGET_LONG_BIT-1)) == 0) - yylval.typed_val.type = builtin_type_ada_long; - else if (((result >> (TARGET_LONG_BIT-1)) >> 1) == 0) - { - /* We have a number representable as an unsigned integer quantity. - For consistency with the C treatment, we will treat it as an - anonymous modular (unsigned) quantity. Alas, the types are such - that we need to store .val as a signed quantity. Sorry - for the mess, but C doesn't officially guarantee that a simple - assignment does the trick (no, it doesn't; read the reference manual). - */ - yylval.typed_val.type = builtin_type_unsigned_long; - if (result & LONGEST_SIGN) - yylval.typed_val.val = - (LONGEST) (result & ~LONGEST_SIGN) - - (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1); - else - yylval.typed_val.val = (LONGEST) result; - return INT; - } - else - yylval.typed_val.type = builtin_type_ada_long_long; - - yylval.typed_val.val = (LONGEST) result; - return INT; -} - -static int -processReal (num0) - const char* num0; -{ - if (sizeof (DOUBLEST) <= sizeof (float)) - sscanf (num0, "%g", &yylval.typed_val_float.dval); - else if (sizeof (DOUBLEST) <= sizeof (double)) - sscanf (num0, "%lg", &yylval.typed_val_float.dval); - else - { -#ifdef PRINTF_HAS_LONG_DOUBLE - sscanf (num0, "%Lg", &yylval.typed_val_float.dval); -#else - /* Scan it into a double, then convert and assign it to the - long double. This at least wins with values representable - in the range of doubles. */ - double temp; - sscanf (num0, "%lg", &temp); - yylval.typed_val_float.dval = temp; -#endif - } - - yylval.typed_val_float.type = builtin_type_ada_float; - if (sizeof(DOUBLEST) >= TARGET_DOUBLE_BIT / TARGET_CHAR_BIT) - yylval.typed_val_float.type = builtin_type_ada_double; - if (sizeof(DOUBLEST) >= TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT) - yylval.typed_val_float.type = builtin_type_ada_long_double; - - return FLOAT; -} - -static int -processId (name0, len) - const char *name0; - int len; -{ - char* name = xmalloc (len + 11); - int i0, i; - -/* add_name_string_cleanup (name); */ -/* FIXME: add_name_string_cleanup should be defined in parse.c */ - while (len > 0 && isspace (name0[len-1])) - len -= 1; - i = i0 = 0; - while (i0 < len) - { - if (isalnum (name0[i0])) - { - name[i] = tolower (name0[i0]); - i += 1; i0 += 1; - } - else switch (name0[i0]) - { - default: - name[i] = name0[i0]; - i += 1; i0 += 1; - break; - case ' ': case '\t': - i0 += 1; - break; - case '\'': - i0 += 1; - while (i0 < len && name0[i0] != '\'') - { - name[i] = name0[i0]; - i += 1; i0 += 1; - } - i0 += 1; - break; - case '<': - i0 += 1; - while (i0 < len && name0[i0] != '>') - { - name[i] = name0[i0]; - i += 1; i0 += 1; - } - i0 += 1; - break; - } - } - name[i] = '\000'; - - yylval.ssym.sym = NULL; - yylval.ssym.stoken.ptr = name; - yylval.ssym.stoken.length = i; - return NAME; -} - -static void -block_lookup (name, err_name) - char* name; - char* err_name; -{ - struct symbol** syms; - struct block** blocks; - int nsyms; - struct symtab *symtab; - nsyms = ada_lookup_symbol_list (name, left_block_context, - VAR_NAMESPACE, &syms, &blocks); - if (left_block_context == NULL && - (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK)) - symtab = lookup_symtab (name); - else - symtab = NULL; - - if (symtab != NULL) - left_block_context = yylval.bval = - BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK); - else if (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK) - { - if (left_block_context == NULL) - error ("No file or function \"%s\".", err_name); - else - error ("No function \"%s\" in specified context.", err_name); - } - else - { - left_block_context = yylval.bval = SYMBOL_BLOCK_VALUE (syms[0]); - if (nsyms > 1) - warning ("Function name \"%s\" ambiguous here", err_name); - } -} - -/* Look up NAME0 (assumed to be mangled) as a name in VAR_NAMESPACE, - setting *TOKEN_TYPE to NAME or TYPENAME, depending on what is - found. Try first the entire name, then the name without the last - segment (i.e., after the last .id), etc., and return the number of - segments that had to be removed to get a match. Calls error if no - matches are found, using ERR_NAME in any error message. When - exactly one symbol match is found, it is placed in yylval. */ - -static int -name_lookup (name0, err_name, token_type) - char* name0; - char* err_name; - int* token_type; -{ - struct symbol** syms; - struct block** blocks; - struct type* type; - int len0 = strlen (name0); - char* name = savestring (name0, len0); - int nsyms; - int segments; - -/* add_name_string_cleanup (name);*/ -/* FIXME: add_name_string_cleanup should be defined in parse.c */ - yylval.ssym.stoken.ptr = name; - yylval.ssym.stoken.length = strlen (name); - for (segments = 0; ; segments += 1) - { - struct type* preferred_type; - int i, preferred_index; - - if (left_block_context == NULL) - nsyms = ada_lookup_symbol_list (name, expression_context_block, - VAR_NAMESPACE, &syms, &blocks); - else - nsyms = ada_lookup_symbol_list (name, left_block_context, - VAR_NAMESPACE, &syms, &blocks); - - /* Check for a type definition. */ - - /* Look for a symbol that doesn't denote void. This is (I think) a */ - /* temporary kludge to get around problems in GNAT output. */ - preferred_index = -1; preferred_type = NULL; - for (i = 0; i < nsyms; i += 1) - switch (SYMBOL_CLASS (syms[i])) - { - case LOC_TYPEDEF: - if (ada_prefer_type (SYMBOL_TYPE (syms[i]), preferred_type)) - { - preferred_index = i; - preferred_type = SYMBOL_TYPE (syms[i]); - } - break; - case LOC_REGISTER: - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_LOCAL: - case LOC_LOCAL_ARG: - case LOC_BASEREG: - case LOC_BASEREG_ARG: - goto NotType; - default: - break; - } - if (preferred_type != NULL) - { -/* if (TYPE_CODE (preferred_type) == TYPE_CODE_VOID) - error ("`%s' matches only void type name(s)", - ada_demangle (name)); -*/ -/* FIXME: ada_demangle should be defined in defs.h, and is located in ada-lang.c */ -/* else*/ if (ada_is_object_renaming (syms[preferred_index])) - { - yylval.ssym.sym = syms[preferred_index]; - *token_type = OBJECT_RENAMING; - return segments; - } - else if (ada_renaming_type (SYMBOL_TYPE (syms[preferred_index])) - != NULL) - { - int result; - const char* renaming = - ada_simple_renamed_entity (syms[preferred_index]); - char* new_name = xmalloc (strlen (renaming) + len0 - - yylval.ssym.stoken.length + 1); -/* add_name_string_cleanup (new_name);*/ -/* FIXME: add_name_string_cleanup should be defined in parse.c */ - strcpy (new_name, renaming); - strcat (new_name, name0 + yylval.ssym.stoken.length); - result = name_lookup (new_name, err_name, token_type); - if (result > segments) - error ("Confused by renamed symbol."); - return result; - } - else if (segments == 0) - { - yylval.tval = preferred_type; - *token_type = TYPENAME; - return 0; - } - } - - if (segments == 0) - { - type = lookup_primitive_typename (name); - if (type == NULL && STREQ ("system__address", name)) - type = builtin_type_ada_system_address; - if (type != NULL) - { - yylval.tval = type; - *token_type = TYPENAME; - return 0; - } - } - - NotType: - if (nsyms == 1) - { - *token_type = NAME; - yylval.ssym.sym = syms[0]; - yylval.ssym.msym = NULL; - yylval.ssym.block = blocks[0]; - return segments; - } - else if (nsyms == 0) { - int i; - yylval.ssym.msym = ada_lookup_minimal_symbol (name); - if (yylval.ssym.msym != NULL) - { - yylval.ssym.sym = NULL; - yylval.ssym.block = NULL; - *token_type = NAME; - return segments; - } - - for (i = yylval.ssym.stoken.length - 1; i > 0; i -= 1) - { - if (name[i] == '.') - { - name[i] = '\0'; - yylval.ssym.stoken.length = i; - break; - } - else if (name[i] == '_' && name[i-1] == '_') - { - i -= 1; - name[i] = '\0'; - yylval.ssym.stoken.length = i; - break; - } - } - if (i <= 0) - { - if (!have_full_symbols () && !have_partial_symbols () - && left_block_context == NULL) - error ("No symbol table is loaded. Use the \"file\" command."); - if (left_block_context == NULL) - error ("No definition of \"%s\" in current context.", - err_name); - else - error ("No definition of \"%s\" in specified context.", - err_name); - } - } - else - { - *token_type = NAME; - yylval.ssym.sym = NULL; - yylval.ssym.msym = NULL; - if (left_block_context == NULL) - yylval.ssym.block = expression_context_block; - else - yylval.ssym.block = left_block_context; - return segments; - } - } -} - -/* Returns the position within STR of the '.' in a - '.{WHITE}*all' component of a dotted name, or -1 if there is none. */ -static int -find_dot_all (str) - const char* str; -{ - int i; - for (i = 0; str[i] != '\000'; i += 1) - { - if (str[i] == '.') - { - int i0 = i; - do - i += 1; - while (isspace (str[i])); - if (strcmp (str+i, "all") == 0 - && ! isalnum (str[i+3]) && str[i+3] != '_') - return i0; - } - } - return -1; -} - -/* Returns non-zero iff string SUBSEQ matches a subsequence of STR, ignoring - case. */ - -static int -subseqMatch (subseq, str) - const char* subseq; - const char* str; -{ - if (subseq[0] == '\0') - return 1; - else if (str[0] == '\0') - return 0; - else if (tolower (subseq[0]) == tolower (str[0])) - return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1); - else - return subseqMatch (subseq, str+1); -} - - -static struct { const char* name; int code; } -attributes[] = { - { "address", TICK_ADDRESS }, - { "unchecked_access", TICK_ACCESS }, - { "unrestricted_access", TICK_ACCESS }, - { "access", TICK_ACCESS }, - { "first", TICK_FIRST }, - { "last", TICK_LAST }, - { "length", TICK_LENGTH }, - { "max", TICK_MAX }, - { "min", TICK_MIN }, - { "modulus", TICK_MODULUS }, - { "pos", TICK_POS }, - { "range", TICK_RANGE }, - { "size", TICK_SIZE }, - { "tag", TICK_TAG }, - { "val", TICK_VAL }, - { NULL, -1 } -}; - -/* Return the syntactic code corresponding to the attribute name or - abbreviation STR. */ - -static int -processAttribute (str) - const char* str; -{ - int i, k; - - for (i = 0; attributes[i].code != -1; i += 1) - if (strcasecmp (str, attributes[i].name) == 0) - return attributes[i].code; - - for (i = 0, k = -1; attributes[i].code != -1; i += 1) - if (subseqMatch (str, attributes[i].name)) - { - if (k == -1) - k = i; - else - error ("ambiguous attribute name: `%s'", str); - } - if (k == -1) - error ("unrecognized attribute: `%s'", str); - - return attributes[k].code; -} - -int -yywrap() -{ - return 1; -} diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c deleted file mode 100644 index 23dc105ea9d..00000000000 --- a/gdb/ada-tasks.c +++ /dev/null @@ -1,806 +0,0 @@ -/* file ada-tasks.c: Ada tasking control for GDB - Copyright 1997 Free Software Foundation, Inc. - Contributed by Ada Core Technologies, Inc -. - This file is part of GDB. - - [$Id$] - Authors: Roch-Alexandre Nomine Beguin, Arnaud Charlet - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - -*/ - -#include -#include "defs.h" -#include "command.h" -#include "value.h" -#include "language.h" -#include "inferior.h" -#include "symtab.h" -#include "target.h" -#include "gdbcore.h" - -#if (defined(__alpha__) && defined(__osf__) && !defined(__alpha_vxworks)) -#include -#endif - -#if (defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)) -#include "gregset.h" -#endif - -#include "ada-lang.h" - -/* FIXME: move all this conditional compilation in description - files or in configure.in */ - -#if defined (VXWORKS_TARGET) -#define THREAD_TO_PID(tid,lwpid) (tid) - -#elif defined (linux) -#define THREAD_TO_PID(tid,lwpid) (0) - -#elif (defined (sun) && defined (__SVR4)) -#define THREAD_TO_PID thread_to_pid - -#elif defined (sgi) || defined (__WIN32__) || defined (hpux) -#define THREAD_TO_PID(tid,lwpid) ((int)lwpid) - -#else -#define THREAD_TO_PID(tid,lwpid) (0) -#endif - -#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET) -#define THREAD_FETCH_REGISTERS dec_thread_fetch_registers -#define GET_CURRENT_THREAD dec_thread_get_current_thread -extern int dec_thread_get_registers (gdb_gregset_t *, gdb_fpregset_t *); -#endif - -#if defined (_AIX) -#define THREAD_FETCH_REGISTERS aix_thread_fetch_registers -#define GET_CURRENT_THREAD aix_thread_get_current_thread -#endif - -#if defined(VXWORKS_TARGET) -#define GET_CURRENT_THREAD() ((void*)inferior_pid) -#define THREAD_FETCH_REGISTERS() (-1) - -#elif defined (sun) && defined (__SVR4) -#define GET_CURRENT_THREAD solaris_thread_get_current_thread -#define THREAD_FETCH_REGISTERS() (-1) -extern void *GET_CURRENT_THREAD(); - -#elif defined (_AIX) || (defined(__alpha__) && defined(__osf__)) -extern void *GET_CURRENT_THREAD(); - -#elif defined (__WIN32__) || defined (hpux) -#define GET_CURRENT_THREAD() (inferior_pid) -#define THREAD_FETCH_REGISTERS() (-1) - -#else -#define GET_CURRENT_THREAD() (NULL) -#define THREAD_FETCH_REGISTERS() (-1) -#endif - -#define KNOWN_TASKS_NAME "system__tasking__debug__known_tasks" - -#define READ_MEMORY(addr, var) read_memory (addr, (char*) &var, sizeof (var)) -/* external declarations */ - -extern struct value* find_function_in_inferior (char *); - -/* Global visible variables */ - -struct task_entry *task_list = NULL; -int ada__tasks_check_symbol_table = 1; -void *pthread_kern_addr = NULL; - -#if (defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)) -gdb_gregset_t gregset_saved; -gdb_fpregset_t fpregset_saved; -#endif - -/* The maximum number of tasks known to the Ada runtime */ -const int MAX_NUMBER_OF_KNOWN_TASKS = 1000; - -/* the current task */ -int current_task = -1, current_task_id = -1, current_task_index; -void *current_thread, *current_lwp; - -char *ada_task_states[] = -{ - "Unactivated", - "Runnable", - "Terminated", - "Child Activation Wait", - "Accept Statement", - "Waiting on entry call", - "Async Select Wait", - "Delay Sleep", - "Child Termination Wait", - "Wait Child in Term Alt", - "", - "", - "", - "", - "Asynchronous Hold" -}; - -/* Global internal types */ - -static char *ada_long_task_states[] = -{ - "Unactivated", - "Runnable", - "Terminated", - "Waiting for child activation", - "Blocked in accept statement", - "Waiting on entry call", - "Asynchronous Selective Wait", - "Delay Sleep", - "Waiting for children termination", - "Waiting for children in terminate alternative", - "", - "", - "", - "", - "Asynchronous Hold" -}; - -/* Global internal variables */ - -static int highest_task_num = 0; -int thread_support = 0; /* 1 if the thread library in use is supported */ -static int gdbtk_task_initialization = 0; - -static int add_task_entry (p_task_id, index) - void *p_task_id; - int index; -{ - struct task_entry *new_task_entry = NULL; - struct task_entry *pt; - - highest_task_num++; - new_task_entry = malloc (sizeof (struct task_entry)); - new_task_entry->task_num = highest_task_num; - new_task_entry->task_id = p_task_id; - new_task_entry->known_tasks_index = index; - new_task_entry->next_task = NULL; - pt = task_list; - if (pt) - { - while (pt->next_task) - pt = pt->next_task; - pt->next_task = new_task_entry; - pt->stack_per = 0; - } - else task_list = new_task_entry; - return new_task_entry->task_num; -} - -int -get_entry_number (p_task_id) - void *p_task_id; -{ - struct task_entry *pt; - - pt = task_list; - while (pt != NULL) - { - if (pt->task_id == p_task_id) - return pt->task_num; - pt = pt->next_task; - } - return 0; -} - -static struct task_entry *get_thread_entry_vptr (thread) - void *thread; -{ - struct task_entry *pt; - - pt = task_list; - while (pt != NULL) - { - if (pt->thread == thread) - return pt; - pt = pt->next_task; - } - return 0; -} - -static struct task_entry *get_entry_vptr (p_task_num) - int p_task_num; -{ - struct task_entry *pt; - - pt = task_list; - while (pt) - { - if (pt->task_num == p_task_num) - return pt; - pt = pt->next_task; - } - return NULL; -} - -void init_task_list () -{ - struct task_entry *pt, *old_pt; - - pt = task_list; - while (pt) - { - old_pt = pt; - pt = pt->next_task; - free (old_pt); - }; - task_list = NULL; - highest_task_num = 0; -} - -int valid_task_id (task) - int task; -{ - return get_entry_vptr (task) != NULL; -} - -void *get_self_id () -{ - struct value* val; - void *self_id; - int result; - struct task_entry *ent; - extern int do_not_insert_breakpoints; - -#if !((defined(sun) && defined(__SVR4)) || defined(VXWORKS_TARGET) || defined(__WIN32__)) - if (thread_support) -#endif - { - ent = get_thread_entry_vptr (GET_CURRENT_THREAD ()); - return ent ? ent->task_id : 0; - } - - /* FIXME: calling a function in the inferior with a multithreaded application - is not reliable, so return NULL if there is no safe way to get the current - task */ - return NULL; -} - -int get_current_task () -{ - int result; - - /* FIXME: language_ada should be defined in defs.h */ - /* if (current_language->la_language != language_ada) return -1; */ - - result = get_entry_number (get_self_id ()); - - /* return -1 if not found */ - return result == 0 ? -1 : result; -} - -/* Print detailed information about specified task */ - -static void -info_task (arg, from_tty) - char *arg; - int from_tty; -{ - void *temp_task; - struct task_entry *pt, *pt2; - void *self_id, *caller; - struct task_fields atcb, atcb2; - struct entry_call call; - int bounds [2]; - char image [256]; - int num; - - /* FIXME: language_ada should be defined in defs.h */ - /* if (current_language->la_language != language_ada) - { - printf_filtered ("The current language does not support tasks.\n"); - return; - } - */ - pt = get_entry_vptr (atoi (arg)); - if (pt == NULL) - { - printf_filtered ("Task %s not found.\n", arg); - return; - } - - temp_task = pt->task_id; - - /* read the atcb in the inferior */ - READ_MEMORY ((CORE_ADDR) temp_task, atcb); - - /* print the Ada task id */ - printf_filtered ("Ada Task: %p\n", temp_task); - - /* print the name of the task */ - if (atcb.image.P_ARRAY != NULL) { - READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS), bounds); - bounds [1] = EXTRACT_INT (bounds [1]); - read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY), - (char*) &image, bounds [1]); - printf_filtered ("Name: %.*s\n", bounds [1], image); - } - else printf_filtered ("\n"); - - /* print the thread id */ - - if ((long) pt->thread < 65536) - printf_filtered ("Thread: %ld\n", (long int) pt->thread); - else - printf_filtered ("Thread: %p\n", pt->thread); - - if ((long) pt->lwp != 0) - { - if ((long) pt->lwp < 65536) - printf_filtered ("LWP: %ld\n", (long int) pt->lwp); - else - printf_filtered ("LWP: %p\n", pt->lwp); - } - - /* print the parent gdb task id */ - num = get_entry_number (EXTRACT_ADDRESS (atcb.parent)); - if (num != 0) - { - printf_filtered ("Parent: %d", num); - pt2 = get_entry_vptr (num); - READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2); - - /* print the name of the task */ - if (atcb2.image.P_ARRAY != NULL) { - READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_BOUNDS), - bounds); - bounds [1] = EXTRACT_INT (bounds [1]); - read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_ARRAY), - (char*) &image, bounds [1]); - printf_filtered (" (%.*s)\n", bounds [1], image); - } - else - printf_filtered ("\n"); - } - else - printf_filtered ("No parent\n"); - - /* print the base priority of the task */ - printf_filtered ("Base Priority: %d\n", EXTRACT_INT (atcb.priority)); - - /* print the current state of the task */ - - /* check if this task is accepting a rendezvous */ - if (atcb.call == NULL) - caller = NULL; - else { - READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call); - caller = EXTRACT_ADDRESS (call.self); - } - - if (caller != NULL) - { - num = get_entry_number (caller); - printf_filtered ("Accepting rendezvous with %d", num); - - if (num != 0) - { - pt2 = get_entry_vptr (num); - READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2); - - /* print the name of the task */ - if (atcb2.image.P_ARRAY != NULL) { - READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_BOUNDS), - bounds); - bounds [1] = EXTRACT_INT (bounds [1]); - read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_ARRAY), - (char*) &image, bounds [1]); - printf_filtered (" (%.*s)\n", bounds [1], image); - } - else - printf_filtered ("\n"); - } - else - printf_filtered ("\n"); - } - else - printf_filtered ("State: %s\n", ada_long_task_states [atcb.state]); -} - -#if 0 - -/* A useful function that shows the alignment of all the fields in the - tasks_fields structure - */ - -print_align () -{ - struct task_fields tf; - void *tf_base = &(tf); - void *tf_state = &(tf.state); - void *tf_entry_num = &(tf.entry_num); - void *tf_parent = &(tf.parent); - void *tf_priority = &(tf.priority); - void *tf_current_priority = &(tf.current_priority); - void *tf_image = &(tf.image); - void *tf_call = &(tf.call); - void *tf_thread = &(tf.thread); - void *tf_lwp = &(tf.lwp); - printf_filtered ("\n"); - printf_filtered ("(tf_base = 0x%x)\n", tf_base); - printf_filtered ("task_fields.entry_num at %3d (0x%x)\n", tf_entry_num - tf_base, tf_entry_num); - printf_filtered ("task_fields.state at %3d (0x%x)\n", tf_state - tf_base, tf_state); - printf_filtered ("task_fields.parent at %3d (0x%x)\n", tf_parent - tf_base, tf_parent); - printf_filtered ("task_fields.priority at %3d (0x%x)\n", tf_priority - tf_base, tf_priority); - printf_filtered ("task_fields.current_priority at %3d (0x%x)\n", tf_current_priority - tf_base, tf_current_priority); - printf_filtered ("task_fields.image at %3d (0x%x)\n", tf_image - tf_base, tf_image); - printf_filtered ("task_fields.call at %3d (0x%x)\n", tf_call - tf_base, tf_call); - printf_filtered ("task_fields.thread at %3d (0x%x)\n", tf_thread - tf_base, tf_thread); - printf_filtered ("task_fields.lwp at %3d (0x%x)\n", tf_lwp - tf_base, tf_lwp); - printf_filtered ("\n"); -} -#endif - -/* Print information about currently known tasks */ - -static void -info_tasks (arg, from_tty) - char *arg; - int from_tty; -{ - struct value* val; - int i, task_number, state; - void *temp_task, *temp_tasks [MAX_NUMBER_OF_KNOWN_TASKS]; - struct task_entry *pt; - void *self_id, *caller, *thread_id=NULL; - struct task_fields atcb; - struct entry_call call; - int bounds [2]; - char image [256]; - int size; - char car; - -#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET) - pthreadTeb_t thr; - gdb_gregset_t regs; -#endif - - static struct symbol *sym; - static struct minimal_symbol *msym; - static void *known_tasks_addr = NULL; - - int init_only = gdbtk_task_initialization; - gdbtk_task_initialization = 0; - - task_number = 0; - - if (PIDGET(inferior_ptid) == 0) - { - printf_filtered ("The program is not being run under gdb. "); - printf_filtered ("Use 'run' or 'attach' first.\n"); - return; - } - - if (ada__tasks_check_symbol_table) - { - thread_support = 0; -#if (defined(__alpha__) && defined(__osf__) & !defined(VXWORKS_TARGET)) || \ - defined (_AIX) - thread_support = 1; -#endif - - msym = lookup_minimal_symbol (KNOWN_TASKS_NAME, NULL, NULL); - if (msym != NULL) - known_tasks_addr = (void *) SYMBOL_VALUE_ADDRESS (msym); - else -#ifndef VXWORKS_TARGET - return; -#else - { - if (target_lookup_symbol (KNOWN_TASKS_NAME, &known_tasks_addr) != 0) - return; - } -#endif - - ada__tasks_check_symbol_table = 0; - } - - if (known_tasks_addr == NULL) - return; - -#if !((defined(sun) && defined(__SVR4)) || defined(VXWORKS_TARGET) || defined(__WIN32__) || defined (hpux)) - if (thread_support) -#endif - thread_id = GET_CURRENT_THREAD (); - - /* then we get a list of tasks created */ - - init_task_list (); - - READ_MEMORY ((CORE_ADDR) known_tasks_addr, temp_tasks); - - for (i=0; itask_id; - - /* read the atcb in the inferior */ - READ_MEMORY ((CORE_ADDR) temp_task, atcb); - - /* store the thread id for future use */ - pt->thread = EXTRACT_ADDRESS (atcb.thread); - -#if defined (linux) - pt->lwp = (void *) THREAD_TO_PID (atcb.thread, 0); -#else - pt->lwp = EXTRACT_ADDRESS (atcb.lwp); -#endif - - /* print a star if this task is the current one */ - if (thread_id) -#if defined (__WIN32__) || defined (SGI) || defined (hpux) - printf_filtered (pt->lwp == thread_id ? "*" : " "); -#else - printf_filtered (pt->thread == thread_id ? "*" : " "); -#endif - - /* print the gdb task id */ - printf_filtered ("%3d", pt->task_num); - - /* print the Ada task id */ -#ifndef VXWORKS_TARGET - printf_filtered (" %9lx", (long) temp_task); -#else -#ifdef TARGET_64 - printf_filtered (" %#9lx", (unsigned long)pt->thread & 0x3ffffffffff); -#else - printf_filtered (" %#9lx", (long)pt->thread); -#endif -#endif - - /* print the parent gdb task id */ - printf_filtered - (" %4d", get_entry_number (EXTRACT_ADDRESS (atcb.parent))); - - /* print the base priority of the task */ - printf_filtered (" %3d", EXTRACT_INT (atcb.priority)); - -#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET) - if (pt->task_num == 1 || atcb.state == Terminated) - { - printf_filtered (" Unknown"); - goto next; - } - - read_memory ((CORE_ADDR)atcb.thread, &thr, sizeof (thr)); - current_thread = atcb.thread; - regs.regs [SP_REGNUM] = 0; - if (dec_thread_get_registers (®s, NULL) == 0) { - pt->stack_per = (100 * ((long)thr.__stack_base - - regs.regs [SP_REGNUM])) / thr.__stack_size; - /* if the thread is terminated but still there, the - stack_base/size values are erroneous. Try to patch it */ - if (pt->stack_per < 0 || pt->stack_per > 100) pt->stack_per = 0; - } - - /* print information about stack space used in the thread */ - if (thr.__stack_size < 1024*1024) - { - size = thr.__stack_size / 1024; - car = 'K'; - } - else if (thr.__stack_size < 1024*1024*1024) - { - size = thr.__stack_size / 1024 / 1024; - car = 'M'; - } - else /* Who knows... */ - { - size = thr.__stack_size / 1024 / 1024 / 1024; - car = 'G'; - } - printf_filtered (" %4d%c %2d", size, car, pt->stack_per); -next: -#endif - - /* print the current state of the task */ - - /* check if this task is accepting a rendezvous */ - if (atcb.call == NULL) - caller = NULL; - else { - READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call); - caller = EXTRACT_ADDRESS (call.self); - } - - if (caller != NULL) - printf_filtered (" Accepting RV with %-4d", get_entry_number (caller)); - else - { - state = atcb.state; -#if defined (__WIN32__) || defined (SGI) || defined (hpux) - if (state == Runnable && (thread_id && pt->lwp == thread_id)) -#else - if (state == Runnable && (thread_id && pt->thread == thread_id)) -#endif - /* Replace "Runnable" by "Running" if this is the current task */ - printf_filtered (" %-22s", "Running"); - else - printf_filtered (" %-22s", ada_task_states [state]); - } - - /* finally, print the name of the task */ - if (atcb.image.P_ARRAY != NULL) { - READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS), bounds); - bounds [1] = EXTRACT_INT (bounds [1]); - read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY), - (char*)&image, bounds [1]); - printf_filtered (" %.*s\n", bounds [1], image); - } - else printf_filtered (" \n"); - - pt = pt->next_task; - } -} - -/* Task list initialization for GDB-Tk. We basically use info_tasks() - to initialize our variables, but abort that function before we - actually print anything. */ - -int -gdbtk_tcl_tasks_initialize () -{ - gdbtk_task_initialization = 1; - info_tasks ("", gdb_stdout); - - return (task_list != NULL); -} - -static void -info_tasks_command (arg, from_tty) - char *arg; - int from_tty; -{ - if (arg == NULL || *arg == '\000') - info_tasks (arg, from_tty); - else - info_task (arg, from_tty); -} - -/* Switch from one thread to another. */ - -static void -switch_to_thread (ptid_t ptid) - -{ - if (ptid_equal (ptid, inferior_ptid)) - return; - - inferior_ptid = ptid; - flush_cached_frames (); - registers_changed (); - stop_pc = read_pc (); - select_frame (get_current_frame ()); -} - -/* Switch to a specified task. */ - -static int task_switch (tid, lwpid) - void *tid, *lwpid; -{ - int res = 0, pid; - - if (thread_support) - { - flush_cached_frames (); - - if (current_task != current_task_id) - { - res = THREAD_FETCH_REGISTERS (); - } - else - { -#if (defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)) - supply_gregset (&gregset_saved); - supply_fpregset (&fpregset_saved); -#endif - } - - if (res == 0) stop_pc = read_pc(); - select_frame (get_current_frame ()); - return res; - } - - return -1; -} - -static void task_command (tidstr, from_tty) - char *tidstr; - int from_tty; -{ - int num; - struct task_entry *e; - - if (!tidstr) - error ("Please specify a task ID. Use the \"info tasks\" command to\n" - "see the IDs of currently known tasks."); - - num = atoi (tidstr); - e = get_entry_vptr (num); - - if (e == NULL) - error ("Task ID %d not known. Use the \"info tasks\" command to\n" - "see the IDs of currently known tasks.", num); - - if (current_task_id == -1) - { -#if (defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)) - fill_gregset (&gregset_saved, -1); - fill_fpregset (&fpregset_saved, -1); -#endif - current_task_id = get_current_task (); - } - - current_task = num; - current_task_index = e->known_tasks_index; - current_thread = e->thread; - current_lwp = e->lwp; - if (task_switch (e->thread, e->lwp) == 0) - { - /* FIXME: find_printable_frame should be defined in frame.h, and - implemented in ada-lang.c */ - /* find_printable_frame (selected_frame, frame_relative_level (selected_frame));*/ - printf_filtered ("[Switching to task %d]\n", num); - print_stack_frame (selected_frame, frame_relative_level (selected_frame), 1); - } - else - printf_filtered ("Unable to switch to task %d\n", num); -} - -void -_initialize_tasks () -{ - static struct cmd_list_element *task_cmd_list = NULL; - extern struct cmd_list_element *cmdlist; - - add_info ( - "tasks", info_tasks_command, - "Without argument: list all known Ada tasks, with status information.\n" - "info tasks n: print detailed information of task n.\n"); - - add_prefix_cmd ("task", class_run, task_command, - "Use this command to switch between tasks.\n\ - The new task ID must be currently known.", &task_cmd_list, "task ", 1, - &cmdlist); -} diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c deleted file mode 100644 index 677356186b2..00000000000 --- a/gdb/ada-typeprint.c +++ /dev/null @@ -1,896 +0,0 @@ -/* Support for printing Ada types for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1997 Free Software Foundation, Inc. - -This file is part of GDB. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "obstack.h" -#include "bfd.h" /* Binary File Description */ -#include "symtab.h" -#include "gdbtypes.h" -#include "expression.h" -#include "value.h" -#include "gdbcore.h" -#include "target.h" -#include "command.h" -#include "gdbcmd.h" -#include "language.h" -#include "demangle.h" -#include "c-lang.h" -#include "typeprint.h" -#include "ada-lang.h" - -#include -#include -#include - -static int print_record_field_types (struct type *, struct type *, - struct ui_file *, int, int); - -static void print_array_type (struct type*, struct ui_file*, int, int); - -static void print_choices (struct type*, int, struct ui_file*, struct type*); - -static void print_range (struct type*, struct ui_file*); - -static void print_range_bound (struct type*, char*, int*, struct ui_file*); - -static void -print_dynamic_range_bound (struct type*, const char*, int, - const char*, struct ui_file*); - -static void print_range_type_named (char*, struct ui_file*); - - - -static char* name_buffer; -static int name_buffer_len; - -/* The (demangled) Ada name of TYPE. This value persists until the - next call. */ - -static char* -demangled_type_name (type) - struct type *type; -{ - if (ada_type_name (type) == NULL) - return NULL; - else - { - char* raw_name = ada_type_name (type); - char *s, *q; - - if (name_buffer == NULL || name_buffer_len <= strlen (raw_name)) - { - name_buffer_len = 16 + 2 * strlen (raw_name); - name_buffer = xrealloc (name_buffer, name_buffer_len); - } - strcpy (name_buffer, raw_name); - - s = (char*) strstr (name_buffer, "___"); - if (s != NULL) - *s = '\0'; - - s = name_buffer + strlen (name_buffer) - 1; - while (s > name_buffer && (s[0] != '_' || s[-1] != '_')) - s -= 1; - - if (s == name_buffer) - return name_buffer; - - if (! islower (s[1])) - return NULL; - - for (s = q = name_buffer; *s != '\0'; q += 1) - { - if (s[0] == '_' && s[1] == '_') - { - *q = '.'; s += 2; - } - else - { - *q = *s; s += 1; - } - } - *q = '\0'; - return name_buffer; - } -} - - -/* Print a description of a type in the format of a - typedef for the current language. - NEW is the new name for a type TYPE. */ - -void -ada_typedef_print (type, new, stream) - struct type *type; - struct symbol *new; - struct ui_file *stream; -{ - fprintf_filtered (stream, "type %.*s is ", - ada_name_prefix_len (SYMBOL_SOURCE_NAME(new)), - SYMBOL_SOURCE_NAME(new)); - type_print (type, "", stream, 1); -} - -/* Print range type TYPE on STREAM. */ - -static void -print_range (type, stream) - struct type* type; - struct ui_file* stream; -{ - struct type* target_type; - target_type = TYPE_TARGET_TYPE (type); - if (target_type == NULL) - target_type = type; - - switch (TYPE_CODE (target_type)) - { - case TYPE_CODE_RANGE: - case TYPE_CODE_INT: - case TYPE_CODE_BOOL: - case TYPE_CODE_CHAR: - case TYPE_CODE_ENUM: - break; - default: - target_type = builtin_type_ada_int; - break; - } - - if (TYPE_NFIELDS (type) < 2) - { - /* A range needs at least 2 bounds to be printed. If there are less - than 2, just print the type name instead of the range itself. - This check handles cases such as characters, for example. - - Note that if the name is not defined, then we don't print anything. - */ - fprintf_filtered (stream, "%.*s", - ada_name_prefix_len (TYPE_NAME (type)), - TYPE_NAME (type)); - } - else - { - /* We extract the range type bounds respectively from the first element - and the last element of the type->fields array */ - const LONGEST lower_bound = (LONGEST) TYPE_LOW_BOUND (type); - const LONGEST upper_bound = - (LONGEST) TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) -1); - - ada_print_scalar (target_type, lower_bound, stream); - fprintf_filtered (stream, " .. "); - ada_print_scalar (target_type, upper_bound, stream); - } -} - -/* Print the number or discriminant bound at BOUNDS+*N on STREAM, and - set *N past the bound and its delimiter, if any. */ - -static void -print_range_bound (type, bounds, n, stream) - struct type* type; - char* bounds; - int* n; - struct ui_file* stream; -{ - LONGEST B; - if (ada_scan_number (bounds, *n, &B, n)) - { - ada_print_scalar (type, B, stream); - if (bounds[*n] == '_') - *n += 2; - } - else - { - int bound_len; - char* bound = bounds + *n; - char* pend; - - pend = strstr (bound, "__"); - if (pend == NULL) - *n += bound_len = strlen (bound); - else - { - bound_len = pend - bound; - *n += bound_len + 2; - } - fprintf_filtered (stream, "%.*s", bound_len, bound); - } -} - -/* Assuming NAME[0 .. NAME_LEN-1] is the name of a range type, print - the value (if found) of the bound indicated by SUFFIX ("___L" or - "___U") according to the ___XD conventions. */ - -static void -print_dynamic_range_bound (type, name, name_len, suffix, stream) - struct type* type; - const char* name; - int name_len; - const char* suffix; - struct ui_file* stream; -{ - static char *name_buf = NULL; - static size_t name_buf_len = 0; - LONGEST B; - int OK; - - GROW_VECT (name_buf, name_buf_len, name_len + strlen (suffix) + 1); - strncpy (name_buf, name, name_len); - strcpy (name_buf + name_len, suffix); - - B = get_int_var_value (name_buf, 0, &OK); - if (OK) - ada_print_scalar (type, B, stream); - else - fprintf_filtered (stream, "?"); -} - -/* Print the range type named NAME. */ - -static void -print_range_type_named (name, stream) - char* name; - struct ui_file* stream; -{ - struct type *raw_type = ada_find_any_type (name); - struct type *base_type; - LONGEST low, high; - char* subtype_info; - - if (raw_type == NULL) - base_type = builtin_type_int; - else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) - base_type = TYPE_TARGET_TYPE (raw_type); - else - base_type = raw_type; - - subtype_info = strstr (name, "___XD"); - if (subtype_info == NULL && raw_type == NULL) - fprintf_filtered (stream, "? .. ?"); - else if (subtype_info == NULL) - print_range (raw_type, stream); - else - { - int prefix_len = subtype_info - name; - char *bounds_str; - int n; - - subtype_info += 5; - bounds_str = strchr (subtype_info, '_'); - n = 1; - - if (*subtype_info == 'L') - { - print_range_bound (raw_type, bounds_str, &n, stream); - subtype_info += 1; - } - else - print_dynamic_range_bound (raw_type, name, prefix_len, "___L", stream); - - fprintf_filtered (stream, " .. "); - - if (*subtype_info == 'U') - print_range_bound (raw_type, bounds_str, &n, stream); - else - print_dynamic_range_bound (raw_type, name, prefix_len, "___U", stream); - } -} - -/* Print enumerated type TYPE on STREAM. */ - -static void -print_enum_type (type, stream) - struct type *type; - struct ui_file *stream; -{ - int len = TYPE_NFIELDS (type); - int i, lastval; - - fprintf_filtered (stream, "("); - wrap_here (" "); - - lastval = 0; - for (i = 0; i < len; i++) - { - QUIT; - if (i) fprintf_filtered (stream, ", "); - wrap_here (" "); - fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream); - if (lastval != TYPE_FIELD_BITPOS (type, i)) - { - fprintf_filtered (stream, " => %d", TYPE_FIELD_BITPOS (type, i)); - lastval = TYPE_FIELD_BITPOS (type, i); - } - lastval += 1; - } - fprintf_filtered (stream, ")"); -} - -/* Print representation of Ada fixed-point type TYPE on STREAM. */ - -static void -print_fixed_point_type (type, stream) - struct type *type; - struct ui_file *stream; -{ - DOUBLEST delta = ada_delta (type); - DOUBLEST small = ada_fixed_to_float (type, 1.0); - - if (delta < 0.0) - fprintf_filtered (stream, "delta ??"); - else - { - fprintf_filtered (stream, "delta %g", (double) delta); - if (delta != small) - fprintf_filtered (stream, " <'small = %g>", (double) small); - } -} - -/* Print representation of special VAX floating-point type TYPE on STREAM. */ - -static void -print_vax_floating_point_type (type, stream) - struct type *type; - struct ui_file *stream; -{ - fprintf_filtered (stream, "", - ada_vax_float_type_suffix (type)); -} - -/* Print simple (constrained) array type TYPE on STREAM. LEVEL is the - recursion (indentation) level, in case the element type itself has - nested structure, and SHOW is the number of levels of internal - structure to show (see ada_print_type). */ - -static void -print_array_type (type, stream, show, level) - struct type *type; - struct ui_file *stream; - int show; - int level; -{ - int bitsize; - int n_indices; - - bitsize = 0; - fprintf_filtered (stream, "array ("); - - n_indices = -1; - if (show < 0) - fprintf_filtered (stream, "..."); - else - { - if (ada_is_packed_array_type (type)) - type = ada_coerce_to_simple_array_type (type); - if (ada_is_simple_array (type)) - { - struct type* range_desc_type = - ada_find_parallel_type (type, "___XA"); - struct type* arr_type; - - bitsize = 0; - if (range_desc_type == NULL) - { - for (arr_type = type; TYPE_CODE (arr_type) == TYPE_CODE_ARRAY; - arr_type = TYPE_TARGET_TYPE (arr_type)) - { - if (arr_type != type) - fprintf_filtered (stream, ", "); - print_range (TYPE_INDEX_TYPE (arr_type), stream); - if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0) - bitsize = TYPE_FIELD_BITSIZE (arr_type, 0); - } - } - else - { - int k; - n_indices = TYPE_NFIELDS (range_desc_type); - for (k = 0, arr_type = type; - k < n_indices; - k += 1, arr_type = TYPE_TARGET_TYPE (arr_type)) - { - if (k > 0) - fprintf_filtered (stream, ", "); - print_range_type_named (TYPE_FIELD_NAME (range_desc_type, k), - stream); - if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0) - bitsize = TYPE_FIELD_BITSIZE (arr_type, 0); - } - } - } - else - { - int i, i0; - for (i = i0 = ada_array_arity (type); i > 0; i -= 1) - fprintf_filtered (stream, "%s<>", i == i0 ? "" : ", "); - } - } - - fprintf_filtered (stream, ") of "); - wrap_here (""); - ada_print_type (ada_array_element_type (type, n_indices), "", stream, - show == 0 ? 0 : show-1, level+1); - if (bitsize > 0) - fprintf_filtered (stream, " ", bitsize); -} - -/* Print the choices encoded by field FIELD_NUM of variant-part TYPE on - STREAM, assuming the VAL_TYPE is the type of the values. */ - -static void -print_choices (type, field_num, stream, val_type) - struct type *type; - int field_num; - struct ui_file *stream; - struct type *val_type; -{ - int have_output; - int p; - const char* name = TYPE_FIELD_NAME (type, field_num); - - have_output = 0; - - /* Skip over leading 'V': NOTE soon to be obsolete. */ - if (name[0] == 'V') - { - if (! ada_scan_number (name, 1, NULL, &p)) - goto Huh; - } - else - p = 0; - - while (1) - { - switch (name[p]) - { - default: - return; - case 'S': - case 'R': - case 'O': - if (have_output) - fprintf_filtered (stream, " | "); - have_output = 1; - break; - } - - switch (name[p]) - { - case 'S': - { - LONGEST W; - if (! ada_scan_number (name, p + 1, &W, &p)) - goto Huh; - ada_print_scalar (val_type, W, stream); - break; - } - case 'R': - { - LONGEST L, U; - if (! ada_scan_number (name, p + 1, &L, &p) - || name[p] != 'T' - || ! ada_scan_number (name, p + 1, &U, &p)) - goto Huh; - ada_print_scalar (val_type, L, stream); - fprintf_filtered (stream, " .. "); - ada_print_scalar (val_type, U, stream); - break; - } - case 'O': - fprintf_filtered (stream, "others"); - p += 1; - break; - } - } - -Huh: - fprintf_filtered (stream, "??"); - -} - -/* Assuming that field FIELD_NUM of TYPE is a VARIANTS field whose - discriminant is contained in OUTER_TYPE, print its variants on STREAM. - LEVEL is the recursion - (indentation) level, in case any of the fields themselves have - nested structure, and SHOW is the number of levels of internal structure - to show (see ada_print_type). For this purpose, fields nested in a - variant part are taken to be at the same level as the fields - immediately outside the variant part. */ - -static void -print_variant_clauses (type, field_num, outer_type, stream, show, level) - struct type *type; - int field_num; - struct type *outer_type; - struct ui_file *stream; - int show; - int level; -{ - int i; - struct type *var_type; - struct type *discr_type; - - var_type = TYPE_FIELD_TYPE (type, field_num); - discr_type = ada_variant_discrim_type (var_type, outer_type); - - if (TYPE_CODE (var_type) == TYPE_CODE_PTR) - { - var_type = TYPE_TARGET_TYPE (var_type); - if (TYPE_FLAGS (var_type) & TYPE_FLAG_STUB) - { - var_type = ada_find_parallel_type (var_type, "___XVU"); - if (var_type == NULL) - return; - } - } - - for (i = 0; i < TYPE_NFIELDS (var_type); i += 1) - { - fprintf_filtered (stream, "\n%*swhen ", level + 4, ""); - print_choices (var_type, i, stream, discr_type); - fprintf_filtered (stream, " =>"); - if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i), - outer_type, stream, show, level+4) <= 0) - fprintf_filtered (stream, " null;"); - } -} - -/* Assuming that field FIELD_NUM of TYPE is a variant part whose - discriminants are contained in OUTER_TYPE, print a description of it - on STREAM. LEVEL is the recursion (indentation) level, in case any of - the fields themselves have nested structure, and SHOW is the number of - levels of internal structure to show (see ada_print_type). For this - purpose, fields nested in a variant part are taken to be at the same - level as the fields immediately outside the variant part. */ - -static void -print_variant_part (type, field_num, outer_type, stream, show, level) - struct type *type; - int field_num; - struct type *outer_type; - struct ui_file *stream; - int show; - int level; -{ - fprintf_filtered (stream, "\n%*scase %s is", level + 4, "", - ada_variant_discrim_name - (TYPE_FIELD_TYPE (type, field_num))); - print_variant_clauses (type, field_num, outer_type, stream, show, level + 4); - fprintf_filtered (stream, "\n%*send case;", level + 4, ""); -} - -/* Print a description on STREAM of the fields in record type TYPE, whose - discriminants are in OUTER_TYPE. LEVEL is the recursion (indentation) - level, in case any of the fields themselves have nested structure, - and SHOW is the number of levels of internal structure to show - (see ada_print_type). Does not print parent type information of TYPE. - Returns 0 if no fields printed, -1 for an incomplete type, else > 0. - Prints each field beginning on a new line, but does not put a new line at - end. */ - -static int -print_record_field_types (type, outer_type, stream, show, level) - struct type *type; - struct type *outer_type; - struct ui_file *stream; - int show; - int level; -{ - int len, i, flds; - - flds = 0; - len = TYPE_NFIELDS (type); - - if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0) - return -1; - - for (i = 0; i < len; i += 1) - { - QUIT; - - if (ada_is_parent_field (type, i) - || ada_is_ignored_field (type, i)) - ; - else if (ada_is_wrapper_field (type, i)) - flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type, - stream, show, level); - else if (ada_is_variant_part (type, i)) - { - print_variant_part (type, i, outer_type, stream, show, level); - flds = 1; - } - else - { - flds += 1; - fprintf_filtered (stream, "\n%*s", level + 4, ""); - ada_print_type (TYPE_FIELD_TYPE (type, i), - TYPE_FIELD_NAME (type, i), - stream, show - 1, level + 4); - fprintf_filtered (stream, ";"); - } - } - - return flds; -} - -/* Print record type TYPE on STREAM. LEVEL is the recursion (indentation) - level, in case the element type itself has nested structure, and SHOW is - the number of levels of internal structure to show (see ada_print_type). */ - -static void -print_record_type (type0, stream, show, level) - struct type* type0; - struct ui_file* stream; - int show; - int level; -{ - struct type* parent_type; - struct type* type; - - type = type0; - if (TYPE_FLAGS (type) & TYPE_FLAG_STUB) - { - struct type* type1 = ada_find_parallel_type (type, "___XVE"); - if (type1 != NULL) - type = type1; - } - - parent_type = ada_parent_type (type); - if (ada_type_name (parent_type) != NULL) - fprintf_filtered (stream, "new %s with ", - demangled_type_name (parent_type)); - else if (parent_type == NULL && ada_is_tagged_type (type)) - fprintf_filtered (stream, "tagged "); - - fprintf_filtered (stream, "record"); - - if (show < 0) - fprintf_filtered (stream, " ... end record"); - else - { - int flds; - - flds = 0; - if (parent_type != NULL && ada_type_name (parent_type) == NULL) - flds += print_record_field_types (parent_type, parent_type, - stream, show, level); - flds += print_record_field_types (type, type, stream, show, level); - - if (flds > 0) - fprintf_filtered (stream, "\n%*send record", level, ""); - else if (flds < 0) - fprintf_filtered (stream, " end record"); - else - fprintf_filtered (stream, " null; end record"); - } -} - -/* Print the unchecked union type TYPE in something resembling Ada - format on STREAM. LEVEL is the recursion (indentation) level - in case the element type itself has nested structure, and SHOW is the - number of levels of internal structure to show (see ada_print_type). */ -static void -print_unchecked_union_type (struct type* type, struct ui_file* stream, - int show, int level) -{ - fprintf_filtered (stream, "record (?) is"); - - if (show < 0) - fprintf_filtered (stream, " ... end record"); - else if (TYPE_NFIELDS (type) == 0) - fprintf_filtered (stream, " null; end record"); - else - { - int i; - - fprintf_filtered (stream, "\n%*scase ? is", - level+4, ""); - - for (i = 0; i < TYPE_NFIELDS (type); i += 1) - { - fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level+8, "", - level+12, ""); - ada_print_type (TYPE_FIELD_TYPE (type, i), - TYPE_FIELD_NAME (type, i), - stream, show - 1, level + 12); - fprintf_filtered (stream, ";"); - } - - fprintf_filtered (stream, "\n%*send case;\n%*send record", - level+4, "", level, ""); - } -} - - - -/* Print function or procedure type TYPE on STREAM. Make it a header - for function or procedure NAME if NAME is not null. */ - -static void -print_func_type (type, stream, name) - struct type *type; - struct ui_file *stream; - char* name; -{ - int i, len = TYPE_NFIELDS (type); - - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID) - fprintf_filtered (stream, "procedure"); - else - fprintf_filtered (stream, "function"); - - if (name != NULL && name[0] != '\0') - fprintf_filtered (stream, " %s", name); - - if (len > 0) - { - fprintf_filtered (stream, " ("); - for (i = 0; i < len; i += 1) - { - if (i > 0) - { - fputs_filtered ("; ", stream); - wrap_here (" "); - } - fprintf_filtered (stream, "a%d: ", i+1); - ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0); - } - fprintf_filtered (stream, ")"); - } - - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) - { - fprintf_filtered (stream, " return "); - ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0); - } -} - - -/* Print a description of a type TYPE0. - Output goes to STREAM (via stdio). - If VARSTRING is a non-empty string, print as an Ada variable/field - declaration. - SHOW+1 is the maximum number of levels of internal type structure - to show (this applies to record types, enumerated types, and - array types). - SHOW is the number of levels of internal type structure to show - when there is a type name for the SHOWth deepest level (0th is - outer level). - When SHOW<0, no inner structure is shown. - LEVEL indicates level of recursion (for nested definitions). */ - -void -ada_print_type (type0, varstring, stream, show, level) - struct type* type0; - char* varstring; - struct ui_file* stream; - int show; - int level; -{ - enum type_code code; - int demangled_args; - struct type* type = ada_completed_type (ada_get_base_type (type0)); - char* type_name = demangled_type_name (type); - int is_var_decl = (varstring != NULL && varstring[0] != '\0'); - - if (type == NULL) - { - if (is_var_decl) - fprintf_filtered (stream, "%.*s: ", - ada_name_prefix_len(varstring), - varstring); - fprintf_filtered (stream, ""); - return; - } - - if (show > 0) - CHECK_TYPEDEF (type); - - if (is_var_decl && TYPE_CODE (type) != TYPE_CODE_FUNC) - fprintf_filtered (stream, "%.*s: ", - ada_name_prefix_len (varstring), varstring); - - if (type_name != NULL && show <= 0) - { - fprintf_filtered (stream, "%.*s", - ada_name_prefix_len (type_name), type_name); - return; - } - - if (ada_is_aligner_type (type)) - ada_print_type (ada_aligned_type (type), "", stream, show, level); - else if (ada_is_packed_array_type (type)) - print_array_type (type, stream, show, level); - else - switch (TYPE_CODE (type)) - { - default: - fprintf_filtered (stream, "<"); - c_print_type (type, "", stream, show, level); - fprintf_filtered (stream, ">"); - break; - case TYPE_CODE_PTR: - fprintf_filtered (stream, "access "); - ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, - level); - break; - case TYPE_CODE_REF: - fprintf_filtered (stream, " "); - ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, - level); - break; - case TYPE_CODE_ARRAY: - print_array_type (type, stream, show, level); - break; - case TYPE_CODE_INT: - if (ada_is_fixed_point_type (type)) - print_fixed_point_type (type, stream); - else if (ada_is_vax_floating_type (type)) - print_vax_floating_point_type (type, stream); - else - { - char* name = ada_type_name (type); - if (! ada_is_range_type_name (name)) - fprintf_filtered (stream, "<%d-byte integer>", TYPE_LENGTH (type)); - else - { - fprintf_filtered (stream, "range "); - print_range_type_named (name, stream); - } - } - break; - case TYPE_CODE_RANGE: - if (ada_is_fixed_point_type (type)) - print_fixed_point_type (type, stream); - else if (ada_is_vax_floating_type (type)) - print_vax_floating_point_type (type, stream); - else if (ada_is_modular_type (type)) - fprintf_filtered (stream, "mod %ld", (long) ada_modulus (type)); - else - { - fprintf_filtered (stream, "range "); - print_range (type, stream); - } - break; - case TYPE_CODE_FLT: - fprintf_filtered (stream, "<%d-byte float>", TYPE_LENGTH (type)); - break; - case TYPE_CODE_ENUM: - if (show < 0) - fprintf_filtered (stream, "(...)"); - else - print_enum_type (type, stream); - break; - case TYPE_CODE_STRUCT: - if (ada_is_array_descriptor (type)) - print_array_type (type, stream, show, level); - else if (ada_is_bogus_array_descriptor (type)) - fprintf_filtered (stream, "array (?) of ? ()"); - else - print_record_type (type, stream, show, level); - break; - case TYPE_CODE_UNION: - print_unchecked_union_type (type, stream, show, level); - break; - case TYPE_CODE_FUNC: - print_func_type (type, stream, varstring); - break; - } -} diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c deleted file mode 100644 index 6db18ebae1e..00000000000 --- a/gdb/ada-valprint.c +++ /dev/null @@ -1,1058 +0,0 @@ -/* Support for printing Ada values for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1997, 2001 - Free Software Foundation, Inc. - -This file is part of GDB. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include "defs.h" -#include "symtab.h" -#include "gdbtypes.h" -#include "expression.h" -#include "value.h" -#include "demangle.h" -#include "valprint.h" -#include "language.h" -#include "annotate.h" -#include "ada-lang.h" -#include "c-lang.h" - -/* Encapsulates arguments to ada_val_print. */ -struct ada_val_print_args { - struct type* type; - char* valaddr0; - int embedded_offset; - CORE_ADDR address; - struct ui_file *stream; - int format; - int deref_ref; - int recurse; - enum val_prettyprint pretty; -}; - -extern int inspect_it; -extern unsigned int repeat_count_threshold; - -static void print_record (struct type*, char*, struct ui_file*, int, - int, enum val_prettyprint); - -static int print_field_values (struct type*, char*, struct ui_file*, - int, int, enum val_prettyprint, - int, struct type*, char*); - -static int print_variant_part (struct type*, int, char*, - struct ui_file*, int, int, enum val_prettyprint, - int, struct type*, char*); - -static void -val_print_packed_array_elements (struct type*, char *valaddr, int, - struct ui_file*, int, int, - enum val_prettyprint); - -static void adjust_type_signedness (struct type*); - -static int ada_val_print_stub (PTR args0); - -static int -ada_val_print_1 (struct type*, char*, int, CORE_ADDR, struct ui_file*, - int, int, int, enum val_prettyprint); - - -/* Make TYPE unsigned if its range of values includes no negatives. */ -static void -adjust_type_signedness (type) - struct type* type; -{ - if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE - && TYPE_LOW_BOUND (type) >= 0) - TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; -} - -/* Assuming TYPE is a simple array type, prints its lower bound on STREAM, - if non-standard (i.e., other than 1 for numbers, other than lower bound - of index type for enumerated type). Returns 1 if something printed, - otherwise 0. */ - -static int -print_optional_low_bound (stream, type) - struct ui_file *stream; - struct type *type; -{ - struct type *index_type; - long low_bound; - - index_type = TYPE_INDEX_TYPE (type); - low_bound = 0; - - if (index_type == NULL) - return 0; - if (TYPE_CODE (index_type) == TYPE_CODE_RANGE) - { - low_bound = TYPE_LOW_BOUND (index_type); - index_type = TYPE_TARGET_TYPE (index_type); - } - else - return 0; - - switch (TYPE_CODE (index_type)) { - case TYPE_CODE_ENUM: - if (low_bound == TYPE_FIELD_BITPOS (index_type, 0)) - return 0; - break; - case TYPE_CODE_UNDEF: - index_type = builtin_type_long; - /* FALL THROUGH */ - default: - if (low_bound == 1) - return 0; - break; - } - - ada_print_scalar (index_type, (LONGEST) low_bound, stream); - fprintf_filtered (stream, " => "); - return 1; -} - -/* Version of val_print_array_elements for GNAT-style packed arrays. - Prints elements of packed array of type TYPE at bit offset - BITOFFSET from VALADDR on STREAM. Formats according to FORMAT and - separates with commas. RECURSE is the recursion (nesting) level. - If PRETTY, uses "prettier" format. TYPE must have been decoded (as - by ada_coerce_to_simple_array). */ - -static void -val_print_packed_array_elements (type, valaddr, bitoffset, stream, format, - recurse, pretty) - struct type *type; - char *valaddr; - int bitoffset; - struct ui_file *stream; - int format; - int recurse; - enum val_prettyprint pretty; -{ - unsigned int i; - unsigned int things_printed = 0; - unsigned len; - struct type *elttype; - unsigned eltlen; - /* Position of the array element we are examining to see - whether it is repeated. */ - unsigned int rep1; - /* Number of repetitions we have detected so far. */ - unsigned int reps; - unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0); - struct value* mark = value_mark (); - - elttype = TYPE_TARGET_TYPE (type); - eltlen = TYPE_LENGTH (check_typedef (elttype)); - - { - LONGEST low, high; - if (get_discrete_bounds (TYPE_FIELD_TYPE (type, 0), &low, &high) < 0) - len = 1; - else - len = high - low + 1; - } - - i = 0; - annotate_array_section_begin (i, elttype); - - while (i < len && things_printed < print_max) - { - struct value *v0, *v1; - int i0; - - if (i != 0) - { - if (prettyprint_arrays) - { - fprintf_filtered (stream, ",\n"); - print_spaces_filtered (2 + 2 * recurse, stream); - } - else - { - fprintf_filtered (stream, ", "); - } - } - wrap_here (n_spaces (2 + 2 * recurse)); - - i0 = i; - v0 = ada_value_primitive_packed_val (NULL, valaddr, - (i0 * bitsize) / HOST_CHAR_BIT, - (i0 * bitsize) % HOST_CHAR_BIT, - bitsize, elttype); - while (1) - { - i += 1; - if (i >= len) - break; - v1 = ada_value_primitive_packed_val (NULL, valaddr, - (i * bitsize) / HOST_CHAR_BIT, - (i * bitsize) % HOST_CHAR_BIT, - bitsize, elttype); - if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen) - != 0) - break; - } - - if (i - i0 > repeat_count_threshold) - { - val_print (elttype, VALUE_CONTENTS (v0), 0, 0, stream, format, - 0, recurse + 1, pretty); - annotate_elt_rep (i - i0); - fprintf_filtered (stream, " ", i - i0); - annotate_elt_rep_end (); - - } - else - { - int j; - for (j = i0; j < i; j += 1) - { - if (j > i0) - { - if (prettyprint_arrays) - { - fprintf_filtered (stream, ",\n"); - print_spaces_filtered (2 + 2 * recurse, stream); - } - else - { - fprintf_filtered (stream, ", "); - } - wrap_here (n_spaces (2 + 2 * recurse)); - } - val_print (elttype, VALUE_CONTENTS (v0), 0, 0, stream, format, - 0, recurse + 1, pretty); - annotate_elt (); - } - } - things_printed += i - i0; - } - annotate_array_section_end (); - if (i < len) - { - fprintf_filtered (stream, "..."); - } - - value_free_to_mark (mark); -} - -static struct type* -printable_val_type (type, valaddr) - struct type* type; - char* valaddr; -{ - return ada_to_fixed_type (ada_aligned_type (type), valaddr, 0, NULL); -} - -/* Print the character C on STREAM as part of the contents of a literal - string whose delimiter is QUOTER. TYPE_LEN is the length in bytes - (1 or 2) of the character. */ - -void -ada_emit_char (c, stream, quoter, type_len) - int c; - struct ui_file *stream; - int quoter; - int type_len; -{ - if (type_len != 2) - type_len = 1; - - c &= (1 << (type_len * TARGET_CHAR_BIT)) - 1; - - if (isascii (c) && isprint (c)) - { - if (c == quoter && c == '"') - fprintf_filtered (stream, "[\"%c\"]", quoter); - else - fprintf_filtered (stream, "%c", c); - } - else - fprintf_filtered (stream, "[\"%0*x\"]", type_len*2, c); -} - -/* Character #I of STRING, given that TYPE_LEN is the size in bytes (1 - or 2) of a character. */ - -static int -char_at (string, i, type_len) - char* string; - int i; - int type_len; -{ - if (type_len == 1) - return string[i]; - else - return (int) extract_unsigned_integer (string + 2*i, 2); -} - -void -ada_printchar (c, stream) - int c; - struct ui_file *stream; -{ - fputs_filtered ("'", stream); - ada_emit_char (c, stream, '\'', 1); - fputs_filtered ("'", stream); -} - -/* [From print_type_scalar in typeprint.c]. Print VAL on STREAM in a - form appropriate for TYPE. */ - -void -ada_print_scalar (type, val, stream) - struct type *type; - LONGEST val; - struct ui_file *stream; -{ - unsigned int i; - unsigned len; - - CHECK_TYPEDEF (type); - - switch (TYPE_CODE (type)) - { - - case TYPE_CODE_ENUM: - len = TYPE_NFIELDS (type); - for (i = 0; i < len; i++) - { - if (TYPE_FIELD_BITPOS (type, i) == val) - { - break; - } - } - if (i < len) - { - fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream); - } - else - { - print_longest (stream, 'd', 0, val); - } - break; - - case TYPE_CODE_INT: - print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0, val); - break; - - case TYPE_CODE_CHAR: - LA_PRINT_CHAR ((unsigned char) val, stream); - break; - - case TYPE_CODE_BOOL: - fprintf_filtered (stream, val ? "true" : "false"); - break; - - case TYPE_CODE_RANGE: - ada_print_scalar (TYPE_TARGET_TYPE (type), val, stream); - return; - - case TYPE_CODE_UNDEF: - case TYPE_CODE_PTR: - case TYPE_CODE_ARRAY: - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - case TYPE_CODE_FUNC: - case TYPE_CODE_FLT: - case TYPE_CODE_VOID: - case TYPE_CODE_SET: - case TYPE_CODE_STRING: - case TYPE_CODE_ERROR: - case TYPE_CODE_MEMBER: - case TYPE_CODE_METHOD: - case TYPE_CODE_REF: - warning ("internal error: unhandled type in ada_print_scalar"); - break; - - default: - error ("Invalid type code in symbol table."); - } - gdb_flush (stream); -} - -/* Print the character string STRING, printing at most LENGTH characters. - Printing stops early if the number hits print_max; repeat counts - are printed as appropriate. Print ellipses at the end if we - had to stop before printing LENGTH characters, or if - FORCE_ELLIPSES. TYPE_LEN is the length (1 or 2) of the character type. - */ - -static void -printstr (stream, string, length, force_ellipses, type_len) - struct ui_file *stream; - char *string; - unsigned int length; - int force_ellipses; - int type_len; -{ - unsigned int i; - unsigned int things_printed = 0; - int in_quotes = 0; - int need_comma = 0; - - if (length == 0) - { - fputs_filtered ("\"\"", stream); - return; - } - - for (i = 0; i < length && things_printed < print_max; i += 1) - { - /* Position of the character we are examining - to see whether it is repeated. */ - unsigned int rep1; - /* Number of repetitions we have detected so far. */ - unsigned int reps; - - QUIT; - - if (need_comma) - { - fputs_filtered (", ", stream); - need_comma = 0; - } - - rep1 = i + 1; - reps = 1; - while (rep1 < length && - char_at(string, rep1, type_len) == char_at (string, i, type_len)) - { - rep1 += 1; - reps += 1; - } - - if (reps > repeat_count_threshold) - { - if (in_quotes) - { - if (inspect_it) - fputs_filtered ("\\\", ", stream); - else - fputs_filtered ("\", ", stream); - in_quotes = 0; - } - fputs_filtered ("'", stream); - ada_emit_char (char_at (string, i, type_len), stream, '\'', type_len); - fputs_filtered ("'", stream); - fprintf_filtered (stream, " ", reps); - i = rep1 - 1; - things_printed += repeat_count_threshold; - need_comma = 1; - } - else - { - if (!in_quotes) - { - if (inspect_it) - fputs_filtered ("\\\"", stream); - else - fputs_filtered ("\"", stream); - in_quotes = 1; - } - ada_emit_char (char_at (string, i, type_len), stream, '"', - type_len); - things_printed += 1; - } - } - - /* Terminate the quotes if necessary. */ - if (in_quotes) - { - if (inspect_it) - fputs_filtered ("\\\"", stream); - else - fputs_filtered ("\"", stream); - } - - if (force_ellipses || i < length) - fputs_filtered ("...", stream); -} - -void -ada_printstr (stream, string, length, force_ellipses, width) - struct ui_file *stream; - char *string; - unsigned int length; - int force_ellipses; - int width; -{ - printstr (stream, string, length, force_ellipses, width); -} - - -/* Print data of type TYPE located at VALADDR (within GDB), which came from - the inferior at address ADDRESS, onto stdio stream STREAM according to - FORMAT (a letter as for the printf % codes or 0 for natural format). - The data at VALADDR is in target byte order. - - If the data is printed as a string, returns the number of string characters - printed. - - If DEREF_REF is nonzero, then dereference references, otherwise just print - them like pointers. - - RECURSE indicates the amount of indentation to supply before - continuation lines; this amount is roughly twice the value of RECURSE. - - When PRETTY is non-zero, prints record fields on separate lines. - (For some reason, the current version of gdb instead uses a global - variable---prettyprint_arrays--- to causes a similar effect on - arrays.) */ - -int -ada_val_print (type, valaddr0, embedded_offset, address, stream, - format, deref_ref, recurse, pretty) - struct type* type; - char* valaddr0; - int embedded_offset; - CORE_ADDR address; - struct ui_file *stream; - int format; - int deref_ref; - int recurse; - enum val_prettyprint pretty; -{ - struct ada_val_print_args args; - args.type = type; args.valaddr0 = valaddr0; - args.embedded_offset = embedded_offset; - args.address = address; - args.stream = stream; - args.format = format; - args.deref_ref = deref_ref; - args.recurse = recurse; - args.pretty = pretty; - - return catch_errors (ada_val_print_stub, &args, NULL, RETURN_MASK_ALL); -} - -/* Helper for ada_val_print; used as argument to catch_errors to - unmarshal the arguments to ada_val_print_1, which does the work. */ -static int -ada_val_print_stub (PTR args0) -{ - struct ada_val_print_args* argsp = (struct ada_val_print_args*) args0; - return ada_val_print_1 (argsp->type, argsp->valaddr0, argsp->embedded_offset, - argsp->address, argsp->stream, argsp->format, - argsp->deref_ref, argsp->recurse, - argsp->pretty); -} - -/* See the comment on ada_val_print. This function differs in that it - * does not catch evaluation errors (leaving that to ada_val_print). */ - -static int -ada_val_print_1 (type, valaddr0, embedded_offset, address, stream, - format, deref_ref, recurse, pretty) - struct type* type; - char* valaddr0; - int embedded_offset; - CORE_ADDR address; - struct ui_file *stream; - int format; - int deref_ref; - int recurse; - enum val_prettyprint pretty; -{ - unsigned int len; - int i; - struct type *elttype; - unsigned int eltlen; - LONGEST val; - CORE_ADDR addr; - char* valaddr = valaddr0 + embedded_offset; - - CHECK_TYPEDEF (type); - - if (ada_is_array_descriptor (type) || ada_is_packed_array_type (type)) - { - int retn; - struct value* mark = value_mark (); - struct value* val; - val = value_from_contents_and_address (type, valaddr, address); - val = ada_coerce_to_simple_array_ptr (val); - if (val == NULL) - { - fprintf_filtered (stream, "(null)"); - retn = 0; - } - else - retn = ada_val_print_1 (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, - VALUE_ADDRESS (val), stream, format, - deref_ref, recurse, pretty); - value_free_to_mark (mark); - return retn; - } - - valaddr = ada_aligned_value_addr (type, valaddr); - embedded_offset -= valaddr - valaddr0 - embedded_offset; - type = printable_val_type (type, valaddr); - - switch (TYPE_CODE (type)) - { - default: - return c_val_print (type, valaddr0, embedded_offset, address, stream, - format, deref_ref, recurse, pretty); - - case TYPE_CODE_INT: - case TYPE_CODE_RANGE: - if (ada_is_fixed_point_type (type)) - { - LONGEST v = unpack_long (type, valaddr); - int len = TYPE_LENGTH (type); - - fprintf_filtered (stream, len < 4 ? "%.11g" : "%.17g", - (double) ada_fixed_to_float (type, v)); - return 0; - } - else if (ada_is_vax_floating_type (type)) - { - struct value* val = - value_from_contents_and_address (type, valaddr, address); - struct value* func = ada_vax_float_print_function (type); - if (func != 0) - { - static struct type* parray_of_char = NULL; - struct value* printable_val; - - if (parray_of_char == NULL) - parray_of_char = - make_pointer_type - (create_array_type - (NULL, builtin_type_char, - create_range_type (NULL, builtin_type_int, 0, 32)), - NULL); - - printable_val = - value_ind (value_cast (parray_of_char, - call_function_by_hand (func, 1, &val))); - - fprintf_filtered (stream, "%s", VALUE_CONTENTS (printable_val)); - return 0; - } - /* No special printing function. Do as best we can. */ - } - else if (TYPE_CODE (type) == TYPE_CODE_RANGE) - { - struct type* target_type = TYPE_TARGET_TYPE (type); - if (TYPE_LENGTH (type) != TYPE_LENGTH (target_type)) - { - /* Obscure case of range type that has different length from - its base type. Perform a conversion, or we will get a - nonsense value. Actually, we could use the same - code regardless of lengths; I'm just avoiding a cast. */ - struct value* v = - value_cast (target_type, - value_from_contents_and_address (type, valaddr, 0)); - return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0, - stream, format, 0, recurse + 1, pretty); - } - else - return ada_val_print_1 (TYPE_TARGET_TYPE (type), - valaddr0, embedded_offset, - address, stream, format, deref_ref, - recurse, pretty); - } - else - { - format = format ? format : output_format; - if (format) - { - print_scalar_formatted (valaddr, type, format, 0, stream); - } - else - { - val_print_type_code_int (type, valaddr, stream); - if (ada_is_character_type (type)) - { - fputs_filtered (" ", stream); - ada_printchar ((unsigned char) unpack_long (type, valaddr), - stream); - } - } - return 0; - } - - case TYPE_CODE_ENUM: - if (format) - { - print_scalar_formatted (valaddr, type, format, 0, stream); - break; - } - len = TYPE_NFIELDS (type); - val = unpack_long (type, valaddr); - for (i = 0; i < len; i++) - { - QUIT; - if (val == TYPE_FIELD_BITPOS (type, i)) - { - break; - } - } - if (i < len) - { - const char* name = ada_enum_name (TYPE_FIELD_NAME (type, i)); - if (name[0] == '\'') - fprintf_filtered (stream, "%ld %s", (long) val, name); - else - fputs_filtered (name, stream); - } - else - { - print_longest (stream, 'd', 0, val); - } - break; - - case TYPE_CODE_UNION: - case TYPE_CODE_STRUCT: - if (ada_is_bogus_array_descriptor (type)) - { - fprintf_filtered (stream, "(...?)"); - return 0; - } - else - { - print_record (type, valaddr, stream, format, - recurse, pretty); - return 0; - } - - case TYPE_CODE_ARRAY: - if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0) - { - elttype = TYPE_TARGET_TYPE (type); - eltlen = TYPE_LENGTH (elttype); - len = TYPE_LENGTH (type) / eltlen; - - /* For an array of chars, print with string syntax. */ - if (ada_is_string_type (type) - && (format == 0 || format == 's')) - { - if (prettyprint_arrays) - { - print_spaces_filtered (2 + 2 * recurse, stream); - } - /* If requested, look for the first null char and only print - elements up to it. */ - if (stop_print_at_null) - { - int temp_len; - - /* Look for a NULL char. */ - for (temp_len = 0; - temp_len < len && temp_len < print_max - && char_at (valaddr, temp_len, eltlen) != 0; - temp_len += 1); - len = temp_len; - } - - printstr (stream, valaddr, len, 0, eltlen); - } - else - { - len = 0; - fprintf_filtered (stream, "("); - print_optional_low_bound (stream, type); - if (TYPE_FIELD_BITSIZE (type, 0) > 0) - val_print_packed_array_elements (type, valaddr, 0, stream, - format, recurse, - pretty); - else - val_print_array_elements (type, valaddr, address, stream, - format, deref_ref, recurse, - pretty, 0); - fprintf_filtered (stream, ")"); - } - gdb_flush (stream); - return len; - } - - case TYPE_CODE_REF: - elttype = check_typedef (TYPE_TARGET_TYPE (type)); - if (addressprint) - { - fprintf_filtered (stream, "@"); - print_address_numeric - (extract_address (valaddr, - TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream); - if (deref_ref) - fputs_filtered (": ", stream); - } - /* De-reference the reference */ - if (deref_ref) - { - if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) - { - LONGEST deref_val_int = (LONGEST) - unpack_pointer (lookup_pointer_type (builtin_type_void), - valaddr); - if (deref_val_int != 0) - { - struct value* deref_val = - ada_value_ind (value_from_longest - (lookup_pointer_type (elttype), - deref_val_int)); - val_print (VALUE_TYPE (deref_val), - VALUE_CONTENTS (deref_val), 0, - VALUE_ADDRESS (deref_val), stream, format, - deref_ref, recurse + 1, pretty); - } - else - fputs_filtered ("(null)", stream); - } - else - fputs_filtered ("???", stream); - } - break; - } - return 0; -} - -static int -print_variant_part (type, field_num, valaddr, - stream, format, recurse, pretty, comma_needed, - outer_type, outer_valaddr) - struct type *type; - int field_num; - char *valaddr; - struct ui_file *stream; - int format; - int recurse; - enum val_prettyprint pretty; - int comma_needed; - struct type *outer_type; - char *outer_valaddr; -{ - struct type *var_type = TYPE_FIELD_TYPE (type, field_num); - int which = - ada_which_variant_applies (var_type, outer_type, outer_valaddr); - - if (which < 0) - return 0; - else - return print_field_values - (TYPE_FIELD_TYPE (var_type, which), - valaddr + TYPE_FIELD_BITPOS (type, field_num) / HOST_CHAR_BIT - + TYPE_FIELD_BITPOS (var_type, which) / HOST_CHAR_BIT, - stream, format, recurse, pretty, - comma_needed, outer_type, outer_valaddr); -} - -int -ada_value_print (val0, stream, format, pretty) - struct value* val0; - struct ui_file *stream; - int format; - enum val_prettyprint pretty; -{ - char* valaddr = VALUE_CONTENTS (val0); - CORE_ADDR address = VALUE_ADDRESS (val0) + VALUE_OFFSET (val0); - struct type* type = - ada_to_fixed_type (VALUE_TYPE (val0), valaddr, address, NULL); - struct value* val = value_from_contents_and_address (type, valaddr, address); - - /* If it is a pointer, indicate what it points to. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR || - TYPE_CODE (type) == TYPE_CODE_REF) - { - /* Hack: remove (char *) for char strings. Their - type is indicated by the quoted string anyway. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR && - TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == sizeof(char) && - TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_INT && - !TYPE_UNSIGNED (TYPE_TARGET_TYPE (type))) - { - /* Print nothing */ - } - else - { - fprintf_filtered (stream, "("); - type_print (type, "", stream, -1); - fprintf_filtered (stream, ") "); - } - } - else if (ada_is_array_descriptor (type)) - { - fprintf_filtered (stream, "("); - type_print (type, "", stream, -1); - fprintf_filtered (stream, ") "); - } - else if (ada_is_bogus_array_descriptor (type)) - { - fprintf_filtered (stream, "("); - type_print (type, "", stream, -1); - fprintf_filtered (stream, ") (...?)"); - return 0; - } - return (val_print (type, VALUE_CONTENTS (val), 0, address, - stream, format, 1, 0, pretty)); -} - -static void -print_record (type, valaddr, stream, format, recurse, pretty) - struct type *type; - char *valaddr; - struct ui_file *stream; - int format; - int recurse; - enum val_prettyprint pretty; -{ - CHECK_TYPEDEF (type); - - fprintf_filtered (stream, "("); - - if (print_field_values (type, valaddr, stream, format, recurse, pretty, - 0, type, valaddr) != 0 - && pretty) - { - fprintf_filtered (stream, "\n"); - print_spaces_filtered (2 * recurse, stream); - } - - fprintf_filtered (stream, ")"); -} - -/* Print out fields of value at VALADDR having structure type TYPE. - - TYPE, VALADDR, STREAM, FORMAT, RECURSE, and PRETTY have the - same meanings as in ada_print_value and ada_val_print. - - OUTER_TYPE and OUTER_VALADDR give type and address of enclosing record - (used to get discriminant values when printing variant parts). - - COMMA_NEEDED is 1 if fields have been printed at the current recursion - level, so that a comma is needed before any field printed by this - call. - - Returns 1 if COMMA_NEEDED or any fields were printed. */ - -static int -print_field_values (type, valaddr, stream, format, recurse, pretty, - comma_needed, outer_type, outer_valaddr) - struct type *type; - char *valaddr; - struct ui_file *stream; - int format; - int recurse; - enum val_prettyprint pretty; - int comma_needed; - struct type *outer_type; - char *outer_valaddr; -{ - int i, len; - - len = TYPE_NFIELDS (type); - - for (i = 0; i < len; i += 1) - { - if (ada_is_ignored_field (type, i)) - continue; - - if (ada_is_wrapper_field (type, i)) - { - comma_needed = - print_field_values (TYPE_FIELD_TYPE (type, i), - valaddr - + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT, - stream, format, recurse, pretty, - comma_needed, type, valaddr); - continue; - } - else if (ada_is_variant_part (type, i)) - { - comma_needed = - print_variant_part (type, i, valaddr, - stream, format, recurse, pretty, comma_needed, - outer_type, outer_valaddr); - continue; - } - - if (comma_needed) - fprintf_filtered (stream, ", "); - comma_needed = 1; - - if (pretty) - { - fprintf_filtered (stream, "\n"); - print_spaces_filtered (2 + 2 * recurse, stream); - } - else - { - wrap_here (n_spaces (2 + 2 * recurse)); - } - if (inspect_it) - { - if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR) - fputs_filtered ("\"( ptr \"", stream); - else - fputs_filtered ("\"( nodef \"", stream); - fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), - language_cplus, DMGL_NO_OPTS); - fputs_filtered ("\" \"", stream); - fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), - language_cplus, DMGL_NO_OPTS); - fputs_filtered ("\") \"", stream); - } - else - { - annotate_field_begin (TYPE_FIELD_TYPE (type, i)); - fprintf_filtered (stream, "%.*s", - ada_name_prefix_len (TYPE_FIELD_NAME (type, i)), - TYPE_FIELD_NAME (type, i)); - annotate_field_name_end (); - fputs_filtered (" => ", stream); - annotate_field_value (); - } - - if (TYPE_FIELD_PACKED (type, i)) - { - struct value* v; - - /* Bitfields require special handling, especially due to byte - order problems. */ - if (TYPE_CPLUS_SPECIFIC (type) != NULL - && TYPE_FIELD_IGNORE (type, i)) - { - fputs_filtered ("", stream); - } - else - { - int bit_pos = TYPE_FIELD_BITPOS (type, i); - int bit_size = TYPE_FIELD_BITSIZE (type, i); - - adjust_type_signedness (TYPE_FIELD_TYPE (type, i)); - v = ada_value_primitive_packed_val (NULL, valaddr, - bit_pos / HOST_CHAR_BIT, - bit_pos % HOST_CHAR_BIT, - bit_size, - TYPE_FIELD_TYPE (type, i)); - val_print (TYPE_FIELD_TYPE(type, i), VALUE_CONTENTS (v), 0, 0, - stream, format, 0, recurse + 1, pretty); - } - } - else - ada_val_print (TYPE_FIELD_TYPE (type, i), - valaddr + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT, - 0, 0, stream, format, 0, recurse + 1, pretty); - annotate_field_end (); - } - - return comma_needed; -} diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c deleted file mode 100644 index db6649286c2..00000000000 --- a/gdb/cli/cli-interp.c +++ /dev/null @@ -1,114 +0,0 @@ -/* CLI Definitions for GDB - Copyright 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "interps.h" -#include "wrapper.h" -#include "event-top.h" -#include "ui-out.h" -#include "cli-out.h" - -/* Prototypes for the CLI Interpreter functions */ - -int cli_interpreter_init (void *data); -int cli_interpreter_resume (void *data); -int cli_interpreter_do_one_event (void *data); -int cli_interpreter_suspend (void *data); -int cli_interpreter_delete (void *data); -int cli_interpreter_exec (void *data, char *command_str); -int cli_interpreter_display_prompt (void *data, char *new_prompt); - -/* These are the ui_out and the interpreter for the console interpreter. */ -struct ui_out *cli_uiout; -struct gdb_interpreter *cli_interp; - -/* These implement the cli out interpreter: */ - -int -cli_interpreter_init (void *data) -{ - return 1; -} - -int -cli_interpreter_resume (void *data) -{ - /*sync_execution = 1;*/ - gdb_setup_readline (); - return 1; -} - -int -cli_interpreter_do_one_event (void *data) -{ - return 1; -} - -int -cli_interpreter_suspend (void *data) -{ - gdb_disable_readline (); - return 1; -} - -int -cli_interpreter_delete (void *data) -{ - return 1; -} - -int -cli_interpreter_display_prompt (void *data, char *new_prompt) -{ - if (gdb_interpreter_is_quiet (NULL)) - { - return 1; - } - else - { - return 0; - } -} - -int -cli_interpreter_exec (void *data, char *command_str) -{ - return gdb_execute_command (uiout, command_str, 0); -} - -/* standard gdb initialization hook */ -void -_initialize_cli_interp (void) -{ - struct gdb_interpreter_procs procs = { - cli_interpreter_init, /* init_proc */ - cli_interpreter_resume, /* resume_proc */ - cli_interpreter_do_one_event, /* do_one_event_proc */ - cli_interpreter_suspend, /* suspend_proc */ - cli_interpreter_delete, /* delete_proc */ - cli_interpreter_exec, /* exec_proc */ - cli_interpreter_display_prompt /* prompt_proc */ - }; - - cli_uiout = cli_out_new (gdb_stdout); - cli_interp = gdb_new_interpreter (GDB_INTERPRETER_CONSOLE, NULL, cli_uiout, - &procs); - gdb_add_interpreter (cli_interp); -} diff --git a/gdb/config/sparc/nbsd64.mh b/gdb/config/sparc/nbsd64.mh deleted file mode 100644 index eb54e489eb8..00000000000 --- a/gdb/config/sparc/nbsd64.mh +++ /dev/null @@ -1,3 +0,0 @@ -# Host: UltraSPARC running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o sparc64nbsd-nat.o -NAT_FILE= nm-nbsd.h diff --git a/gdb/config/sparc/nbsd64.mt b/gdb/config/sparc/nbsd64.mt deleted file mode 100644 index 93b8f7841d4..00000000000 --- a/gdb/config/sparc/nbsd64.mt +++ /dev/null @@ -1,4 +0,0 @@ -# Target: UltraSPARC running NetBSD -TDEPFILES= sparc-tdep.o sparcnbsd-tdep.o nbsd-tdep.o corelow.o solib.o \ - solib-svr4.o -TM_FILE= tm-nbsd64.h diff --git a/gdb/config/sparc/tm-nbsd64.h b/gdb/config/sparc/tm-nbsd64.h deleted file mode 100644 index cc1d6b32297..00000000000 --- a/gdb/config/sparc/tm-nbsd64.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Macro definitions for UltraSPARC running under NetBSD. - Copyright 1994, 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_NBSD64_H -#define TM_NBSD64_H - -#include "sparc/tm-sp64.h" /* sets GDB_MULTI_ARCH */ -#include "solib.h" - -#endif /* TM_NBSD64_H */ diff --git a/gdb/defs.h b/gdb/defs.h index a83b6e93737..ab66d731182 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -1143,7 +1143,6 @@ extern void (*error_begin_hook) (void); extern int (*ui_load_progress_hook) (const char *section, unsigned long num); -extern void (*selected_frame_level_changed_hook) (int level); /* Inhibit window interface if non-zero. */ diff --git a/gdb/event-loop.c b/gdb/event-loop.c index f0984878665..4e42d7e2b62 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -22,7 +22,6 @@ #include "defs.h" #include "event-loop.h" #include "event-top.h" -#include "interps.h" #ifdef HAVE_POLL #if defined (HAVE_POLL_H) @@ -394,23 +393,10 @@ start_event_loop (void) longer any event sources registered. */ while (1) { - int gdb_result, interp_result; - - gdb_result = catch_errors (gdb_do_one_event, 0, "", RETURN_MASK_ALL); - if (gdb_result < 0) + int result = catch_errors (gdb_do_one_event, 0, "", RETURN_MASK_ALL); + if (result < 0) break; - - interp_result = catch_errors (interpreter_do_one_event, 0, "", RETURN_MASK_ALL); - if (interp_result < 0) - { - /* FIXME - kill the interpreter */ - } - - /* If we long-jumped out of do_one_event, we probably - didn't get around to resetting the prompt, which leaves - readline in a messed-up state. Reset it here. */ - - if (gdb_result == 0) + if (result == 0) { /* FIXME: this should really be a call to a hook that is interface specific, because interfaces can display the diff --git a/gdb/event-top.c b/gdb/event-top.c index 878e769611a..b472694a347 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -26,7 +26,6 @@ #include "terminal.h" /* for job_control */ #include "event-loop.h" #include "event-top.h" -#include "interps.h" #include /* For dont_repeat() */ @@ -253,7 +252,7 @@ display_gdb_prompt (char *new_prompt) /* When an alternative interpreter has been installed, do not display the comand prompt. */ - if (gdb_interpreter_display_prompt (new_prompt)) + if (interpreter_p) return; if (target_executing && sync_execution) @@ -1112,31 +1111,14 @@ set_async_prompt (char *args, int from_tty, struct cmd_list_element *c) PROMPT (0) = savestring (new_async_prompt, strlen (new_async_prompt)); } -void -_initialize_event_loop (void) -{ - /* Tell gdb to use the cli_command_loop as the main loop. */ - if (event_loop_p && command_loop_hook == NULL) - command_loop_hook = cli_command_loop; -} - /* Set things up for readline to be invoked via the alternate interface, i.e. via a callback function (rl_callback_read_char), and hook up instream to the event loop. */ void -gdb_setup_readline (void) +_initialize_event_loop (void) { - /* This function is a noop for the async case. The assumption is that - the async setup is ALL done in gdb_init, and we would only mess it up - here. The async stuff should really go away over time. */ - if (event_loop_p) { - gdb_stdout = stdio_fileopen (stdout); - gdb_stderr = stdio_fileopen (stderr); - gdb_stdlog = gdb_stderr; /* for moment */ - gdb_stdtarg = gdb_stderr; /* for moment */ - /* If the input stream is connected to a terminal, turn on editing. */ if (ISATTY (instream)) @@ -1169,6 +1151,9 @@ gdb_setup_readline (void) register it with the event loop. */ input_fd = fileno (instream); + /* Tell gdb to use the cli_command_loop as the main loop. */ + command_loop_hook = cli_command_loop; + /* Now we need to create the event sources for the input file descriptor. */ /* At this point in time, this is the only event source that we @@ -1179,31 +1164,3 @@ gdb_setup_readline (void) add_file_handler (input_fd, stdin_event_handler, 0); } } - -/* Disable command input through the standard CLI channels. Used in - the suspend proc for interpreters that use the standard gdb readline - interface, like the cli & the mi. */ - -void -gdb_disable_readline (void) -{ - if (event_loop_p) - { - /* FIXME - It is too heavyweight to delete and remake these - every time you run an interpreter that needs readline. - It is probably better to have the interpreters cache these, - which in turn means that this needs to be moved into interpreter - specific code. */ - -#if 0 - ui_file_delete (gdb_stdout); - ui_file_delete (gdb_stderr); - gdb_stdlog = NULL; - gdb_stdtarg = NULL; -#endif - - rl_callback_handler_remove (); - delete_file_handler (input_fd); - } -} - diff --git a/gdb/event-top.h b/gdb/event-top.h index d8c0a963989..24044a57bab 100644 --- a/gdb/event-top.h +++ b/gdb/event-top.h @@ -71,8 +71,6 @@ struct prompts FIXME: these should really go into top.h. */ extern void display_gdb_prompt (char *new_prompt); -void gdb_setup_readline (void); -void gdb_disable_readline (void); extern void async_init_signals (void); extern void set_async_editing_command (char *args, int from_tty, struct cmd_list_element *c); diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4 deleted file mode 100644 index bbfa86f16c5..00000000000 --- a/gdb/gdbserver/acinclude.m4 +++ /dev/null @@ -1,41 +0,0 @@ -dnl gdb/gdbserver/configure.in uses BFD_HAVE_SYS_PROCFS_TYPE. -sinclude(../../bfd/acinclude.m4) - -AC_DEFUN([SRV_CHECK_THREAD_DB], -[AC_CACHE_CHECK([for libthread_db],[srv_cv_thread_db], - [old_LIBS="$LIBS" - LIBS="$LIBS -lthread_db" - AC_TRY_LINK( - [void ps_pglobal_lookup() {} - void ps_pdread() {} - void ps_pdwrite() {} - void ps_lgetregs() {} - void ps_lsetregs() {} - void ps_lgetfpregs() {} - void ps_lsetfpregs() {} - void ps_getpid() {}], - [td_ta_new();], - [srv_cv_thread_db="-lthread_db"], - [srv_cv_thread_db=no - - if test "$prefix" = "/usr" || test "$prefix" = "NONE"; then - thread_db="/lib/libthread_db.so.1" - else - thread_db='$prefix/lib/libthread_db.so.1' - fi - LIBS="$old_LIBS `eval echo "$thread_db"`" - AC_TRY_LINK( - [void ps_pglobal_lookup() {} - void ps_pdread() {} - void ps_pdwrite() {} - void ps_lgetregs() {} - void ps_lsetregs() {} - void ps_lgetfpregs() {} - void ps_lsetfpregs() {} - void ps_getpid() {}], - [td_ta_new();], - [srv_cv_thread_db="$thread_db"], - [srv_cv_thread_db=no]) - LIBS="$old_LIBS" - ]]) -)]) diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c deleted file mode 100644 index becf565529b..00000000000 --- a/gdb/gdbserver/proc-service.c +++ /dev/null @@ -1,256 +0,0 @@ -/* libthread_db helper functions for the remote server for GDB. - Copyright 2002 - Free Software Foundation, Inc. - - Contributed by MontaVista Software. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "server.h" - -/* This file is currently tied to GNU/Linux. It should scale well to - another libthread_db implementation, with the approriate gdbserver - hooks, but for now this means we can use GNU/Linux's target data. */ - -#include "linux-low.h" - -/* Correct for all GNU/Linux targets (for quite some time). */ -#define GDB_GREGSET_T elf_gregset_t -#define GDB_FPREGSET_T elf_fpregset_t - -#ifndef HAVE_ELF_FPREGSET_T -/* Make sure we have said types. Not all platforms bring in - via . */ -#ifdef HAVE_LINUX_ELF_H -#include -#endif -#endif - -#include "../gdb_proc_service.h" - -typedef struct ps_prochandle *gdb_ps_prochandle_t; -typedef void *gdb_ps_read_buf_t; -typedef const void *gdb_ps_write_buf_t; -typedef size_t gdb_ps_size_t; - -/* FIXME redo this right */ -#if 0 -#ifndef HAVE_LINUX_REGSETS -#error HAVE_LINUX_REGSETS required! -#else -static struct regset_info * -gregset_info(void) -{ - int i = 0; - - while (target_regsets[i].size != -1) - { - if (target_regsets[i].type == GENERAL_REGS) - break; - i++; - } - - return &target_regsets[i]; -} - -static struct regset_info * -fpregset_info(void) -{ - int i = 0; - - while (target_regsets[i].size != -1) - { - if (target_regsets[i].type == FP_REGS) - break; - i++; - } - - return &target_regsets[i]; -} -#endif -#endif - -/* Search for the symbol named NAME within the object named OBJ within - the target process PH. If the symbol is found the address of the - symbol is stored in SYM_ADDR. */ - -ps_err_e -ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj, - const char *name, paddr_t *sym_addr) -{ - CORE_ADDR addr; - - if (look_up_one_symbol (name, &addr) == 0) - return PS_NOSYM; - - *sym_addr = (paddr_t) (unsigned long) addr; - return PS_OK; -} - -/* Read SIZE bytes from the target process PH at address ADDR and copy - them into BUF. */ - -ps_err_e -ps_pdread (gdb_ps_prochandle_t ph, paddr_t addr, - gdb_ps_read_buf_t buf, gdb_ps_size_t size) -{ - read_inferior_memory (addr, buf, size); - return PS_OK; -} - -/* Write SIZE bytes from BUF into the target process PH at address ADDR. */ - -ps_err_e -ps_pdwrite (gdb_ps_prochandle_t ph, paddr_t addr, - gdb_ps_write_buf_t buf, gdb_ps_size_t size) -{ - return write_inferior_memory (addr, buf, size); -} - -/* Get the general registers of LWP LWPID within the target process PH - and store them in GREGSET. */ - -ps_err_e -ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset) -{ -#if 0 - struct thread_info *reg_inferior, *save_inferior; - void *regcache; - - reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, - lwpid); - if (reg_inferior == NULL) - return PS_ERR; - - save_inferior = current_inferior; - current_inferior = reg_inferior; - - regcache = new_register_cache (); - the_target->fetch_registers (0, regcache); - gregset_info()->fill_function (gregset, regcache); - free_register_cache (regcache); - - current_inferior = save_inferior; - return PS_OK; -#endif - /* FIXME */ - return PS_ERR; -} - -/* Set the general registers of LWP LWPID within the target process PH - from GREGSET. */ - -ps_err_e -ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset) -{ -#if 0 - struct thread_info *reg_inferior, *save_inferior; - void *regcache; - - reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid); - if (reg_inferior == NULL) - return PS_ERR; - - save_inferior = current_inferior; - current_inferior = reg_inferior; - - regcache = new_register_cache (); - gregset_info()->store_function (gregset, regcache); - the_target->store_registers (0, regcache); - free_register_cache (regcache); - - current_inferior = save_inferior; - - return PS_OK; -#endif - /* FIXME */ - return PS_ERR; -} - -/* Get the floating-point registers of LWP LWPID within the target - process PH and store them in FPREGSET. */ - -ps_err_e -ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, - gdb_prfpregset_t *fpregset) -{ -#if 0 - struct thread_info *reg_inferior, *save_inferior; - void *regcache; - - reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid); - if (reg_inferior == NULL) - return PS_ERR; - - save_inferior = current_inferior; - current_inferior = reg_inferior; - - regcache = new_register_cache (); - the_target->fetch_registers (0, regcache); - fpregset_info()->fill_function (fpregset, regcache); - free_register_cache (regcache); - - current_inferior = save_inferior; - - return PS_OK; -#endif - /* FIXME */ - return PS_ERR; -} - -/* Set the floating-point registers of LWP LWPID within the target - process PH from FPREGSET. */ - -ps_err_e -ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, - const gdb_prfpregset_t *fpregset) -{ -#if 0 - struct thread_info *reg_inferior, *save_inferior; - void *regcache; - - reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid); - if (reg_inferior == NULL) - return PS_ERR; - - save_inferior = current_inferior; - current_inferior = reg_inferior; - - regcache = new_register_cache (); - fpregset_info()->store_function (fpregset, regcache); - the_target->store_registers (0, regcache); - free_register_cache (regcache); - - current_inferior = save_inferior; - - return PS_OK; -#endif - /* FIXME */ - return PS_ERR; -} - -/* Return overall process id of the target PH. Special for GNU/Linux - -- not used on Solaris. */ - -pid_t -ps_getpid (gdb_ps_prochandle_t ph) -{ - return ph->pid; -} - - diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c deleted file mode 100644 index f3d57a54d62..00000000000 --- a/gdb/gdbserver/thread-db.c +++ /dev/null @@ -1,342 +0,0 @@ -/* Thread management interface, for the remote server for GDB. - Copyright 2002 - Free Software Foundation, Inc. - - Contributed by MontaVista Software. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "server.h" - -#include "linux-low.h" - -extern int debug_threads; - -#ifdef HAVE_THREAD_DB_H -#include -#endif - -/* Correct for all GNU/Linux targets (for quite some time). */ -#define GDB_GREGSET_T elf_gregset_t -#define GDB_FPREGSET_T elf_fpregset_t - -#ifndef HAVE_ELF_FPREGSET_T -/* Make sure we have said types. Not all platforms bring in - via . */ -#ifdef HAVE_LINUX_ELF_H -#include -#endif -#endif - -#include "../gdb_proc_service.h" - -/* Structure that identifies the child process for the - interface. */ -static struct ps_prochandle proc_handle; - -/* Connection to the libthread_db library. */ -static td_thragent_t *thread_agent; - -static int find_new_threads_callback (const td_thrhandle_t *th_p, void *data); - -static char * -thread_db_err_str (td_err_e err) -{ - static char buf[64]; - - switch (err) - { - case TD_OK: - return "generic 'call succeeded'"; - case TD_ERR: - return "generic error"; - case TD_NOTHR: - return "no thread to satisfy query"; - case TD_NOSV: - return "no sync handle to satisfy query"; - case TD_NOLWP: - return "no LWP to satisfy query"; - case TD_BADPH: - return "invalid process handle"; - case TD_BADTH: - return "invalid thread handle"; - case TD_BADSH: - return "invalid synchronization handle"; - case TD_BADTA: - return "invalid thread agent"; - case TD_BADKEY: - return "invalid key"; - case TD_NOMSG: - return "no event message for getmsg"; - case TD_NOFPREGS: - return "FPU register set not available"; - case TD_NOLIBTHREAD: - return "application not linked with libthread"; - case TD_NOEVENT: - return "requested event is not supported"; - case TD_NOCAPAB: - return "capability not available"; - case TD_DBERR: - return "debugger service failed"; - case TD_NOAPLIC: - return "operation not applicable to"; - case TD_NOTSD: - return "no thread-specific data for this thread"; - case TD_MALLOC: - return "malloc failed"; - case TD_PARTIALREG: - return "only part of register set was written/read"; - case TD_NOXREGS: - return "X register set not available for this thread"; - default: - snprintf (buf, sizeof (buf), "unknown thread_db error '%d'", err); - return buf; - } -} - -#if 0 -static char * -thread_db_state_str (td_thr_state_e state) -{ - static char buf[64]; - - switch (state) - { - case TD_THR_STOPPED: - return "stopped by debugger"; - case TD_THR_RUN: - return "runnable"; - case TD_THR_ACTIVE: - return "active"; - case TD_THR_ZOMBIE: - return "zombie"; - case TD_THR_SLEEP: - return "sleeping"; - case TD_THR_STOPPED_ASLEEP: - return "stopped by debugger AND blocked"; - default: - snprintf (buf, sizeof (buf), "unknown thread_db state %d", state); - return buf; - } -} -#endif - -static void -thread_db_create_event (CORE_ADDR where) -{ - td_event_msg_t msg; - td_err_e err; - struct inferior_linux_data *tdata; - - if (debug_threads) - fprintf (stderr, "Thread creation event.\n"); - - tdata = inferior_target_data (current_inferior); - - /* FIXME: This assumes we don't get another event. - In the LinuxThreads implementation, this is safe, - because all events come from the manager thread - (except for its own creation, of course). */ - err = td_ta_event_getmsg (thread_agent, &msg); - if (err != TD_OK) - fprintf (stderr, "thread getmsg err: %s\n", - thread_db_err_str (err)); - - /* msg.event == TD_EVENT_CREATE */ - - find_new_threads_callback (msg.th_p, NULL); -} - -#if 0 -static void -thread_db_death_event (CORE_ADDR where) -{ - if (debug_threads) - fprintf (stderr, "Thread death event.\n"); -} -#endif - -static int -thread_db_enable_reporting () -{ - td_thr_events_t events; - td_notify_t notify; - td_err_e err; - - /* Set the process wide mask saying which events we're interested in. */ - td_event_emptyset (&events); - td_event_addset (&events, TD_CREATE); - -#if 0 - /* This is reported to be broken in glibc 2.1.3. A different approach - will be necessary to support that. */ - td_event_addset (&events, TD_DEATH); -#endif - - err = td_ta_set_event (thread_agent, &events); - if (err != TD_OK) - { - warning ("Unable to set global thread event mask: %s", - thread_db_err_str (err)); - return 0; - } - - /* Get address for thread creation breakpoint. */ - err = td_ta_event_addr (thread_agent, TD_CREATE, ¬ify); - if (err != TD_OK) - { - warning ("Unable to get location for thread creation breakpoint: %s", - thread_db_err_str (err)); - return 0; - } - set_breakpoint_at ((CORE_ADDR) (unsigned long) notify.u.bptaddr, - thread_db_create_event); - -#if 0 - /* Don't concern ourselves with reported thread deaths, only - with actual thread deaths (via wait). */ - - /* Get address for thread death breakpoint. */ - err = td_ta_event_addr (thread_agent, TD_DEATH, ¬ify); - if (err != TD_OK) - { - warning ("Unable to get location for thread death breakpoint: %s", - thread_db_err_str (err)); - return; - } - set_breakpoint_at ((CORE_ADDR) (unsigned long) notify.u.bptaddr, - thread_db_death_event); -#endif - - return 1; -} - -static void -maybe_attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p) -{ - td_err_e err; - struct thread_info *inferior; - struct process_info *process; - - /* If we are attaching to our first thread, things are a little - different. */ - if (all_threads.head == all_threads.tail) - { - inferior = (struct thread_info *) all_threads.head; - process = get_thread_process (inferior); - if (process->thread_known == 0) - { - /* Switch to indexing the threads list by TID. */ - change_inferior_id (&all_threads, ti_p->ti_tid); - goto found; - } - } - - inferior = (struct thread_info *) find_inferior_id (&all_threads, - ti_p->ti_tid); - if (inferior != NULL) - return; - - if (debug_threads) - fprintf (stderr, "Attaching to thread %ld (LWP %d)\n", - ti_p->ti_tid, ti_p->ti_lid); - linux_attach_lwp (ti_p->ti_lid, ti_p->ti_tid); - inferior = (struct thread_info *) find_inferior_id (&all_threads, - ti_p->ti_tid); - if (inferior == NULL) - { - warning ("Could not attach to thread %ld (LWP %d)\n", - ti_p->ti_tid, ti_p->ti_lid); - return; - } - - process = inferior_target_data (inferior); - -found: - new_thread_notify (ti_p->ti_tid); - - process->tid = ti_p->ti_tid; - process->lwpid = ti_p->ti_lid; - - process->thread_known = 1; - err = td_thr_event_enable (th_p, 1); - if (err != TD_OK) - error ("Cannot enable thread event reporting for %d: %s", - ti_p->ti_lid, thread_db_err_str (err)); -} - -static int -find_new_threads_callback (const td_thrhandle_t *th_p, void *data) -{ - td_thrinfo_t ti; - td_err_e err; - - err = td_thr_get_info (th_p, &ti); - if (err != TD_OK) - error ("Cannot get thread info: %s", thread_db_err_str (err)); - - /* Check for zombies. */ - if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE) - return 0; - - maybe_attach_thread (th_p, &ti); - - return 0; -} - -static void -thread_db_find_new_threads (void) -{ - td_err_e err; - - /* Iterate over all user-space threads to discover new threads. */ - err = td_ta_thr_iter (thread_agent, find_new_threads_callback, NULL, - TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY, - TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS); - if (err != TD_OK) - error ("Cannot find new threads: %s", thread_db_err_str (err)); -} - -int -thread_db_init () -{ - int err; - - proc_handle.pid = ((struct inferior_list_entry *)current_inferior)->id; - - err = td_ta_new (&proc_handle, &thread_agent); - switch (err) - { - case TD_NOLIBTHREAD: - /* No thread library was detected. */ - return 0; - - case TD_OK: - /* The thread library was detected. */ - - if (thread_db_enable_reporting () == 0) - return 0; - thread_db_find_new_threads (); - return 1; - - default: - warning ("error initializing thread_db library."); - } - - return 0; -} diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h deleted file mode 100644 index 3c30130ede9..00000000000 --- a/gdb/i386-linux-tdep.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Target-dependent code for Linux/x86. - Copyright 2002 - Free Software Foundation, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef I386_LINUX_TDEP_H -#define I386_LINUX_TDEP_H - -/* The Linux kernel pretends there is an additional "orig_eax" - register. Since GDB needs access to that register to be able to - properly restart system calls when necessary (see - i386-linux-tdep.c) we need our own versions of a number of - functions that deal with GDB's register cache. */ - -/* Register number for the "orig_eax" pseudo-register. If this - pseudo-register contains a value >= 0 it is interpreted as the - system call number that the kernel is supposed to restart. */ -#define I386_LINUX_ORIG_EAX_REGNUM I386_SSE_NUM_REGS - -#endif /* i386-linux-tdep.h */ diff --git a/gdb/interps.c b/gdb/interps.c deleted file mode 100644 index 4b9b901f1bc..00000000000 --- a/gdb/interps.c +++ /dev/null @@ -1,659 +0,0 @@ -/* Manages interpreters for gdb. - Copyright 2000, 2002 Free Software Foundation, Inc. - Written by Jim Ingham of Apple Computer, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This is just a first cut at separating out the "interpreter" functions - of gdb into self-contained modules. There are a couple of open areas that - need to be sorted out: - - 1) The interpreter explicitly contains a UI_OUT, and can insert itself - into the event loop, but it doesn't explicitly contain hooks for readline. - I did this because it seems to me many interpreters won't want to use - the readline command interface, and it is probably simpler to just let - them take over the input in their resume proc. - - 2) The event loop insertion is probably wrong. I just inserted a - do_one_event alongside gdb's do_one_event. This probably will lead - to one or the other event loop getting starved. It would be better - to provide conversion functions for the gdb file handlers, and when - an interpreter starts up, it grabs all the gdb created file handlers - and inserts them into its select. This is more complicated, however, - and I have run out of time for now. -*/ - -#include "defs.h" -#include "gdbcmd.h" -#include "ui-out.h" -#include "event-loop.h" -#include "event-top.h" -#include "interps.h" -#include "completer.h" -#include "gdb_string.h" - -struct gdb_interpreter -{ - char *name; /* This is the name in "-i=" and set interpreter. */ - struct gdb_interpreter *next; /* Interpreters are stored in a linked list, - this is the next one... */ - void *data; /* This is a cookie that the instance of the - interpreter can use, for instance to call - itself in hook functions */ - int inited; /* Has the init_proc been run? */ - struct ui_out *interpreter_out; /* This is the ui_out used to collect - results for this interpreter. It can - be a formatter for stdout, as is the - case for the console & mi outputs, or it - might be a result formatter. */ - struct gdb_interpreter_procs procs; - int quiet_p; -}; - -/* Functions local to this file. */ -static void initialize_interps (void); - -static void set_interpreter_cmd (char *args, int from_tty, - struct cmd_list_element *c); -static void list_interpreter_cmd (char *args, int from_tty); -static void do_set_interpreter (int not_an_fd); -static char **interpreter_completer (char *text, char *word); - -/* The magic initialization routine for this module. */ - -void _initialize_interpreter (void); - -/* Variables local to this file: */ - -static struct gdb_interpreter *interp_list = NULL; -static struct gdb_interpreter *current_interpreter = NULL; - -static int interpreter_initialized = 0; - -/* gdb_new_interpreter - This allocates space for a new interpreter, - fills the fields from the inputs, and returns a pointer to the - interpreter. */ - -struct gdb_interpreter * -gdb_new_interpreter (char *name, - void *data, - struct ui_out *uiout, - struct gdb_interpreter_procs *procs) -{ - struct gdb_interpreter *new_interp; - - new_interp = - (struct gdb_interpreter *) xmalloc (sizeof (struct gdb_interpreter)); - - new_interp->name = xstrdup (name); - new_interp->data = data; - new_interp->interpreter_out = uiout; - new_interp->quiet_p = 0; - new_interp->procs.init_proc = procs->init_proc; - new_interp->procs.resume_proc = procs->resume_proc; - new_interp->procs.do_one_event_proc = procs->do_one_event_proc; - new_interp->procs.suspend_proc = procs->suspend_proc; - new_interp->procs.delete_proc = procs->delete_proc; - new_interp->procs.exec_proc = procs->exec_proc; - new_interp->procs.prompt_proc = procs->prompt_proc; - new_interp->inited = 0; - - return new_interp; -} - -/* Add interpreter INTERP to the gdb interpreter list. If an - interpreter of the same name is already on the list, then - the new one is NOT added, and the function returns 0. Otherwise - it returns 1. */ - -int -gdb_add_interpreter (struct gdb_interpreter *interp) -{ - if (!interpreter_initialized) - initialize_interps (); - - if (gdb_lookup_interpreter (interp->name) != NULL) - return 0; - - interp->next = interp_list; - interp_list = interp; - - return 1; -} - -/* Looks for the interpreter INTERP in the interpreter list. If it exists, - runs the delete_proc, and if this is successful, the INTERP is deleted from - the interpreter list and the function returns 1. If the delete_proc fails, the - function returns -1 and the interpreter is NOT removed from the list. If the - interp is not found, 0 is returned. */ - -int -gdb_delete_interpreter (struct gdb_interpreter *interp) -{ - struct gdb_interpreter *cur_ptr, *prev_ptr; - - if (!interpreter_initialized) - { - ui_out_message (uiout, 0, - "You can't delete an interp before you have added one!"); - return -1; - } - - if (interp_list == NULL) - { - ui_out_message (uiout, 0, "No interpreters to delete."); - return -1; - } - - if (interp_list->next == NULL) - { - ui_out_message (uiout, 0, "You can't delete gdb's only intepreter."); - return -1; - } - - for (cur_ptr = interp_list, prev_ptr = NULL; - cur_ptr != NULL; prev_ptr = cur_ptr, cur_ptr = cur_ptr->next) - { - if (cur_ptr == interp) - { - /* Can't currently delete the console interpreter... */ - if (strcmp (interp->name, "console") == 0) - { - ui_out_message (uiout, 0, - "You can't delete the console interpreter."); - return -1; - } - - /* If the interpreter is the current interpreter, switch - back to the console interpreter */ - - if (interp == current_interpreter) - { - gdb_set_interpreter (gdb_lookup_interpreter ("console")); - } - - /* Don't delete the interpreter if its delete proc fails */ - - if ((interp->procs.delete_proc != NULL) - && (!interp->procs.delete_proc (interp->data))) - return -1; - - if (cur_ptr == interp_list) - interp_list = cur_ptr->next; - else - prev_ptr->next = cur_ptr->next; - - break; - } - } - - if (cur_ptr == NULL) - return 0; - else - return 1; -} - -/* This sets the current interpreter to be INTERP. If INTERP has not - been initialized, then this will also run the init proc. If the - init proc is successful, return 1, if it fails, set the old - interpreter back in place and return 0. If we can't restore the - old interpreter, then raise an internal error, since we are in - pretty bad shape at this point. */ - -int -gdb_set_interpreter (struct gdb_interpreter *interp) -{ - struct gdb_interpreter *old_interp = current_interpreter; - int first_time = 0; - - - char buffer[64]; - - if (current_interpreter != NULL) - { - do_all_continuations (); - ui_out_flush (uiout); - if (current_interpreter->procs.suspend_proc && - !current_interpreter->procs.suspend_proc (current_interpreter->data)) - { - error ("Could not suspend interpreter \"%s\"\n", current_interpreter->name); - } - } - else - { - first_time = 1; - } - - current_interpreter = interp; - - /* We use interpreter_p for the "set interpreter" variable, so we need - to make sure we have a malloc'ed copy for the set command to free. */ - if (interpreter_p != NULL && strcmp (current_interpreter->name, interpreter_p) != 0) - { - xfree (interpreter_p); - - interpreter_p = xstrdup (current_interpreter->name); - } - - uiout = interp->interpreter_out; - - /* Run the init proc. If it fails, try to restore the old interp. */ - - if (!interp->inited) - { - if (interp->procs.init_proc != NULL) - { - if (!interp->procs.init_proc (interp->data)) - { - if (!gdb_set_interpreter (old_interp)) - internal_error (__FILE__, __LINE__, - "Failed to initialize new interp \"%s\" %s", - interp->name, - "and could not restore old interp!\n"); - return 0; - } - else - { - interp->inited = 1; - } - } - else - { - interp->inited = 1; - } - } - - if (interp->procs.resume_proc != NULL - && (!interp->procs.resume_proc (interp->data))) - { - if (!gdb_set_interpreter (old_interp)) - internal_error (__FILE__, __LINE__, - "Failed to initialize new interp \"%s\" %s", - interp->name, "and could not restore old interp!\n"); - return 0; - } - - /* Finally, put up the new prompt to show that we are indeed here. - Also, display_gdb_prompt for the console does some readline magic - which is needed for the console interpreter, at least... */ - - if (!first_time) - { - if (!gdb_interpreter_is_quiet (interp)) - { - sprintf (buffer, "Switching to interpreter \"%.24s\".\n", - interp->name); - ui_out_text (uiout, buffer); - } - display_gdb_prompt (NULL); - } - - return 1; -} - -/* - * gdb_lookup_interpreter - Looks up the interpreter for NAME. If - * no such interpreter exists, return NULL, otherwise return a pointer - * to the interpreter. - */ - -struct gdb_interpreter * -gdb_lookup_interpreter (char *name) -{ - struct gdb_interpreter *interp; - - if (name == NULL || strlen (name) == 0) - return NULL; - - for (interp = interp_list; interp != NULL; interp = interp->next) - { - if (strcmp (interp->name, name) == 0) - return interp; - } - - return NULL; -} - -/* Returns the current interpreter. */ - -struct gdb_interpreter * -gdb_current_interpreter () -{ - return current_interpreter; -} - -struct ui_out * -gdb_interpreter_ui_out (struct gdb_interpreter *interp) -{ - if (interp != NULL) - return interp->interpreter_out; - - return current_interpreter->interpreter_out; -} - -/* Returns true if the current interp is the passed in name. */ -int -gdb_current_interpreter_is_named (char *interp_name) -{ - struct gdb_interpreter *current_interp = gdb_current_interpreter (); - - if (current_interp) - return (strcmp (current_interp->name, interp_name) == 0); - - return 0; -} - -/* This is called in display_gdb_prompt. - If the current interpreter defines a prompt_proc, then that proc is - run. If the proc returns a non-zero value, display_gdb_prompt will - return without itself displaying the prompt. */ - -int -gdb_interpreter_display_prompt (char *new_prompt) -{ - if (current_interpreter->procs.prompt_proc == NULL) - return 0; - else - return current_interpreter->procs.prompt_proc (current_interpreter->data, - new_prompt); -} - -int -gdb_interpreter_is_quiet (struct gdb_interpreter *interp) -{ - if (interp != NULL) - return interp->quiet_p; - else - return current_interpreter->quiet_p; -} - -int -gdb_interpreter_set_quiet (struct gdb_interpreter *interp, int quiet) -{ - int old_val = interp->quiet_p; - interp->quiet_p = quiet; - return old_val; -} - -/* gdb_interpreter_exec - This executes COMMAND_STR in the current - interpreter. */ - -int -gdb_interpreter_exec (char *command_str) -{ - if (current_interpreter->procs.exec_proc != NULL) - { - return current_interpreter->procs.exec_proc (current_interpreter->data, - command_str); - } - - return 0; -} - -struct gdb_interpreter_procs * -gdb_interpreter_get_procs (struct gdb_interpreter *interp) -{ - if (interp != NULL) - return &interp->procs; - - return ¤t_interpreter->procs; -} - -void * -gdb_interpreter_get_data (struct gdb_interpreter *interp) -{ - if (interp != NULL) - return interp->data; - - return current_interpreter->data; -} - -int -interpreter_do_one_event () -{ - if (current_interpreter->procs.do_one_event_proc == NULL) - return 0; - - return current_interpreter->procs.do_one_event_proc (current_interpreter->data); -} - -/* A convenience routine that nulls out all the - common command hooks. Use it when removing your interpreter in its - suspend proc. */ - -void -clear_interpreter_hooks () -{ - init_ui_hook = 0; - print_frame_info_listing_hook = 0; - /*print_frame_more_info_hook = 0; */ - query_hook = 0; - warning_hook = 0; - create_breakpoint_hook = 0; - delete_breakpoint_hook = 0; - modify_breakpoint_hook = 0; - interactive_hook = 0; - registers_changed_hook = 0; - readline_begin_hook = 0; - readline_hook = 0; - readline_end_hook = 0; - register_changed_hook = 0; - memory_changed_hook = 0; - context_hook = 0; - target_wait_hook = 0; - call_command_hook = 0; - error_hook = 0; - error_begin_hook = 0; - command_loop_hook = 0; -} - -/* This is a lazy init routine, called the first time - the interpreter module is used. I put it here just in case, but I haven't - thought of a use for it yet. I will probably bag it soon, since I don't - think it will be necessary. */ - -static void -initialize_interps (void) -{ - interpreter_initialized = 1; - /* Don't know if anything needs to be done here... */ -} - -/* set_interpreter_cmd - This implements "set interpreter foo". */ - -static void -set_interpreter_cmd (char *args, int from_tty, struct cmd_list_element *c) -{ - struct gdb_interpreter *interp_ptr; - - dont_repeat (); - - if (cmd_type (c) != set_cmd) - return; - - interp_ptr = gdb_lookup_interpreter (interpreter_p); - if (interp_ptr != NULL) - { - if (!gdb_set_interpreter (interp_ptr)) - error ("\nCould not switch to interpreter \"%s\", %s%s\".\n", - interp_ptr->name, "reverting to interpreter \"", - current_interpreter->name); - } - else - { - char *bad_name = interpreter_p; - interpreter_p = xstrdup (current_interpreter->name); - error ("Could not find interpreter \"%s\".", bad_name); - } -} - -/* list_interpreter_cmd - This implements "info interpreters". */ - -void -list_interpreter_cmd (char *args, int from_tty) -{ - struct gdb_interpreter *interp_ptr; - - ui_out_list_begin (uiout, "interpreters"); - for (interp_ptr = interp_list; interp_ptr != NULL; - interp_ptr = interp_ptr->next) - { - ui_out_text (uiout, " * "); - ui_out_field_string (uiout, "interpreter", interp_ptr->name); - ui_out_text (uiout, "\n"); - } - ui_out_list_end (uiout); -} - -void -interpreter_exec_cmd (char *args, int from_tty) -{ - struct gdb_interpreter *old_interp, *interp_to_use; - char **prules = NULL; - char **trule = NULL; - unsigned int nrules; - unsigned int i; - int old_quiet; - - prules = buildargv (args); - if (prules == NULL) - { - error ("unable to parse arguments"); - } - - nrules = 0; - if (prules != NULL) - { - for (trule = prules; *trule != NULL; trule++) - { - nrules++; - } - } - - if (nrules < 2) - error ("usage: interpreter-exec [ ... ]"); - - old_interp = gdb_current_interpreter (); - - interp_to_use = gdb_lookup_interpreter (prules[0]); - if (interp_to_use == NULL) - error ("Could not find interpreter \"%s\".", prules[0]); - - old_quiet = gdb_interpreter_set_quiet (interp_to_use, 1); - - if (!gdb_set_interpreter (interp_to_use)) - error ("Could not switch to interpreter \"%s\".", prules[0]); - - for (i = 1; i < nrules; i++) - { - if (!gdb_interpreter_exec (prules[i])) - { - gdb_set_interpreter (old_interp); - gdb_interpreter_set_quiet (interp_to_use, old_quiet); - error - ("interpreter-exec: mi_interpreter_execute: error in command: \"%s\".", - prules[i]); - break; - } - } - - gdb_set_interpreter (old_interp); - gdb_interpreter_set_quiet (interp_to_use, old_quiet); -} - -/* List the possible interpreters which could complete the given text. */ - -static char ** -interpreter_completer (char *text, char *word) -{ - int alloced, textlen; - int num_matches; - char **matches; - struct gdb_interpreter *interp; - - /* We expect only a very limited number of interpreters, so just - allocate room for all of them. */ - for (interp = interp_list; interp != NULL; interp = interp->next) - ++alloced; - matches = (char **) xmalloc (alloced * sizeof (char *)); - - num_matches = 0; - textlen = strlen (text); - for (interp = interp_list; interp != NULL; interp = interp->next) - { - if (strncmp (interp->name, text, textlen) == 0) - { - matches[num_matches] = - (char *) xmalloc (strlen (word) + strlen (interp->name) + 1); - if (word == text) - strcpy (matches[num_matches], interp->name); - else if (word > text) - { - /* Return some portion of interp->name */ - strcpy (matches[num_matches], interp->name + (word - text)); - } - else - { - /* Return some of text plus interp->name */ - strncpy (matches[num_matches], word, text - word); - matches[num_matches][text - word] = '\0'; - strcat (matches[num_matches], interp->name); - } - ++num_matches; - } - } - - if (num_matches == 0) - { - xfree (matches); - matches = NULL; - } - else if (num_matches < alloced) - { - matches = (char **) xrealloc ((char *) matches, ((num_matches + 1) - * sizeof (char *))); - matches[num_matches] = NULL; - } - - return matches; -} - -/* This just adds the "set interpreter" and "info interpreters" commands. */ - -void -_initialize_interpreter (void) -{ - struct cmd_list_element *c; - - c = add_set_cmd ("interpreter", class_support, - var_string, - &interpreter_p, "Set the interpreter for gdb.", &setlist); - set_cmd_sfunc (c, set_interpreter_cmd); - add_show_from_set (c, &showlist); - - add_cmd ("interpreters", class_support, - list_interpreter_cmd, - "List the interpreters currently available in gdb.", &infolist); - - c = add_cmd ("interpreter-exec", class_support, - interpreter_exec_cmd, - "Execute a command in an interpreter. It takes two arguments:\n\ -The first argument is the name of the interpreter to use.\n\ -The second argument is the command to execute.\n", &cmdlist); - set_cmd_completer (c, interpreter_completer); -} diff --git a/gdb/interps.h b/gdb/interps.h deleted file mode 100644 index 05420b1a66a..00000000000 --- a/gdb/interps.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Manages interpreters for gdb. - Copyright 2000,2002 Free Software Foundation, Inc. - Written by Jim Ingham of Apple Computer, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef GDB_INTERPRETER_H -#define GDB_INTERPRETER_H - -typedef int (*interp_init_ftype) (void *data); -typedef int (*interp_resume_ftype) (void *data); -typedef int (*interp_do_one_event_ftype) (void *data); -typedef int (*interp_suspend_ftype) (void *data); -typedef int (*interp_delete_ftype) (void *data); -typedef int (*interp_prompt_ftype) (void *data, char *new_prompt); -typedef int (*interp_exec_ftype) (void *data, char *command); - -struct ui_out; -struct gdb_interpreter; - -struct gdb_interpreter_procs -{ - interp_init_ftype init_proc; - interp_resume_ftype resume_proc; - interp_do_one_event_ftype do_one_event_proc; - interp_suspend_ftype suspend_proc; - interp_delete_ftype delete_proc; - interp_exec_ftype exec_proc; - interp_prompt_ftype prompt_proc; -}; - -extern struct gdb_interpreter - *gdb_new_interpreter (char *name, void *data, struct ui_out *uiout, - struct gdb_interpreter_procs *procs); - -extern int gdb_add_interpreter (struct gdb_interpreter *interp); -extern int gdb_delete_interpreter (struct gdb_interpreter *interp); -extern int gdb_set_interpreter (struct gdb_interpreter *interp); -extern struct gdb_interpreter *gdb_lookup_interpreter (char *name); -extern struct gdb_interpreter *gdb_current_interpreter (); -extern struct ui_out *gdb_interpreter_ui_out (struct gdb_interpreter *interp); -extern int gdb_current_interpreter_is_named (char *interp_name); -extern int gdb_interpreter_exec (char *command_str); -extern int gdb_interpreter_display_prompt (char *new_prompt); -extern int gdb_interpreter_set_quiet (struct gdb_interpreter *interp, - int quiet); -extern int gdb_interpreter_is_quiet (struct gdb_interpreter *interp); -extern struct gdb_interpreter_procs *gdb_interpreter_get_procs (struct gdb_interpreter *interp); -extern void *gdb_interpreter_get_data (struct gdb_interpreter *interp); -extern int interpreter_do_one_event (); - -void clear_interpreter_hooks (); - -/* well-known interpreters */ -#define GDB_INTERPRETER_CONSOLE "console" -#define GDB_INTERPRETER_MI "mi" -#define GDB_INTERPRETER_MI0 "mi0" - -#endif /* GDB_INTERPRETER_H */ diff --git a/gdb/main.c b/gdb/main.c index 78852115d65..7ef8647c65a 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -51,9 +51,7 @@ int display_space; processes UI events asynchronously. */ int event_loop_p = 1; -/* Has an interpreter been specified and if so, which. - This will be used as a set command variable, so it should - always be malloc'ed - since do_setshow_command will free it. */ +/* Has an interpreter been specified and if so, which. */ char *interpreter_p; /* Whether this is the command line version or not */ @@ -356,7 +354,7 @@ extern int gdbtk_test (char *); } #endif /* GDBTK */ case 'i': - interpreter_p = xstrdup (optarg); + interpreter_p = optarg; break; case 'd': dirarg[ndir++] = optarg; diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 0d50d13826f..233d06bded2 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -88,8 +88,6 @@ struct mi_cmd mi_cmds[] = {"gdb-show", "show %s", 0}, {"gdb-source", 0, 0}, {"gdb-version", "show version", 0}, - {"interpreter-set", 0, 0, mi_cmd_interpreter_set}, - {"interpreter-exec", 0, 0, mi_cmd_interpreter_exec}, {"kod-info", 0, 0}, {"kod-list", 0, 0}, {"kod-list-object-types", 0, 0}, diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 8c650fc91e1..88775e6f961 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -27,7 +27,7 @@ enum mi_cmd_result { /* Report the command as ``done''. Display both the ``NNN^done'' - message and the completion prompt. */ + message and the completion prompt. */ MI_CMD_DONE = 0, /* The command is still running in the forground. Main loop should display the completion prompt. */ @@ -75,8 +75,6 @@ extern mi_cmd_args_ftype mi_cmd_exec_step_instruction; extern mi_cmd_args_ftype mi_cmd_exec_until; extern mi_cmd_args_ftype mi_cmd_exec_interrupt; extern mi_cmd_argv_ftype mi_cmd_gdb_exit; -extern mi_cmd_argv_ftype mi_cmd_interpreter_set; -extern mi_cmd_argv_ftype mi_cmd_interpreter_exec; extern mi_cmd_argv_ftype mi_cmd_stack_info_depth; extern mi_cmd_argv_ftype mi_cmd_stack_list_args; extern mi_cmd_argv_ftype mi_cmd_stack_list_frames; @@ -124,6 +122,4 @@ extern int mi_debug_p; /* Raw console output - FIXME: should this be a parameter? */ extern struct ui_file *raw_stdout; -extern char *mi_error_message; -void mi_execute_command (char *cmd, int from_tty); #endif diff --git a/gdb/mi/mi-events.c b/gdb/mi/mi-events.c deleted file mode 100644 index 1d942a4d265..00000000000 --- a/gdb/mi/mi-events.c +++ /dev/null @@ -1,148 +0,0 @@ -/* MI Event Handlers - Copyright 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "ui-out.h" -#include "interps.h" -#include "gdb.h" -#include "breakpoint.h" - -#include "mi.h" - -void -mi_interp_stack_changed_hook (void) -{ - struct ui_out *saved_ui_out = uiout; - struct mi_out *tmp_mi_out; - - if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) - uiout = gdb_interpreter_ui_out (mi0_interp); - else - uiout = gdb_interpreter_ui_out (mi_interp); - - ui_out_list_begin (uiout, "MI_HOOK_RESULT"); - ui_out_field_string (uiout, "HOOK_TYPE", "stack_changed"); - ui_out_list_end (uiout); - uiout = saved_ui_out; -} - -void -mi_interp_frame_changed_hook (int new_frame_number) -{ - struct ui_out *saved_ui_out = uiout; - struct mi_out *tmp_mi_out; - - if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) - uiout = gdb_interpreter_ui_out (mi0_interp); - else - uiout = gdb_interpreter_ui_out (mi_interp); - - ui_out_list_begin (uiout, "MI_HOOK_RESULT"); - ui_out_field_string (uiout, "HOOK_TYPE", "frame_changed"); - ui_out_field_int (uiout, "frame", new_frame_number); - ui_out_list_end (uiout); - uiout = saved_ui_out; - -} - -void -mi_interp_context_hook (int thread_id) -{ - struct ui_out *saved_ui_out = uiout; - struct mi_out *tmp_mi_out; - - if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) - uiout = gdb_interpreter_ui_out (mi0_interp); - else - uiout = gdb_interpreter_ui_out (mi_interp); - - ui_out_list_begin (uiout, "MI_HOOK_RESULT"); - ui_out_field_string (uiout, "HOOK_TYPE", "thread_changed"); - ui_out_field_int (uiout, "thread", thread_id); - ui_out_list_end (uiout); - uiout = saved_ui_out; -} - -void -mi_interp_create_breakpoint_hook (struct breakpoint *bpt) -{ - CORE_ADDR unusued_addr; - struct ui_out *saved_ui_out = uiout; - struct mi_out *tmp_mi_out; - - if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) - uiout = gdb_interpreter_ui_out (mi0_interp); - else - uiout = gdb_interpreter_ui_out (mi_interp); - - /* This is a little inefficient, but it probably isn't worth adding - a gdb_breakpoint_query that takes a bpt structure... */ - - ui_out_list_begin (uiout, "MI_HOOK_RESULT"); - ui_out_field_string (uiout, "HOOK_TYPE", "breakpoint_create"); - gdb_breakpoint_query (uiout, bpt->number); - ui_out_list_end (uiout); - uiout = saved_ui_out; -} - -void -mi_interp_modify_breakpoint_hook (struct breakpoint *bpt) -{ - - CORE_ADDR unusued_addr; - struct ui_out *saved_ui_out = uiout; - struct mi_out *tmp_mi_out; - - if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) - uiout = gdb_interpreter_ui_out (mi0_interp); - else - uiout = gdb_interpreter_ui_out (mi_interp); - - /* This is a little inefficient, but it probably isn't worth adding - a gdb_breakpoint_query that takes a bpt structure... */ - - ui_out_list_begin (uiout, "MI_HOOK_RESULT"); - ui_out_field_string (uiout, "HOOK_TYPE", "breakpoint_modify"); - gdb_breakpoint_query (uiout, bpt->number); - ui_out_list_end (uiout); - uiout = saved_ui_out; -} - -void -mi_interp_delete_breakpoint_hook (struct breakpoint *bpt) -{ - CORE_ADDR unusued_addr; - struct ui_out *saved_ui_out = uiout; - struct mi_out *tmp_mi_out; - - if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) - uiout = gdb_interpreter_ui_out (mi0_interp); - else - uiout = gdb_interpreter_ui_out (mi_interp); - - /* This is a little inefficient, but it probably isn't worth adding - a gdb_breakpoint_query that takes a bpt structure... */ - - ui_out_list_begin (uiout, "MI_HOOK_RESULT"); - ui_out_field_string (uiout, "HOOK_TYPE", "breakpoint_delete"); - ui_out_field_int (uiout, "bkptno", bpt->number); - ui_out_list_end (uiout); - uiout = saved_ui_out; -} diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c deleted file mode 100644 index 9a918339870..00000000000 --- a/gdb/mi/mi-interp.c +++ /dev/null @@ -1,500 +0,0 @@ -/* MI Interpreter Definitions and Commands - Copyright 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "interps.h" -#include "event-top.h" -#include "event-loop.h" -#include "inferior.h" -#include "ui-out.h" -#include "top.h" - -#include "mi.h" -#include "mi-cmds.h" -#include "mi-out.h" -#include "mi-console.h" - -/* MI's output channels */ -struct ui_file *mi_stdout; -struct ui_file *mi_stderr; -struct ui_file *mi_stdlog; -struct ui_file *mi_stdtarg; - -/* This is the interpreter for the mi... */ -struct gdb_interpreter *mi0_interp; -struct gdb_interpreter *mi_interp; - -/* These are the interpreter setup, etc. functions for the MI interpreter */ -static int mi_interpreter_init (void *data); -static int mi_interpreter_resume (void *data); -static int mi_interpreter_do_one_event (void *data); -static int mi_interpreter_suspend (void *data); -static int mi_interpreter_delete (void *data); -static int mi_interpreter_prompt (void *data, char *new_prompt); - -static void mi_execute_command_wrapper (char *cmd); -static void mi_command_loop (int mi_version); -static char *mi_input (char *); - -/* These are hooks that we put in place while doing interpreter_exec - so we can report interesting things that happened "behind the mi's - back" in this command */ -static int mi_interp_query_hook (const char *ctlstr, va_list ap); -static void mi_interp_stack_changed_hook (void); -static char *mi_interp_read_one_line_hook (char *prompt, int repeat, - char *anno); - -static void mi0_command_loop (void); -static void mi1_command_loop (void); - -static void mi_insert_notify_hooks (void); -static void mi_remove_notify_hooks (void); - -int -mi_interpreter_init (void *data) -{ - /* Why is this a part of the mi architecture? */ - - mi_setup_architecture_data (); - - /* HACK: We need to force stdout/stderr to point at the console. This avoids - any potential side effects caused by legacy code that is still - using the TUI / fputs_unfiltered_hook. So we set up output channels for - this now, and swap them in when we are run. */ - - raw_stdout = stdio_fileopen (stdout); - /* Route normal output through the MIx */ - mi_stdout = mi_console_file_new (raw_stdout, "~"); - /* Route error and log output through the MI */ - mi_stderr = mi_console_file_new (raw_stdout, "&"); - mi_stdlog = mi_stderr; - /* Route target output through the MI. */ - mi_stdtarg = mi_console_file_new (raw_stdout, "@"); - - return 1; -} - -int -mi_interpreter_resume (void *data) -{ - /* As per hack note in mi_interpreter_init, swap in the output channels... */ - - gdb_setup_readline (); - mi_register_gdbarch_swap (); - - if (event_loop_p) - { - /* These overwrite some of the initialization done in - _intialize_event_loop. */ - call_readline = gdb_readline2; - input_handler = mi_execute_command_wrapper; - add_file_handler (input_fd, stdin_event_handler, 0); - async_command_editing_p = 0; - /* FIXME: This is a total hack for now. PB's use of the MI implicitly - relies on a bug in the async support which allows asynchronous - commands to leak through the commmand loop. The bug involves - (but is not limited to) the fact that sync_execution was - erroneously initialized to 0. Duplicate by initializing it - thus here... */ - sync_execution = 0; - } - - gdb_stdout = mi_stdout; - /* Route error and log output through the MI */ - gdb_stderr = mi_stderr; - gdb_stdlog = mi_stdlog; - /* Route target output through the MI. */ - gdb_stdtarg = mi_stdtarg; - - /* Replace all the hooks that we know about. There really needs to be a better way - of doing this... */ - clear_interpreter_hooks (); - - show_load_progress = mi_load_progress; - - /* If we're _the_ interpreter, take control. */ - if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) - command_loop_hook = mi0_command_loop; - else if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI)) - command_loop_hook = mi1_command_loop; - else - return 0; - - return 1; -} - -int -mi_interpreter_suspend (void *data) -{ - gdb_disable_readline (); - return 1; -} - -int -mi_interpreter_delete (void *data) -{ - return 1; -} - -int -mi_interpreter_prompt (void *data, char *new_prompt) -{ - return 1; -} - -int -mi_do_one_event (void *data) -{ - return 1; -} - -void -mi_interpreter_exec_continuation (struct continuation_arg *arg) -{ - bpstat_do_actions (&stop_bpstat); - if (!target_executing) - { - fputs_unfiltered ("*stopped", raw_stdout); - mi_out_put (uiout, raw_stdout); - fputs_unfiltered ("\n", raw_stdout); - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); - do_exec_cleanups (ALL_CLEANUPS); - } - else if (target_can_async_p ()) - { - add_continuation (mi_interpreter_exec_continuation, NULL); - } -} - -enum mi_cmd_result -mi_cmd_interpreter_exec (char *command, char **argv, int argc) -{ - struct gdb_interpreter *old_interp, *interp_to_use; - enum mi_cmd_result result = MI_CMD_DONE; - int i, old_quiet; - struct gdb_interpreter_procs *procs; - - if (argc < 2) - { - xasprintf (&mi_error_message, - "Wrong # or arguments, should be \"%s interp cmd \".", - command); - return MI_CMD_ERROR; - } - - old_interp = gdb_current_interpreter (); - - interp_to_use = gdb_lookup_interpreter (argv[0]); - if (interp_to_use == NULL) - { - xasprintf (&mi_error_message, - "Could not find interpreter \"%s\".", argv[0]); - return MI_CMD_ERROR; - } - - procs = gdb_interpreter_get_procs (interp_to_use); - if (!procs->exec_proc) - { - xasprintf (&mi_error_message, - "Interpreter \"%s\" does not support command execution.", - argv[0]); - return MI_CMD_ERROR; - } - old_quiet = gdb_interpreter_set_quiet (interp_to_use, 1); - - if (!gdb_set_interpreter (interp_to_use)) - { - xasprintf (&mi_error_message, - "Could not switch to interpreter \"%s\".", argv[0]); - return MI_CMD_ERROR; - } - - /* Insert the MI out hooks, making sure to also call the interpreter's hooks - if it has any. */ - - mi_insert_notify_hooks (); - - /* Now run the code... */ - - for (i = 1; i < argc; i++) - { - char *buff = NULL; - /* Do this in a cleaner way... We want to force execution to be - asynchronous for commands that run the target. */ - if (target_can_async_p () && (strcmp (argv[0], "console") == 0)) - { - int len = strlen (argv[i]); - buff = xmalloc (len + 2); - memcpy (buff, argv[i], len); - buff[len] = '&'; - buff[len + 1] = '\0'; - } - - /* We had to set sync_execution = 0 for the mi (well really for Project - Builder's use of the mi - particularly so interrupting would work. - But for console commands to work, we need to initialize it to 1 - - since that is what the cli expects - before running the command, - and then set it back to 0 when we are done. */ - sync_execution = 1; - if (!procs->exec_proc (gdb_interpreter_get_data (interp_to_use), argv[i])) - { - xasprintf (&mi_error_message, - "mi_interpreter_execute: error in command: \"%s\".", - argv[i]); - - result = MI_CMD_ERROR; - break; - } - xfree (buff); - do_exec_error_cleanups (ALL_CLEANUPS); - sync_execution = 0; - - } - - /* Now do the switch... */ - - gdb_set_interpreter (old_interp); - mi_remove_notify_hooks (); - gdb_interpreter_set_quiet (interp_to_use, old_quiet); - - /* Okay, now let's see if the command set the inferior going... - Tricky point - have to do this AFTER resetting the interpreter, since - changing the interpreter will clear out all the continuations for - that interpreter... */ - - if (target_can_async_p () && target_executing) - { - fputs_unfiltered ("^running\n", raw_stdout); - add_continuation (mi_interpreter_exec_continuation, NULL); - } - - return result; -} - -enum mi_cmd_result -mi_cmd_interpreter_set (char *command, char **argv, int argc) -{ - struct gdb_interpreter *interp; - int result; - - if (argc != 1) - { - xasprintf (&mi_error_message, - "mi_cmd_interpreter_set: wrong #of args, should be 1 "); - return MI_CMD_ERROR; - } - interp = gdb_lookup_interpreter (argv[0]); - if (interp == NULL) - { - xasprintf (&mi_error_message, - "mi_cmd_interpreter_set: could not find interpreter %s", - argv[0]); - return MI_CMD_ERROR; - } - - if (interp != gdb_current_interpreter ()) - { - result = gdb_set_interpreter (interp); - if (result != 1) - { - xasprintf (&mi_error_message, - "mi_cmd_interpreter_set: error setting interpreter %s", - argv[0]); - return MI_CMD_ERROR; - } - } - - /* We don't want to put up the "done" and whatnot here, since we - * are going over to another interpreter. - */ - return MI_CMD_QUIET; -} - -/* - * mi_insert_notify_hooks - This inserts a number of hooks that are meant to produce - * async-notify ("=") MI messages while running commands in another interpreter - * using mi_interpreter_exec. The canonical use for this is to allow access to - * the gdb CLI interpreter from within the MI, while still producing MI style output - * when actions in the CLI command change gdb's state. -*/ - -static void -mi_insert_notify_hooks (void) -{ - - create_breakpoint_hook = mi_interp_create_breakpoint_hook; - delete_breakpoint_hook = mi_interp_delete_breakpoint_hook; - modify_breakpoint_hook = mi_interp_modify_breakpoint_hook; - selected_frame_level_changed_hook = mi_interp_frame_changed_hook; - context_hook = mi_interp_context_hook; - query_hook = mi_interp_query_hook; -} - -static void -mi_remove_notify_hooks () -{ - create_breakpoint_hook = NULL; - delete_breakpoint_hook = NULL; - modify_breakpoint_hook = NULL; - selected_frame_level_changed_hook = NULL; - context_hook = NULL; - query_hook = NULL; -} - -int -mi_interp_query_hook (const char *ctlstr, va_list ap) -{ - return 1; -} - -char * -mi_interp_read_one_line_hook (char *prompt, int repeat, char *anno) -{ - static char buff[256]; - printf_unfiltered ("=read-one-line,prompt=\"%s\"\n", prompt); - gdb_flush (gdb_stdout); - (void) fgets (buff, sizeof (buff), stdin); - buff[(strlen (buff) - 1)] = 0; - return buff; -} - -static void -output_control_change_notification (char *notification) -{ - printf_unfiltered ("^"); - printf_unfiltered ("%s\n", notification); - gdb_flush (gdb_stdout); -} - -static void -mi_execute_command_wrapper (char *cmd) -{ - mi_execute_command (cmd, stdin == instream); -} - -static void -mi0_command_loop (void) -{ - mi_command_loop (0); -} - -static void -mi1_command_loop (void) -{ - mi_command_loop (1); -} - -static void -mi_command_loop (int mi_version) -{ - /* HACK: Force stdout/stderr to point at the console. This avoids - any potential side effects caused by legacy code that is still - using the TUI / fputs_unfiltered_hook */ - raw_stdout = stdio_fileopen (stdout); - /* Route normal output through the MIx */ - gdb_stdout = mi_console_file_new (raw_stdout, "~"); - /* Route error and log output through the MI */ - gdb_stderr = mi_console_file_new (raw_stdout, "&"); - gdb_stdlog = gdb_stderr; - /* Route target output through the MI. */ - gdb_stdtarg = mi_console_file_new (raw_stdout, "@"); - /* HACK: Poke the ui_out table directly. Should we be creating a - mi_out object wired up to the above gdb_stdout / gdb_stderr? */ - uiout = mi_out_new (mi_version); - /* HACK: Override any other interpreter hooks. We need to create a - real event table and pass in that. */ - init_ui_hook = 0; - /* command_loop_hook = 0; */ - print_frame_info_listing_hook = 0; - query_hook = 0; - warning_hook = 0; - create_breakpoint_hook = 0; - delete_breakpoint_hook = 0; - modify_breakpoint_hook = 0; - interactive_hook = 0; - registers_changed_hook = 0; - readline_begin_hook = 0; - readline_hook = 0; - readline_end_hook = 0; - register_changed_hook = 0; - memory_changed_hook = 0; - context_hook = 0; - target_wait_hook = 0; - call_command_hook = 0; - error_hook = 0; - error_begin_hook = 0; - show_load_progress = mi_load_progress; - /* Turn off 8 bit strings in quoted output. Any character with the - high bit set is printed using C's octal format. */ - sevenbit_strings = 1; - /* Tell the world that we're alive */ - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); - if (!event_loop_p) - simplified_command_loop (mi_input, mi_execute_command); - else - start_event_loop (); -} - -static char * -mi_input (char *buf) -{ - return gdb_readline (NULL); -} - -void -_initialize_mi_interp (void) -{ - struct gdb_interpreter_procs procs = - { - mi_interpreter_init, /* init_proc */ - mi_interpreter_resume, /* resume_proc */ - NULL, /* do_one_event_proc */ - mi_interpreter_suspend, /* suspend_proc */ - mi_interpreter_delete, /* delete_proc */ - NULL, /* exec_proc */ - mi_interpreter_prompt /* prompt_proc */ - }; - - if (mi0_interp == NULL) - { - mi0_interp = - gdb_new_interpreter (GDB_INTERPRETER_MI0, NULL, mi_out_new (0), - &procs); - if (mi0_interp == NULL) - error - ("Couldn't allocate a new interpreter for the mi0 interpreter\n"); - if (gdb_add_interpreter (mi0_interp) != 1) - error ("Couldn't add the mi0 interpreter to gdb.\n"); - } - - if (mi_interp == NULL) - { - mi_interp = - gdb_new_interpreter (GDB_INTERPRETER_MI, NULL, mi_out_new (1), - &procs); - if (mi_interp == NULL) - error - ("Couldn't allocate a new interpreter for the mi interpreter\n"); - if (gdb_add_interpreter (mi_interp) != 1) - error ("Couldn't add the mi interpreter to gdb.\n"); - } -} diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 1e9baed91e4..bd8cd67081d 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -33,7 +33,6 @@ #include "mi-console.h" #include "ui-out.h" #include "mi-out.h" -#include "interps.h" #include "event-loop.h" #include "event-top.h" #include "gdbcore.h" /* for write_memory() */ @@ -78,25 +77,27 @@ struct ui_file *raw_stdout; /* The token of the last asynchronous command */ static char *last_async_command; static char *previous_async_command; -char *mi_error_message; +static char *mi_error_message; static char *old_regs; extern void _initialize_mi_main (void); -void mi_execute_command (char *cmd, int from_tty); +static char *mi_input (char *); +static void mi_execute_command (char *cmd, int from_tty); static enum mi_cmd_result mi_cmd_execute (struct mi_parse *parse); static void mi_execute_cli_command (const char *cli, char *args); static enum mi_cmd_result mi_execute_async_cli_command (char *mi, char *args, int from_tty); +static void mi_execute_command_wrapper (char *cmd); void mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg); static int register_changed_p (int regnum); static int get_register (int regnum, int format); -void mi_load_progress (const char *section_name, - unsigned long sent_so_far, - unsigned long total_section, - unsigned long total_sent, - unsigned long grand_total); +static void mi_load_progress (const char *section_name, + unsigned long sent_so_far, + unsigned long total_section, + unsigned long total_sent, + unsigned long grand_total); /* FIXME: these should go in some .h file, but infcmd.c doesn't have a corresponding .h file. These wrappers will be obsolete anyway, once @@ -1079,12 +1080,7 @@ captured_mi_execute_command (struct ui_out *uiout, void *data) if (!target_can_async_p () || !target_executing) { - /* print the result if there were no errors - - Remember that on the way out of executing a command, you have - to directly use the mi_interp's uiout, since the command could - have reset the interpreter, in which case the current uiout - will most likely crash in the mi_out_* routines. */ + /* print the result if there were no errors */ if (args->rc == MI_CMD_DONE) { fputs_unfiltered (context->token, raw_stdout); @@ -1132,21 +1128,15 @@ captured_mi_execute_command (struct ui_out *uiout, void *data) /* FIXME: If the command string has something that looks like a format spec (e.g. %s) we will get a core dump */ mi_execute_cli_command ("%s", context->command); - - /* If we changed interpreters, DON'T print out anything. */ - if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI) - || gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) - { - /* print the result */ - /* FIXME: Check for errors here. */ - fputs_unfiltered (context->token, raw_stdout); - fputs_unfiltered ("^done", raw_stdout); - mi_out_put (uiout, raw_stdout); - mi_out_rewind (uiout); - fputs_unfiltered ("\n", raw_stdout); - args->action = EXECUTE_COMMAND_DISPLAY_PROMPT; - args->rc = MI_CMD_DONE; - } + /* print the result */ + /* FIXME: Check for errors here. */ + fputs_unfiltered (context->token, raw_stdout); + fputs_unfiltered ("^done", raw_stdout); + mi_out_put (uiout, raw_stdout); + mi_out_rewind (uiout); + fputs_unfiltered ("\n", raw_stdout); + args->action = EXECUTE_COMMAND_DISPLAY_PROMPT; + args->rc = MI_CMD_DONE; break; } @@ -1161,7 +1151,7 @@ mi_execute_command (char *cmd, int from_tty) struct mi_parse *command; struct captured_mi_execute_command_args args; struct ui_out *saved_uiout = uiout; - int result; + int result, rc; /* This is to handle EOF (^D). We just quit gdb. */ /* FIXME: we should call some API function here. */ @@ -1199,13 +1189,10 @@ mi_execute_command (char *cmd, int from_tty) mi_parse_free (command); } - if (args.rc != MI_CMD_QUIET) - { - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); - /* print any buffered hook code */ - /* ..... */ - } + fputs_unfiltered ("(gdb) \n", raw_stdout); + gdb_flush (raw_stdout); + /* print any buffered hook code */ + /* ..... */ } static enum mi_cmd_result @@ -1272,6 +1259,12 @@ mi_cmd_execute (struct mi_parse *parse) } } +static void +mi_execute_command_wrapper (char *cmd) +{ + mi_execute_command (cmd, stdin == instream); +} + /* FIXME: This is just a hack so we can get some extra commands going. We don't want to channel things through the CLI, but call libgdb directly */ /* Use only for synchronous commands */ @@ -1374,7 +1367,13 @@ mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg) do_exec_cleanups (ALL_CLEANUPS); } -void +static char * +mi_input (char *buf) +{ + return gdb_readline (NULL); +} + +static void mi_load_progress (const char *section_name, unsigned long sent_so_far, unsigned long total_section, @@ -1386,8 +1385,7 @@ mi_load_progress (const char *section_name, static char *previous_sect_name = NULL; int new_section; - if (!gdb_current_interpreter_is_named (GDB_INTERPRETER_MI) - && !gdb_current_interpreter_is_named (GDB_INTERPRETER_MI0)) + if (!interpreter_p || strncmp (interpreter_p, "mi", 2) != 0) return; update_threshold.tv_sec = 0; @@ -1444,17 +1442,118 @@ mi_load_progress (const char *section_name, } } -void -mi_setup_architecture_data (void) +static void +mi_command_loop (int mi_version) +{ + /* HACK: Force stdout/stderr to point at the console. This avoids + any potential side effects caused by legacy code that is still + using the TUI / fputs_unfiltered_hook */ + raw_stdout = stdio_fileopen (stdout); + /* Route normal output through the MIx */ + gdb_stdout = mi_console_file_new (raw_stdout, "~"); + /* Route error and log output through the MI */ + gdb_stderr = mi_console_file_new (raw_stdout, "&"); + gdb_stdlog = gdb_stderr; + /* Route target output through the MI. */ + gdb_stdtarg = mi_console_file_new (raw_stdout, "@"); + + /* HACK: Poke the ui_out table directly. Should we be creating a + mi_out object wired up to the above gdb_stdout / gdb_stderr? */ + uiout = mi_out_new (mi_version); + + /* HACK: Override any other interpreter hooks. We need to create a + real event table and pass in that. */ + init_ui_hook = 0; + /* command_loop_hook = 0; */ + print_frame_info_listing_hook = 0; + query_hook = 0; + warning_hook = 0; + create_breakpoint_hook = 0; + delete_breakpoint_hook = 0; + modify_breakpoint_hook = 0; + interactive_hook = 0; + registers_changed_hook = 0; + readline_begin_hook = 0; + readline_hook = 0; + readline_end_hook = 0; + register_changed_hook = 0; + memory_changed_hook = 0; + context_hook = 0; + target_wait_hook = 0; + call_command_hook = 0; + error_hook = 0; + error_begin_hook = 0; + show_load_progress = mi_load_progress; + + /* Turn off 8 bit strings in quoted output. Any character with the + high bit set is printed using C's octal format. */ + sevenbit_strings = 1; + + /* Tell the world that we're alive */ + fputs_unfiltered ("(gdb) \n", raw_stdout); + gdb_flush (raw_stdout); + + if (!event_loop_p) + simplified_command_loop (mi_input, mi_execute_command); + else + start_event_loop (); +} + +static void +mi0_command_loop (void) +{ + mi_command_loop (0); +} + +static void +mi1_command_loop (void) +{ + mi_command_loop (1); +} + +static void +setup_architecture_data (void) { /* don't trust REGISTER_BYTES to be zero. */ old_regs = xmalloc (REGISTER_BYTES + 1); memset (old_regs, 0, REGISTER_BYTES + 1); } +static void +mi_init_ui (char *arg0) +{ + /* Eventually this will contain code that takes control of the + console. */ +} + void -mi_register_gdbarch_swap (void) +_initialize_mi_main (void) { + if (interpreter_p == NULL) + return; + + /* If we're _the_ interpreter, take control. */ + if (strcmp (interpreter_p, "mi0") == 0) + command_loop_hook = mi0_command_loop; + else if (strcmp (interpreter_p, "mi") == 0 + || strcmp (interpreter_p, "mi1") == 0) + command_loop_hook = mi1_command_loop; + else + return; + + init_ui_hook = mi_init_ui; + setup_architecture_data (); register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL); - register_gdbarch_swap (NULL, 0, mi_setup_architecture_data); + register_gdbarch_swap (NULL, 0, setup_architecture_data); + if (event_loop_p) + { + /* These overwrite some of the initialization done in + _intialize_event_loop. */ + call_readline = gdb_readline2; + input_handler = mi_execute_command_wrapper; + add_file_handler (input_fd, stdin_event_handler, 0); + async_command_editing_p = 0; + } + /* FIXME: Should we notify main that we are here as a possible + interpreter? */ } diff --git a/gdb/mi/mi.h b/gdb/mi/mi.h deleted file mode 100644 index cc921e71660..00000000000 --- a/gdb/mi/mi.h +++ /dev/null @@ -1,43 +0,0 @@ -/* MI Internal Functions - Copyright 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef MI_H -#define MI_H -/* The mi interpreters. */ -struct gdb_interpreter; -extern struct gdb_interpreter *mi_interp; -extern struct gdb_interpreter *mi0_interp; - -extern void mi_setup_architecture_data (void); -extern void mi_register_gdbarch_swap (void); - -/* Events/Hooks */ -extern void mi_load_progress (const char *section_name, - unsigned long sent_so_far, - unsigned long total_section, - unsigned long total_sent, - unsigned long grand_total); -extern void mi_interp_create_breakpoint_hook (struct breakpoint *bpt); -extern void mi_interp_delete_breakpoint_hook (struct breakpoint *bpt); -extern void mi_interp_modify_breakpoint_hook (struct breakpoint *bpt); -extern void mi_interp_frame_changed_hook (int new_frame_number); -extern void mi_interp_context_hook (int thread_id); - -#endif /* MI_H */ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c deleted file mode 100644 index 0d33683a4c4..00000000000 --- a/gdb/ppc-sysv-tdep.c +++ /dev/null @@ -1,312 +0,0 @@ -/* Target-dependent code for PowerPC systems using the SVR4 ABI - for GDB, the GNU debugger. - - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "gdbcore.h" -#include "inferior.h" -#include "regcache.h" -#include "value.h" - -#include "ppc-tdep.h" - -/* round2 rounds x up to the nearest multiple of s assuming that s is a - power of 2 */ - -#undef round2 -#define round2(x,s) ((((long) (x) - 1) & ~(long)((s)-1)) + (s)) - -/* Pass the arguments in either registers, or in the stack. Using the - ppc sysv ABI, the first eight words of the argument list (that might - be less than eight parameters if some parameters occupy more than one - word) are passed in r3..r10 registers. float and double parameters are - passed in fpr's, in addition to that. Rest of the parameters if any - are passed in user stack. - - If the function is returning a structure, then the return address is passed - in r3, then the first 7 words of the parametes can be passed in registers, - starting from r4. */ - -CORE_ADDR -ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr) -{ - int argno; - /* Next available general register for non-float, non-vector arguments. */ - int greg; - /* Next available floating point register for float arguments. */ - int freg; - /* Next available vector register for vector arguments. */ - int vreg; - int argstkspace; - int structstkspace; - int argoffset; - int structoffset; - struct value *arg; - struct type *type; - int len; - char old_sp_buf[4]; - CORE_ADDR saved_sp; - - greg = struct_return ? 4 : 3; - freg = 1; - vreg = 2; - argstkspace = 0; - structstkspace = 0; - - /* Figure out how much new stack space is required for arguments - which don't fit in registers. Unlike the PowerOpen ABI, the - SysV ABI doesn't reserve any extra space for parameters which - are put in registers. */ - for (argno = 0; argno < nargs; argno++) - { - arg = args[argno]; - type = check_typedef (VALUE_TYPE (arg)); - len = TYPE_LENGTH (type); - - if (TYPE_CODE (type) == TYPE_CODE_FLT) - { - if (freg <= 8) - freg++; - else - { - /* SysV ABI converts floats to doubles when placed in - memory and requires 8 byte alignment */ - if (argstkspace & 0x4) - argstkspace += 4; - argstkspace += 8; - } - } - else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */ - { - if (greg > 9) - { - greg = 11; - if (argstkspace & 0x4) - argstkspace += 4; - argstkspace += 8; - } - else - { - if ((greg & 1) == 0) - greg++; - greg += 2; - } - } - else if (!TYPE_VECTOR (type)) - { - if (len > 4 - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) - { - /* Rounding to the nearest multiple of 8 may not be necessary, - but it is safe. Particularly since we don't know the - field types of the structure */ - structstkspace += round2 (len, 8); - } - if (greg <= 10) - greg++; - else - argstkspace += 4; - } - else - { - if (len == 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_VECTOR (type)) - { - if (vreg <= 13) - vreg++; - else - { - /* Vector arguments must be aligned to 16 bytes on - the stack. */ - argstkspace += round2 (argstkspace, 16); - argstkspace += 16; - } - } - } - } - - /* Get current SP location */ - saved_sp = read_sp (); - - sp -= argstkspace + structstkspace; - - /* Allocate space for backchain and callee's saved lr */ - sp -= 8; - - /* Make sure that we maintain 16 byte alignment */ - sp &= ~0x0f; - - /* Update %sp before proceeding any further */ - write_register (SP_REGNUM, sp); - - /* write the backchain */ - store_address (old_sp_buf, 4, saved_sp); - write_memory (sp, old_sp_buf, 4); - - argoffset = 8; - structoffset = argoffset + argstkspace; - freg = 1; - greg = 3; - vreg = 2; - /* Fill in r3 with the return structure, if any */ - if (struct_return) - { - char val_buf[4]; - store_address (val_buf, 4, struct_addr); - memcpy (®isters[REGISTER_BYTE (greg)], val_buf, 4); - greg++; - } - /* Now fill in the registers and stack... */ - for (argno = 0; argno < nargs; argno++) - { - arg = args[argno]; - type = check_typedef (VALUE_TYPE (arg)); - len = TYPE_LENGTH (type); - - if (TYPE_CODE (type) == TYPE_CODE_FLT) - { - if (freg <= 8) - { - if (len > 8) - printf_unfiltered ( - "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM + freg)], - VALUE_CONTENTS (arg), len); - freg++; - } - else - { - /* SysV ABI converts floats to doubles when placed in - memory and requires 8 byte alignment */ - /* FIXME: Convert floats to doubles */ - if (argoffset & 0x4) - argoffset += 4; - write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len); - argoffset += 8; - } - } - else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */ - { - if (greg > 9) - { - greg = 11; - if (argoffset & 0x4) - argoffset += 4; - write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len); - argoffset += 8; - } - else - { - if ((greg & 1) == 0) - greg++; - - memcpy (®isters[REGISTER_BYTE (greg)], - VALUE_CONTENTS (arg), 4); - memcpy (®isters[REGISTER_BYTE (greg + 1)], - VALUE_CONTENTS (arg) + 4, 4); - greg += 2; - } - } - else if (!TYPE_VECTOR (type)) - { - char val_buf[4]; - if (len > 4 - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) - { - write_memory (sp + structoffset, VALUE_CONTENTS (arg), len); - store_address (val_buf, 4, sp + structoffset); - structoffset += round2 (len, 8); - } - else - { - memset (val_buf, 0, 4); - memcpy (val_buf, VALUE_CONTENTS (arg), len); - } - if (greg <= 10) - { - memcpy (®isters[REGISTER_BYTE (greg)], val_buf, 4); - greg++; - } - else - { - write_memory (sp + argoffset, val_buf, 4); - argoffset += 4; - } - } - else - { - if (len == 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_VECTOR (type)) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - char *v_val_buf = alloca (16); - memset (v_val_buf, 0, 16); - memcpy (v_val_buf, VALUE_CONTENTS (arg), len); - if (vreg <= 13) - { - memcpy (®isters[REGISTER_BYTE (tdep->ppc_vr0_regnum - + vreg)], - v_val_buf, 16); - vreg++; - } - else - { - write_memory (sp + argoffset, v_val_buf, 16); - argoffset += 16; - } - } - } - } - - target_store_registers (-1); - return sp; -} - -/* Until November 2001, gcc was not complying to the SYSV ABI for - returning structures less than or equal to 8 bytes in size. It was - returning everything in memory. When this was corrected, it wasn't - fixed for native platforms. */ -int -ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type) -{ - if (TYPE_LENGTH (value_type) == 16 - && TYPE_VECTOR (value_type)) - return 0; - - return generic_use_struct_convention (gcc_p, value_type); -} - -/* Structures 8 bytes or less long are returned in the r3 & r4 - registers, according to the SYSV ABI. */ -int -ppc_sysv_abi_use_struct_convention (int gcc_p, struct type *value_type) -{ - if (TYPE_LENGTH (value_type) == 16 - && TYPE_VECTOR (value_type)) - return 0; - - return (TYPE_LENGTH (value_type) > 8); -} diff --git a/gdb/sim-regno.h b/gdb/sim-regno.h deleted file mode 100644 index 5a7057b6b04..00000000000 --- a/gdb/sim-regno.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Generic remote debugging interface for simulators. - - Copyright 2002 Free Software Foundation, Inc. - - Contributed by Red Hat, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef SIM_REGNO_H -#define SIM_REGNO_H - -/* The REGISTER_SIM_REGNO(REGNUM) method, when there is a - corresponding simulator register, returns that register number as a - cardinal. When there is no corresponding register, it returns a - negative value. */ - -enum sim_regno { - /* Normal sane architecture. The simulator is known to not model - this register. */ - SIM_REGNO_DOES_NOT_EXIST = -1, - /* For possible backward compatibility. The register cache doesn't - have a corresponding name. Skip the register entirely. */ - LEGACY_SIM_REGNO_IGNORE = -2 -}; - -/* Treat all raw registers as valid. */ - -extern int one2one_register_sim_regno (int regnum); - -#endif diff --git a/gdb/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c deleted file mode 100644 index a991d0ef2a4..00000000000 --- a/gdb/sparc64nbsd-nat.c +++ /dev/null @@ -1,207 +0,0 @@ -/* Native-dependent code for UltraSPARC systems running NetBSD. - Copyright 2002 Free Software Foundation, Inc. - Contributed by Wasabi Systems, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "regcache.h" - -#include "sparcnbsd-tdep.h" - -#include -#include -#include - -/* NOTE: We don't bother with any of the deferred_store nonsense; it - makes things a lot more complicated than they need to be. */ - -/* Determine if PT_GETREGS fetches this register. */ -static int -getregs_supplies (int regno) -{ - /* FIXME: PS_REGNUM for 32-bit code. */ - return (regno == TSTATE_REGNUM - || regno == PC_REGNUM - || regno == NPC_REGNUM - || regno == Y_REGNUM - || (regno >= G0_REGNUM && regno <= G7_REGNUM) - || (regno >= O0_REGNUM && regno <= O7_REGNUM) - /* stack regs (handled by sparcnbsd_supply_reg) */ - || (regno >= L0_REGNUM && regno <= I7_REGNUM)); -} - -/* Determine if PT_GETFPREGS fetches this register. */ -static int -getfpregs_supplies (int regno) -{ - return ((regno >= FP0_REGNUM && regno <= (FP0_REGNUM + 47)) - || regno == FPS_REGNUM); -} - -void -fetch_inferior_registers (int regno) -{ - /* We don't use deferred stores. */ - if (deferred_stores) - internal_error (__FILE__, __LINE__, - "fetch_inferior_registers: deferred stores pending"); - - if (regno == -1 || getregs_supplies (regno)) - { - union { - struct reg32 regs32; - struct reg64 regs64; - } regs; - - if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't get registers"); - - if (gdbarch_ptr_bit (current_gdbarch) == 32) - sparcnbsd_supply_reg32 ((char *) ®s.regs32, regno); - else - sparcnbsd_supply_reg64 ((char *) ®s.regs64, regno); - if (regno != -1) - return; - } - - if (regno == -1 || getfpregs_supplies (regno)) - { - union { - struct fpreg32 fpregs32; - struct fpreg64 fpregs64; - } fpregs; - - if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't get floating point registers"); - - if (gdbarch_ptr_bit (current_gdbarch) == 32) - sparcnbsd_supply_fpreg32 ((char *) &fpregs.fpregs32, regno); - else - sparcnbsd_supply_fpreg64 ((char *) &fpregs.fpregs64, regno); - if (regno != -1) - return; - } -} - -void -store_inferior_registers (int regno) -{ - /* We don't use deferred stores. */ - if (deferred_stores) - internal_error (__FILE__, __LINE__, - "store_inferior_registers: deferred stores pending"); - - if (regno == -1 || getregs_supplies (regno)) - { - union { - struct reg32 regs32; - struct reg64 regs64; - } regs; - - if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't get registers"); - - if (gdbarch_ptr_bit (current_gdbarch) == 32) - sparcnbsd_fill_reg32 ((char *) ®s.regs32, regno); - else - sparcnbsd_fill_reg64 ((char *) ®s.regs64, regno); - - if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't write registers"); - - /* Deal with the stack regs. */ - if (regno == -1 || regno == SP_REGNUM - || (regno >= L0_REGNUM && regno <= I7_REGNUM)) - { - CORE_ADDR sp = read_register (SP_REGNUM); - int i; - char buf[8]; - - if (sp & 1) - { - /* Registers are 64-bit. */ - sp += 2047; - - for (i = L0_REGNUM; i <= I7_REGNUM; i++) - { - if (regno == -1 || regno == SP_REGNUM || regno == i) - { - regcache_collect (i, buf); - target_write_memory (sp + ((i - L0_REGNUM) * 8), - buf, sizeof (buf)); - } - } - } - else - { - /* Registers are 32-bit. Toss any sign-extension of the stack - pointer. - - FIXME: We don't currently handle 32-bit code in a binary - that indicated LP64. Do we have to care about that? */ - if (gdbarch_ptr_bit (current_gdbarch) != 32) - internal_error - (__FILE__, __LINE__, - "store_inferior_registers: 32-bit code in 64-bit inferior"); - - sp &= 0xffffffffUL; - for (i = L0_REGNUM; i <= I7_REGNUM; i++) - { - if (regno == -1 || regno == SP_REGNUM || regno == i) - { - regcache_collect (i, buf); - target_write_memory (sp + ((i - L0_REGNUM) * 4), buf, 4); - } - } - } - } - - if (regno != -1) - return; - } - - if (regno == -1 || getfpregs_supplies (regno)) - { - union { - struct fpreg32 fpregs32; - struct fpreg64 fpregs64; - } fpregs; - - if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't get floating point registers"); - - if (gdbarch_ptr_bit (current_gdbarch) == 32) - sparcnbsd_fill_fpreg32 ((char *) &fpregs.fpregs32, regno); - else - sparcnbsd_fill_fpreg64 ((char *) &fpregs.fpregs64, regno); - - if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't write floating point registers"); - - if (regno != -1) - return; - } -} diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c deleted file mode 100644 index ce5d44dc6b4..00000000000 --- a/gdb/sparcnbsd-nat.c +++ /dev/null @@ -1,154 +0,0 @@ -/* Native-dependent code for SPARC systems running NetBSD. - Copyright 2002 Free Software Foundation, Inc. - Contributed by Wasabi Systems, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "regcache.h" - -#include "sparcnbsd-tdep.h" - -#include -#include -#include - -/* NOTE: We don't bother with any of the deferred_store nonsense; it - makes things a lot more complicated than they need to be. */ - -/* Determine if PT_GETREGS fetches this register. */ -static int -getregs_supplies (int regno) -{ - return (regno == PS_REGNUM - || regno == PC_REGNUM - || regno == NPC_REGNUM - || regno == Y_REGNUM - || (regno >= G0_REGNUM && regno <= G7_REGNUM) - || (regno >= O0_REGNUM && regno <= O7_REGNUM) - /* stack regs (handled by sparcnbsd_supply_reg) */ - || (regno >= L0_REGNUM && regno <= I7_REGNUM)); -} - -/* Determine if PT_GETFPREGS fetches this register. */ -static int -getfpregs_supplies (int regno) -{ - return ((regno >= FP0_REGNUM && regno <= (FP0_REGNUM + 31)) - || regno == FPS_REGNUM); -} - -void -fetch_inferior_registers (int regno) -{ - /* We don't use deferred stores. */ - if (deferred_stores) - internal_error (__FILE__, __LINE__, - "fetch_inferior_registers: deferred stores pending"); - - if (regno == -1 || getregs_supplies (regno)) - { - struct reg regs; - - if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't get registers"); - - sparcnbsd_supply_reg32 ((char *) ®s, regno); - if (regno != -1) - return; - } - - if (regno == -1 || getfpregs_supplies (regno)) - { - struct fpreg fpregs; - - if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't get floating point registers"); - - sparcnbsd_supply_fpreg32 ((char *) &fpregs, regno); - if (regno != -1) - return; - } -} - -void -store_inferior_registers (int regno) -{ - /* We don't use deferred stores. */ - if (deferred_stores) - internal_error (__FILE__, __LINE__, - "store_inferior_registers: deferred stores pending"); - - if (regno == -1 || getregs_supplies (regno)) - { - struct reg regs; - - if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't get registers"); - - sparcnbsd_fill_reg32 ((char *) ®s, regno); - - if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't write registers"); - - /* Deal with the stack regs. */ - if (regno == -1 || regno == SP_REGNUM - || (regno >= L0_REGNUM && regno <= I7_REGNUM)) - { - CORE_ADDR sp = read_register (SP_REGNUM); - int i; - char buf[4]; - - for (i = L0_REGNUM; i <= I7_REGNUM; i++) - { - if (regno == -1 || regno == SP_REGNUM || regno == i) - { - regcache_collect (i, buf); - target_write_memory (sp + ((i - L0_REGNUM) * 4), - buf, sizeof (buf)); - } - } - } - - if (regno != -1) - return; - } - - if (regno == -1 || getfpregs_supplies (regno)) - { - struct fpreg fpregs; - - if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't get floating point registers"); - - sparcnbsd_fill_fpreg32 ((char *) &fpregs, regno); - - if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't write floating point registers"); - - if (regno != -1) - return; - } -} diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c deleted file mode 100644 index ea70e517b6d..00000000000 --- a/gdb/sparcnbsd-tdep.c +++ /dev/null @@ -1,531 +0,0 @@ -/* Target-dependent code for SPARC systems running NetBSD. - Copyright 2002 Free Software Foundation, Inc. - Contributed by Wasabi Systems, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "gdbcore.h" -#include "regcache.h" -#include "target.h" -#include "value.h" -#include "osabi.h" - -#include "sparcnbsd-tdep.h" -#include "nbsd-tdep.h" - -#include "solib-svr4.h" - -#define REG32_OFFSET_PSR (0 * 4) -#define REG32_OFFSET_PC (1 * 4) -#define REG32_OFFSET_NPC (2 * 4) -#define REG32_OFFSET_Y (3 * 4) -#define REG32_OFFSET_GLOBAL (4 * 4) -#define REG32_OFFSET_OUT (12 * 4) - -#define REG64_OFFSET_TSTATE (0 * 8) -#define REG64_OFFSET_PC (1 * 8) -#define REG64_OFFSET_NPC (2 * 8) -#define REG64_OFFSET_Y (3 * 8) -#define REG64_OFFSET_GLOBAL (4 * 8) -#define REG64_OFFSET_OUT (12 * 8) - -void -sparcnbsd_supply_reg32 (char *regs, int regno) -{ - int i; - - if (regno == PS_REGNUM || regno == -1) - supply_register (PS_REGNUM, regs + REG32_OFFSET_PSR); - - if (regno == PC_REGNUM || regno == -1) - supply_register (PC_REGNUM, regs + REG32_OFFSET_PC); - - if (regno == NPC_REGNUM || regno == -1) - supply_register (NPC_REGNUM, regs + REG32_OFFSET_NPC); - - if (regno == Y_REGNUM || regno == -1) - supply_register (Y_REGNUM, regs + REG32_OFFSET_Y); - - if ((regno >= G0_REGNUM && regno <= G7_REGNUM) || regno == -1) - { - if (regno == G0_REGNUM || regno == -1) - supply_register (G0_REGNUM, NULL); /* %g0 is always zero */ - for (i = G1_REGNUM; i <= G7_REGNUM; i++) - { - if (regno == i || regno == -1) - supply_register (i, regs + REG32_OFFSET_GLOBAL + - ((i - G0_REGNUM) * 4)); - } - } - - if ((regno >= O0_REGNUM && regno <= O7_REGNUM) || regno == -1) - { - for (i = O0_REGNUM; i <= O7_REGNUM; i++) - { - if (regno == i || regno == -1) - supply_register (i, regs + REG32_OFFSET_OUT + - ((i - O0_REGNUM) * 4)); - } - } - - /* Inputs and Locals are stored onto the stack by by the kernel. */ - if ((regno >= L0_REGNUM && regno <= I7_REGNUM) || regno == -1) - { - CORE_ADDR sp = read_register (SP_REGNUM); - char buf[4]; - - for (i = L0_REGNUM; i <= I7_REGNUM; i++) - { - if (regno == i || regno == -1) - { - target_read_memory (sp + ((i - L0_REGNUM) * 4), - buf, sizeof (buf)); - supply_register (i, buf); - } - } - } - - /* FIXME: If we don't set these valid, read_register_bytes() rereads - all the regs every time it is called! */ - if (regno == WIM_REGNUM || regno == -1) - supply_register (WIM_REGNUM, NULL); - if (regno == TBR_REGNUM || regno == -1) - supply_register (TBR_REGNUM, NULL); - if (regno == CPS_REGNUM || regno == -1) - supply_register (CPS_REGNUM, NULL); -} - -void -sparcnbsd_supply_reg64 (char *regs, int regno) -{ - int i; - char buf[8]; - - if (regno == TSTATE_REGNUM || regno == -1) - supply_register (PS_REGNUM, regs + REG64_OFFSET_TSTATE); - - if (regno == PC_REGNUM || regno == -1) - supply_register (PC_REGNUM, regs + REG64_OFFSET_PC); - - if (regno == NPC_REGNUM || regno == -1) - supply_register (NPC_REGNUM, regs + REG64_OFFSET_NPC); - - if (regno == Y_REGNUM || regno == -1) - { - memset (buf, 0, sizeof (buf)); - memcpy (&buf[4], regs + REG64_OFFSET_Y, 4); - supply_register (Y_REGNUM, buf); - } - - if ((regno >= G0_REGNUM && regno <= G7_REGNUM) || regno == -1) - { - if (regno == G0_REGNUM || regno == -1) - supply_register (G0_REGNUM, NULL); /* %g0 is always zero */ - for (i = G1_REGNUM; i <= G7_REGNUM; i++) - { - if (regno == i || regno == -1) - supply_register (i, regs + REG64_OFFSET_GLOBAL + - ((i - G0_REGNUM) * 8)); - } - } - - if ((regno >= O0_REGNUM && regno <= O7_REGNUM) || regno == -1) - { - for (i = O0_REGNUM; i <= O7_REGNUM; i++) - { - if (regno == i || regno == -1) - supply_register (i, regs + REG64_OFFSET_OUT + - ((i - O0_REGNUM) * 8)); - } - } - - /* Inputs and Locals are stored onto the stack by by the kernel. */ - if ((regno >= L0_REGNUM && regno <= I7_REGNUM) || regno == -1) - { - CORE_ADDR sp = read_register (SP_REGNUM); - char buf[8]; - - if (sp & 1) - { - /* Registers are 64-bit. */ - sp += 2047; - - for (i = L0_REGNUM; i <= I7_REGNUM; i++) - { - if (regno == i || regno == -1) - { - target_read_memory (sp + ((i - L0_REGNUM) * 8), - buf, sizeof (buf)); - supply_register (i, buf); - } - } - } - else - { - /* Registers are 32-bit. Toss any sign-extension of the stack - pointer, clear out the top half of the temporary buffer, and - put the register value in the bottom half. */ - - sp &= 0xffffffffUL; - memset (buf, 0, sizeof (buf)); - for (i = L0_REGNUM; i <= I7_REGNUM; i++) - { - if (regno == i || regno == -1) - { - target_read_memory (sp + ((i - L0_REGNUM) * 4), - &buf[4], sizeof (buf)); - supply_register (i, buf); - } - } - } - } - - /* FIXME: If we don't set these valid, read_register_bytes() rereads - all the regs every time it is called! */ - if (regno == WIM_REGNUM || regno == -1) - supply_register (WIM_REGNUM, NULL); - if (regno == TBR_REGNUM || regno == -1) - supply_register (TBR_REGNUM, NULL); - if (regno == CPS_REGNUM || regno == -1) - supply_register (CPS_REGNUM, NULL); -} - -void -sparcnbsd_fill_reg32 (char *regs, int regno) -{ - int i; - - if (regno == PS_REGNUM || regno == -1) - regcache_collect (PS_REGNUM, regs + REG32_OFFSET_PSR); - - if (regno == PC_REGNUM || regno == -1) - regcache_collect (PC_REGNUM, regs + REG32_OFFSET_PC); - - if (regno == NPC_REGNUM || regno == -1) - regcache_collect (NPC_REGNUM, regs + REG32_OFFSET_NPC); - - if (regno == Y_REGNUM || regno == -1) - regcache_collect (Y_REGNUM, regs + REG32_OFFSET_Y); - - if ((regno >= G0_REGNUM && regno <= G7_REGNUM) || regno == -1) - { - /* %g0 is always zero */ - for (i = G1_REGNUM; i <= G7_REGNUM; i++) - { - if (regno == i || regno == -1) - regcache_collect (i, regs + REG32_OFFSET_GLOBAL + - ((i - G0_REGNUM) * 4)); - } - } - - if ((regno >= O0_REGNUM && regno <= O7_REGNUM) || regno == -1) - { - for (i = O0_REGNUM; i <= O7_REGNUM; i++) - { - if (regno == i || regno == -1) - regcache_collect (i, regs + REG32_OFFSET_OUT + - ((i - O0_REGNUM) * 4)); - } - } - - /* Responsibility for the stack regs is pushed off onto the caller. */ -} - -void -sparcnbsd_fill_reg64 (char *regs, int regno) -{ - int i; - - if (regno == TSTATE_REGNUM || regno == -1) - regcache_collect (TSTATE_REGNUM, regs + REG64_OFFSET_TSTATE); - - if (regno == PC_REGNUM || regno == -1) - regcache_collect (PC_REGNUM, regs + REG64_OFFSET_PC); - - if (regno == NPC_REGNUM || regno == -1) - regcache_collect (NPC_REGNUM, regs + REG64_OFFSET_NPC); - - if (regno == Y_REGNUM || regno == -1) - regcache_collect (Y_REGNUM, regs + REG64_OFFSET_Y); - - if ((regno >= G0_REGNUM && regno <= G7_REGNUM) || regno == -1) - { - /* %g0 is always zero */ - for (i = G1_REGNUM; i <= G7_REGNUM; i++) - { - if (regno == i || regno == -1) - regcache_collect (i, regs + REG64_OFFSET_GLOBAL + - ((i - G0_REGNUM) * 4)); - } - } - - if ((regno >= O0_REGNUM && regno <= O7_REGNUM) || regno == -1) - { - for (i = O0_REGNUM; i <= O7_REGNUM; i++) - { - if (regno == i || regno == -1) - regcache_collect (i, regs + REG64_OFFSET_OUT + - ((i - O0_REGNUM) * 4)); - } - } - - /* Responsibility for the stack regs is pushed off onto the caller. */ -} - -void -sparcnbsd_supply_fpreg32 (char *fpregs, int regno) -{ - int i; - - for (i = 0; i <= 31; i++) - { - if (regno == (FP0_REGNUM + i) || regno == -1) - supply_register (FP0_REGNUM + i, fpregs + (i * 4)); - } - - if (regno == FPS_REGNUM || regno == -1) - supply_register (FPS_REGNUM, fpregs + (32 * 4)); -} - -void -sparcnbsd_supply_fpreg64 (char *fpregs, int regno) -{ - int i; - - for (i = 0; i <= 31; i++) - { - if (regno == (FP0_REGNUM + i) || regno == -1) - supply_register (FP0_REGNUM + i, fpregs + (i * 4)); - } - - for (; i <= 47; i++) - { - if (regno == (FP0_REGNUM + i) || regno == -1) - supply_register (FP0_REGNUM + i, fpregs + (32 * 4) + (i * 8)); - } - - if (regno == FPS_REGNUM || regno == -1) - supply_register (FPS_REGNUM, fpregs + (32 * 4) + (16 * 8)); - - /* XXX %gsr */ -} - -void -sparcnbsd_fill_fpreg32 (char *fpregs, int regno) -{ - int i; - - for (i = 0; i <= 31; i++) - { - if (regno == (FP0_REGNUM + i) || regno == -1) - regcache_collect (FP0_REGNUM + i, fpregs + (i * 4)); - } - - if (regno == FPS_REGNUM || regno == -1) - regcache_collect (FPS_REGNUM, fpregs + (32 * 4)); -} - -void -sparcnbsd_fill_fpreg64 (char *fpregs, int regno) -{ - int i; - - for (i = 0; i <= 31; i++) - { - if (regno == (FP0_REGNUM + i) || regno == -1) - regcache_collect (FP0_REGNUM + i, fpregs + (i * 4)); - } - - for (; i <= 47; i++) - { - if (regno == (FP0_REGNUM + i) || regno == -1) - regcache_collect (FP0_REGNUM + i, fpregs + (32 * 4) + (i * 8)); - } - - if (regno == FPS_REGNUM || regno == -1) - regcache_collect (FPS_REGNUM, fpregs + (32 * 4) + (16 * 8)); - - /* XXX %gsr */ -} - -/* Unlike other NetBSD implementations, the SPARC port historically used - .reg and .reg2 (see bfd/netbsd-core.c), and as such, we can share one - routine for a.out and ELF core files. */ -static void -fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, - CORE_ADDR ignore) -{ - int reg_size, fpreg_size; - - if (gdbarch_ptr_bit (current_gdbarch) == 32) - { - reg_size = (20 * 4); - fpreg_size = (33 * 4); - } - else - { - reg_size = (20 * 8); - fpreg_size = (64 * 4) - + 8 /* fsr */ - + 4 /* gsr */ - + 4; /* pad */ - } - - switch (which) - { - case 0: /* Integer registers */ - if (core_reg_size != reg_size) - warning ("Wrong size register set in core file."); - else if (gdbarch_ptr_bit (current_gdbarch) == 32) - sparcnbsd_supply_reg32 (core_reg_sect, -1); - else - sparcnbsd_supply_reg64 (core_reg_sect, -1); - break; - - case 2: /* Floating pointer registers */ - if (core_reg_size != fpreg_size) - warning ("Wrong size FP register set in core file."); - else if (gdbarch_ptr_bit (current_gdbarch) == 32) - sparcnbsd_supply_fpreg32 (core_reg_sect, -1); - else - sparcnbsd_supply_fpreg64 (core_reg_sect, -1); - break; - - default: - /* Don't know what kind of register request this is; just ignore it. */ - break; - } -} - -static struct core_fns sparcnbsd_core_fns = -{ - bfd_target_unknown_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL -}; - -static struct core_fns sparcnbsd_elfcore_fns = -{ - bfd_target_elf_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL -}; - -/* FIXME: Need PC_IN_SIGTRAMP() support, but NetBSD/sparc signal trampolines - aren't easily identified. */ - -static int -sparcnbsd_get_longjmp_target_32 (CORE_ADDR *pc) -{ - CORE_ADDR jb_addr; - char buf[4]; - - jb_addr = read_register (O0_REGNUM); - - if (target_read_memory (jb_addr + 12, buf, sizeof (buf))) - return 0; - - *pc = extract_address (buf, sizeof (buf)); - - return 1; -} - -static int -sparcnbsd_get_longjmp_target_64 (CORE_ADDR *pc) -{ - CORE_ADDR jb_addr; - char buf[8]; - - jb_addr = read_register (O0_REGNUM); - - if (target_read_memory (jb_addr + 16, buf, sizeof (buf))) - return 0; - - *pc = extract_address (buf, sizeof (buf)); - - return 1; -} - -static int -sparcnbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name) -{ - if (strcmp (name, "_DYNAMIC") == 0) - return 1; - - return 0; -} - -static void -sparcnbsd_init_abi_common (struct gdbarch_info info, - struct gdbarch *gdbarch) -{ - set_gdbarch_get_longjmp_target (gdbarch, gdbarch_ptr_bit (gdbarch) == 32 ? - sparcnbsd_get_longjmp_target_32 : - sparcnbsd_get_longjmp_target_64); -} - -static void -sparcnbsd_init_abi_aout (struct gdbarch_info info, - struct gdbarch *gdbarch) -{ - sparcnbsd_init_abi_common (info, gdbarch); - - set_gdbarch_in_solib_call_trampoline (gdbarch, - sparcnbsd_aout_in_solib_call_trampoline); -} - -static void -sparcnbsd_init_abi_elf (struct gdbarch_info info, - struct gdbarch *gdbarch) -{ - sparcnbsd_init_abi_common (info, gdbarch); - - set_solib_svr4_fetch_link_map_offsets (gdbarch, - gdbarch_ptr_bit (gdbarch) == 32 ? - nbsd_ilp32_solib_svr4_fetch_link_map_offsets : - nbsd_lp64_solib_svr4_fetch_link_map_offsets); -} - -static enum gdb_osabi -sparcnbsd_aout_osabi_sniffer (bfd *abfd) -{ - if (strcmp (bfd_get_target (abfd), "a.out-sparc-netbsd") == 0) - return GDB_OSABI_NETBSD_AOUT; - - return GDB_OSABI_UNKNOWN; -} - -void -_initialize_sparnbsd_tdep (void) -{ - gdbarch_register_osabi_sniffer (bfd_arch_sparc, bfd_target_aout_flavour, - sparcnbsd_aout_osabi_sniffer); - - gdbarch_register_osabi (bfd_arch_sparc, GDB_OSABI_NETBSD_AOUT, - sparcnbsd_init_abi_aout); - gdbarch_register_osabi (bfd_arch_sparc, GDB_OSABI_NETBSD_ELF, - sparcnbsd_init_abi_elf); - - add_core_fns (&sparcnbsd_core_fns); - add_core_fns (&sparcnbsd_elfcore_fns); -} diff --git a/gdb/sparcnbsd-tdep.h b/gdb/sparcnbsd-tdep.h deleted file mode 100644 index bad2d653c8e..00000000000 --- a/gdb/sparcnbsd-tdep.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Common target dependent code for GDB on SPARC systems running NetBSD. - Copyright 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef SPARCNBSD_TDEP_H -#define SPARCNBSD_TDEP_H - -void sparcnbsd_supply_reg32 (char *, int); -void sparcnbsd_supply_reg64 (char *, int); -void sparcnbsd_fill_reg32 (char *, int); -void sparcnbsd_fill_reg64 (char *, int); - -void sparcnbsd_supply_fpreg32 (char *, int); -void sparcnbsd_supply_fpreg64 (char *, int); -void sparcnbsd_fill_fpreg32 (char *, int); -void sparcnbsd_fill_fpreg64 (char *, int); - -#endif /* SPARCNBSD_TDEP_H */ diff --git a/gdb/testsuite/gdb.asm/x86_64.inc b/gdb/testsuite/gdb.asm/x86_64.inc deleted file mode 100644 index 5bcaeae25ab..00000000000 --- a/gdb/testsuite/gdb.asm/x86_64.inc +++ /dev/null @@ -1,39 +0,0 @@ - comment "subroutine prologue" - .macro gdbasm_enter - push %rbp - mov %rsp,%rbp - .endm - - comment "subroutine epilogue" - .macro gdbasm_leave - pop %rbp - ret - .endm - - .macro gdbasm_call subr - call \subr - .endm - - .macro gdbasm_several_nops - nop - nop - nop - nop - .endm - - comment "exit (0)" - .macro gdbasm_exit0 - hlt - .endm - - comment "crt0 startup" - .macro gdbasm_startup - xor %rbp, %rbp - .endm - - comment "Declare a data variable" - .macro gdbasm_datavar name value - .data -\name: - .long \value - .endm diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp deleted file mode 100644 index 283fe844573..00000000000 --- a/gdb/testsuite/gdb.base/macscp.exp +++ /dev/null @@ -1,403 +0,0 @@ -# Test macro scoping. -# Copyright 2002 Free Software Foundation, Inc. - -# 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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -if $tracelevel then { - strace $tracelevel -} - -set prms_id 0 -set bug_id 0 - -set testfile "macscp" -set binfile ${objdir}/${subdir}/${testfile} - -if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${binfile}" executable {debug}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - - -# Ask GDB to show the current definition of MACRO, and return a list -# describing the result. -# -# The return value has the form {FILE1 FILE2 ... DEF}, which means -# that MACRO has the definition `DEF', and was defined in `FILE1', -# which was included from `FILE2', included from ... . -# -# If GDB says that MACRO has no definition, return the string `undefined'. -# -# If GDB complains that it doesn't have any information about -# preprocessor macro definitions, return the string `no-macro-info'. -# -# If expect times out waiting for GDB, we return the string `timeout'. -# -# If GDB's output doesn't otherwise match what we're expecting, we -# return the empty string. - -proc info_macro {macro} { - global gdb_prompt - global decimal - - set filepat {macscp[0-9]+\.[ch]} - set definition {} - set location {} - - send_gdb "info macro ${macro}\n" - - set debug_me 0 - - if {$debug_me} {exp_internal 1} - gdb_expect { - -re "Defined at \[^\r\n\]*(${filepat}):${decimal}\[\r\n\]" { - # `location' and `definition' should be empty when we see - # this message. - if {[llength $location] == 0 && [llength $definition] == 0} { - set location $expect_out(1,string) - exp_continue - } else { - # Exit this expect loop, with a result indicating failure. - set definition {} - } - } - -re "The symbol `${macro}' has no definition as a C/C\\+\\+ preprocessor macro\[^\r\n\]*\[\r\n\]" { - # `location' and `definition' should be empty when we see - # this message. - if {[llength $location] == 0 && [llength $definition] == 0} { - set definition undefined - exp_continue - } else { - # Exit this expect loop, with a result indicating failure. - set definition {} - } - } - -re "^\[\r\n\]* included at \[^\r\n\]*(${filepat}):${decimal}\[\r\n\]" { - # `location' should *not* be empty when we see this - # message. It should have recorded at least the initial - # `Defined at ' message (for definitions) or ` at' message - # (for undefined symbols). - if {[llength $location] != 0} { - lappend location $expect_out(1,string) - exp_continue - } else { - # Exit this expect loop, with a result indicating failure. - set definition {} - } - } - -re "^\[\r\n\]*at \[^\r\n\]*(${filepat}):${decimal}\[\r\n\]" { - # This appears after a `has no definition' message. - # `location' should be empty when we see it. - if {[string compare $definition undefined] == 0 \ - && [llength $location] == 0} { - set location $expect_out(1,string) - exp_continue - } else { - # Exit this expect loop, with a result indicating failure. - set definition {} - } - } - -re "#define ${macro} (\[^\r\n\]*)\[\r\n\]" { - # `definition' should be empty when we see this message. - if {[string compare $definition ""] == 0} { - set definition $expect_out(1,string) - exp_continue - } else { - # Exit this expect loop, with a result indicating failure. - set definition {} - } - } - -re "has no preprocessor macro information.*$gdb_prompt $" { - set definition no-macro-info - } - -re "$gdb_prompt $" { - # Exit the expect loop; let the existing value of `definition' - # indicate failure or success. - } - timeout { - set definition timeout - } - } - if {$debug_me} {exp_internal 0} - - switch -exact -- $definition { - no-macro-info { return no-macro-info } - timeout { return timeout } - undefined - - default { - if {[llength $location] >= 1} { - return [concat $location [list $definition]] - } else { - return {} - } - } - } -} - - -# Call info_macro to show the definition of MACRO. Expect a result of -# EXPECTED. Use WHERE in pass/fail messages to identify the context. -# Return non-zero if we should abort the entire test file, or zero if -# we can continue. -proc check_macro {macro expected where} { - set func_def [info_macro $macro] - if {[string compare $func_def $expected] == 0} { - pass "info macro $macro $where" - } else { - switch -exact -- $func_def { - no-macro-info { - xfail "executable includes no macro debugging information" - return 1 - } - timeout { - fail "info macro $macro $where (timeout)" - } - default { - fail "info macro $macro $where" - } - } - } - return 0 -} - - -# List the function FUNC, and then show the definition of MACRO, -# expecting the result EXPECTED. -proc list_and_check_macro {func macro expected} { - gdb_test "list $func" ".*${func}.*" - return [check_macro $macro $expected "after `list $func'"] -} - - -if {[list_and_check_macro main WHERE {macscp1.c {before macscp1_3}}]} { - return 0 -} -list_and_check_macro macscp2_2 WHERE {macscp2.h macscp1.c {before macscp2_2}} -list_and_check_macro macscp3_2 WHERE {macscp3.h macscp1.c {before macscp3_2}} - - -# Although GDB's macro table structures distinguish between multiple -# #inclusions of the same file, GDB's other structures don't. So the -# `list' command here doesn't reliably select one #inclusion or the -# other, even though it could. It would be nice to eventually change -# GDB's structures to handle this correctly. -gdb_test "list macscp4_2_from_macscp2" ".*macscp4_2_, MACSCP4_INCLUSION.*" -switch -exact -- [info_macro WHERE] { - {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} { - pass "info macro WHERE after `list macscp_4_2_from_macscp2'" - } - {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} { - # setup_kfail "gdb/555" - fail "info macro WHERE after `list macscp_4_2_from_macscp2' (gdb/555)" - } - timeout { - fail "info macro WHERE after `list macscp_4_2_from_macscp2' (timeout)" - } - default { fail "info macro WHERE after `list macscp_4_2_from_macscp2'" } -} - -gdb_test "list macscp4_2_from_macscp3" ".*macscp4_2_, MACSCP4_INCLUSION.*" -switch -exact -- [info_macro WHERE] { - {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} { - pass "info macro WHERE after `list macscp_4_2_from_macscp3'" - } - {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} { - # setup_kfail "gdb/555" - fail "info macro WHERE after `list macscp_4_2_from_macscp3' (gdb/555)" - } - timeout { - fail "info macro WHERE after `list macscp_4_2_from_macscp3' (timeout)" - } - default { fail "info macro WHERE after `list macscp_4_2_from_macscp3'" } -} - - -#### Test the selection of the macro scope by the current frame. - -### A table of functions, in the order they will be reached, which is -### also the order they appear in the preprocessed output. Each entry -### has the form {FUNCNAME WHERE KFAILWHERE}, where: -### - FUNCNAME is the name of the function, -### - WHERE is the definition we expect to see for the macro `WHERE', as -### returned by `info_macro', and -### - KFAILWHERE is an alternate definition which should be reported -### as a `known failure', due to GDB's inability to distinguish multiple -### #inclusions of the same file. -### KFAILWHERE may be omitted. - -set funcs { - { - macscp1_1 - {macscp1.c {before macscp1_1}} - } - { - macscp2_1 - {macscp2.h macscp1.c {before macscp2_1}} - } - { - macscp4_1_from_macscp2 - {macscp4.h macscp2.h macscp1.c {before macscp4_1_..., from macscp2.h}} - {macscp4.h macscp3.h macscp1.c {before macscp4_1_..., from macscp3.h}} - } - { - macscp4_2_from_macscp2 - {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} - {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} - } - { - macscp2_2 - {macscp2.h macscp1.c {before macscp2_2}} - } - { - macscp1_2 - {macscp1.c {before macscp1_2}} - } - { - macscp3_1 - {macscp3.h macscp1.c {before macscp3_1}} - } - { - macscp4_1_from_macscp3 - {macscp4.h macscp3.h macscp1.c {before macscp4_1_..., from macscp3.h}} - {macscp4.h macscp2.h macscp1.c {before macscp4_1_..., from macscp2.h}} - } - { - macscp4_2_from_macscp3 - {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} - {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} - } - { - macscp3_2 - {macscp3.h macscp1.c {before macscp3_2}} - } - { - macscp1_3 - {macscp1.c {before macscp1_3}} - } -} - - -# Start the program running. -if {! [runto_main]} { - fail "macro tests suppressed: couldn't run to main" - return 0 -} - -# Set a breakpoint on each of the functions. -foreach func_entry $funcs { - set func [lindex $func_entry 0] - gdb_test "break $func" "Breakpoint.*" -} - -# Run to each of the breakpoints and check the definition (or lack -# thereof) of each macro. -for {set i 0} {$i < [llength $funcs]} {incr i} { - set func_entry [lindex $funcs $i] - set func [lindex $func_entry 0] - set expected [lindex $func_entry 1] - set kfail_expected [lindex $func_entry 2] - - # Run to the breakpoint for $func. - gdb_test "continue" "Breakpoint $decimal, $func .*" "continue to $func" - - # Check the macro WHERE. - set result [info_macro WHERE] - if {[string compare $result $expected] == 0} { - pass "info macro WHERE stopped in $func" - } elseif {[string compare $result $kfail_expected] == 0} { - # setup_kfail "gdb/555" - fail "info macro WHERE stopped in $func (gdb/555)" - } elseif {[string compare $result timeout] == 0} { - fail "info macro WHERE stopped in $func (timeout)" - } else { - fail "info macro WHERE stopped in $func" - } - - # Check that the BEFORE_ macros for all prior functions are - # #defined, and that those for all subsequent functions are not. - for {set j 0} {$j < [llength $funcs]} {incr j} { - if {$j != $i} { - set func_j_entry [lindex $funcs $j] - set func_j [lindex $func_j_entry 0] - - set before_macro "BEFORE_[string toupper $func_j]" - set test_name \ - "$before_macro defined/undefined when stopped at $func" - set result [info_macro $before_macro] - - # We can't get the right scope info when we're stopped in - # the macro4_ functions. - if {[string match macscp4_* $func]} { - # setup_kfail "gdb/555" - set test_name "$test_name (gdb/555)" - } - if {$j < $i} { - if {[llength $result] >= 2 && \ - [string compare [lindex $result end] {}] == 0} { - pass $test_name - } elseif {[string compare $result timeout] == 0} { - fail "$test_name (timeout)" - } else { - fail "$test_name" - } - } elseif {$j > $i} { - switch -- [lindex $result end] { - undefined { pass $test_name } - timeout { fail "$test_name (timeout)" } - default { - fail "$test_name" - } - } - } - - set until_macro "UNTIL_[string toupper $func_j]" - set test_name \ - "$until_macro defined/undefined when stopped at $func" - set result [info_macro $until_macro] - - # We can't get the right scope info when we're stopped in - # the macro4_ functions. - if {[string match macscp4_* $func]} { - # setup_kfail "gdb/555" - set test_name "$test_name (gdb/555)" - } - if {$j <= $i} { - switch -- [lindex $result end] { - undefined { pass $test_name } - timeout { fail "$test_name (timeout)" } - default { - fail "$test_name" - } - } - } elseif {$j > $i} { - if {[llength $result] >= 2 && \ - [string compare [lindex $result end] {}] == 0} { - pass $test_name - } elseif {[string compare $result timeout] == 0} { - fail "$test_name (timeout)" - } else { - fail "$test_name" - } - } - } - } -} diff --git a/gdb/testsuite/gdb.base/macscp1.c b/gdb/testsuite/gdb.base/macscp1.c deleted file mode 100644 index 89a1b07d1e6..00000000000 --- a/gdb/testsuite/gdb.base/macscp1.c +++ /dev/null @@ -1,80 +0,0 @@ -#include - -#define SPLICE(a, b) INNER_SPLICE(a, b) -#define INNER_SPLICE(a, b) a ## b -#define STRINGIFY(a) INNER_STRINGIFY(a) -#define INNER_STRINGIFY(a) #a - -/* A macro named UNTIL_ is #defined until just before the - definition of the function . - - A macro named BEFORE_ is not #defined until just before the - definition of . - - The macro WHERE is redefined before each function to the - token list ``before ''. - - The macscp IN_MACSCP2_H and IN_MACSCP3_H are defined while - processing those header files; macscp4.h uses them to choose - appropriate function names, output strings, and macro definitions. */ - -#define UNTIL_MACSCP1_1 -#define UNTIL_MACSCP2_1 -#define UNTIL_MACSCP4_1_FROM_MACSCP2 -#define UNTIL_MACSCP4_2_FROM_MACSCP2 -#define UNTIL_MACSCP2_2 -#define UNTIL_MACSCP1_2 -#define UNTIL_MACSCP3_1 -#define UNTIL_MACSCP4_1_FROM_MACSCP3 -#define UNTIL_MACSCP4_2_FROM_MACSCP3 -#define UNTIL_MACSCP3_2 -#define UNTIL_MACSCP1_3 - -#define WHERE before macscp1_1 -#define BEFORE_MACSCP1_1 -#undef UNTIL_MACSCP1_1 -void -macscp1_1 () -{ - puts ("macscp1_1"); -} - -#include "macscp2.h" - -#undef WHERE -#define WHERE before macscp1_2 -#define BEFORE_MACSCP1_2 -#undef UNTIL_MACSCP1_2 -void -macscp1_2 () -{ - puts ("macscp1_2"); -} - -#include "macscp3.h" - -#undef WHERE -#define WHERE before macscp1_3 -#define BEFORE_MACSCP1_3 -#undef UNTIL_MACSCP1_3 -void -macscp1_3 () -{ - puts ("macscp1_3"); -} - -int -main (int argc, char **argv) -{ - macscp1_1 (); - macscp2_1 (); - macscp4_1_from_macscp2 (); - macscp4_2_from_macscp2 (); - macscp2_2 (); - macscp1_2 (); - macscp3_1 (); - macscp4_1_from_macscp3 (); - macscp4_2_from_macscp3 (); - macscp3_2 (); - macscp1_3 (); -} diff --git a/gdb/testsuite/gdb.base/macscp2.h b/gdb/testsuite/gdb.base/macscp2.h deleted file mode 100644 index ef0feaac5a5..00000000000 --- a/gdb/testsuite/gdb.base/macscp2.h +++ /dev/null @@ -1,25 +0,0 @@ -#define IN_MACSCP2_H - -#undef WHERE -#define WHERE before macscp2_1 -#define BEFORE_MACSCP2_1 -#undef UNTIL_MACSCP2_1 -void -macscp2_1 () -{ - puts ("macscp2_1"); -} - -#include "macscp4.h" - -#undef WHERE -#define WHERE before macscp2_2 -#define BEFORE_MACSCP2_2 -#undef UNTIL_MACSCP2_2 -void -macscp2_2 () -{ - puts ("macscp2_2"); -} - -#undef IN_MACSCP2_H diff --git a/gdb/testsuite/gdb.base/macscp3.h b/gdb/testsuite/gdb.base/macscp3.h deleted file mode 100644 index ebfcc6e1930..00000000000 --- a/gdb/testsuite/gdb.base/macscp3.h +++ /dev/null @@ -1,25 +0,0 @@ -#define IN_MACSCP3_H - -#undef WHERE -#define WHERE before macscp3_1 -#define BEFORE_MACSCP3_1 -#undef UNTIL_MACSCP3_1 -void -macscp3_1 () -{ - puts ("macscp3_1"); -} - -#include "macscp4.h" - -#undef WHERE -#define WHERE before macscp3_2 -#define BEFORE_MACSCP3_2 -#undef UNTIL_MACSCP3_2 -void -macscp3_2 () -{ - puts ("macscp3_2"); -} - -#undef IN_MACSCP3_H diff --git a/gdb/testsuite/gdb.base/macscp4.h b/gdb/testsuite/gdb.base/macscp4.h deleted file mode 100644 index 5302d8d3c47..00000000000 --- a/gdb/testsuite/gdb.base/macscp4.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Put together a macro we can use as part of function names. */ -#undef MACSCP4_INCLUSION -#ifdef IN_MACSCP2_H -#define MACSCP4_INCLUSION from_macscp2 -#endif -#ifdef IN_MACSCP3_H -#define MACSCP4_INCLUSION from_macscp3 -#endif - -#undef WHERE -#ifdef IN_MACSCP2_H -#define WHERE before macscp4_1_..., from macscp2.h -#define BEFORE_MACSCP4_1_FROM_MACSCP2 -#undef UNTIL_MACSCP4_1_FROM_MACSCP2 -#endif -#ifdef IN_MACSCP3_H -#define WHERE before macscp4_1_..., from macscp3.h -#define BEFORE_MACSCP4_1_FROM_MACSCP3 -#undef UNTIL_MACSCP4_1_FROM_MACSCP3 -#endif -void -SPLICE (macscp4_1_, MACSCP4_INCLUSION) () -{ - puts ("macscp4_1_" STRINGIFY(MACSCP4_INCLUSION)); -} - -#undef WHERE -#ifdef IN_MACSCP2_H -#define WHERE before macscp4_2_..., from macscp2.h -#define BEFORE_MACSCP4_2_FROM_MACSCP2 -#undef UNTIL_MACSCP4_2_FROM_MACSCP2 -#endif -#ifdef IN_MACSCP3_H -#define WHERE before macscp4_2_..., from macscp3.h -#define BEFORE_MACSCP4_2_FROM_MACSCP3 -#undef UNTIL_MACSCP4_2_FROM_MACSCP3 -#endif -void -SPLICE (macscp4_2_, MACSCP4_INCLUSION) () -{ - puts ("macscp4_2_" STRINGIFY(MACSCP4_INCLUSION)); -} - -#define DEFINED_IN_MACSCP4 this was defined in macscp4.h. diff --git a/gdb/testsuite/gdb.c++/m-static.cc b/gdb/testsuite/gdb.c++/m-static.cc deleted file mode 100644 index 24338014365..00000000000 --- a/gdb/testsuite/gdb.c++/m-static.cc +++ /dev/null @@ -1,72 +0,0 @@ -// 2002-05-13 - -namespace __gnu_test -{ - enum region { oriental, egyptian, greek, etruscan, roman }; - - // Test one. - class gnu_obj_1 - { - protected: - typedef region antiquities; - static const bool test = true; - static const int key1 = 5; - static long key2; - - static antiquities value; - - public: - gnu_obj_1(antiquities a, long l) {} - }; - - const bool gnu_obj_1::test; - const int gnu_obj_1::key1; - long gnu_obj_1::key2 = 77; - gnu_obj_1::antiquities gnu_obj_1::value = oriental; - - - // Test two. - template - class gnu_obj_2: public virtual gnu_obj_1 - { - public: - static antiquities value_derived; - - public: - gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { } - }; - - template - typename gnu_obj_2::antiquities gnu_obj_2::value_derived = etruscan; - - // Test three. - template - class gnu_obj_3 - { - public: - typedef region antiquities; - static gnu_obj_2 data; - - public: - gnu_obj_3(antiquities b) { } - }; - - template - gnu_obj_2 gnu_obj_3::data(etruscan); -} - -// instantiate templates explicitly so their static members will exist -template class __gnu_test::gnu_obj_2; -template class __gnu_test::gnu_obj_2; -template class __gnu_test::gnu_obj_3; - -int main() -{ - using namespace __gnu_test; - - gnu_obj_1 test1(egyptian, 4589); - gnu_obj_2 test2(roman); - gnu_obj_3 test3(greek); - - return 0; -} diff --git a/gdb/testsuite/gdb.c++/m-static.exp b/gdb/testsuite/gdb.c++/m-static.exp deleted file mode 100644 index c05983b6538..00000000000 --- a/gdb/testsuite/gdb.c++/m-static.exp +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright 2002 Free Software Foundation, Inc. - -# 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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Tests for member static data -# 2002-05-13 Benjamin Kosnik - -# This file is part of the gdb testsuite - -if $tracelevel then { - strace $tracelevel - } - -if { [skip_cplus_tests] } { continue } - -# -# test running programs -# -set prms_id 0 -set bug_id 0 - -set testfile "m-static" -set srcfile ${testfile}.cc -set binfile ${objdir}/${subdir}/${testfile} - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -} - -if [get_compiler_info ${binfile} "c++"] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - - -if ![runto_main] then { - perror "couldn't run to breakpoint" - continue -} - -# One. -gdb_test "break 68" "Breakpoint \[0-9\]*.*line 68\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:68\r\n.*" "continue to 68" - -# simple object, static const bool -gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool" - -# simple object, static const int -gdb_test "print test1.key1" "\\$\[0-9\]* = 5" "simple object, static const int" - -# simple object, static long -gdb_test "print test1.key2" "\\$\[0-9\]* = 77" "simple object, static long" - -# simple object, static enum -gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum" - -# Two. -gdb_test "break 69" "Breakpoint \[0-9\]*.*line 69\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:69\r\n.*" "continue to 69" - -# derived template object, base static const bool -gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool" - -# derived template object, base static const int -gdb_test "print test2.key1" "\\$\[0-9\]* = 5" "derived template object, base static const int" - -# derived template object, base static long -gdb_test "print test2.key2" "\\$\[0-9\]* = 77" "derived template object, base static long" - -# derived template object, base static enum -gdb_test "print test2.value" "\\$\[0-9\].* = oriental" "derived template object, base static enum" - -# derived template object, static enum -gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum" - -# Three. -gdb_test "break 71" "Breakpoint \[0-9\]*.*line 71\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:71\r\n.*" "continue to 71" - -# template object, static derived template data member's base static const bool -gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool" - -# template object, static derived template data member's base static const int -gdb_test "print test3.data.key1" "\\$\[0-9\].* = 5" "template object, static const int" - -# template object, static derived template data member's base static long -gdb_test "print test3.data.key2" "\\$\[0-9\].* = 77" "template object, static long" - -# template object, static derived template data member's base static enum -gdb_test "print test3.data.value" "\\$\[0-9\].* = oriental" "template object, static enum" - -# template object, static derived template data member's static enum -gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum" - -gdb_exit -return 0 diff --git a/gdb/top.c b/gdb/top.c index b4026c1895b..4749c381809 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -63,7 +63,6 @@ #include #include "ui-out.h" #include "cli-out.h" -#include "interps.h" /* Default command line prompt. This is overriden in some configs. */ @@ -387,7 +386,6 @@ catcher (catch_exceptions_ftype *func, char *saved_error_pre_print; char *saved_quit_pre_print; struct ui_out *saved_uiout; - struct gdb_interpreter *saved_interp; /* Return value from SIGSETJMP(): enum return_reason if error or quit caught, 0 otherwise. */ @@ -410,7 +408,6 @@ catcher (catch_exceptions_ftype *func, /* Override the global ``struct ui_out'' builder. */ saved_uiout = uiout; - saved_interp = gdb_current_interpreter (); uiout = func_uiout; /* Prevent error/quit during FUNC from calling cleanups established @@ -441,24 +438,7 @@ catcher (catch_exceptions_ftype *func, restore_cleanups (saved_cleanup_chain); - /* - cases: - 1. interp1 calls using uiout1 - 2. interp1 calls using uiout1 calls using uiout2 - 3. interp1 calls using uiout1 calls interp2 using uiout2 - 4. more? - is it enough to note that the interpreter has changed and - reset saved_uiout - */ - if (gdb_current_interpreter () == saved_interp) - uiout = saved_uiout; - else - { - /* We've changed interpreters under this call. - Reset uiout to the current interpreter's uiout - and hope for the best. */ - uiout = gdb_interpreter_ui_out (NULL); - } + uiout = saved_uiout; if (mask & RETURN_MASK_QUIT) quit_pre_print = saved_quit_pre_print; @@ -2108,26 +2088,17 @@ gdb_init (char *argv0) init_ui_hook (argv0); /* Install the default UI */ - /* All the interpreters should have had a look at things by now. - Initialize the selected interpreter. */ - { - struct gdb_interpreter *interp; - if (interpreter_p == NULL) - interpreter_p = xstrdup (GDB_INTERPRETER_CONSOLE); - - interp = gdb_lookup_interpreter (interpreter_p); + if (!init_ui_hook) + { + uiout = cli_out_new (gdb_stdout); - if (interp == NULL) - { - fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n", - interpreter_p); - exit (1); - } - if (!gdb_set_interpreter (interp)) - { - fprintf_unfiltered (gdb_stderr, "Interpreter `%s' failed to initialize.\n", - interpreter_p); - exit (1); - } - } + /* All the interpreters should have had a look at things by now. + Initialize the selected interpreter. */ + if (interpreter_p) + { + fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n", + interpreter_p); + exit (1); + } + } } diff --git a/gdb/wrapper.c b/gdb/wrapper.c index 4d390088032..6c9c6d60cef 100644 --- a/gdb/wrapper.c +++ b/gdb/wrapper.c @@ -19,9 +19,8 @@ #include "defs.h" #include "value.h" #include "wrapper.h" -#include "top.h" /* for execute_command */ -/* use this struct to pass arguments to wrapper routines. We assume +/* Use this struct to pass arguments to wrapper routines. We assume (arbitrarily) that no gdb function takes more than ten arguments. */ struct gdb_wrapper_arguments { @@ -52,12 +51,6 @@ struct captured_value_struct_elt_args struct value **result_ptr; }; -struct captured_execute_command_args -{ - char *command; - int from_tty; -}; - static int wrap_parse_exp_1 (char *); static int wrap_evaluate_expression (char *); @@ -338,20 +331,3 @@ do_captured_value_struct_elt (struct ui_out *uiout, void *data) return GDB_RC_OK; } -static int -do_captured_execute_command (struct ui_out *uiout, void *data) -{ - struct captured_execute_command_args *args = data; - execute_command (args->command, args->from_tty); - return GDB_RC_OK; -} - -enum gdb_rc -gdb_execute_command (struct ui_out *uiout, char *command, int from_tty) -{ - struct captured_execute_command_args args; - args.command = command; - args.from_tty = from_tty; - return catch_exceptions (uiout, do_captured_execute_command, &args, - NULL, RETURN_MASK_ALL); -} diff --git a/gdb/wrapper.h b/gdb/wrapper.h index 85072743f90..977a77d04cd 100644 --- a/gdb/wrapper.h +++ b/gdb/wrapper.h @@ -21,10 +21,6 @@ #include "gdb.h" struct value; -struct block; -struct expression; -struct ui_out; -struct type; /* Use this struct to pass arguments to wrapper routines. */ struct gdb_wrapper_arguments; @@ -50,6 +46,4 @@ extern int gdb_value_ind (struct value *val, struct value ** rval); extern int gdb_parse_and_eval_type (char *, int, struct type **); -extern enum gdb_rc gdb_execute_command (struct ui_out *uiout, char *command, - int from_tty); #endif /* WRAPPER_H */ diff --git a/include/elf/vax.h b/include/elf/vax.h deleted file mode 100644 index aba5d9f08a0..00000000000 --- a/include/elf/vax.h +++ /dev/null @@ -1,51 +0,0 @@ -/* VAX ELF support for BFD. - Copyright (C) 2002 Free Software Foundation, Inc. - Contributed by Matt Thomas . - - This file is part of BFD, the Binary File Descriptor library. - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_VAX_H -#define _ELF_VAX_H - -#include "elf/reloc-macros.h" - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_vax_reloc_type) - RELOC_NUMBER (R_VAX_NONE, 0) /* No reloc */ - RELOC_NUMBER (R_VAX_32, 1) /* Direct 32 bit */ - RELOC_NUMBER (R_VAX_16, 2) /* Direct 16 bit */ - RELOC_NUMBER (R_VAX_8, 3) /* Direct 8 bit */ - RELOC_NUMBER (R_VAX_PC32, 4) /* PC relative 32 bit */ - RELOC_NUMBER (R_VAX_PC16, 5) /* PC relative 16 bit */ - RELOC_NUMBER (R_VAX_PC8, 6) /* PC relative 8 bit */ - RELOC_NUMBER (R_VAX_GOT32, 7) /* 32 bit PC relative GOT entry */ - RELOC_NUMBER (R_VAX_PLT32, 13) /* 32 bit PC relative PLT address */ - RELOC_NUMBER (R_VAX_COPY, 19) /* Copy symbol at runtime */ - RELOC_NUMBER (R_VAX_GLOB_DAT, 20) /* Create GOT entry */ - RELOC_NUMBER (R_VAX_JMP_SLOT, 21) /* Create PLT entry */ - RELOC_NUMBER (R_VAX_RELATIVE, 22) /* Adjust by program base */ - /* These are GNU extensions to enable C++ vtable garbage collection. */ - RELOC_NUMBER (R_VAX_GNU_VTINHERIT, 23) - RELOC_NUMBER (R_VAX_GNU_VTENTRY, 24) -END_RELOC_NUMBERS (R_VAX_max) - -/* Processor specific flags for the ELF header e_flags field. */ -#define EF_NONPIC 0x0001 /* Object contains non-PIC code */ -#define EF_DFLOAT 0x0100 /* Object contains D-Float insn. */ -#define EF_GFLOAT 0x0200 /* Object contains G-Float insn. */ - -#endif diff --git a/include/gdb/callback.h b/include/gdb/callback.h deleted file mode 100644 index 30752842ed9..00000000000 --- a/include/gdb/callback.h +++ /dev/null @@ -1,270 +0,0 @@ -/* Remote target system call callback support. - Copyright 1997 Free Software Foundation, Inc. - Contributed by Cygnus Solutions. - -This file is part of GDB. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This interface isn't intended to be specific to any particular kind - of remote (hardware, simulator, whatever). As such, support for it - (e.g. sim/common/callback.c) should *not* live in the simulator source - tree, nor should it live in the gdb source tree. */ - -/* There are various ways to handle system calls: - - 1) Have a simulator intercept the appropriate trap instruction and - directly perform the system call on behalf of the target program. - This is the typical way of handling system calls for embedded targets. - [Handling system calls for embedded targets isn't that much of an - oxymoron as running compiler testsuites make use of the capability.] - - This method of system call handling is done when STATE_ENVIRONMENT - is ENVIRONMENT_USER. - - 2) Have a simulator emulate the hardware as much as possible. - If the program running on the real hardware communicates with some sort - of target manager, one would want to be able to run this program on the - simulator as well. - - This method of system call handling is done when STATE_ENVIRONMENT - is ENVIRONMENT_OPERATING. -*/ - -#ifndef CALLBACK_H -#define CALLBACK_H - -/* ??? The reason why we check for va_start here should be documented. */ - -#ifndef va_start -#include -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif -#endif - -/* Mapping of host/target values. */ -/* ??? For debugging purposes, one might want to add a string of the - name of the symbol. */ - -typedef struct { - int host_val; - int target_val; -} CB_TARGET_DEFS_MAP; - -#define MAX_CALLBACK_FDS 10 - -/* Forward decl for stat/fstat. */ -struct stat; - -typedef struct host_callback_struct host_callback; - -struct host_callback_struct -{ - int (*close) PARAMS ((host_callback *,int)); - int (*get_errno) PARAMS ((host_callback *)); - int (*isatty) PARAMS ((host_callback *, int)); - int (*lseek) PARAMS ((host_callback *, int, long , int)); - int (*open) PARAMS ((host_callback *, const char*, int mode)); - int (*read) PARAMS ((host_callback *,int, char *, int)); - int (*read_stdin) PARAMS (( host_callback *, char *, int)); - int (*rename) PARAMS ((host_callback *, const char *, const char *)); - int (*system) PARAMS ((host_callback *, const char *)); - long (*time) PARAMS ((host_callback *, long *)); - int (*unlink) PARAMS ((host_callback *, const char *)); - int (*write) PARAMS ((host_callback *,int, const char *, int)); - int (*write_stdout) PARAMS ((host_callback *, const char *, int)); - void (*flush_stdout) PARAMS ((host_callback *)); - int (*write_stderr) PARAMS ((host_callback *, const char *, int)); - void (*flush_stderr) PARAMS ((host_callback *)); - int (*stat) PARAMS ((host_callback *, const char *, struct stat *)); - int (*fstat) PARAMS ((host_callback *, int, struct stat *)); - - /* When present, call to the client to give it the oportunity to - poll any io devices for a request to quit (indicated by a nonzero - return value). */ - int (*poll_quit) PARAMS ((host_callback *)); - - /* Used when the target has gone away, so we can close open - handles and free memory etc etc. */ - int (*shutdown) PARAMS ((host_callback *)); - int (*init) PARAMS ((host_callback *)); - - /* depreciated, use vprintf_filtered - Talk to the user on a console. */ - void (*printf_filtered) PARAMS ((host_callback *, const char *, ...)); - - /* Talk to the user on a console. */ - void (*vprintf_filtered) PARAMS ((host_callback *, const char *, va_list)); - - /* Same as vprintf_filtered but to stderr. */ - void (*evprintf_filtered) PARAMS ((host_callback *, const char *, va_list)); - - /* Print an error message and "exit". - In the case of gdb "exiting" means doing a longjmp back to the main - command loop. */ - void (*error) PARAMS ((host_callback *, const char *, ...)); - - int last_errno; /* host format */ - - int fdmap[MAX_CALLBACK_FDS]; - char fdopen[MAX_CALLBACK_FDS]; - char alwaysopen[MAX_CALLBACK_FDS]; - - /* System call numbers. */ - CB_TARGET_DEFS_MAP *syscall_map; - /* Errno values. */ - CB_TARGET_DEFS_MAP *errno_map; - /* Flags to the open system call. */ - CB_TARGET_DEFS_MAP *open_map; - /* Signal numbers. */ - CB_TARGET_DEFS_MAP *signal_map; - /* Layout of `stat' struct. - The format is a series of "name,length" pairs separated by colons. - Empty space is indicated with a `name' of "space". - All padding must be explicitly mentioned. - Lengths are in bytes. If this needs to be extended to bits, - use "name.bits". - Example: "st_dev,4:st_ino,4:st_mode,4:..." */ - const char *stat_map; - - /* Marker for those wanting to do sanity checks. - This should remain the last member of this struct to help catch - miscompilation errors. */ -#define HOST_CALLBACK_MAGIC 4705 /* teds constant */ - int magic; -}; - -extern host_callback default_callback; - -/* Canonical versions of system call numbers. - It's not intended to willy-nilly throw every system call ever heard - of in here. Only include those that have an important use. - ??? One can certainly start a discussion over the ones that are currently - here, but that will always be true. */ - -/* These are used by the ANSI C support of libc. */ -#define CB_SYS_exit 1 -#define CB_SYS_open 2 -#define CB_SYS_close 3 -#define CB_SYS_read 4 -#define CB_SYS_write 5 -#define CB_SYS_lseek 6 -#define CB_SYS_unlink 7 -#define CB_SYS_getpid 8 -#define CB_SYS_kill 9 -#define CB_SYS_fstat 10 -/*#define CB_SYS_sbrk 11 - not currently a system call, but reserved. */ - -/* ARGV support. */ -#define CB_SYS_argvlen 12 -#define CB_SYS_argv 13 - -/* These are extras added for one reason or another. */ -#define CB_SYS_chdir 14 -#define CB_SYS_stat 15 -#define CB_SYS_chmod 16 -#define CB_SYS_utime 17 -#define CB_SYS_time 18 - -/* Struct use to pass and return information necessary to perform a - system call. */ -/* FIXME: Need to consider target word size. */ - -typedef struct cb_syscall { - /* The target's value of what system call to perform. */ - int func; - /* The arguments to the syscall. */ - long arg1, arg2, arg3, arg4; - - /* The result. */ - long result; - /* Some system calls have two results. */ - long result2; - /* The target's errno value, or 0 if success. - This is converted to the target's value with host_to_target_errno. */ - int errcode; - - /* Working space to be used by memory read/write callbacks. */ - PTR p1; - PTR p2; - long x1,x2; - - /* Callbacks for reading/writing memory (e.g. for read/write syscalls). - ??? long or unsigned long might be better to use for the `count' - argument here. We mimic sim_{read,write} for now. Be careful to - test any changes with -Wall -Werror, mixed signed comparisons - will get you. */ - int (*read_mem) PARAMS ((host_callback * /*cb*/, struct cb_syscall * /*sc*/, - unsigned long /*taddr*/, char * /*buf*/, - int /*bytes*/)); - int (*write_mem) PARAMS ((host_callback * /*cb*/, struct cb_syscall * /*sc*/, - unsigned long /*taddr*/, const char * /*buf*/, - int /*bytes*/)); - - /* For sanity checking, should be last entry. */ - int magic; -} CB_SYSCALL; - -/* Magic number sanity checker. */ -#define CB_SYSCALL_MAGIC 0x12344321 - -/* Macro to initialize CB_SYSCALL. Called first, before filling in - any fields. */ -#define CB_SYSCALL_INIT(sc) \ -do { \ - memset ((sc), 0, sizeof (*(sc))); \ - (sc)->magic = CB_SYSCALL_MAGIC; \ -} while (0) - -/* Return codes for various interface routines. */ - -typedef enum { - CB_RC_OK = 0, - /* generic error */ - CB_RC_ERR, - /* either file not found or no read access */ - CB_RC_ACCESS, - CB_RC_NO_MEM -} CB_RC; - -/* Read in target values for system call numbers, errno values, signals. */ -CB_RC cb_read_target_syscall_maps PARAMS ((host_callback *, const char *)); - -/* Translate target to host syscall function numbers. */ -int cb_target_to_host_syscall PARAMS ((host_callback *, int)); - -/* Translate host to target errno value. */ -int cb_host_to_target_errno PARAMS ((host_callback *, int)); - -/* Translate target to host open flags. */ -int cb_target_to_host_open PARAMS ((host_callback *, int)); - -/* Translate target signal number to host. */ -int cb_target_to_host_signal PARAMS ((host_callback *, int)); - -/* Translate host signal number to target. */ -int cb_host_to_target_signal PARAMS ((host_callback *, int)); - -/* Translate host stat struct to target. - If stat struct ptr is NULL, just compute target stat struct size. - Result is size of target stat struct or 0 if error. */ -int cb_host_to_target_stat PARAMS ((host_callback *, const struct stat *, PTR)); - -/* Perform a system call. */ -CB_RC cb_syscall PARAMS ((host_callback *, CB_SYSCALL *)); - -#endif diff --git a/include/gdb/remote-sim.h b/include/gdb/remote-sim.h deleted file mode 100644 index 726ec623fbd..00000000000 --- a/include/gdb/remote-sim.h +++ /dev/null @@ -1,354 +0,0 @@ -/* This file defines the interface between the simulator and gdb. - Copyright 1993, 1994, 1996, 1997, 1998, 2000 - Free Software Foundation, Inc. - -This file is part of GDB. - -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#if !defined (REMOTE_SIM_H) -#define REMOTE_SIM_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* This file is used when building stand-alone simulators, so isolate this - file from gdb. */ - -/* Pick up CORE_ADDR_TYPE if defined (from gdb), otherwise use same value as - gdb does (unsigned int - from defs.h). */ - -#ifndef CORE_ADDR_TYPE -typedef unsigned int SIM_ADDR; -#else -typedef CORE_ADDR_TYPE SIM_ADDR; -#endif - - -/* Semi-opaque type used as result of sim_open and passed back to all - other routines. "desc" is short for "descriptor". - It is up to each simulator to define `sim_state'. */ - -typedef struct sim_state *SIM_DESC; - - -/* Values for `kind' arg to sim_open. */ - -typedef enum { - SIM_OPEN_STANDALONE, /* simulator used standalone (run.c) */ - SIM_OPEN_DEBUG /* simulator used by debugger (gdb) */ -} SIM_OPEN_KIND; - - -/* Return codes from various functions. */ - -typedef enum { - SIM_RC_FAIL = 0, - SIM_RC_OK = 1, - SIM_RC_UNKNOWN_BREAKPOINT = 2, - SIM_RC_INSUFFICIENT_RESOURCES = 3, - SIM_RC_DUPLICATE_BREAKPOINT = 4 -} SIM_RC; - - -/* The bfd struct, as an opaque type. */ - -struct _bfd; - - -/* Main simulator entry points. */ - - -/* Create a fully initialized simulator instance. - - (This function is called when the simulator is selected from the - gdb command line.) - - KIND specifies how the simulator shall be used. Currently there - are only two kinds: stand-alone and debug. - - CALLBACK specifies a standard host callback (defined in callback.h). - - ABFD, when non NULL, designates a target program. The program is - not loaded. - - ARGV is a standard ARGV pointer such as that passed from the - command line. The syntax of the argument list is is assumed to be - ``SIM-PROG { SIM-OPTION } [ TARGET-PROGRAM { TARGET-OPTION } ]''. - The trailing TARGET-PROGRAM and args are only valid for a - stand-alone simulator. - - On success, the result is a non NULL descriptor that shall be - passed to the other sim_foo functions. While the simulator - configuration can be parameterized by (in decreasing precedence) - ARGV's SIM-OPTION, ARGV's TARGET-PROGRAM and the ABFD argument, the - successful creation of the simulator shall not dependent on the - presence of any of these arguments/options. - - Hardware simulator: The created simulator shall be sufficiently - initialized to handle, with out restrictions any client requests - (including memory reads/writes, register fetch/stores and a - resume). - - Process simulator: that process is not created until a call to - sim_create_inferior. FIXME: What should the state of the simulator - be? */ - -SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct _bfd *abfd, char **argv)); - - -/* Destory a simulator instance. - - QUITTING is non-zero if we cannot hang on errors. - - This may involve freeing target memory and closing any open files - and mmap'd areas. You cannot assume sim_kill has already been - called. */ - -void sim_close PARAMS ((SIM_DESC sd, int quitting)); - - -/* Load program PROG into the simulators memory. - - If ABFD is non-NULL, the bfd for the file has already been opened. - The result is a return code indicating success. - - Hardware simulator: Normally, each program section is written into - memory according to that sections LMA using physical (direct) - addressing. The exception being systems, such as PPC/CHRP, which - support more complicated program loaders. A call to this function - should not effect the state of the processor registers. Multiple - calls to this function are permitted and have an accumulative - effect. - - Process simulator: Calls to this function may be ignored. - - FIXME: Most hardware simulators load the image at the VMA using - virtual addressing. - - FIXME: For some hardware targets, before a loaded program can be - executed, it requires the manipulation of VM registers and tables. - Such manipulation should probably (?) occure in - sim_create_inferior. */ - -SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tty)); - - -/* Prepare to run the simulated program. - - ABFD, if not NULL, provides initial processor state information. - ARGV and ENV, if non NULL, are NULL terminated lists of pointers. - - Hardware simulator: This function shall initialize the processor - registers to a known value. The program counter and possibly stack - pointer shall be set using information obtained from ABFD (or - hardware reset defaults). ARGV and ENV, dependant on the target - ABI, may be written to memory. - - Process simulator: After a call to this function, a new process - instance shall exist. The TEXT, DATA, BSS and stack regions shall - all be initialized, ARGV and ENV shall be written to process - address space (according to the applicable ABI) and the program - counter and stack pointer set accordingly. */ - -SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, struct _bfd *abfd, char **argv, char **env)); - - -/* Fetch LENGTH bytes of the simulated program's memory. Start fetch - at virtual address MEM and store in BUF. Result is number of bytes - read, or zero if error. */ - -int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); - - -/* Store LENGTH bytes from BUF into the simulated program's - memory. Store bytes starting at virtual address MEM. Result is - number of bytes write, or zero if error. */ - -int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); - - -/* Fetch register REGNO storing its raw (target endian) value in the - LENGTH byte buffer BUF. Return the actual size of the register or - zero if REGNO is not applicable. - - Legacy implementations ignore LENGTH and always return -1. - - If LENGTH does not match the size of REGNO no data is transfered - (the actual register size is still returned). */ - -int sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); - - -/* Store register REGNO from the raw (target endian) value in BUF. - Return the actual size of the register or zero if REGNO is not - applicable. - - Legacy implementations ignore LENGTH and always return -1. - - If LENGTH does not match the size of REGNO no data is transfered - (the actual register size is still returned). */ - -int sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); - - -/* Print whatever statistics the simulator has collected. - - VERBOSE is currently unused and must always be zero. */ - -void sim_info PARAMS ((SIM_DESC sd, int verbose)); - - -/* Run (or resume) the simulated program. - - STEP, when non-zero indicates that only a single simulator cycle - should be emulated. - - SIGGNAL, if non-zero is a (HOST) SIGRC value indicating the type of - event (hardware interrupt, signal) to be delivered to the simulated - program. - - Hardware simulator: If the SIGRC value returned by - sim_stop_reason() is passed back to the simulator via SIGGNAL then - the hardware simulator shall correctly deliver the hardware event - indicated by that signal. If a value of zero is passed in then the - simulation will continue as if there were no outstanding signal. - The effect of any other SIGGNAL value is is implementation - dependant. - - Process simulator: If SIGRC is non-zero then the corresponding - signal is delivered to the simulated program and execution is then - continued. A zero SIGRC value indicates that the program should - continue as normal. */ - -void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal)); - - -/* Asynchronous request to stop the simulation. - A nonzero return indicates that the simulator is able to handle - the request */ - -int sim_stop PARAMS ((SIM_DESC sd)); - - -/* Fetch the REASON why the program stopped. - - SIM_EXITED: The program has terminated. SIGRC indicates the target - dependant exit status. - - SIM_STOPPED: The program has stopped. SIGRC uses the host's signal - numbering as a way of identifying the reaon: program interrupted by - user via a sim_stop request (SIGINT); a breakpoint instruction - (SIGTRAP); a completed single step (SIGTRAP); an internal error - condition (SIGABRT); an illegal instruction (SIGILL); Access to an - undefined memory region (SIGSEGV); Mis-aligned memory access - (SIGBUS). For some signals information in addition to the signal - number may be retained by the simulator (e.g. offending address), - that information is not directly accessable via this interface. - - SIM_SIGNALLED: The program has been terminated by a signal. The - simulator has encountered target code that causes the the program - to exit with signal SIGRC. - - SIM_RUNNING, SIM_POLLING: The return of one of these values - indicates a problem internal to the simulator. */ - -enum sim_stop { sim_running, sim_polling, sim_exited, sim_stopped, sim_signalled }; - -void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc)); - - -/* Passthru for other commands that the simulator might support. - Simulators should be prepared to deal with any combination of NULL - or empty CMD. */ - -void sim_do_command PARAMS ((SIM_DESC sd, char *cmd)); - -/* Call these functions to set and clear breakpoints at ADDR. */ - -SIM_RC sim_set_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_clear_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_clear_all_breakpoints PARAMS ((SIM_DESC sd)); - -/* These functions are used to enable and disable breakpoints. */ - -SIM_RC sim_enable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_disable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_enable_all_breakpoints PARAMS ((SIM_DESC sd)); -SIM_RC sim_disable_all_breakpoints PARAMS ((SIM_DESC sd)); - - -/* Provide simulator with a default (global) host_callback_struct. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure does not take a SIM_DESC argument as it is - used before sim_open. */ - -void sim_set_callbacks PARAMS ((struct host_callback_struct *)); - - -/* Set the size of the simulator memory array. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure does not take a SIM_DESC argument as it is - used before sim_open. */ - -void sim_size PARAMS ((int i)); - - -/* Single-step simulator with tracing enabled. - THIS PROCEDURE IS DEPRECIATED. - THIS PROCEDURE IS EVEN MORE DEPRECATED THAN SIM_SET_TRACE - GDB and NRUN do not use this interface. - This procedure returns: ``0'' indicating that the simulator should - be continued using sim_trace() calls; ``1'' indicating that the - simulation has finished. */ - -int sim_trace PARAMS ((SIM_DESC sd)); - - -/* Enable tracing. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure returns: ``0'' indicating that the simulator should - be continued using sim_trace() calls; ``1'' indicating that the - simulation has finished. */ - -void sim_set_trace PARAMS ((void)); - - -/* Configure the size of the profile buffer. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure does not take a SIM_DESC argument as it is - used before sim_open. */ - -void sim_set_profile_size PARAMS ((int n)); - - -/* Kill the running program. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure will be replaced as part of the introduction of - multi-cpu simulators. */ - -void sim_kill PARAMS ((SIM_DESC sd)); - -#ifdef __cplusplus -} -#endif - -#endif /* !defined (REMOTE_SIM_H) */ diff --git a/sim/mips/cp1.h b/sim/mips/cp1.h deleted file mode 100644 index 24901d8b75a..00000000000 --- a/sim/mips/cp1.h +++ /dev/null @@ -1,82 +0,0 @@ -/*> cp1.h <*/ -/* MIPS Simulator FPU (CoProcessor 1) definitions. - Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc. - Derived from sim-main.h contributed by Cygnus Solutions, - modified substially by Broadcom Corporation (SiByte). - -This file is part of GDB, the GNU debugger. - -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 -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef CP1_H -#define CP1_H - -/* See sim-main.h for allocation of registers FCR0 and FCR31 (FCSR) - in CPU state (struct sim_cpu), and for FPU functions. */ - -#define fcsr_FCC_mask (0xFE800000) -#define fcsr_FCC_shift (23) -#define fcsr_FCC_bit(cc) ((cc) == 0 ? 23 : (24 + (cc))) -#define fcsr_FS (1 << 24) /* MIPS III onwards : Flush to Zero */ -#define fcsr_ZERO_mask (0x007C0000) -#define fcsr_CAUSE_mask (0x0003F000) -#define fcsr_CAUSE_shift (12) -#define fcsr_ENABLES_mask (0x00000F80) -#define fcsr_ENABLES_shift (7) -#define fcsr_FLAGS_mask (0x0000007C) -#define fcsr_FLAGS_shift (2) -#define fcsr_RM_mask (0x00000003) -#define fcsr_RM_shift (0) - -#define fenr_FS (0x00000004) - -/* Macros to update and retrieve the FCSR condition-code bits. This - is complicated by the fact that there is a hole in the index range - of the bits within the FCSR register. (Note that the number of bits - visible depends on the ISA in use, but that is handled elsewhere.) */ -#define SETFCC(cc,v) \ - do { \ - (FCSR = ((FCSR & ~(1 << fcsr_FCC_bit(cc))) | ((v) << fcsr_FCC_bit(cc)))); \ - } while (0) -#define GETFCC(cc) ((FCSR & (1 << fcsr_FCC_bit(cc))) != 0 ? 1 : 0) - - -/* Read flush-to-zero bit (not right-justified). */ -#define GETFS() ((int)(FCSR & fcsr_FS)) - - -/* FCSR flag bits definitions and access macros. */ -#define IR 0 /* I: Inexact Result */ -#define UF 1 /* U: UnderFlow */ -#define OF 2 /* O: OverFlow */ -#define DZ 3 /* Z: Division by Zero */ -#define IO 4 /* V: Invalid Operation */ -#define UO 5 /* E: Unimplemented Operation (CAUSE field only) */ - -#define FP_FLAGS(b) (1 << ((b) + fcsr_FLAGS_shift)) -#define FP_ENABLE(b) (1 << ((b) + fcsr_ENABLES_shift)) -#define FP_CAUSE(b) (1 << ((b) + fcsr_CAUSE_shift)) - - -/* Rounding mode bit definitions and access macros. */ -#define FP_RM_NEAREST 0 /* Round to nearest (Round). */ -#define FP_RM_TOZERO 1 /* Round to zero (Trunc). */ -#define FP_RM_TOPINF 2 /* Round to Plus infinity (Ceil). */ -#define FP_RM_TOMINF 3 /* Round to Minus infinity (Floor). */ - -#define GETRM() ((FCSR >> fcsr_RM_shift) & fcsr_RM_mask) - - -#endif /* CP1_H */ diff --git a/sim/mips/mdmx.igen b/sim/mips/mdmx.igen deleted file mode 100644 index f286e3b4ab4..00000000000 --- a/sim/mips/mdmx.igen +++ /dev/null @@ -1,592 +0,0 @@ -// -*- C -*- - -// Simulator definition for the MIPS MDMX ASE. -// Copyright (C) 2002 Free Software Foundation, Inc. -// Contributed by Broadcom Corporation (SiByte). -// -// This file is part of GDB, the GNU debugger. -// -// 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 -// the Free Software Foundation; either version 2, or (at your option) -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// Reference: MIPS64 Architecture Volume IV-b: -// The MDMX Application-Specific Extension - -// Notes on "format selectors" (FMTSEL): -// -// A selector with final bit 0 indicates OB format. -// A selector with final bits 01 indicates QH format. -// A selector with final bits 11 has UNPREDICTABLE result per the spec. -// -// Similarly, for the single-bit fields which differentiate between -// formats (FMTOP), 0 is OB format and 1 is QH format. - -// If you change this file to add instructions, please make sure that model -// "sb1" configurations still build, and that you've added no new -// instructions to the "sb1" model. - - -// Helper: -// -// Check whether MDMX is usable, and if not signal an appropriate exception. -// - -:function:::void:check_mdmx:instruction_word insn -*mdmx: -{ - if (! COP_Usable (1)) - SignalExceptionCoProcessorUnusable (1); - if ((SR & (status_MX|status_FR)) != (status_MX|status_FR)) - SignalExceptionMDMX (); - check_u64 (SD_, insn); -} - - -// Helper: -// -// Check whether a given MDMX format selector indicates a valid and usable -// format, and if not signal an appropriate exception. -// - -:function:::int:check_mdmx_fmtsel:instruction_word insn, int fmtsel -*mdmx: -{ - switch (fmtsel & 0x03) - { - case 0x00: /* ob */ - case 0x02: - case 0x01: /* qh */ - return 1; - case 0x03: /* UNPREDICTABLE */ - SignalException (ReservedInstruction, insn); - return 0; - } - return 0; -} - - -// Helper: -// -// Check whether a given MDMX format bit indicates a valid and usable -// format, and if not signal an appropriate exception. -// - -:function:::int:check_mdmx_fmtop:instruction_word insn, int fmtop -*mdmx: -{ - switch (fmtop & 0x01) - { - case 0x00: /* ob */ - case 0x01: /* qh */ - return 1; - } - return 0; -} - - -:%s::::FMTSEL:int fmtsel -*mdmx: -*sb1: -{ - if ((fmtsel & 0x1) == 0) - return "ob"; - else if ((fmtsel & 0x3) == 1) - return "qh"; - else - return "?"; -} - - -:%s::::FMTOP:int fmtop -*mdmx: -*sb1: -{ - switch (fmtop) - { - case 0: return "ob"; - case 1: return "qh"; - default: return "?"; - } -} - - -:%s::::SHOP:int shop -*mdmx: -*sb1: -{ - if ((shop & 0x11) == 0x00) - switch ((shop >> 1) & 0x07) - { - case 3: return "upsl.ob"; - case 4: return "pach.ob"; - case 6: return "mixh.ob"; - case 7: return "mixl.ob"; - default: return "?"; - } - else if ((shop & 0x03) == 0x01) - switch ((shop >> 2) & 0x07) - { - case 0: return "mixh.qh"; - case 1: return "mixl.qh"; - case 2: return "pach.qh"; - case 4: return "bfla.qh"; - case 6: return "repa.qh"; - case 7: return "repb.qh"; - default: return "?"; - } - else - return "?"; -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,001011:MDMX:64::ADD.fmt -"add.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Add(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,0,0000,110111:MDMX:64::ADDA.fmt -"adda.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_AddA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,1,0000,110111:MDMX:64::ADDL.fmt -"addl.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_AddL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); -} - - -011110,00,3.IMM,5.VT,5.VS,5.VD,0110,1.FMTOP,0:MDMX:64::ALNI.fmt -"alni.%s v, v, v, " -*mdmx: -*sb1: -{ - unsigned64 result; - int s; - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - s = (IMM << 3); - result = ValueFPR(VS,fmt_mdmx) << s; - if (s != 0) // x86 gcc treats >> 64 as >> 0 - result |= ValueFPR(VT,fmt_mdmx) >> (64 - s); - StoreFPR(VD,fmt_mdmx,result); -} - - -011110,5.RS,5.VT,5.VS,5.VD,0110,1.FMTOP,1:MDMX:64::ALNV.fmt -"alnv.%s v, v, v, r" -*mdmx: -*sb1: -{ - unsigned64 result; - int s; - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - s = ((GPR[RS] & 0x7) << 3); - result = ValueFPR(VS,fmt_mdmx) << s; - if (s != 0) // x86 gcc treats >> 64 as >> 0 - result |= ValueFPR(VT,fmt_mdmx) >> (64 - s); - StoreFPR(VD,fmt_mdmx,result); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,001100:MDMX:64::AND.fmt -"and.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_And(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,00000,000001:MDMX:64::C.EQ.fmt -"c.eq.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_EQ,VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,00000,000101:MDMX:64::C.LE.fmt -"c.le.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_LT|MX_C_EQ,VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,00000,000100:MDMX:64::C.LT.fmt -"c.lt.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_LT,VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,000111:MDMX:64::MAX.fmt -"max.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Max(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,000110:MDMX:64::MIN.fmt -"min.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Min(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,3.SEL,01,5.VT,5.VS,5.VD,000000:MDMX:64::MSGN.QH -"msgn.qh v, v, v" -*mdmx: -{ - check_mdmx (SD_, instruction_0); - StoreFPR(VD,fmt_mdmx,MX_Msgn(ValueFPR(VS,fmt_mdmx),VT,qh_fmtsel(SEL))); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,110000:MDMX:64::MUL.fmt -"mul.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Mul(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,0,0000,110011:MDMX:64::MULA.fmt -"mula.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_MulA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,1,0000,110011:MDMX:64::MULL.fmt -"mull.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_MulL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,0,0000,110010:MDMX:64::MULS.fmt -"muls.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_MulS(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,1,0000,110010:MDMX:64::MULSL.fmt -"mulsl.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_MulSL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,001111:MDMX:64::NOR.fmt -"nor.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Nor(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,001110:MDMX:64::OR.fmt -"or.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Or(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,000010:MDMX:64::PICKF.fmt -"pickf.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Pick(0,ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,000011:MDMX:64::PICKT.fmt -"pickt.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Pick(1,ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,1000,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACH.fmt -"rach.%s v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_H,FMTOP)); -} - - -011110,0000,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACL.fmt -"racl.%s v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_L,FMTOP)); -} - - -011110,0100,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACM.fmt -"racm.%s v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_M,FMTOP)); -} - - -011110,3.SEL,01,5.VT,00000,5.VD,100101:MDMX:64::RNAS.QH -"rnas.qh v, v" -*mdmx: -{ - check_mdmx (SD_, instruction_0); - StoreFPR(VD,fmt_mdmx,MX_RNAS(VT,qh_fmtsel(SEL))); -} - - -011110,5.FMTSEL,5.VT,00000,5.VD,100001:MDMX:64::RNAU.fmt -"rnau.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_RNAU(VT,FMTSEL)); -} - - -011110,3.SEL,01,5.VT,00000,5.VD,100110:MDMX:64::RNES.QH -"rnes.qh v, v" -*mdmx: -{ - check_mdmx (SD_, instruction_0); - StoreFPR(VD,fmt_mdmx,MX_RNES(VT,qh_fmtsel(SEL))); -} - - -011110,5.FMTSEL,5.VT,00000,5.VD,100010:MDMX:64::RNEU.fmt -"rneu.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_RNEU(VT,FMTSEL)); -} - - -011110,3.SEL,01,5.VT,00000,5.VD,100100:MDMX:64::RZS.QH -"rzs.qh v, v" -*mdmx: -{ - check_mdmx (SD_, instruction_0); - StoreFPR(VD,fmt_mdmx,MX_RZS(VT,qh_fmtsel(SEL))); -} - - -011110,5.FMTSEL,5.VT,00000,5.VD,100000:MDMX:64::RZU.fmt -"rzu.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_RZU(VT,FMTSEL)); -} - - -011110,5.SHOP,5.VT,5.VS,5.VD,011111:MDMX:64::SHFL.op.fmt -"shfl.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, SHOP)) - StoreFPR(VD,fmt_mdmx,MX_SHFL(SHOP,ValueFPR(VS,fmt_mdmx),ValueFPR(VT,fmt_mdmx))); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,010000:MDMX:64::SLL.fmt -"sll.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_ShiftLeftLogical(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,3.SEL,01,5.VT,5.VS,5.VD,010011:MDMX:64::SRA.QH -"sra.qh v, v, v" -*mdmx: -{ - check_mdmx (SD_, instruction_0); - StoreFPR(VD,fmt_mdmx,MX_ShiftRightArith(ValueFPR(VS,fmt_mdmx),VT,qh_fmtsel(SEL))); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,010010:MDMX:64::SRL.fmt -"srl.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_ShiftRightLogical(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,001010:MDMX:64::SUB.fmt -"sub.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Sub(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} - - -011110,5.FMTSEL,5.VT,5.VS,0,0000,110110:MDMX:64::SUBA.fmt -"suba.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_SubA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); -} - - -011110,5.FMTSEL,5.VT,5.VS,1,0000,110110:MDMX:64::SUBL.fmt -"subl.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - MX_SubL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); -} - - -011110,1000,1.FMTOP,00000,5.VS,00000,111110:MDMX:64::WACH.fmt -"wach.%s v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - MX_WACH(FMTOP,ValueFPR(VS,fmt_mdmx)); -} - - -011110,0000,1.FMTOP,5.VT,5.VS,00000,111110:MDMX:64::WACL.fmt -"wacl.%s v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - MX_WACL(FMTOP,ValueFPR(VS,fmt_mdmx),ValueFPR(VT,fmt_mdmx)); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,001101:MDMX:64::XOR.fmt -"xor.%s v, v, v" -*mdmx: -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL)) - StoreFPR(VD,fmt_mdmx,MX_Xor(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); -} diff --git a/sim/mips/mips3d.igen b/sim/mips/mips3d.igen deleted file mode 100644 index f7043efcac0..00000000000 --- a/sim/mips/mips3d.igen +++ /dev/null @@ -1,176 +0,0 @@ -// -*- C -*- - -// Simulator definition for the MIPS MIPS-3D ASE. -// Copyright (C) 2002 Free Software Foundation, Inc. -// Contributed by Broadcom Corporation (SiByte). -// -// This file is part of GDB, the GNU debugger. -// -// 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 -// the Free Software Foundation; either version 2, or (at your option) -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// Reference: MIPS64 Architecture for Programmers Volume IV-c: -// The MIPS-3D Application-Specific Extension to the -// MIPS64 Architecture. (MIPS Document MD00099) - - -010001,10,110,5.FT,5.FS,5.FD,011000:COP1:64,f::ADDR.PS -"addr.ps f, f, f" -*mips3d: -{ - /* fd.PL = ft.PU + ft.PL; fd.PU = fs.PU + fs.PL; */ - check_fpu (SD_); - check_u64 (SD_, instruction_0); - StoreFPR (FD, fmt_ps, AddR (ValueFPR (FS, fmt_ps), - ValueFPR (FT, fmt_ps), fmt_ps)); -} - - -010001,01001,3.CC,0,1.TF,16.OFFSET:COP1:64,f::BC1ANY2tf -"bc1any2%s , %#lx" -*mips3d: -{ - address_word offset; - int cc = CC; - check_fpu (SD_); - check_u64 (SD_, instruction_0); - if ((cc & 0x1) != 0) - Unpredictable (); - if ((GETFCC (cc) == TF) || (GETFCC (cc + 1) == TF)) - { - offset = (EXTEND16 (OFFSET) << 2); - DELAY_SLOT (NIA + offset); - } -} - - -010001,01010,3.CC,0,1.TF,16.OFFSET:COP1:64,f::BC1ANY4tf -"bc1any4%s , %#lx" -*mips3d: -{ - address_word offset; - int cc = CC; - check_fpu (SD_); - check_u64 (SD_, instruction_0); - if ((cc & 0x3) != 0) - Unpredictable (); - if ((GETFCC (cc) == TF) - || (GETFCC (cc + 1) == TF) - || (GETFCC (cc + 2) == TF) - || (GETFCC (cc + 3) == TF)) - { - offset = (EXTEND16 (OFFSET) << 2); - DELAY_SLOT (NIA + offset); - } -} - - -010001,10,3.FMT,5.FT,5.FS,3.CC,01,11,4.COND:COP1:64,f::CABS.cond.fmt -"cabs.%s.%s , f, f" -*mips3d: -{ - int fmt = FMT; - check_fpu (SD_); - check_u64 (SD_, instruction_0); - check_fmt_p (SD_, fmt, instruction_0); - CompareAbs (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt, COND, CC); - TRACE_ALU_RESULT (ValueFCR (31)); -} - - -010001,10,110,00000,5.FS,5.FD,100100:COP1:64,f::CVT.PW.PS -"cvt.pw.ps f, f" -*mips3d: -{ - /* fd.pu = cvt_rnd (fs.pu); fd.pl = cvt_rnd (fs.pl); */ - /* fmt_pw is fmt_long for 64 bit transfers, but cvt encoding is fmt_word. */ - check_fpu (SD_); - check_u64 (SD_, instruction_0); - StoreFPR (FD, fmt_pw, ConvertPS (GETRM (), ValueFPR (FS, fmt_ps), - fmt_ps, fmt_word)); -} - - -010001,10,100,00000,5.FS,5.FD,100110:COP1:64,f::CVT.PS.PW -"cvt.ps.pw f, f" -*mips3d: -{ - /* fd.pl = cvt_rnd (fs.pl); fd.pu = cvt_rnd (fs.pu); */ - /* fmt_pw is fmt_long for 64 bit transfers, but cvt encoding is fmt_word. */ - check_fpu (SD_); - check_u64 (SD_, instruction_0); - StoreFPR (FD, fmt_ps, ConvertPS (GETRM (), ValueFPR (FS, fmt_pw), - fmt_word, fmt_ps)); -} - - -010001,10,110,5.FT,5.FS,5.FD,011010:COP1:64,f::MULR.PS -"mulr.ps f, f, f" -*mips3d: -{ - /* fd.PL = ft.PU * ft.PL; fd.PU = fs.PU * fs.PL; */ - check_fpu (SD_); - check_u64 (SD_, instruction_0); - StoreFPR (FD, fmt_ps, MultiplyR (ValueFPR (FS, fmt_ps), - ValueFPR (FT, fmt_ps), fmt_ps)); -} - - -010001,10,3.FMT,00000,5.FS,5.FD,011101:COP1:64,f::RECIP1.fmt -"recip1.%s f, f" -*mips3d: -{ - int fmt = FMT; - check_fpu (SD_); - check_u64 (SD_, instruction_0); - check_fmt_p (SD_, fmt, instruction_0); - StoreFPR (FD, fmt, Recip1 (ValueFPR (FS, fmt), fmt)); -} - - -010001,10,3.FMT,5.FT,5.FS,5.FD,011100:COP1:64,f::RECIP2.fmt -"recip2.%s f, f, f" -*mips3d: -{ - int fmt = FMT; - check_fpu (SD_); - check_u64 (SD_, instruction_0); - check_fmt_p (SD_, fmt, instruction_0); - StoreFPR (FD, fmt, Recip2 (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt)); -} - - -010001,10,3.FMT,00000,5.FS,5.FD,011110:COP1:64,f::RSQRT1.fmt -"rsqrt1.%s f, f" -*mips3d: -{ - int fmt = FMT; - check_fpu (SD_); - check_u64 (SD_, instruction_0); - check_fmt_p (SD_, fmt, instruction_0); - StoreFPR (FD, fmt, RSquareRoot1 (ValueFPR (FS, fmt), fmt)); -} - - -010001,10,3.FMT,5.FT,5.FS,5.FD,011111:COP1:64,f::RSQRT2.fmt -"rsqrt2.%s f, f, f" -*mips3d: -{ - int fmt = FMT; - check_fpu (SD_); - check_u64 (SD_, instruction_0); - check_fmt_p (SD_, fmt, instruction_0); - StoreFPR (FD, fmt, RSquareRoot2 (ValueFPR (FS, fmt), - ValueFPR (FT, fmt), fmt)); -} diff --git a/sim/mips/sb1.igen b/sim/mips/sb1.igen deleted file mode 100644 index 6453670b1d6..00000000000 --- a/sim/mips/sb1.igen +++ /dev/null @@ -1,191 +0,0 @@ -// -*- C -*- - -// Simulator definition for the Broadcom SiByte SB-1 CPU extensions. -// Copyright (C) 2002 Free Software Foundation, Inc. -// Contributed by Broadcom Corporation (SiByte). -// -// This file is part of GDB, the GNU debugger. -// -// 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 -// the Free Software Foundation; either version 2, or (at your option) -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -// MDMX ASE Instructions -// --------------------- -// -// The SB-1 implements the format OB subset of MDMX -// and has three additions (pavg, pabsdiff, pabsdifc). -// In addition, there are a couple of partial-decoding -// issues for the read/write accumulator instructions. -// -// This code is structured so that mdmx.igen can be used by -// selecting the allowed instructions either via model, or by -// using check_mdmx_fmtsel and check_mdmx_fmtop to cause an -// exception if the instruction is not allowed. - - -:function:::void:check_mdmx:instruction_word insn -*sb1: -{ - if (!COP_Usable(1)) - SignalExceptionCoProcessorUnusable(1); - if ((SR & status_MX) == 0) - SignalExceptionMDMX(); - check_u64 (SD_, insn); -} - -:function:::int:check_mdmx_fmtsel:instruction_word insn, int fmtsel -*sb1: -{ - switch (fmtsel & 0x03) - { - case 0x00: /* ob */ - case 0x02: - return 1; - case 0x01: /* qh */ - case 0x03: /* UNPREDICTABLE */ - SignalException (ReservedInstruction, insn); - return 0; - } - return 0; -} - -:function:::int:check_mdmx_fmtop:instruction_word insn, int fmtop -*sb1: -{ - switch (fmtop & 0x01) - { - case 0x00: /* ob */ - return 1; - case 0x01: /* qh */ - SignalException (ReservedInstruction, insn); - return 0; - } - return 0; -} - - -011110,10,2.X!0,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACH.sb1.fmt -"rach.?.%s v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - /* No op. */ -} - - -011110,00,2.X!0,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACL.sb1.fmt -"racl.?.%s v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - /* No op. */ -} - - -011110,01,2.X!0,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACM.sb1.fmt -"racm.?.%s v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - /* No op. */ -} - - -011110,2.X1!0!1!2,2.X2,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RAC.sb1.fmt -"rac?.? v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - /* No op. */ -} - - -011110,10,2.X!0,1.FMTOP,00000,5.VS,00000,111110:MDMX:64::WACH.sb1.fmt -"wach.?.%s v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - /* No op. */ -} - - -011110,00,2.X!0,1.FMTOP,5.VT,5.VS,00000,111110:MDMX:64::WACL.sb1.fmt -"wacl.?.%s v,v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - /* No op. */ -} - - -011110,2.X1!0!2,2.X2,1.FMTOP,5.VT,5.VS,00000,111110:MDMX:64::WAC.sb1.fmt -"wacl?.?.%s v,v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - check_mdmx_fmtop (SD_, instruction_0, FMTOP); - /* No op. */ -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,001001:MDMX:64::PABSDIFF.fmt -"pabsdiff.%s v,v,v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (SR & status_SBX) - { - check_mdmx_fmtsel (SD_, instruction_0, FMTSEL); - StoreFPR(VD,fmt_mdmx,MX_AbsDiff(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); - } - else - SignalException(ReservedInstruction, instruction_0); -} - - -011110,5.FMTSEL,5.VT,5.VS,00000,110101:MDMX:64::PABSDIFC.fmt -"pabsdifc.% v,v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (SR & status_SBX) - { - check_mdmx_fmtsel (SD_, instruction_0, FMTSEL); - MX_AbsDiffC(ValueFPR(VS,fmt_mdmx),VT,FMTSEL); - } - else - SignalException(ReservedInstruction, instruction_0); -} - - -011110,5.FMTSEL,5.VT,5.VS,5.VD,001000:MDMX:64::PAVG.fmt -"pavg.%s v,v,v" -*sb1: -{ - check_mdmx (SD_, instruction_0); - if (SR & status_SBX) - { - check_mdmx_fmtsel (SD_, instruction_0, FMTSEL); - StoreFPR(VD,fmt_mdmx,MX_Avg(ValueFPR(VS,fmt_mdmx),VT,FMTSEL)); - } - else - SignalException(ReservedInstruction, instruction_0); -}