From 4b5eb65210b3b44b4f0ea8c7a95a16f199fbd057 Mon Sep 17 00:00:00 2001 From: nobody <> Date: Mon, 1 May 2006 19:36:28 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'msnyder- reverse-20060502-branch'. Sprout from readline_5_1-import-branch 2006-04-20 20:13:22 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'readline_5_1' Cherrypick from master 2006-05-01 19:36:27 UTC DJ Delorie '* bfd-in.h (bfd_hash_table): Add count field.': bfd/ChangeLog bfd/bfd-in.h bfd/bfd-in2.h bfd/coff-rs6000.c bfd/elf.c bfd/elf32-arm.c bfd/elfxx-target.h bfd/hash.c bfd/libbfd-in.h bfd/libbfd.h bfd/opncls.c bfd/tekhex.c bfd/version.h gdb/ChangeLog gdb/MAINTAINERS gdb/Makefile.in gdb/NEWS gdb/breakpoint.c gdb/config/m32c/m32c.mt gdb/configure.tgt gdb/doc/ChangeLog gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/dwarf2read.c gdb/linux-fork.c gdb/m32c-tdep.c gdb/mingw-hdep.c gdb/mips-mdebug-tdep.c gdb/ppcnbsd-tdep.c gdb/remote.c gdb/rs6000-tdep.c gdb/ser-mingw.c gdb/serial.c gdb/serial.h gdb/testsuite/ChangeLog gdb/testsuite/gdb.asm/asm-source.exp gdb/testsuite/gdb.asm/m32c.inc gdb/testsuite/gdb.base/multi-forks.exp gdb/testsuite/gdb.base/sigbpt.exp gdb/testsuite/gdb.base/siginfo.exp gdb/testsuite/gdb.base/sigstep.exp gdb/version.in include/ChangeLog include/opcode/ChangeLog include/opcode/arm.h include/opcode/mips.h libiberty/ChangeLog libiberty/floatformat.c opcodes/ChangeLog opcodes/arm-dis.c opcodes/m68k-dis.c opcodes/mips-dis.c opcodes/mips-opc.c sim/ppc/ChangeLog sim/ppc/Makefile.in Delete: readline/examples/rlfe/ChangeLog readline/examples/rlfe/Makefile.in readline/examples/rlfe/README readline/examples/rlfe/config.h.in readline/examples/rlfe/configure readline/examples/rlfe/configure.in readline/examples/rlfe/extern.h readline/examples/rlfe/os.h readline/examples/rlfe/pty.c readline/examples/rlfe/rlfe.c readline/examples/rlfe/screen.h sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms sim/testsuite/sim/cris/hw/rv-n-cris/quit.s sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp sim/testsuite/sim/cris/hw/rv-n-cris/std.dev sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms --- bfd/ChangeLog | 87 + bfd/bfd-in.h | 2 + bfd/bfd-in2.h | 2 + bfd/coff-rs6000.c | 4 +- bfd/elf.c | 169 +- bfd/elf32-arm.c | 17 +- bfd/elfxx-target.h | 4 +- bfd/hash.c | 101 +- bfd/libbfd-in.h | 2 + bfd/libbfd.h | 2 + bfd/opncls.c | 28 +- bfd/tekhex.c | 82 +- bfd/version.h | 2 +- gdb/ChangeLog | 101 + gdb/MAINTAINERS | 3 + gdb/Makefile.in | 9 +- gdb/NEWS | 6 + gdb/breakpoint.c | 2 +- gdb/config/m32c/m32c.mt | 7 + gdb/configure.tgt | 2 + gdb/doc/ChangeLog | 9 + gdb/doc/gdb.texinfo | 23 +- gdb/doc/gdbint.texinfo | 56 +- gdb/dwarf2read.c | 61 +- gdb/linux-fork.c | 25 +- gdb/m32c-tdep.c | 2552 ++++++++ gdb/mingw-hdep.c | 10 + gdb/mips-mdebug-tdep.c | 2 +- gdb/ppcnbsd-tdep.c | 4 +- gdb/remote.c | 2 +- gdb/rs6000-tdep.c | 1 - gdb/ser-mingw.c | 516 +- gdb/serial.c | 7 + gdb/serial.h | 4 + gdb/testsuite/ChangeLog | 22 + gdb/testsuite/gdb.asm/asm-source.exp | 3 + gdb/testsuite/gdb.asm/m32c.inc | 33 + gdb/testsuite/gdb.base/multi-forks.exp | 41 +- gdb/testsuite/gdb.base/sigbpt.exp | 4 + gdb/testsuite/gdb.base/siginfo.exp | 4 + gdb/testsuite/gdb.base/sigstep.exp | 8 + gdb/version.in | 2 +- include/ChangeLog | 5 + include/opcode/ChangeLog | 22 +- include/opcode/arm.h | 10 +- include/opcode/mips.h | 28 +- libiberty/ChangeLog | 4 + libiberty/floatformat.c | 2 +- opcodes/ChangeLog | 60 + opcodes/arm-dis.c | 1471 +++-- opcodes/m68k-dis.c | 6 +- opcodes/mips-dis.c | 75 +- opcodes/mips-opc.c | 66 + readline/examples/rlfe/ChangeLog | 37 - readline/examples/rlfe/Makefile.in | 176 - readline/examples/rlfe/README | 78 - readline/examples/rlfe/config.h.in | 375 -- readline/examples/rlfe/configure | 5400 ----------------- readline/examples/rlfe/configure.in | 438 -- readline/examples/rlfe/extern.h | 33 - readline/examples/rlfe/os.h | 530 -- readline/examples/rlfe/pty.c | 387 -- readline/examples/rlfe/rlfe.c | 780 --- readline/examples/rlfe/screen.h | 2 - sim/ppc/ChangeLog | 6 + sim/ppc/Makefile.in | 6 +- sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms | 8 - sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms | 69 - sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms | 44 - sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms | 46 - sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms | 46 - sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms | 46 - sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms | 99 - sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms | 88 - sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms | 100 - sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms | 104 - sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms | 22 - sim/testsuite/sim/cris/hw/rv-n-cris/quit.s | 4 - sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp | 241 - sim/testsuite/sim/cris/hw/rv-n-cris/std.dev | 8 - .../sim/cris/hw/rv-n-cris/testutils.inc | 22 - .../sim/cris/hw/rv-n-cris/trivial1.ms | 17 - .../sim/cris/hw/rv-n-cris/trivial2.ms | 21 - .../sim/cris/hw/rv-n-cris/trivial3.ms | 20 - .../sim/cris/hw/rv-n-cris/trivial4.ms | 22 - .../sim/cris/hw/rv-n-cris/trivial4.r | 4 - .../sim/cris/hw/rv-n-cris/trivial5.ms | 16 - sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms | 33 - 88 files changed, 5115 insertions(+), 9983 deletions(-) create mode 100644 gdb/config/m32c/m32c.mt create mode 100644 gdb/m32c-tdep.c create mode 100644 gdb/testsuite/gdb.asm/m32c.inc delete mode 100644 readline/examples/rlfe/ChangeLog delete mode 100644 readline/examples/rlfe/Makefile.in delete mode 100644 readline/examples/rlfe/README delete mode 100644 readline/examples/rlfe/config.h.in delete mode 100755 readline/examples/rlfe/configure delete mode 100644 readline/examples/rlfe/configure.in delete mode 100644 readline/examples/rlfe/extern.h delete mode 100644 readline/examples/rlfe/os.h delete mode 100644 readline/examples/rlfe/pty.c delete mode 100644 readline/examples/rlfe/rlfe.c delete mode 100644 readline/examples/rlfe/screen.h delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/quit.s delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/std.dev delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms delete mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1ea6061fc8b..dcfe7138af0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,72 @@ +2006-05-01 DJ Delorie + + * bfd-in.h (bfd_hash_table): Add count field. + * bfd-in2.h: Regenerate. + * hash.c (higher_prime_number): New. + (bfd_hash_table_inint_n): Init count field. + (bfd_hash_lookup): Grow table as needed. + +2006-04-27 Kaz Kojima + + PR binutils/2584 + * tekhex.c (getvalue): Change return type to bfd_boolean and + add the new parameter. Return false if the unexpected character + is found. + (getsym): Likewise. + (first_phase): Change return type to bfd_boolean and return + false if the unexpected character is found. Replace abort + with returning false. + (pass_over): Change return type to bfd_boolean and the type of + the second argument to bfd_boolean (*) (bfd *, int, char *). + Return false if FUNC returns false. + (tekhex_object_p): Return NULL if pass_over fails. + +2006-04-27 Alan Modra + + * coff-rs6000.c (xcoff_write_archive_contents_old): Warning fix. + +2006-04-26 H.J. Lu + + PR binutils/2593 + * elf.c (_bfd_elf_new_section_hook): Don't set section ELF type + and flags if its BFD flags have been set. + (_bfd_elf_init_private_section_data): Don't copy the output ELF + section type from input if it has been set to something + different. + +2006-04-25 H.J. Lu + + PR binutils/2467 + * elf.c (_bfd_elf_close_and_cleanup): Check elf_tdata (abfd) + is NULL first. + + * elf32-arm.c (elf32_arm_close_and_cleanup): Check if + abfd->sections is NULL. + (elf32_arm_bfd_free_cached_info): New. + (bfd_elf32_bfd_free_cached_info): Defined. + + * elfxx-target.h (bfd_elfNN_bfd_free_cached_info): Default it + to _bfd_free_cached_info. + + * libbfd-in.h (_bfd_free_cached_info): New. + * libbfd: Regenerated. + + * opncls.c (_bfd_delete_bfd): Check if abfd->memory is NULL. + (_bfd_free_cached_info): New. + +2006-04-21 Alan Modra + + * elf.c (assign_file_positions_except_relocs): Move code setting + file position of non-loaded sections.. + (assign_file_positions_for_segments): ..to here. + +2006-04-20 H.J. Lu + + PR ld/2537 + * elf.c (bfd_section_from_shdr): Allow sections reserved for + applications. Issue an error on sections we don't know how + to handle. + 2006-04-19 Alan Modra * Makefile.am: Run "make dep-am". @@ -278,6 +347,24 @@ bfd_get_compatible to set the new bfd architecture. Rely on it to detect incompatibilities. +2006-03-23 Michael Matz + + * reloc.c: Add BFD_RELOC_X86_64_GOT64, BFD_RELOC_X86_64_GOTPCREL64, + BFD_RELOC_X86_64_GOTPC64, BFD_RELOC_X86_64_GOTPLT64, + BFD_RELOC_X86_64_PLTOFF64. + * bfd-in2.h: Regenerated. + * libbfd.h: Regenerated. + * elf64-x86-64.c (x86_64_elf_howto_table): Correct comment. + Add howtos for above relocs. + (x86_64_reloc_map): Add mappings for new relocs. + (elf64_x86_64_check_relocs): R_X86_64_GOT64, R_X86_64_GOTPCREL64, + R_X86_64_GOTPLT64 need a got entry. R_X86_64_GOTPLT64 also a PLT + entry. R_X86_64_GOTPC64 needs a .got section. R_X86_64_PLTOFF64 + needs a PLT entry. + (elf64_x86_64_gc_sweep_hook): Reflect changes from + elf64_x86_64_check_relocs for the new relocs. + (elf64_x86_64_relocate_section): Handle new relocs. + 2006-03-22 Bob Wilson * elf32-xtensa.c (xtensa_read_table_entries): Remove assertion that diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 9daa578c03e..5c2f05dce39 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -376,6 +376,8 @@ struct bfd_hash_table struct bfd_hash_entry **table; /* The number of slots in the hash table. */ unsigned int size; + /* The number of entries in the hash table. */ + unsigned int count; /* The size of elements. */ unsigned int entsize; /* A function used to create new elements in the hash table. The diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 63fb521b0ab..0e921baabac 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -383,6 +383,8 @@ struct bfd_hash_table struct bfd_hash_entry **table; /* The number of slots in the hash table. */ unsigned int size; + /* The number of entries in the hash table. */ + unsigned int count; /* The size of elements. */ unsigned int entsize; /* A function used to create new elements in the hash table. The diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 220edf8809c..951587f99b1 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced @@ -2083,7 +2083,7 @@ xcoff_write_archive_contents_old (abfd) char decbuf[XCOFFARMAG_ELEMENT_SIZE + 1]; memset (&fhdr, 0, sizeof fhdr); - strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG); + (void) strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG); sprintf (fhdr.firstmemoff, "%d", SIZEOF_AR_FILE_HDR); sprintf (fhdr.freeoff, "%d", 0); diff --git a/bfd/elf.c b/bfd/elf.c index 9e48f66e90f..e6977228d24 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -2159,8 +2159,43 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) default: /* Check for any processor-specific section types. */ - return bed->elf_backend_section_from_shdr (abfd, hdr, name, - shindex); + if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex)) + return TRUE; + + if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER) + { + if ((hdr->sh_flags & SHF_ALLOC) != 0) + /* FIXME: How to properly handle allocated section reserved + for applications? */ + (*_bfd_error_handler) + (_("%B: don't know how to handle allocated, application " + "specific section `%s' [0x%8x]"), + abfd, name, hdr->sh_type); + else + /* Allow sections reserved for applications. */ + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, + shindex); + } + else if (hdr->sh_type >= SHT_LOPROC + && hdr->sh_type <= SHT_HIPROC) + /* FIXME: We should handle this section. */ + (*_bfd_error_handler) + (_("%B: don't know how to handle processor specific section " + "`%s' [0x%8x]"), + abfd, name, hdr->sh_type); + else if (hdr->sh_type >= SHT_LOOS && hdr->sh_type <= SHT_HIOS) + /* FIXME: We should handle this section. */ + (*_bfd_error_handler) + (_("%B: don't know how to handle OS specific section " + "`%s' [0x%8x]"), + abfd, name, hdr->sh_type); + else + /* FIXME: We should handle this section. */ + (*_bfd_error_handler) + (_("%B: don't know how to handle section `%s' [0x%8x]"), + abfd, name, hdr->sh_type); + + return FALSE; } return TRUE; @@ -2452,10 +2487,13 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec) bed = get_elf_backend_data (abfd); sec->use_rela_p = bed->default_use_rela_p; - /* When we read a file, we don't need section type and flags unless - it is a linker created section. They will be overridden in - _bfd_elf_make_section_from_shdr anyway. */ - if (abfd->direction != read_direction + /* When we read a file, we don't need to set ELF section type and + flags. They will be overridden in _bfd_elf_make_section_from_shdr + anyway. We will set ELF section type and flags for all linker + created sections. If user specifies BFD section flags, we will + set ELF section type and flags based on BFD section flags in + elf_fake_sections. */ + if ((!sec->flags && abfd->direction != read_direction) || (sec->flags & SEC_LINKER_CREATED) != 0) { ssect = (*bed->get_sec_type_attr) (abfd, sec); @@ -4084,6 +4122,10 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) bfd_vma filehdr_vaddr, filehdr_paddr; bfd_vma phdrs_vaddr, phdrs_paddr; Elf_Internal_Phdr *p; + Elf_Internal_Shdr **i_shdrpp; + Elf_Internal_Shdr **hdrpp; + unsigned int i; + unsigned int num_sec; if (elf_tdata (abfd)->segment_map == NULL) { @@ -4101,7 +4143,6 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) m = m->next) { unsigned int new_count; - unsigned int i; new_count = 0; for (i = 0; i < m->count; i ++) @@ -4175,7 +4216,6 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) m != NULL; m = m->next, p++) { - unsigned int i; asection **secpp; /* If elf_segment_map is not from map_sections_to_segments, the @@ -4500,6 +4540,51 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) } } + /* Assign file positions for the other sections. */ + i_shdrpp = elf_elfsections (abfd); + num_sec = elf_numsections (abfd); + for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++) + { + struct elf_obj_tdata *tdata = elf_tdata (abfd); + Elf_Internal_Shdr *hdr; + + hdr = *hdrpp; + if (hdr->bfd_section != NULL + && hdr->bfd_section->filepos != 0) + hdr->sh_offset = hdr->bfd_section->filepos; + else if ((hdr->sh_flags & SHF_ALLOC) != 0) + { + ((*_bfd_error_handler) + (_("%B: warning: allocated section `%s' not in segment"), + abfd, + (hdr->bfd_section == NULL + ? "*unknown*" + : hdr->bfd_section->name))); + if ((abfd->flags & D_PAGED) != 0) + off += vma_page_aligned_bias (hdr->sh_addr, off, + bed->maxpagesize); + else + off += vma_page_aligned_bias (hdr->sh_addr, off, + hdr->sh_addralign); + off = _bfd_elf_assign_file_position_for_section (hdr, off, + FALSE); + } + else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA) + && hdr->bfd_section == NULL) + || hdr == i_shdrpp[tdata->symtab_section] + || hdr == i_shdrpp[tdata->symtab_shndx_section] + || hdr == i_shdrpp[tdata->strtab_section]) + hdr->sh_offset = -1; + else + off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); + + if (i == SHN_LORESERVE - 1) + { + i += SHN_HIRESERVE + 1 - SHN_LORESERVE; + hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE; + } + } + /* Now that we have set the section file positions, we can set up the file positions for the non PT_LOAD segments. */ for (m = elf_tdata (abfd)->segment_map, p = phdrs; @@ -4515,7 +4600,6 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) PT_LOAD segment, so it will not be processed above. */ if (p->p_type == PT_DYNAMIC && m->sections[0]->filepos == 0) { - unsigned int i; Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); i = 1; @@ -4718,16 +4802,16 @@ static bfd_boolean assign_file_positions_except_relocs (bfd *abfd, struct bfd_link_info *link_info) { - struct elf_obj_tdata * const tdata = elf_tdata (abfd); - Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd); - Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); - unsigned int num_sec = elf_numsections (abfd); + struct elf_obj_tdata *tdata = elf_tdata (abfd); + Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); file_ptr off; const struct elf_backend_data *bed = get_elf_backend_data (abfd); if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 && bfd_get_format (abfd) != bfd_core) { + Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); + unsigned int num_sec = elf_numsections (abfd); Elf_Internal_Shdr **hdrpp; unsigned int i; @@ -4762,57 +4846,12 @@ assign_file_positions_except_relocs (bfd *abfd, } else { - unsigned int i; - Elf_Internal_Shdr **hdrpp; - /* Assign file positions for the loaded sections based on the assignment of sections to segments. */ if (! assign_file_positions_for_segments (abfd, link_info)) return FALSE; - /* Assign file positions for the other sections. */ - - off = elf_tdata (abfd)->next_file_pos; - for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++) - { - Elf_Internal_Shdr *hdr; - - hdr = *hdrpp; - if (hdr->bfd_section != NULL - && hdr->bfd_section->filepos != 0) - hdr->sh_offset = hdr->bfd_section->filepos; - else if ((hdr->sh_flags & SHF_ALLOC) != 0) - { - ((*_bfd_error_handler) - (_("%B: warning: allocated section `%s' not in segment"), - abfd, - (hdr->bfd_section == NULL - ? "*unknown*" - : hdr->bfd_section->name))); - if ((abfd->flags & D_PAGED) != 0) - off += vma_page_aligned_bias (hdr->sh_addr, off, - bed->maxpagesize); - else - off += vma_page_aligned_bias (hdr->sh_addr, off, - hdr->sh_addralign); - off = _bfd_elf_assign_file_position_for_section (hdr, off, - FALSE); - } - else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA) - && hdr->bfd_section == NULL) - || hdr == i_shdrpp[tdata->symtab_section] - || hdr == i_shdrpp[tdata->symtab_shndx_section] - || hdr == i_shdrpp[tdata->strtab_section]) - hdr->sh_offset = -1; - else - off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); - - if (i == SHN_LORESERVE - 1) - { - i += SHN_HIRESERVE + 1 - SHN_LORESERVE; - hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE; - } - } + off = tdata->next_file_pos; } /* Place the section headers. */ @@ -4820,7 +4859,7 @@ assign_file_positions_except_relocs (bfd *abfd, i_ehdrp->e_shoff = off; off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize; - elf_tdata (abfd)->next_file_pos = off; + tdata->next_file_pos = off; return TRUE; } @@ -5870,9 +5909,11 @@ _bfd_elf_init_private_section_data (bfd *ibfd, || obfd->xvec->flavour != bfd_target_elf_flavour) return TRUE; - /* FIXME: What if the output ELF section type has been set to - something different? */ - if (elf_section_type (osec) == SHT_NULL) + /* Don't copy the output ELF section type from input if the + output BFD section flags has been set to something different. + elf_fake_sections will set ELF section type based on BFD + section flags. */ + if (osec->flags == isec->flags || !osec->flags) elf_section_type (osec) = elf_section_type (isec); /* Set things up for objcopy and relocatable link. The output @@ -7171,7 +7212,7 @@ _bfd_elf_close_and_cleanup (bfd *abfd) { if (bfd_get_format (abfd) == bfd_object) { - if (elf_shstrtab (abfd) != NULL) + if (elf_tdata (abfd) != NULL && elf_shstrtab (abfd) != NULL) _bfd_elf_strtab_free (elf_shstrtab (abfd)); _bfd_dwarf2_cleanup_debug_info (abfd); } diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index ca33121708d..bd3c4e3356b 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -7936,11 +7936,25 @@ unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED, static bfd_boolean elf32_arm_close_and_cleanup (bfd * abfd) { - bfd_map_over_sections (abfd, unrecord_section_via_map_over_sections, NULL); + if (abfd->sections) + bfd_map_over_sections (abfd, + unrecord_section_via_map_over_sections, + NULL); return _bfd_elf_close_and_cleanup (abfd); } +static bfd_boolean +elf32_arm_bfd_free_cached_info (bfd * abfd) +{ + if (abfd->sections) + bfd_map_over_sections (abfd, + unrecord_section_via_map_over_sections, + NULL); + + return _bfd_free_cached_info (abfd); +} + /* Display STT_ARM_TFUNC symbols as functions. */ static void @@ -8100,6 +8114,7 @@ const struct elf_size_info elf32_arm_size_info = { #define bfd_elf32_new_section_hook elf32_arm_new_section_hook #define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol #define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup +#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info #define bfd_elf32_bfd_final_link elf32_arm_bfd_final_link #define elf_backend_get_symbol_type elf32_arm_get_symbol_type diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 503726d2b86..14a693a420b 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -29,7 +29,9 @@ #ifndef bfd_elfNN_close_and_cleanup #define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup #endif -#define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#ifndef bfd_elfNN_bfd_free_cached_info +#define bfd_elfNN_bfd_free_cached_info _bfd_free_cached_info +#endif #ifndef bfd_elfNN_get_section_contents #define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents #endif diff --git a/bfd/hash.c b/bfd/hash.c index ce9ba5c6297..bc81ac87f2b 100644 --- a/bfd/hash.c +++ b/bfd/hash.c @@ -298,7 +298,72 @@ SUBSUBSECTION */ /* The default number of entries to use when creating a hash table. */ -#define DEFAULT_SIZE 4051 +#define DEFAULT_SIZE (4093) + +/* The following function returns a nearest prime number which is + greater than N, and near a power of two. Copied from libiberty. */ + +static unsigned long +higher_prime_number (unsigned long n) +{ + /* These are primes that are near, but slightly smaller than, a + power of two. */ + static const unsigned long primes[] = { + (unsigned long) 7, + (unsigned long) 13, + (unsigned long) 31, + (unsigned long) 61, + (unsigned long) 127, + (unsigned long) 251, + (unsigned long) 509, + (unsigned long) 1021, + (unsigned long) 2039, + (unsigned long) 4093, + (unsigned long) 8191, + (unsigned long) 16381, + (unsigned long) 32749, + (unsigned long) 65521, + (unsigned long) 131071, + (unsigned long) 262139, + (unsigned long) 524287, + (unsigned long) 1048573, + (unsigned long) 2097143, + (unsigned long) 4194301, + (unsigned long) 8388593, + (unsigned long) 16777213, + (unsigned long) 33554393, + (unsigned long) 67108859, + (unsigned long) 134217689, + (unsigned long) 268435399, + (unsigned long) 536870909, + (unsigned long) 1073741789, + (unsigned long) 2147483647, + /* 4294967291L */ + ((unsigned long) 2147483647) + ((unsigned long) 2147483644), + }; + + const unsigned long *low = &primes[0]; + const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])]; + + while (low != high) + { + const unsigned long *mid = low + (high - low) / 2; + if (n >= *mid) + low = mid + 1; + else + high = mid; + } + + /* If we've run out of primes, abort. */ + if (n > *low) + { + fprintf (stderr, "Cannot find prime bigger than %lu\n", n); + abort (); + } + + return *low; +} + static size_t bfd_default_hash_table_size = DEFAULT_SIZE; /* Create a new hash table, given a number of entries. */ @@ -330,6 +395,7 @@ bfd_hash_table_init_n (struct bfd_hash_table *table, memset ((void *) table->table, 0, alloc); table->size = size; table->entsize = entsize; + table->count = 0; table->newfunc = newfunc; return TRUE; } @@ -402,6 +468,7 @@ bfd_hash_lookup (struct bfd_hash_table *table, if (copy) { char *new; + table->count ++; new = objalloc_alloc ((struct objalloc *) table->memory, len + 1); if (!new) @@ -417,6 +484,38 @@ bfd_hash_lookup (struct bfd_hash_table *table, hashp->next = table->table[index]; table->table[index] = hashp; + if (table->count > table->size * 3 / 4) + { + int newsize = higher_prime_number (table->size); + struct bfd_hash_entry **newtable; + unsigned int hi; + unsigned int alloc; + + alloc = newsize * sizeof (struct bfd_hash_entry *); + + newtable = ((struct bfd_hash_entry **) + objalloc_alloc ((struct objalloc *) table->memory, alloc)); + memset ((PTR) newtable, 0, alloc); + + for (hi = 0; hi < table->size; hi ++) + while (table->table[hi]) + { + struct bfd_hash_entry *chain = table->table[hi]; + struct bfd_hash_entry *chain_end = chain; + int index; + + while (chain_end->next && chain_end->next->hash == chain->hash) + chain_end = chain_end->next; + + table->table[hi] = chain_end->next; + index = chain->hash % newsize; + chain_end->next = newtable[index]; + newtable[index] = chain; + } + table->table = newtable; + table->size = newsize; + } + return hashp; } diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index ee2484f25c1..2248479c5e3 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -155,6 +155,8 @@ bfd * _bfd_new_bfd (void); void _bfd_delete_bfd (bfd *); +bfd_boolean _bfd_free_cached_info + (bfd *); bfd_boolean bfd_false (bfd *ignore); diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 2a590a395a5..e9e6c9d23c5 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -160,6 +160,8 @@ bfd * _bfd_new_bfd (void); void _bfd_delete_bfd (bfd *); +bfd_boolean _bfd_free_cached_info + (bfd *); bfd_boolean bfd_false (bfd *ignore); diff --git a/bfd/opncls.c b/bfd/opncls.c index b02b137889a..7e62d06a5bb 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -115,11 +115,35 @@ _bfd_new_bfd_contained_in (bfd *obfd) void _bfd_delete_bfd (bfd *abfd) { - bfd_hash_table_free (&abfd->section_htab); - objalloc_free ((struct objalloc *) abfd->memory); + if (abfd->memory) + { + bfd_hash_table_free (&abfd->section_htab); + objalloc_free ((struct objalloc *) abfd->memory); + } free (abfd); } +/* Free objalloc memory. */ + +bfd_boolean +_bfd_free_cached_info (bfd *abfd) +{ + if (abfd->memory) + { + bfd_hash_table_free (&abfd->section_htab); + objalloc_free ((struct objalloc *) abfd->memory); + + abfd->sections = NULL; + abfd->section_last = NULL; + abfd->outsymbols = NULL; + abfd->tdata.any = NULL; + abfd->usrdata = NULL; + abfd->memory = NULL; + } + + return TRUE; +} + /* SECTION Opening and closing BFDs diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 559f21afb5c..afe42cc948a 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -264,36 +264,50 @@ typedef struct tekhex_data_struct #define enda(x) (x->vma + x->size) -static bfd_vma -getvalue (char **srcp) +static bfd_boolean +getvalue (char **srcp, bfd_vma *valuep) { char *src = *srcp; bfd_vma value = 0; - unsigned int len = hex_value(*src++); + unsigned int len; + + if (!ISHEX (*src)) + return FALSE; + len = hex_value (*src++); if (len == 0) len = 16; while (len--) - value = value << 4 | hex_value(*src++); + { + if (!ISHEX (*src)) + return FALSE; + value = value << 4 | hex_value (*src++); + } *srcp = src; - return value; + *valuep = value; + return TRUE; } -static unsigned int -getsym (char *dstp, char **srcp) +static bfd_boolean +getsym (char *dstp, char **srcp, unsigned int *lenp) { char *src = *srcp; unsigned int i; - unsigned int len = hex_value(*src++); + unsigned int len; + + if (!ISHEX (*src)) + return FALSE; + len = hex_value (*src++); if (len == 0) len = 16; for (i = 0; i < len; i++) dstp[i] = src[i]; dstp[i] = 0; *srcp = src + i; - return len; + *lenp = len; + return TRUE; } static struct data_struct * @@ -333,11 +347,12 @@ insert_byte (bfd *abfd, int value, bfd_vma addr) /* The first pass is to find the names of all the sections, and see how big the data is. */ -static void +static bfd_boolean first_phase (bfd *abfd, int type, char *src) { asection *section = bfd_abs_section_ptr; unsigned int len; + bfd_vma val; char sym[17]; /* A symbol can only be 16chars long. */ switch (type) @@ -345,7 +360,10 @@ first_phase (bfd *abfd, int type, char *src) case '6': /* Data record - read it and store it. */ { - bfd_vma addr = getvalue (&src); + bfd_vma addr; + + if (!getvalue (&src, &addr)) + return FALSE; while (*src) { @@ -355,17 +373,18 @@ first_phase (bfd *abfd, int type, char *src) } } - return; + return TRUE; case '3': /* Symbol record, read the segment. */ - len = getsym (sym, &src); + if (!getsym (sym, &src, &len)) + return FALSE; section = bfd_get_section_by_name (abfd, sym); if (section == NULL) { char *n = bfd_alloc (abfd, (bfd_size_type) len + 1); if (!n) - abort (); /* FIXME. */ + return FALSE; memcpy (n, sym, len + 1); section = bfd_make_section (abfd, n); } @@ -375,8 +394,11 @@ first_phase (bfd *abfd, int type, char *src) { case '1': /* Section range. */ src++; - section->vma = getvalue (&src); - section->size = getvalue (&src) - section->vma; + if (!getvalue (&src, §ion->vma)) + return FALSE; + if (!getvalue (&src, &val)) + return FALSE; + section->size = val - section->vma; section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; break; case '0': @@ -393,35 +415,42 @@ first_phase (bfd *abfd, int type, char *src) char stype = (*src); if (!new) - abort (); /* FIXME. */ + return FALSE; new->symbol.the_bfd = abfd; src++; abfd->symcount++; abfd->flags |= HAS_SYMS; new->prev = abfd->tdata.tekhex_data->symbols; abfd->tdata.tekhex_data->symbols = new; - len = getsym (sym, &src); + if (!getsym (sym, &src, &len)) + return FALSE; new->symbol.name = bfd_alloc (abfd, (bfd_size_type) len + 1); if (!new->symbol.name) - abort (); /* FIXME. */ + return FALSE; memcpy ((char *) (new->symbol.name), sym, len + 1); new->symbol.section = section; if (stype <= '4') new->symbol.flags = (BSF_GLOBAL | BSF_EXPORT); else new->symbol.flags = BSF_LOCAL; - new->symbol.value = getvalue (&src) - section->vma; + if (!getvalue (&src, &val)) + return FALSE; + new->symbol.value = val - section->vma; } + default: + return FALSE; } } } + + return TRUE; } /* Pass over a tekhex, calling one of the above functions on each record. */ -static void -pass_over (bfd *abfd, void (*func) (bfd *, int, char *)) +static bfd_boolean +pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *)) { unsigned int chars_on_line; bfd_boolean eof = FALSE; @@ -462,8 +491,11 @@ pass_over (bfd *abfd, void (*func) (bfd *, int, char *)) /* Put a null at the end. */ src[chars_on_line] = 0; - func (abfd, type, src); + if (!func (abfd, type, src)) + return FALSE; } + + return TRUE; } static long @@ -524,7 +556,9 @@ tekhex_object_p (bfd *abfd) tekhex_mkobject (abfd); - pass_over (abfd, first_phase); + if (!pass_over (abfd, first_phase)) + return NULL; + return abfd->xvec; } diff --git a/bfd/version.h b/bfd/version.h index 8957708435d..73eabbe6083 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20060420 +#define BFD_VERSION_DATE 20060501 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dcb436b7df6..b2dd5f42cef 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,104 @@ +2006-04-30 Mark Kettenis + + * breakpoint.c (insert_single_step_breakpoint): Make a failure to + insert a single-step breakpoint an error instead of a warning. + +2006-05-01 Nathan J. Williams + + * ppcnbsd-tdep.c (ppcnbsd_return_value): Change type of last two + arguments from void * to gdb_byte *. + +2006-04-26 Michael Snyder + + * linux-fork.c (_initialize_linux_fork): Rename "delete-fork" + command to "delete fork" (no hyphen), compatible with other + "delete" commands. + (info_forks_command): Accept a fork ID argument, for info + on a single fork. Report if no matching forks. + +2006-04-25 Mark Kettenis + + * breakpoint.c (remove_single_step_breakpoints): Bail out early if + no breakpoints are inserted. + + From Masaki MURANAKA : + * mips-mdebug-tdep.c (mips_mdebug_frame_prev_register): Change + type of last argument to `gdb_byte *' + +2006-04-25 Jim Blandy + + Add support for 'target remote |' on MinGW. + * ser-mingw.c (struct pipe_state): New structure. + (make_pipe_state, free_pipe_state, cleanup_pipe_state) + (pipe_windows_open, pipe_windows_close, pipe_windows_read) + (pipe_windows_write, pipe_wait_handle): New functions. + (_initialize_ser_windows): Register a "pipe" interface based on + them. + +2006-04-24 Daniel Jacobowitz + + * ser-mingw.c: Include . + (struct ser_console_state, struct net_windows_state): Add exit_select, + have_stopped, thread. + (pipe_select_thread, console_select_thread) + (net_windows_select_thread): Don't create a local state copy or + close stop_select. Exit on exit_select instead of stop_select. Set + have_stopped. + (console_select_thread): Don't report control keypresses as pending + input. + (pipe_select_thread): Allow stop_select to interrupt sleeping. + (set_console_wait_handle): Create exit_select and have_stopped. + Save the thread handle. Check _kbhit before starting a thread. + (ser_console_done_wait_handle): New. + (ser_console_close): Close new handles. Wait for the thread to + exit. + (new_windows_select_thread): Assert that an event occurred. + (net_windows_wait_handle): Check for pending input before starting + a thread. + (net_windows_done_wait_handle): New. + (net_windows_open): Create exit_select and have_stopped. + Save the thread handle. + (net_windows_close): Close new handles. Wait for the thread to + exit. + (_intiialize_ser_windows): Register done_wait_handle methods. + + * serial.c [USE_WIN32API] (serial_done_wait_handle): New. + * serial.h [USE_WIN32API] (struct serial_ops): Add done_wait_handle. + [USE_WIN32API] (serial_done_wait_handle): New prototype. + * mingw-hdep.c (gdb_select): Use serial_done_wait_handle. + +2006-04-23 Andreas Schwab + + * rs6000-tdep.c: Include "reggroups.h" only once. + * Makefile.in (rs6000-tdep.o): Update dependencies. + +2006-04-21 Frederic Riss + + * dwarf2read.c (dwarf2_start_subfile): Change prototype to accept + compilation directory as last argument. + Always pass comp_dir as second argument to start_subfile and prepend + dirname to the filename when necessary. + Remove now superfluous search for pre-existing subfile. + (dwarf_decode_lines): Pass the compilation directory to + dwarf2_start_subfile. + +2006-04-20 Michael Snyder + + * 2006-03-22 Jim Blandy + Add support for the Renesas M32C and M16C. + + * configure.tgt (m32c-*-*): New entry. + * config/m32c/m32c.mt: New file. + * m32c-tdep.c: New file. + * Makefile.in (elf_m32c_h): New variable. + (m32c-tdep.o): New rule. + * NEWS: Mention new target. + * MAINTAINERS: Designate Jim Blandy as responsible maintainer. + +2006-04-20 Michael Snyder + + * remote.c: Fix spelling error in comment. + 2006-04-20 Daniel Jacobowitz * m68klinux-tdep.c (m68k_linux_sigtramp_frame_prev_register): diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index dbd2f9368b8..48f8c001595 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -266,6 +266,9 @@ the native maintainer when resolving ABI issues. ia64 --target=ia64-linux-gnu ,-Werror (--target=ia64-elf broken) + m32c --target=m32c-elf ,-Werror + Jim Blandy, jimb@codesourcery.com + m32r --target=m32r-elf ,-Werror m68hc11 --target=m68hc11-elf ,-Werror , diff --git a/gdb/Makefile.in b/gdb/Makefile.in index beab57cd730..e27a718f3b2 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -582,6 +582,7 @@ elf_sh_h = $(INCLUDE_DIR)/elf/sh.h elf_arm_h = $(INCLUDE_DIR)/elf/arm.h $(elf_reloc_macros_h) elf_bfd_h = $(BFD_SRC)/elf-bfd.h elf_frv_h = $(INCLUDE_DIR)/elf/frv.h $(elf_reloc_macros_h) +elf_m32c_h = $(INCLUDE_DIR)/elf/m32c.h $(elf_reloc_macros_h) libaout_h = $(BFD_SRC)/libaout.h libiberty_h = $(INCLUDE_DIR)/libiberty.h libbfd_h = $(BFD_SRC)/libbfd.h @@ -598,6 +599,7 @@ gdb_callback_h = $(INCLUDE_DIR)/gdb/callback.h gdb_sim_arm_h = $(INCLUDE_DIR)/gdb/sim-arm.h gdb_sim_d10v_h = $(INCLUDE_DIR)/gdb/sim-d10v.h gdb_sim_frv_h = $(INCLUDE_DIR)/gdb/sim-frv.h +gdb_sim_m32c_h = $(INCLUDE_DIR)/gdb/sim-m32c.h gdb_sim_ppc_h = $(INCLUDE_DIR)/gdb/sim-ppc.h gdb_sim_sh_h = $(INCLUDE_DIR)/gdb/sim-sh.h splay_tree_h = $(INCLUDE_DIR)/splay-tree.h @@ -2215,6 +2217,11 @@ m2-typeprint.o: m2-typeprint.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \ $(expression_h) $(value_h) $(gdbcore_h) $(target_h) $(m2_lang_h) m2-valprint.o: m2-valprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(m2_lang_h) $(c_lang_h) +m32c-tdep.o: m32c-tdep.c $(defs_h) $(gdb_assert_h) $(elf_bfd_h) \ + $(elf_m32c_h) $(gdb_sim_m32c_h) $(dis_asm_h) $(gdbtypes_h) \ + $(regcache_h) $(arch_utils_h) $(frame_h) $(frame_unwind_h) \ + $(dwarf2_frame_h) $(dwarf2expr_h) $(symtab_h) $(gdbcore_h) \ + $(value_h) $(reggroups_h) $(prologue_value_h) $(target_h) m32r-linux-nat.o: m32r-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ $(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \ $(gregset_h) $(m32r_tdep_h) $(target_h) @@ -2508,7 +2515,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \ $(reggroups_h) $(libbfd_h) $(coff_internal_h) $(libcoff_h) \ $(coff_xcoff_h) $(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) \ $(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \ - $(frame_unwind_h) $(frame_base_h) $(reggroups_h) $(rs6000_tdep_h) + $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h) rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(osabi_h) $(rs6000_tdep_h) s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \ $(s390_tdep_h) $(target_h) $(linux_nat_h) diff --git a/gdb/NEWS b/gdb/NEWS index 526f45a43d8..bf6f31e1ea3 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,6 +3,12 @@ *** Changes since GDB 6.4 +* New targets + +Renesas M32C/M16C m32c-elf + +Morpho Technologies ms1 ms1-elf + * New commands init-if-undefined Initialize a convenience variable, but diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 130b6845af2..fd231dee498 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -7717,7 +7717,7 @@ insert_single_step_breakpoint (CORE_ADDR next_pc) *bpt_p = deprecated_insert_raw_breakpoint (next_pc); if (*bpt_p == NULL) - warning (_("Could not insert single-step breakpoint at 0x%s"), + error (_("Could not insert single-step breakpoint at 0x%s"), paddr_nz (next_pc)); } diff --git a/gdb/config/m32c/m32c.mt b/gdb/config/m32c/m32c.mt new file mode 100644 index 00000000000..2a404d45b6a --- /dev/null +++ b/gdb/config/m32c/m32c.mt @@ -0,0 +1,7 @@ +# Target: Renesas M32C family +TDEPFILES = m32c-tdep.o prologue-value.o + +# There may also be a SID / CGEN simulator for this, but we do have DJ +# Delorie's mini-sim. +SIM_OBS = remote-sim.o +SIM = ../sim/m32c/libsim.a diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 4092fe12d9d..f6e1ad899ff 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -107,6 +107,8 @@ ia64*-*-*) gdb_target=ia64 ;; iq2000-*-*) gdb_target=iq2000 ;; +m32c-*-*) gdb_target=m32c ;; + m32r*-*-linux*) gdb_target=linux ;; m32r*-*-*) gdb_target=m32r ;; diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 66ff9d7e6dc..dc5f4f1374c 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,12 @@ +2006-04-27 Michael Snyder + + * gdb.texinfo (delete-fork): Command renamed to "delete fork". + +2006-04-22 Andrew Cagney + + * gdb.texinfo (Contributors): Credit frame unwinder contributors. + * gdbint.texinfo (Algorithms): Fix errors in frame documentation. + 2006-04-18 Daniel Jacobowitz * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 790c58dc5b2..3230dcb40a8 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -484,6 +484,19 @@ Sakamoto, Yoshinori Sato, Michael Snyder, Andreas Schwab, Jason Thorpe, Corinna Vinschen, Ulrich Weigand, and Elena Zannoni, helped with the migration of old architectures to this new framework. +Andrew Cagney completely re-designed and re-implemented @value{GDBN}'s +unwinder framework, this consisting of a fresh new design featuring +frame IDs, independent frame sniffers, and the sentinel frame. Mark +Kettenis implemented the @sc{dwarf 2} unwinder, Jeff Johnston the +libunwind unwinder, and Andrew Cagney the dummy, sentinel, tramp, and +trad unwinders. The architecture specific changes, each involving a +complete rewrite of the architecture's frame code, were carried out by +Jim Blandy, Joel Brobecker, Kevin Buettner, Andrew Cagney, Stephane +Carrez, Randolph Chung, Orjan Friberg, Richard Henderson, Daniel +Jacobowitz, Jeff Johnston, Mark Kettenis, Theodore A. Roth, Kei +Sakamoto, Yoshinori Sato, Michael Snyder, Corinna Vinschen, and Ulrich +Weigand. + @node Sample Session @chapter A Sample @value{GDBN} Session @@ -2563,7 +2576,7 @@ as shown in the first field of the @samp{info forks} display. To quit debugging one of the forked processes, you can either detach from it by using the @w{@code{detach-fork}} command (allowing it to run independently), or delete (and kill) it using the -@w{@code{delete-fork}} command. +@w{@code{delete fork}} command. @table @code @kindex detach-fork @var{fork-id} @@ -2572,8 +2585,8 @@ Detach from the process identified by @value{GDBN} fork number @var{fork-id}, and remove it from the fork list. The process will be allowed to run independently. -@kindex delete-fork @var{fork-id} -@item delete-fork @var{fork-id} +@kindex delete fork @var{fork-id} +@item delete fork @var{fork-id} Kill the process identified by @value{GDBN} fork number @var{fork-id}, and remove it from the fork list. @@ -2662,8 +2675,8 @@ are not affected by restoring a checkpoint. In general, a checkpoint only restores things that reside in the program being debugged, not in the debugger. -@kindex delete-checkpoint @var{checkpoint-id} -@item delete-checkpoint @var{checkpoint-id} +@kindex delete checkpoint @var{checkpoint-id} +@item delete checkpoint @var{checkpoint-id} Delete the previously-saved checkpoint identified by @var{checkpoint-id}. @end table diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index e1d1557a738..7bbd41726ce 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -232,25 +232,21 @@ A frame is a construct that @value{GDBN} uses to keep track of calling and called functions. @cindex frame, unwind -@value{GDBN}'s current frame model is the result of an incremental -cleanup of working code, not a fresh design, so it's a little weird. - -The natural model would have a frame object, with methods that read -and write that frame's registers. Reading or writing the youngest -frame's registers would simply read or write the processor's current -registers, since the youngest frame is running directly on the -processor. Older frames might have some registers saved on the stack -by younger frames, so accessing the older frames' registers would do a -mix of memory accesses and register accesses, as appropriate. +@value{GDBN}'s frame model, a fresh design, was implemented with the +need to support @sc{dwarf}'s Call Frame Information in mind. In fact, +the term ``unwind'' is taken directly from that specification. +Developers wishing to learn more about unwinders, are encouraged to +read the the @sc{dwarf} specification. @findex frame_register_unwind -Instead, @value{GDBN}'s model is that you find a frame's registers by -``unwinding'' them from the next younger frame. That is, to access -the registers of frame #1 (the next-to-youngest frame), you actually -apply @code{frame_register_unwind} to frame #0 (the youngest frame). -But then the obvious question is: how do you access the registers of -the youngest frame itself? How do you ``unwind'' them when they're -not wound up? +@findex get_frame_register +@value{GDBN}'s model is that you find a frame's registers by +``unwinding'' them from the next younger frame. That is, +@samp{get_frame_register} which returns the value of a register in +frame #1 (the next-to-youngest frame), is implemented by calling frame +#0's @code{frame_register_unwind} (the youngest frame). But then the +obvious question is: how do you access the registers of the youngest +frame itself? @cindex sentinel frame @findex get_frame_type @@ -261,32 +257,6 @@ the current values of the youngest real frame's registers. If @var{f} is a sentinel frame, then @code{get_frame_type (@var{f}) == SENTINEL_FRAME}. -@findex create_new_frame -@vindex FRAME_FP -@code{FRAME_FP} in the machine description has no meaning to the -machine-independent part of @value{GDBN}, except that it is used when -setting up a new frame from scratch, as follows: - -@smallexample -create_new_frame (read_register (DEPRECATED_FP_REGNUM), read_pc ())); -@end smallexample - -@cindex frame pointer register -Other than that, all the meaning imparted to @code{DEPRECATED_FP_REGNUM} -is imparted by the machine-dependent code. So, -@code{DEPRECATED_FP_REGNUM} can have any value that is convenient for -the code that creates new frames. (@code{create_new_frame} calls -@code{DEPRECATED_INIT_EXTRA_FRAME_INFO} if it is defined; that is where -you should use the @code{DEPRECATED_FP_REGNUM} value, if your frames are -nonstandard.) - -@cindex frame chain -Given a @value{GDBN} frame, define @code{DEPRECATED_FRAME_CHAIN} to -determine the address of the calling function's frame. This will be -used to create a new @value{GDBN} frame struct, and then -@code{DEPRECATED_INIT_EXTRA_FRAME_INFO} and -@code{DEPRECATED_INIT_FRAME_PC} will be called for the new frame. - @section Prologue Analysis @cindex prologue analysis diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 6fe9245f4a2..32bf163534c 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -846,7 +846,7 @@ static struct line_header *(dwarf_decode_line_header static void dwarf_decode_lines (struct line_header *, char *, bfd *, struct dwarf2_cu *, struct partial_symtab *); -static void dwarf2_start_subfile (char *, char *); +static void dwarf2_start_subfile (char *, char *, char *); static struct symbol *new_symbol (struct die_info *, struct type *, struct dwarf2_cu *); @@ -6529,13 +6529,12 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, directory and file name numbers in the statement program are 1-based. */ struct file_entry *fe = &lh->file_names[file - 1]; - char *dir; + char *dir = NULL; if (fe->dir_index) dir = lh->include_dirs[fe->dir_index - 1]; - else - dir = comp_dir; - dwarf2_start_subfile (fe->name, dir); + + dwarf2_start_subfile (fe->name, dir, comp_dir); } /* Decode the table. */ @@ -6627,17 +6626,16 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, 0-based, but the directory and file name numbers in the statement program are 1-based. */ struct file_entry *fe; - char *dir; + char *dir = NULL; file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; fe = &lh->file_names[file - 1]; if (fe->dir_index) dir = lh->include_dirs[fe->dir_index - 1]; - else - dir = comp_dir; + if (!decode_for_pst_p) - dwarf2_start_subfile (fe->name, dir); + dwarf2_start_subfile (fe->name, dir, comp_dir); } break; case DW_LNS_set_column: @@ -6717,7 +6715,8 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, /* Start a subfile for DWARF. FILENAME is the name of the file and DIRNAME the name of the source directory which contains FILENAME - or NULL if not known. + or NULL if not known. COMP_DIR is the compilation directory for the + linetable's compilation unit or NULL if not known. This routine tries to keep line numbers from identical absolute and relative file names in a common subfile. @@ -6733,31 +6732,35 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, files.files[1].dir: /srcdir The line number information for list0.c has to end up in a single - subfile, so that `break /srcdir/list0.c:1' works as expected. */ + subfile, so that `break /srcdir/list0.c:1' works as expected. + start_subfile will ensure that this happens provided that we pass the + concatenation of files.files[1].dir and files.files[1].name as the + subfile's name. */ static void -dwarf2_start_subfile (char *filename, char *dirname) +dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir) { - /* If the filename isn't absolute, try to match an existing subfile - with the full pathname. */ + char *fullname; + + /* While reading the DIEs, we call start_symtab(DW_AT_name, DW_AT_comp_dir). + `start_symtab' will always pass the contents of DW_AT_comp_dir as + second argument to start_subfile. To be consistent, we do the + same here. In order not to lose the line information directory, + we concatenate it to the filename when it makes sense. + Note that the Dwarf3 standard says (speaking of filenames in line + information): ``The directory index is ignored for file names + that represent full path names''. Thus ignoring dirname in the + `else' branch below isn't an issue. */ if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL) - { - struct subfile *subfile; - char *fullname = concat (dirname, "/", filename, (char *)NULL); + fullname = concat (dirname, SLASH_STRING, filename, (char *)NULL); + else + fullname = filename; - for (subfile = subfiles; subfile; subfile = subfile->next) - { - if (FILENAME_CMP (subfile->name, fullname) == 0) - { - current_subfile = subfile; - xfree (fullname); - return; - } - } - xfree (fullname); - } - start_subfile (filename, dirname); + start_subfile (fullname, comp_dir); + + if (fullname != filename) + xfree (fullname); } static void diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index bb4468268c2..e96275b8d57 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -448,9 +448,18 @@ info_forks_command (char *arg, int from_tty) struct fork_info *fp; int cur_line; ULONGEST pc; + int requested = -1; + struct fork_info *printed = NULL; + + if (arg && *arg) + requested = (int) parse_and_eval_long (arg); for (fp = fork_list; fp; fp = fp->next) { + if (requested > 0 && fp->num != requested) + continue; + + printed = fp; if (ptid_equal (fp->ptid, inferior_ptid)) { printf_filtered ("* "); @@ -490,6 +499,13 @@ info_forks_command (char *arg, int from_tty) putchar_filtered ('\n'); } + if (printed == NULL) + { + if (requested > 0) + printf_filtered (_("No fork number %d.\n"), requested); + else + printf_filtered (_("No forks.\n")); + } } /* Save/restore mode variable 'detach_fork': @@ -670,11 +686,12 @@ Fork a duplicate process (experimental).")); restart : restore program context from a checkpoint.\n\ Argument 'n' is checkpoint ID, as displayed by 'info checkpoints'.")); - /* Delete-checkpoint command: kill the process and remove it from + /* Delete checkpoint command: kill the process and remove it from fork list. */ - add_com ("delete-checkpoint", class_obscure, delete_fork_command, _("\ -Delete a fork/checkpoint (experimental).")); + add_cmd ("checkpoint", class_obscure, delete_fork_command, _("\ +Delete a fork/checkpoint (experimental)."), + &deletelist); /* Detach-checkpoint command: release the process to run independantly, and remove it from the fork list. */ @@ -691,7 +708,7 @@ Detach from a fork/checkpoint (experimental).")); /* Command aliases (let "fork" and "checkpoint" be used interchangeably). */ - add_com_alias ("delete-fork", "delete-checkpoint", class_obscure, 1); + add_alias_cmd ("fork", "checkpoint", class_obscure, 1, &deletelist); add_com_alias ("detach-fork", "detach-checkpoint", class_obscure, 1); add_info_alias ("forks", "checkpoints", 0); diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c new file mode 100644 index 00000000000..e93a98cdaec --- /dev/null +++ b/gdb/m32c-tdep.c @@ -0,0 +1,2552 @@ +/* Renesas M32C target-dependent code for GDB, the GNU debugger. + + Copyright 2004, 2005 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 + +#if defined (HAVE_STRING_H) +#include +#endif + +#include "gdb_assert.h" +#include "elf-bfd.h" +#include "elf/m32c.h" +#include "gdb/sim-m32c.h" +#include "dis-asm.h" +#include "gdbtypes.h" +#include "regcache.h" +#include "arch-utils.h" +#include "frame.h" +#include "frame-unwind.h" +#include "dwarf2-frame.h" +#include "dwarf2expr.h" +#include "symtab.h" +#include "gdbcore.h" +#include "value.h" +#include "reggroups.h" +#include "prologue-value.h" +#include "target.h" + + +/* The m32c tdep structure. */ + +static struct reggroup *m32c_dma_reggroup; + +struct m32c_reg; + +/* The type of a function that moves the value of REG between CACHE or + BUF --- in either direction. */ +typedef void (m32c_move_reg_t) (struct m32c_reg *reg, + struct regcache *cache, + void *buf); + +struct m32c_reg +{ + /* The name of this register. */ + const char *name; + + /* Its type. */ + struct type *type; + + /* The architecture this register belongs to. */ + struct gdbarch *arch; + + /* Its GDB register number. */ + int num; + + /* Its sim register number. */ + int sim_num; + + /* Its DWARF register number, or -1 if it doesn't have one. */ + int dwarf_num; + + /* Register group memberships. */ + unsigned int general_p : 1; + unsigned int dma_p : 1; + unsigned int system_p : 1; + unsigned int save_restore_p : 1; + + /* Functions to read its value from a regcache, and write its value + to a regcache. */ + m32c_move_reg_t *read, *write; + + /* Data for READ and WRITE functions. The exact meaning depends on + the specific functions selected; see the comments for those + functions. */ + struct m32c_reg *rx, *ry; + int n; +}; + + +/* An overestimate of the number of raw and pseudoregisters we will + have. The exact answer depends on the variant of the architecture + at hand, but we can use this to declare statically allocated + arrays, and bump it up when needed. */ +#define M32C_MAX_NUM_REGS (75) + +/* The largest assigned DWARF register number. */ +#define M32C_MAX_DWARF_REGNUM (40) + + +struct gdbarch_tdep +{ + /* All the registers for this variant, indexed by GDB register + number, and the number of registers present. */ + struct m32c_reg regs[M32C_MAX_NUM_REGS]; + + /* The number of valid registers. */ + int num_regs; + + /* Interesting registers. These are pointers into REGS. */ + struct m32c_reg *pc, *flg; + struct m32c_reg *r0, *r1, *r2, *r3, *a0, *a1; + struct m32c_reg *r2r0, *r3r2r1r0, *r3r1r2r0; + struct m32c_reg *sb, *fb, *sp; + + /* A table indexed by DWARF register numbers, pointing into + REGS. */ + struct m32c_reg *dwarf_regs[M32C_MAX_DWARF_REGNUM + 1]; + + /* Types for this architecture. We can't use the builtin_type_foo + types, because they're not initialized when building a gdbarch + structure. */ + struct type *voyd, *ptr_voyd, *func_voyd; + struct type *uint8, *uint16; + struct type *int8, *int16, *int32, *int64; + + /* The types for data address and code address registers. */ + struct type *data_addr_reg_type, *code_addr_reg_type; + + /* The number of bytes a return address pushed by a 'jsr' instruction + occupies on the stack. */ + int ret_addr_bytes; + + /* The number of bytes an address register occupies on the stack + when saved by an 'enter' or 'pushm' instruction. */ + int push_addr_bytes; +}; + + +/* Types. */ + +static void +make_types (struct gdbarch *arch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + unsigned long mach = gdbarch_bfd_arch_info (arch)->mach; + int data_addr_reg_bits, code_addr_reg_bits; + char type_name[50]; + +#if 0 + /* This is used to clip CORE_ADDR values, so this value is + appropriate both on the m32c, where pointers are 32 bits long, + and on the m16c, where pointers are sixteen bits long, but there + may be code above the 64k boundary. */ + set_gdbarch_addr_bit (arch, 24); +#else + /* GCC uses 32 bits for addrs in the dwarf info, even though + only 16/24 bits are used. Setting addr_bit to 24 causes + errors in reading the dwarf addresses. */ + set_gdbarch_addr_bit (arch, 32); +#endif + + set_gdbarch_int_bit (arch, 16); + switch (mach) + { + case bfd_mach_m16c: + data_addr_reg_bits = 16; + code_addr_reg_bits = 24; + set_gdbarch_ptr_bit (arch, 16); + tdep->ret_addr_bytes = 3; + tdep->push_addr_bytes = 2; + break; + + case bfd_mach_m32c: + data_addr_reg_bits = 24; + code_addr_reg_bits = 24; + set_gdbarch_ptr_bit (arch, 32); + tdep->ret_addr_bytes = 4; + tdep->push_addr_bytes = 4; + break; + + default: + gdb_assert (0); + } + + /* The builtin_type_mumble variables are sometimes uninitialized when + this is called, so we avoid using them. */ + tdep->voyd = init_type (TYPE_CODE_VOID, 1, 0, "void", NULL); + tdep->ptr_voyd = init_type (TYPE_CODE_PTR, gdbarch_ptr_bit (arch) / 8, + TYPE_FLAG_UNSIGNED, NULL, NULL); + TYPE_TARGET_TYPE (tdep->ptr_voyd) = tdep->voyd; + tdep->func_voyd = lookup_function_type (tdep->voyd); + + sprintf (type_name, "%s_data_addr_t", + gdbarch_bfd_arch_info (arch)->printable_name); + tdep->data_addr_reg_type + = init_type (TYPE_CODE_PTR, data_addr_reg_bits / 8, + TYPE_FLAG_UNSIGNED, xstrdup (type_name), NULL); + TYPE_TARGET_TYPE (tdep->data_addr_reg_type) = tdep->voyd; + + sprintf (type_name, "%s_code_addr_t", + gdbarch_bfd_arch_info (arch)->printable_name); + tdep->code_addr_reg_type + = init_type (TYPE_CODE_PTR, code_addr_reg_bits / 8, + TYPE_FLAG_UNSIGNED, xstrdup (type_name), NULL); + TYPE_TARGET_TYPE (tdep->code_addr_reg_type) = tdep->func_voyd; + + tdep->uint8 = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, + "uint8_t", NULL); + tdep->uint16 = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, + "uint16_t", NULL); + tdep->int8 = init_type (TYPE_CODE_INT, 1, 0, "int8_t", NULL); + tdep->int16 = init_type (TYPE_CODE_INT, 2, 0, "int16_t", NULL); + tdep->int32 = init_type (TYPE_CODE_INT, 4, 0, "int32_t", NULL); + tdep->int64 = init_type (TYPE_CODE_INT, 8, 0, "int64_t", NULL); +} + + + +/* Register set. */ + +static const char * +m32c_register_name (int num) +{ + return gdbarch_tdep (current_gdbarch)->regs[num].name; +} + + +static struct type * +m32c_register_type (struct gdbarch *arch, int reg_nr) +{ + return gdbarch_tdep (arch)->regs[reg_nr].type; +} + + +static int +m32c_register_sim_regno (int reg_nr) +{ + return gdbarch_tdep (current_gdbarch)->regs[reg_nr].sim_num; +} + + +static int +m32c_debug_info_reg_to_regnum (int reg_nr) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + if (0 <= reg_nr && reg_nr <= M32C_MAX_DWARF_REGNUM + && tdep->dwarf_regs[reg_nr]) + return tdep->dwarf_regs[reg_nr]->num; + else + /* The DWARF CFI code expects to see -1 for invalid register + numbers. */ + return -1; +} + + +int +m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum, + struct reggroup *group) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct m32c_reg *reg = &tdep->regs[regnum]; + + /* The anonymous raw registers aren't in any groups. */ + if (! reg->name) + return 0; + + if (group == all_reggroup) + return 1; + + if (group == general_reggroup + && reg->general_p) + return 1; + + if (group == m32c_dma_reggroup + && reg->dma_p) + return 1; + + if (group == system_reggroup + && reg->system_p) + return 1; + + /* Since the m32c DWARF register numbers refer to cooked registers, not + raw registers, and frame_pop depends on the save and restore groups + containing registers the DWARF CFI will actually mention, our save + and restore groups are cooked registers, not raw registers. (This is + why we can't use the default reggroup function.) */ + if ((group == save_reggroup + || group == restore_reggroup) + && reg->save_restore_p) + return 1; + + return 0; +} + + +/* Register move functions. We declare them here using + m32c_move_reg_t to check the types. */ +static m32c_move_reg_t m32c_raw_read, m32c_raw_write; +static m32c_move_reg_t m32c_banked_read, m32c_banked_write; +static m32c_move_reg_t m32c_sb_read, m32c_sb_write; +static m32c_move_reg_t m32c_part_read, m32c_part_write; +static m32c_move_reg_t m32c_cat_read, m32c_cat_write; +static m32c_move_reg_t m32c_r3r2r1r0_read, m32c_r3r2r1r0_write; + + +/* Copy the value of the raw register REG from CACHE to BUF. */ +static void +m32c_raw_read (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + regcache_raw_read (cache, reg->num, buf); +} + + +/* Copy the value of the raw register REG from BUF to CACHE. */ +static void +m32c_raw_write (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + regcache_raw_write (cache, reg->num, (const void *) buf); +} + + +/* Return the value of the 'flg' register in CACHE. */ +static int +m32c_read_flg (struct regcache *cache) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (cache)); + ULONGEST flg; + regcache_raw_read_unsigned (cache, tdep->flg->num, &flg); + return flg & 0xffff; +} + + +/* Move the value of a banked register from CACHE to BUF. + If the value of the 'flg' register in CACHE has any of the bits + masked in REG->n set, then read REG->ry. Otherwise, read + REG->rx. */ +static void +m32c_banked_read (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + struct m32c_reg *bank_reg + = ((m32c_read_flg (cache) & reg->n) ? reg->ry : reg->rx); + regcache_raw_read (cache, bank_reg->num, buf); +} + + +/* Move the value of a banked register from BUF to CACHE. + If the value of the 'flg' register in CACHE has any of the bits + masked in REG->n set, then write REG->ry. Otherwise, write + REG->rx. */ +static void +m32c_banked_write (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + struct m32c_reg *bank_reg + = ((m32c_read_flg (cache) & reg->n) ? reg->ry : reg->rx); + regcache_raw_write (cache, bank_reg->num, (const void *) buf); +} + + +/* Move the value of SB from CACHE to BUF. On bfd_mach_m32c, SB is a + banked register; on bfd_mach_m16c, it's not. */ +static void +m32c_sb_read (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + if (gdbarch_bfd_arch_info (reg->arch)->mach == bfd_mach_m16c) + m32c_raw_read (reg->rx, cache, buf); + else + m32c_banked_read (reg, cache, buf); +} + + +/* Move the value of SB from BUF to CACHE. On bfd_mach_m32c, SB is a + banked register; on bfd_mach_m16c, it's not. */ +static void +m32c_sb_write (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + if (gdbarch_bfd_arch_info (reg->arch)->mach == bfd_mach_m16c) + m32c_raw_write (reg->rx, cache, buf); + else + m32c_banked_write (reg, cache, buf); +} + + +/* Assuming REG uses m32c_part_read and m32c_part_write, set *OFFSET_P + and *LEN_P to the offset and length, in bytes, of the part REG + occupies in its underlying register. The offset is from the + lower-addressed end, regardless of the architecture's endianness. + (The M32C family is always little-endian, but let's keep those + assumptions out of here.) */ +static void +m32c_find_part (struct m32c_reg *reg, int *offset_p, int *len_p) +{ + /* The length of the containing register, of which REG is one part. */ + int containing_len = TYPE_LENGTH (reg->rx->type); + + /* The length of one "element" in our imaginary array. */ + int elt_len = TYPE_LENGTH (reg->type); + + /* The offset of REG's "element" from the least significant end of + the containing register. */ + int elt_offset = reg->n * elt_len; + + /* If we extend off the end, trim the length of the element. */ + if (elt_offset + elt_len > containing_len) + { + elt_len = containing_len - elt_offset; + /* We shouldn't be declaring partial registers that go off the + end of their containing registers. */ + gdb_assert (elt_len > 0); + } + + /* Flip the offset around if we're big-endian. */ + if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG) + elt_offset = TYPE_LENGTH (reg->rx->type) - elt_offset - elt_len; + + *offset_p = elt_offset; + *len_p = elt_len; +} + + +/* Move the value of a partial register (r0h, intbl, etc.) from CACHE + to BUF. Treating the value of the register REG->rx as an array of + REG->type values, where higher indices refer to more significant + bits, read the value of the REG->n'th element. */ +static void +m32c_part_read (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + int offset, len; + memset (buf, 0, TYPE_LENGTH (reg->type)); + m32c_find_part (reg, &offset, &len); + regcache_cooked_read_part (cache, reg->rx->num, offset, len, buf); +} + + +/* Move the value of a banked register from BUF to CACHE. + Treating the value of the register REG->rx as an array of REG->type + values, where higher indices refer to more significant bits, write + the value of the REG->n'th element. */ +static void +m32c_part_write (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + int offset, len; + m32c_find_part (reg, &offset, &len); + regcache_cooked_write_part (cache, reg->rx->num, offset, len, buf); +} + + +/* Move the value of REG from CACHE to BUF. REG's value is the + concatenation of the values of the registers REG->rx and REG->ry, + with REG->rx contributing the more significant bits. */ +static void +m32c_cat_read (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + int high_bytes = TYPE_LENGTH (reg->rx->type); + int low_bytes = TYPE_LENGTH (reg->ry->type); + /* For address arithmetic. */ + unsigned char *cbuf = buf; + + gdb_assert (TYPE_LENGTH (reg->type) == high_bytes + low_bytes); + + if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG) + { + regcache_cooked_read (cache, reg->rx->num, cbuf); + regcache_cooked_read (cache, reg->ry->num, cbuf + high_bytes); + } + else + { + regcache_cooked_read (cache, reg->rx->num, cbuf + low_bytes); + regcache_cooked_read (cache, reg->ry->num, cbuf); + } +} + + +/* Move the value of REG from CACHE to BUF. REG's value is the + concatenation of the values of the registers REG->rx and REG->ry, + with REG->rx contributing the more significant bits. */ +static void +m32c_cat_write (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + int high_bytes = TYPE_LENGTH (reg->rx->type); + int low_bytes = TYPE_LENGTH (reg->ry->type); + /* For address arithmetic. */ + unsigned char *cbuf = buf; + + gdb_assert (TYPE_LENGTH (reg->type) == high_bytes + low_bytes); + + if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG) + { + regcache_cooked_write (cache, reg->rx->num, cbuf); + regcache_cooked_write (cache, reg->ry->num, cbuf + high_bytes); + } + else + { + regcache_cooked_write (cache, reg->rx->num, cbuf + low_bytes); + regcache_cooked_write (cache, reg->ry->num, cbuf); + } +} + + +/* Copy the value of the raw register REG from CACHE to BUF. REG is + the concatenation (from most significant to least) of r3, r2, r1, + and r0. */ +static void +m32c_r3r2r1r0_read (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (reg->arch); + int len = TYPE_LENGTH (tdep->r0->type); + + /* For address arithmetic. */ + unsigned char *cbuf = buf; + + if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG) + { + regcache_cooked_read (cache, tdep->r0->num, cbuf + len * 3); + regcache_cooked_read (cache, tdep->r1->num, cbuf + len * 2); + regcache_cooked_read (cache, tdep->r2->num, cbuf + len * 1); + regcache_cooked_read (cache, tdep->r3->num, cbuf); + } + else + { + regcache_cooked_read (cache, tdep->r0->num, cbuf); + regcache_cooked_read (cache, tdep->r1->num, cbuf + len * 1); + regcache_cooked_read (cache, tdep->r2->num, cbuf + len * 2); + regcache_cooked_read (cache, tdep->r3->num, cbuf + len * 3); + } +} + + +/* Copy the value of the raw register REG from BUF to CACHE. REG is + the concatenation (from most significant to least) of r3, r2, r1, + and r0. */ +static void +m32c_r3r2r1r0_write (struct m32c_reg *reg, struct regcache *cache, void *buf) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (reg->arch); + int len = TYPE_LENGTH (tdep->r0->type); + + /* For address arithmetic. */ + unsigned char *cbuf = buf; + + if (gdbarch_byte_order (reg->arch) == BFD_ENDIAN_BIG) + { + regcache_cooked_write (cache, tdep->r0->num, cbuf + len * 3); + regcache_cooked_write (cache, tdep->r1->num, cbuf + len * 2); + regcache_cooked_write (cache, tdep->r2->num, cbuf + len * 1); + regcache_cooked_write (cache, tdep->r3->num, cbuf); + } + else + { + regcache_cooked_write (cache, tdep->r0->num, cbuf); + regcache_cooked_write (cache, tdep->r1->num, cbuf + len * 1); + regcache_cooked_write (cache, tdep->r2->num, cbuf + len * 2); + regcache_cooked_write (cache, tdep->r3->num, cbuf + len * 3); + } +} + + +static void +m32c_pseudo_register_read (struct gdbarch *arch, + struct regcache *cache, + int cookednum, + gdb_byte *buf) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + struct m32c_reg *reg; + + gdb_assert (0 <= cookednum && cookednum < tdep->num_regs); + gdb_assert (arch == get_regcache_arch (cache)); + gdb_assert (arch == tdep->regs[cookednum].arch); + reg = &tdep->regs[cookednum]; + + reg->read (reg, cache, buf); +} + + +static void +m32c_pseudo_register_write (struct gdbarch *arch, + struct regcache *cache, + int cookednum, + const gdb_byte *buf) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + struct m32c_reg *reg; + + gdb_assert (0 <= cookednum && cookednum < tdep->num_regs); + gdb_assert (arch == get_regcache_arch (cache)); + gdb_assert (arch == tdep->regs[cookednum].arch); + reg = &tdep->regs[cookednum]; + + reg->write (reg, cache, (void *) buf); +} + + +/* Add a register with the given fields to the end of ARCH's table. + Return a pointer to the newly added register. */ +static struct m32c_reg * +add_reg (struct gdbarch *arch, + const char *name, + struct type *type, + int sim_num, + m32c_move_reg_t *read, + m32c_move_reg_t *write, + struct m32c_reg *rx, + struct m32c_reg *ry, + int n) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + struct m32c_reg *r = &tdep->regs[tdep->num_regs]; + + gdb_assert (tdep->num_regs < M32C_MAX_NUM_REGS); + + r->name = name; + r->type = type; + r->arch = arch; + r->num = tdep->num_regs; + r->sim_num = sim_num; + r->dwarf_num = -1; + r->general_p = 0; + r->dma_p = 0; + r->system_p = 0; + r->save_restore_p = 0; + r->read = read; + r->write = write; + r->rx = rx; + r->ry = ry; + r->n = n; + + tdep->num_regs++; + + return r; +} + + +/* Record NUM as REG's DWARF register number. */ +static void +set_dwarf_regnum (struct m32c_reg *reg, int num) +{ + gdb_assert (num < M32C_MAX_NUM_REGS); + + /* Update the reg->DWARF mapping. Only count the first number + assigned to this register. */ + if (reg->dwarf_num == -1) + reg->dwarf_num = num; + + /* Update the DWARF->reg mapping. */ + gdbarch_tdep (reg->arch)->dwarf_regs[num] = reg; +} + + +/* Mark REG as a general-purpose register, and return it. */ +static struct m32c_reg * +mark_general (struct m32c_reg *reg) +{ + reg->general_p = 1; + return reg; +} + + +/* Mark REG as a DMA register, and return it. */ +static struct m32c_reg * +mark_dma (struct m32c_reg *reg) +{ + reg->dma_p = 1; + return reg; +} + + +/* Mark REG as a SYSTEM register, and return it. */ +static struct m32c_reg * +mark_system (struct m32c_reg *reg) +{ + reg->system_p = 1; + return reg; +} + + +/* Mark REG as a save-restore register, and return it. */ +static struct m32c_reg * +mark_save_restore (struct m32c_reg *reg) +{ + reg->save_restore_p = 1; + return reg; +} + + +#define FLAGBIT_B 0x0010 +#define FLAGBIT_U 0x0080 + +/* Handy macros for declaring registers. These all evaluate to + pointers to the register declared. Macros that define two + registers evaluate to a pointer to the first. */ + +/* A raw register named NAME, with type TYPE and sim number SIM_NUM. */ +#define R(name, type, sim_num) \ + (add_reg (arch, (name), (type), (sim_num), \ + m32c_raw_read, m32c_raw_write, NULL, NULL, 0)) + +/* The simulator register number for a raw register named NAME. */ +#define SIM(name) (m32c_sim_reg_ ## name) + +/* A raw unsigned 16-bit data register named NAME. + NAME should be an identifier, not a string. */ +#define R16U(name) \ + (R(#name, tdep->uint16, SIM (name))) + +/* A raw data address register named NAME. + NAME should be an identifier, not a string. */ +#define RA(name) \ + (R(#name, tdep->data_addr_reg_type, SIM (name))) + +/* A raw code address register named NAME. NAME should + be an identifier, not a string. */ +#define RC(name) \ + (R(#name, tdep->code_addr_reg_type, SIM (name))) + +/* A pair of raw registers named NAME0 and NAME1, with type TYPE. + NAME should be an identifier, not a string. */ +#define RP(name, type) \ + (R(#name "0", (type), SIM (name ## 0)), \ + R(#name "1", (type), SIM (name ## 1)) - 1) + +/* A raw banked general-purpose data register named NAME. + NAME should be an identifier, not a string. */ +#define RBD(name) \ + (R(NULL, tdep->int16, SIM (name ## _bank0)), \ + R(NULL, tdep->int16, SIM (name ## _bank1)) - 1) + +/* A raw banked data address register named NAME. + NAME should be an identifier, not a string. */ +#define RBA(name) \ + (R(NULL, tdep->data_addr_reg_type, SIM (name ## _bank0)), \ + R(NULL, tdep->data_addr_reg_type, SIM (name ## _bank1)) - 1) + +/* A cooked register named NAME referring to a raw banked register + from the bank selected by the current value of FLG. RAW_PAIR + should be a pointer to the first register in the banked pair. + NAME must be an identifier, not a string. */ +#define CB(name, raw_pair) \ + (add_reg (arch, #name, (raw_pair)->type, 0, \ + m32c_banked_read, m32c_banked_write, \ + (raw_pair), (raw_pair + 1), FLAGBIT_B)) + +/* A pair of registers named NAMEH and NAMEL, of type TYPE, that + access the top and bottom halves of the register pointed to by + NAME. NAME should be an identifier. */ +#define CHL(name, type) \ + (add_reg (arch, #name "h", (type), 0, \ + m32c_part_read, m32c_part_write, name, NULL, 1), \ + add_reg (arch, #name "l", (type), 0, \ + m32c_part_read, m32c_part_write, name, NULL, 0) - 1) + +/* A register constructed by concatenating the two registers HIGH and + LOW, whose name is HIGHLOW and whose type is TYPE. */ +#define CCAT(high, low, type) \ + (add_reg (arch, #high #low, (type), 0, \ + m32c_cat_read, m32c_cat_write, (high), (low), 0)) + +/* Abbreviations for marking register group membership. */ +#define G(reg) (mark_general (reg)) +#define S(reg) (mark_system (reg)) +#define DMA(reg) (mark_dma (reg)) + + +/* Construct the register set for ARCH. */ +static void +make_regs (struct gdbarch *arch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + int mach = gdbarch_bfd_arch_info (arch)->mach; + + struct m32c_reg *raw_r0_pair = RBD (r0); + struct m32c_reg *raw_r1_pair = RBD (r1); + struct m32c_reg *raw_r2_pair = RBD (r2); + struct m32c_reg *raw_r3_pair = RBD (r3); + struct m32c_reg *raw_a0_pair = RBA (a0); + struct m32c_reg *raw_a1_pair = RBA (a1); + struct m32c_reg *raw_fb_pair = RBA (fb); + + /* sb is banked on the bfd_mach_m32c, but not on bfd_mach_m16c. + We always declare both raw registers, and deal with the distinction + in the pseudoregister. */ + struct m32c_reg *raw_sb_pair = RBA (sb); + + struct m32c_reg *usp = S (RA (usp)); + struct m32c_reg *isp = S (RA (isp)); + struct m32c_reg *intb = S (RC (intb)); + struct m32c_reg *pc = G (RC (pc)); + struct m32c_reg *flg = G (R16U (flg)); + + if (mach == bfd_mach_m32c) + { + struct m32c_reg *svf = S (R16U (svf)); + struct m32c_reg *svp = S (RC (svp)); + struct m32c_reg *vct = S (RC (vct)); + + struct m32c_reg *dmd01 = DMA (RP (dmd, tdep->uint8)); + struct m32c_reg *dct01 = DMA (RP (dct, tdep->uint16)); + struct m32c_reg *drc01 = DMA (RP (drc, tdep->uint16)); + struct m32c_reg *dma01 = DMA (RP (dma, tdep->data_addr_reg_type)); + struct m32c_reg *dsa01 = DMA (RP (dsa, tdep->data_addr_reg_type)); + struct m32c_reg *dra01 = DMA (RP (dra, tdep->data_addr_reg_type)); + } + + int num_raw_regs = tdep->num_regs; + + struct m32c_reg *r0 = G (CB (r0, raw_r0_pair)); + struct m32c_reg *r1 = G (CB (r1, raw_r1_pair)); + struct m32c_reg *r2 = G (CB (r2, raw_r2_pair)); + struct m32c_reg *r3 = G (CB (r3, raw_r3_pair)); + struct m32c_reg *a0 = G (CB (a0, raw_a0_pair)); + struct m32c_reg *a1 = G (CB (a1, raw_a1_pair)); + struct m32c_reg *fb = G (CB (fb, raw_fb_pair)); + + /* sb is banked on the bfd_mach_m32c, but not on bfd_mach_m16c. + Specify custom read/write functions that do the right thing. */ + struct m32c_reg *sb + = G (add_reg (arch, "sb", raw_sb_pair->type, 0, + m32c_sb_read, m32c_sb_write, + raw_sb_pair, raw_sb_pair + 1, 0)); + + /* The current sp is either usp or isp, depending on the value of + the FLG register's U bit. */ + struct m32c_reg *sp + = G (add_reg (arch, "sp", usp->type, 0, + m32c_banked_read, m32c_banked_write, isp, usp, FLAGBIT_U)); + + struct m32c_reg *r0hl = CHL (r0, tdep->int8); + struct m32c_reg *r1hl = CHL (r1, tdep->int8); + struct m32c_reg *r2hl = CHL (r2, tdep->int8); + struct m32c_reg *r3hl = CHL (r3, tdep->int8); + struct m32c_reg *intbhl = CHL (intb, tdep->int16); + + struct m32c_reg *r2r0 = CCAT (r2, r0, tdep->int32); + struct m32c_reg *r3r1 = CCAT (r3, r1, tdep->int32); + struct m32c_reg *r3r1r2r0 = CCAT (r3r1, r2r0, tdep->int64); + + struct m32c_reg *r3r2r1r0 + = add_reg (arch, "r3r2r1r0", tdep->int64, 0, + m32c_r3r2r1r0_read, m32c_r3r2r1r0_write, NULL, NULL, 0); + + struct m32c_reg *a1a0; + if (mach == bfd_mach_m16c) + a1a0 = CCAT (a1, a0, tdep->int32); + else + a1a0 = NULL; + + int num_cooked_regs = tdep->num_regs - num_raw_regs; + + tdep->pc = pc; + tdep->flg = flg; + tdep->r0 = r0; + tdep->r1 = r1; + tdep->r2 = r2; + tdep->r3 = r3; + tdep->r2r0 = r2r0; + tdep->r3r2r1r0 = r3r2r1r0; + tdep->r3r1r2r0 = r3r1r2r0; + tdep->a0 = a0; + tdep->a1 = a1; + tdep->sb = sb; + tdep->fb = fb; + tdep->sp = sp; + + /* Set up the DWARF register table. */ + memset (tdep->dwarf_regs, 0, sizeof (tdep->dwarf_regs)); + set_dwarf_regnum (r0hl + 1, 0x01); + set_dwarf_regnum (r0hl + 0, 0x02); + set_dwarf_regnum (r1hl + 1, 0x03); + set_dwarf_regnum (r1hl + 0, 0x04); + set_dwarf_regnum (r0, 0x05); + set_dwarf_regnum (r1, 0x06); + set_dwarf_regnum (r2, 0x07); + set_dwarf_regnum (r3, 0x08); + set_dwarf_regnum (a0, 0x09); + set_dwarf_regnum (a1, 0x0a); + set_dwarf_regnum (fb, 0x0b); + set_dwarf_regnum (sp, 0x0c); + set_dwarf_regnum (pc, 0x0d); /* GCC's invention */ + set_dwarf_regnum (sb, 0x13); + set_dwarf_regnum (r2r0, 0x15); + set_dwarf_regnum (r3r1, 0x16); + if (a1a0) + set_dwarf_regnum (a1a0, 0x17); + + /* Enumerate the save/restore register group. + + The regcache_save and regcache_restore functions apply their read + function to each register in this group. + + Since frame_pop supplies frame_unwind_register as its read + function, the registers meaningful to the Dwarf unwinder need to + be in this group. + + On the other hand, when we make inferior calls, save_inferior_status + and restore_inferior_status use them to preserve the current register + values across the inferior call. For this, you'd kind of like to + preserve all the raw registers, to protect the interrupted code from + any sort of bank switching the callee might have done. But we handle + those cases so badly anyway --- for example, it matters whether we + restore FLG before or after we restore the general-purpose registers, + but there's no way to express that --- that it isn't worth worrying + about. + + We omit control registers like inthl: if you call a function that + changes those, it's probably because you wanted that change to be + visible to the interrupted code. */ + mark_save_restore (r0); + mark_save_restore (r1); + mark_save_restore (r2); + mark_save_restore (r3); + mark_save_restore (a0); + mark_save_restore (a1); + mark_save_restore (sb); + mark_save_restore (fb); + mark_save_restore (sp); + mark_save_restore (pc); + mark_save_restore (flg); + + set_gdbarch_num_regs (arch, num_raw_regs); + set_gdbarch_num_pseudo_regs (arch, num_cooked_regs); + set_gdbarch_pc_regnum (arch, pc->num); + set_gdbarch_sp_regnum (arch, sp->num); + set_gdbarch_register_name (arch, m32c_register_name); + set_gdbarch_register_type (arch, m32c_register_type); + set_gdbarch_pseudo_register_read (arch, m32c_pseudo_register_read); + set_gdbarch_pseudo_register_write (arch, m32c_pseudo_register_write); + set_gdbarch_register_sim_regno (arch, m32c_register_sim_regno); + set_gdbarch_stab_reg_to_regnum (arch, m32c_debug_info_reg_to_regnum); + set_gdbarch_dwarf_reg_to_regnum (arch, m32c_debug_info_reg_to_regnum); + set_gdbarch_dwarf2_reg_to_regnum (arch, m32c_debug_info_reg_to_regnum); + set_gdbarch_register_reggroup_p (arch, m32c_register_reggroup_p); + + reggroup_add (arch, general_reggroup); + reggroup_add (arch, all_reggroup); + reggroup_add (arch, save_reggroup); + reggroup_add (arch, restore_reggroup); + reggroup_add (arch, system_reggroup); + reggroup_add (arch, m32c_dma_reggroup); +} + + + +/* Breakpoints. */ + +static const unsigned char * +m32c_breakpoint_from_pc (CORE_ADDR *pc, int *len) +{ + static unsigned char break_insn[] = { 0x00 }; /* brk */ + + *len = sizeof (break_insn); + return break_insn; +} + + + +/* Prologue analysis. */ + +struct m32c_prologue +{ + /* For consistency with the DWARF 2 .debug_frame info generated by + GCC, a frame's CFA is the address immediately after the saved + return address. */ + + /* The architecture for which we generated this prologue info. */ + struct gdbarch *arch; + + enum { + /* This function uses a frame pointer. */ + prologue_with_frame_ptr, + + /* This function has no frame pointer. */ + prologue_sans_frame_ptr, + + /* This function sets up the stack, so its frame is the first + frame on the stack. */ + prologue_first_frame + + } kind; + + /* If KIND is prologue_with_frame_ptr, this is the offset from the + CFA to where the frame pointer points. This is always zero or + negative. */ + LONGEST frame_ptr_offset; + + /* If KIND is prologue_sans_frame_ptr, the offset from the CFA to + the stack pointer --- always zero or negative. + + Calling this a "size" is a bit misleading, but given that the + stack grows downwards, using offsets for everything keeps one + from going completely sign-crazy: you never change anything's + sign for an ADD instruction; always change the second operand's + sign for a SUB instruction; and everything takes care of + itself. + + Functions that use alloca don't have a constant frame size. But + they always have frame pointers, so we must use that to find the + CFA (and perhaps to unwind the stack pointer). */ + LONGEST frame_size; + + /* The address of the first instruction at which the frame has been + set up and the arguments are where the debug info says they are + --- as best as we can tell. */ + CORE_ADDR prologue_end; + + /* reg_offset[R] is the offset from the CFA at which register R is + saved, or 1 if register R has not been saved. (Real values are + always zero or negative.) */ + LONGEST reg_offset[M32C_MAX_NUM_REGS]; +}; + + +/* The longest I've seen, anyway. */ +#define M32C_MAX_INSN_LEN (9) + +/* Processor state, for the prologue analyzer. */ +struct m32c_pv_state +{ + struct gdbarch *arch; + pv_t r0, r1, r2, r3; + pv_t a0, a1; + pv_t sb, fb, sp; + pv_t pc; + struct pv_area *stack; + + /* Bytes from the current PC, the address they were read from, + and the address of the next unconsumed byte. */ + gdb_byte insn[M32C_MAX_INSN_LEN]; + CORE_ADDR scan_pc, next_addr; +}; + + +/* Push VALUE on STATE's stack, occupying SIZE bytes. Return zero if + all went well, or non-zero if simulating the action would trash our + state. */ +static int +m32c_pv_push (struct m32c_pv_state *state, pv_t value, int size) +{ + if (pv_area_store_would_trash (state->stack, state->sp)) + return 1; + + state->sp = pv_add_constant (state->sp, -size); + pv_area_store (state->stack, state->sp, size, value); + + return 0; +} + + +/* A source or destination location for an m16c or m32c + instruction. */ +struct srcdest +{ + /* If srcdest_reg, the location is a register pointed to by REG. + If srcdest_partial_reg, the location is part of a register pointed + to by REG. We don't try to handle this too well. + If srcdest_mem, the location is memory whose address is ADDR. */ + enum { srcdest_reg, srcdest_partial_reg, srcdest_mem } kind; + pv_t *reg, addr; +}; + + +/* Return the SIZE-byte value at LOC in STATE. */ +static pv_t +m32c_srcdest_fetch (struct m32c_pv_state *state, struct srcdest loc, int size) +{ + if (loc.kind == srcdest_mem) + return pv_area_fetch (state->stack, loc.addr, size); + else if (loc.kind == srcdest_partial_reg) + return pv_unknown (); + else + return *loc.reg; +} + + +/* Write VALUE, a SIZE-byte value, to LOC in STATE. Return zero if + all went well, or non-zero if simulating the store would trash our + state. */ +static int +m32c_srcdest_store (struct m32c_pv_state *state, struct srcdest loc, + pv_t value, int size) +{ + if (loc.kind == srcdest_mem) + { + if (pv_area_store_would_trash (state->stack, loc.addr)) + return 1; + pv_area_store (state->stack, loc.addr, size, value); + } + else if (loc.kind == srcdest_partial_reg) + *loc.reg = pv_unknown (); + else + *loc.reg = value; + + return 0; +} + + +static int +m32c_sign_ext (int v, int bits) +{ + int mask = 1 << (bits - 1); + return (v ^ mask) - mask; +} + +static unsigned int +m32c_next_byte (struct m32c_pv_state *st) +{ + gdb_assert (st->next_addr - st->scan_pc < sizeof (st->insn)); + return st->insn[st->next_addr++ - st->scan_pc]; +} + +static int +m32c_udisp8 (struct m32c_pv_state *st) +{ + return m32c_next_byte (st); +} + + +static int +m32c_sdisp8 (struct m32c_pv_state *st) +{ + return m32c_sign_ext (m32c_next_byte (st), 8); +} + + +static int +m32c_udisp16 (struct m32c_pv_state *st) +{ + int low = m32c_next_byte (st); + int high = m32c_next_byte (st); + + return low + (high << 8); +} + + +static int +m32c_sdisp16 (struct m32c_pv_state *st) +{ + int low = m32c_next_byte (st); + int high = m32c_next_byte (st); + + return m32c_sign_ext (low + (high << 8), 16); +} + + +static int +m32c_udisp24 (struct m32c_pv_state *st) +{ + int low = m32c_next_byte (st); + int mid = m32c_next_byte (st); + int high = m32c_next_byte (st); + + return low + (mid << 8) + (high << 16); +} + + +/* Extract the 'source' field from an m32c MOV.size:G-format instruction. */ +static int +m32c_get_src23 (unsigned char *i) +{ + return (((i[0] & 0x70) >> 2) + | ((i[1] & 0x30) >> 4)); +} + + +/* Extract the 'dest' field from an m32c MOV.size:G-format instruction. */ +static int +m32c_get_dest23 (unsigned char *i) +{ + return (((i[0] & 0x0e) << 1) + | ((i[1] & 0xc0) >> 6)); +} + + +static struct srcdest +m32c_decode_srcdest4 (struct m32c_pv_state *st, + int code, int size) +{ + struct srcdest sd; + + if (code < 6) + sd.kind = (size == 2 ? srcdest_reg : srcdest_partial_reg); + else + sd.kind = srcdest_mem; + + switch (code) + { + case 0x0: sd.reg = (size == 1 ? &st->r0 : &st->r0); break; + case 0x1: sd.reg = (size == 1 ? &st->r0 : &st->r1); break; + case 0x2: sd.reg = (size == 1 ? &st->r1 : &st->r2); break; + case 0x3: sd.reg = (size == 1 ? &st->r1 : &st->r3); break; + + case 0x4: sd.reg = &st->a0; break; + case 0x5: sd.reg = &st->a1; break; + + case 0x6: sd.addr = st->a0; break; + case 0x7: sd.addr = st->a1; break; + + case 0x8: sd.addr = pv_add_constant (st->a0, m32c_udisp8 (st)); break; + case 0x9: sd.addr = pv_add_constant (st->a1, m32c_udisp8 (st)); break; + case 0xa: sd.addr = pv_add_constant (st->sb, m32c_udisp8 (st)); break; + case 0xb: sd.addr = pv_add_constant (st->fb, m32c_sdisp8 (st)); break; + + case 0xc: sd.addr = pv_add_constant (st->a0, m32c_udisp16 (st)); break; + case 0xd: sd.addr = pv_add_constant (st->a1, m32c_udisp16 (st)); break; + case 0xe: sd.addr = pv_add_constant (st->sb, m32c_udisp16 (st)); break; + case 0xf: sd.addr = pv_constant (m32c_udisp16 (st)); break; + + default: + gdb_assert (0); + } + + return sd; +} + + +static struct srcdest +m32c_decode_sd23 (struct m32c_pv_state *st, int code, int size, int ind) +{ + struct srcdest sd; + + switch (code) + { + case 0x12: + case 0x13: + case 0x10: + case 0x11: + sd.kind = (size == 1) ? srcdest_partial_reg : srcdest_reg; + break; + + case 0x02: + case 0x03: + sd.kind = (size == 4) ? srcdest_reg : srcdest_partial_reg; + break; + + default: + sd.kind = srcdest_mem; + break; + + } + + switch (code) + { + case 0x12: sd.reg = &st->r0; break; + case 0x13: sd.reg = &st->r1; break; + case 0x10: sd.reg = ((size == 1) ? &st->r0 : &st->r2); break; + case 0x11: sd.reg = ((size == 1) ? &st->r1 : &st->r3); break; + case 0x02: sd.reg = &st->a0; break; + case 0x03: sd.reg = &st->a1; break; + + case 0x00: sd.addr = st->a0; break; + case 0x01: sd.addr = st->a1; break; + case 0x04: sd.addr = pv_add_constant (st->a0, m32c_udisp8 (st)); break; + case 0x05: sd.addr = pv_add_constant (st->a1, m32c_udisp8 (st)); break; + case 0x06: sd.addr = pv_add_constant (st->sb, m32c_udisp8 (st)); break; + case 0x07: sd.addr = pv_add_constant (st->fb, m32c_sdisp8 (st)); break; + case 0x08: sd.addr = pv_add_constant (st->a0, m32c_udisp16 (st)); break; + case 0x09: sd.addr = pv_add_constant (st->a1, m32c_udisp16 (st)); break; + case 0x0a: sd.addr = pv_add_constant (st->sb, m32c_udisp16 (st)); break; + case 0x0b: sd.addr = pv_add_constant (st->fb, m32c_sdisp16 (st)); break; + case 0x0c: sd.addr = pv_add_constant (st->a0, m32c_udisp24 (st)); break; + case 0x0d: sd.addr = pv_add_constant (st->a1, m32c_udisp24 (st)); break; + case 0x0f: sd.addr = pv_constant (m32c_udisp16 (st)); break; + case 0x0e: sd.addr = pv_constant (m32c_udisp24 (st)); break; + default: + gdb_assert (0); + } + + if (ind) + { + sd.addr = m32c_srcdest_fetch (st, sd, 4); + sd.kind = srcdest_mem; + } + + return sd; +} + + +/* The r16c and r32c machines have instructions with similar + semantics, but completely different machine language encodings. So + we break out the semantics into their own functions, and leave + machine-specific decoding in m32c_analyze_prologue. + + The following functions all expect their arguments already decoded, + and they all return zero if analysis should continue past this + instruction, or non-zero if analysis should stop. */ + + +/* Simulate an 'enter SIZE' instruction in STATE. */ +static int +m32c_pv_enter (struct m32c_pv_state *state, int size) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch); + + /* If simulating this store would require us to forget + everything we know about the stack frame in the name of + accuracy, it would be better to just quit now. */ + if (pv_area_store_would_trash (state->stack, state->sp)) + return 1; + + if (m32c_pv_push (state, state->fb, tdep->push_addr_bytes)) + return 1; + state->fb = state->sp; + state->sp = pv_add_constant (state->sp, -size); + + return 0; +} + + +static int +m32c_pv_pushm_one (struct m32c_pv_state *state, pv_t reg, + int bit, int src, int size) +{ + if (bit & src) + { + if (m32c_pv_push (state, reg, size)) + return 1; + } + + return 0; +} + + +/* Simulate a 'pushm SRC' instruction in STATE. */ +static int +m32c_pv_pushm (struct m32c_pv_state *state, int src) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch); + + /* The bits in SRC indicating which registers to save are: + r0 r1 r2 r3 a0 a1 sb fb */ + return + ( m32c_pv_pushm_one (state, state->fb, 0x01, src, tdep->push_addr_bytes) + || m32c_pv_pushm_one (state, state->sb, 0x02, src, tdep->push_addr_bytes) + || m32c_pv_pushm_one (state, state->a1, 0x04, src, tdep->push_addr_bytes) + || m32c_pv_pushm_one (state, state->a0, 0x08, src, tdep->push_addr_bytes) + || m32c_pv_pushm_one (state, state->r3, 0x10, src, 2) + || m32c_pv_pushm_one (state, state->r2, 0x20, src, 2) + || m32c_pv_pushm_one (state, state->r1, 0x40, src, 2) + || m32c_pv_pushm_one (state, state->r0, 0x80, src, 2)); +} + +/* Return non-zero if VALUE is the first incoming argument register. */ + +static int +m32c_is_1st_arg_reg (struct m32c_pv_state *state, pv_t value) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch); + return (value.kind == pvk_register + && (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c + ? (value.reg == tdep->r1->num) + : (value.reg == tdep->r0->num)) + && value.k == 0); +} + +/* Return non-zero if VALUE is an incoming argument register. */ + +static int +m32c_is_arg_reg (struct m32c_pv_state *state, pv_t value) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch); + return (value.kind == pvk_register + && (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c + ? (value.reg == tdep->r1->num || value.reg == tdep->r2->num) + : (value.reg == tdep->r0->num)) + && value.k == 0); +} + +/* Return non-zero if a store of VALUE to LOC is probably spilling an + argument register to its stack slot in STATE. Such instructions + should be included in the prologue, if possible. + + The store is a spill if: + - the value being stored is the original value of an argument register; + - the value has not already been stored somewhere in STACK; and + - LOC is a stack slot (e.g., a memory location whose address is + relative to the original value of the SP). */ + +static int +m32c_is_arg_spill (struct m32c_pv_state *st, + struct srcdest loc, + pv_t value) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (st->arch); + + return (m32c_is_arg_reg (st, value) + && loc.kind == srcdest_mem + && pv_is_register (loc.addr, tdep->sp->num) + && ! pv_area_find_reg (st->stack, st->arch, value.reg, 0)); +} + +/* Return non-zero if a store of VALUE to LOC is probably + copying the struct return address into an address register + for immediate use. This is basically a "spill" into the + address register, instead of onto the stack. + + The prerequisites are: + - value being stored is original value of the FIRST arg register; + - value has not already been stored on stack; and + - LOC is an address register (a0 or a1). */ + +static int +m32c_is_struct_return (struct m32c_pv_state *st, + struct srcdest loc, + pv_t value) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (st->arch); + + return (m32c_is_1st_arg_reg (st, value) + && !pv_area_find_reg (st->stack, st->arch, value.reg, 0) + && loc.kind == srcdest_reg + && (pv_is_register (*loc.reg, tdep->a0->num) + || pv_is_register (*loc.reg, tdep->a1->num))); +} + +/* Return non-zero if a 'pushm' saving the registers indicated by SRC + was a register save: + - all the named registers should have their original values, and + - the stack pointer should be at a constant offset from the + original stack pointer. */ +static int +m32c_pushm_is_reg_save (struct m32c_pv_state *st, int src) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (st->arch); + /* The bits in SRC indicating which registers to save are: + r0 r1 r2 r3 a0 a1 sb fb */ + return + (pv_is_register (st->sp, tdep->sp->num) + && (! (src & 0x01) || pv_is_register_k (st->fb, tdep->fb->num, 0)) + && (! (src & 0x02) || pv_is_register_k (st->sb, tdep->sb->num, 0)) + && (! (src & 0x04) || pv_is_register_k (st->a1, tdep->a1->num, 0)) + && (! (src & 0x08) || pv_is_register_k (st->a0, tdep->a0->num, 0)) + && (! (src & 0x10) || pv_is_register_k (st->r3, tdep->r3->num, 0)) + && (! (src & 0x20) || pv_is_register_k (st->r2, tdep->r2->num, 0)) + && (! (src & 0x40) || pv_is_register_k (st->r1, tdep->r1->num, 0)) + && (! (src & 0x80) || pv_is_register_k (st->r0, tdep->r0->num, 0))); +} + + +/* Function for finding saved registers in a 'struct pv_area'; we pass + this to pv_area_scan. + + If VALUE is a saved register, ADDR says it was saved at a constant + offset from the frame base, and SIZE indicates that the whole + register was saved, record its offset in RESULT_UNTYPED. */ +static void +check_for_saved (void *prologue_untyped, pv_t addr, CORE_ADDR size, pv_t value) +{ + struct m32c_prologue *prologue = (struct m32c_prologue *) prologue_untyped; + struct gdbarch *arch = prologue->arch; + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + + /* Is this the unchanged value of some register being saved on the + stack? */ + if (value.kind == pvk_register + && value.k == 0 + && pv_is_register (addr, tdep->sp->num)) + { + /* Some registers require special handling: they're saved as a + larger value than the register itself. */ + CORE_ADDR saved_size = register_size (arch, value.reg); + + if (value.reg == tdep->pc->num) + saved_size = tdep->ret_addr_bytes; + else if (gdbarch_register_type (arch, value.reg) + == tdep->data_addr_reg_type) + saved_size = tdep->push_addr_bytes; + + if (size == saved_size) + { + /* Find which end of the saved value corresponds to our + register. */ + if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG) + prologue->reg_offset[value.reg] + = (addr.k + saved_size - register_size (arch, value.reg)); + else + prologue->reg_offset[value.reg] = addr.k; + } + } +} + + +/* Analyze the function prologue for ARCH at START, going no further + than LIMIT, and place a description of what we found in + PROLOGUE. */ +void +m32c_analyze_prologue (struct gdbarch *arch, + CORE_ADDR start, CORE_ADDR limit, + struct m32c_prologue *prologue) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + unsigned long mach = gdbarch_bfd_arch_info (arch)->mach; + CORE_ADDR after_last_frame_related_insn; + struct cleanup *back_to; + struct m32c_pv_state st; + + st.arch = arch; + st.r0 = pv_register (tdep->r0->num, 0); + st.r1 = pv_register (tdep->r1->num, 0); + st.r2 = pv_register (tdep->r2->num, 0); + st.r3 = pv_register (tdep->r3->num, 0); + st.a0 = pv_register (tdep->a0->num, 0); + st.a1 = pv_register (tdep->a1->num, 0); + st.sb = pv_register (tdep->sb->num, 0); + st.fb = pv_register (tdep->fb->num, 0); + st.sp = pv_register (tdep->sp->num, 0); + st.pc = pv_register (tdep->pc->num, 0); + st.stack = make_pv_area (tdep->sp->num); + back_to = make_cleanup_free_pv_area (st.stack); + + /* Record that the call instruction has saved the return address on + the stack. */ + m32c_pv_push (&st, st.pc, tdep->ret_addr_bytes); + + memset (prologue, 0, sizeof (*prologue)); + prologue->arch = arch; + { + int i; + for (i = 0; i < M32C_MAX_NUM_REGS; i++) + prologue->reg_offset[i] = 1; + } + + st.scan_pc = after_last_frame_related_insn = start; + + while (st.scan_pc < limit) + { + pv_t pre_insn_fb = st.fb; + pv_t pre_insn_sp = st.sp; + + /* In theory we could get in trouble by trying to read ahead + here, when we only know we're expecting one byte. In + practice I doubt anyone will care, and it makes the rest of + the code easier. */ + if (target_read_memory (st.scan_pc, st.insn, sizeof (st.insn))) + /* If we can't fetch the instruction from memory, stop here + and hope for the best. */ + break; + st.next_addr = st.scan_pc; + + /* The assembly instructions are written as they appear in the + section of the processor manuals that describe the + instruction encodings. + + When a single assembly language instruction has several + different machine-language encodings, the manual + distinguishes them by a number in parens, before the + mnemonic. Those numbers are included, as well. + + The srcdest decoding instructions have the same names as the + analogous functions in the simulator. */ + if (mach == bfd_mach_m16c) + { + /* (1) ENTER #imm8 */ + if (st.insn[0] == 0x7c && st.insn[1] == 0xf2) + { + if (m32c_pv_enter (&st, st.insn[2])) + break; + st.next_addr += 3; + } + /* (1) PUSHM src */ + else if (st.insn[0] == 0xec) + { + int src = st.insn[1]; + if (m32c_pv_pushm (&st, src)) + break; + st.next_addr += 2; + + if (m32c_pushm_is_reg_save (&st, src)) + after_last_frame_related_insn = st.next_addr; + } + + /* (6) MOV.size:G src, dest */ + else if ((st.insn[0] & 0xfe) == 0x72) + { + int size = (st.insn[0] & 0x01) ? 2 : 1; + + st.next_addr += 2; + + struct srcdest src + = m32c_decode_srcdest4 (&st, (st.insn[1] >> 4) & 0xf, size); + struct srcdest dest + = m32c_decode_srcdest4 (&st, st.insn[1] & 0xf, size); + pv_t src_value = m32c_srcdest_fetch (&st, src, size); + + if (m32c_is_arg_spill (&st, dest, src_value)) + after_last_frame_related_insn = st.next_addr; + else if (m32c_is_struct_return (&st, dest, src_value)) + after_last_frame_related_insn = st.next_addr; + + if (m32c_srcdest_store (&st, dest, src_value, size)) + break; + } + + /* (1) LDC #IMM16, sp */ + else if (st.insn[0] == 0xeb + && st.insn[1] == 0x50) + { + st.next_addr += 2; + st.sp = pv_constant (m32c_udisp16 (&st)); + } + + else + /* We've hit some instruction we don't know how to simulate. + Strictly speaking, we should set every value we're + tracking to "unknown". But we'll be optimistic, assume + that we have enough information already, and stop + analysis here. */ + break; + } + else + { + int src_indirect = 0; + int dest_indirect = 0; + int i = 0; + + gdb_assert (mach == bfd_mach_m32c); + + /* Check for prefix bytes indicating indirect addressing. */ + if (st.insn[0] == 0x41) + { + src_indirect = 1; + i++; + } + else if (st.insn[0] == 0x09) + { + dest_indirect = 1; + i++; + } + else if (st.insn[0] == 0x49) + { + src_indirect = dest_indirect = 1; + i++; + } + + /* (1) ENTER #imm8 */ + if (st.insn[i] == 0xec) + { + if (m32c_pv_enter (&st, st.insn[i + 1])) + break; + st.next_addr += 2; + } + + /* (1) PUSHM src */ + else if (st.insn[i] == 0x8f) + { + int src = st.insn[i + 1]; + if (m32c_pv_pushm (&st, src)) + break; + st.next_addr += 2; + + if (m32c_pushm_is_reg_save (&st, src)) + after_last_frame_related_insn = st.next_addr; + } + + /* (7) MOV.size:G src, dest */ + else if ((st.insn[i] & 0x80) == 0x80 + && (st.insn[i + 1] & 0x0f) == 0x0b + && m32c_get_src23 (&st.insn[i]) < 20 + && m32c_get_dest23 (&st.insn[i]) < 20) + { + int bw = st.insn[i] & 0x01; + int size = bw ? 2 : 1; + + st.next_addr += 2; + + struct srcdest src + = m32c_decode_sd23 (&st, m32c_get_src23 (&st.insn[i]), + size, src_indirect); + struct srcdest dest + = m32c_decode_sd23 (&st, m32c_get_dest23 (&st.insn[i]), + size, dest_indirect); + pv_t src_value = m32c_srcdest_fetch (&st, src, size); + + if (m32c_is_arg_spill (&st, dest, src_value)) + after_last_frame_related_insn = st.next_addr; + + if (m32c_srcdest_store (&st, dest, src_value, size)) + break; + } + /* (2) LDC #IMM24, sp */ + else if (st.insn[i] == 0xd5 + && st.insn[i + 1] == 0x29) + { + st.next_addr += 2; + st.sp = pv_constant (m32c_udisp24 (&st)); + } + else + /* We've hit some instruction we don't know how to simulate. + Strictly speaking, we should set every value we're + tracking to "unknown". But we'll be optimistic, assume + that we have enough information already, and stop + analysis here. */ + break; + } + + /* If this instruction changed the FB or decreased the SP (i.e., + allocated more stack space), then this may be a good place to + declare the prologue finished. However, there are some + exceptions: + + - If the instruction just changed the FB back to its original + value, then that's probably a restore instruction. The + prologue should definitely end before that. + + - If the instruction increased the value of the SP (that is, + shrunk the frame), then it's probably part of a frame + teardown sequence, and the prologue should end before + that. */ + + if (! pv_is_identical (st.fb, pre_insn_fb)) + { + if (! pv_is_register_k (st.fb, tdep->fb->num, 0)) + after_last_frame_related_insn = st.next_addr; + } + else if (! pv_is_identical (st.sp, pre_insn_sp)) + { + /* The comparison of the constants looks odd, there, because + .k is unsigned. All it really means is that the SP is + lower than it was before the instruction. */ + if ( pv_is_register (pre_insn_sp, tdep->sp->num) + && pv_is_register (st.sp, tdep->sp->num) + && ((pre_insn_sp.k - st.sp.k) < (st.sp.k - pre_insn_sp.k))) + after_last_frame_related_insn = st.next_addr; + } + + st.scan_pc = st.next_addr; + } + + /* Did we load a constant value into the stack pointer? */ + if (pv_is_constant (st.sp)) + prologue->kind = prologue_first_frame; + + /* Alternatively, did we initialize the frame pointer? Remember + that the CFA is the address after the return address. */ + if (pv_is_register (st.fb, tdep->sp->num)) + { + prologue->kind = prologue_with_frame_ptr; + prologue->frame_ptr_offset = st.fb.k; + } + + /* Is the frame size a known constant? Remember that frame_size is + actually the offset from the CFA to the SP (i.e., a negative + value). */ + else if (pv_is_register (st.sp, tdep->sp->num)) + { + prologue->kind = prologue_sans_frame_ptr; + prologue->frame_size = st.sp.k; + } + + /* We haven't been able to make sense of this function's frame. Treat + it as the first frame. */ + else + prologue->kind = prologue_first_frame; + + /* Record where all the registers were saved. */ + pv_area_scan (st.stack, check_for_saved, (void *) prologue); + + prologue->prologue_end = after_last_frame_related_insn; + + do_cleanups (back_to); +} + + +static CORE_ADDR +m32c_skip_prologue (CORE_ADDR ip) +{ + char *name; + CORE_ADDR func_addr, func_end, sal_end; + struct m32c_prologue p; + + /* Try to find the extent of the function that contains IP. */ + if (! find_pc_partial_function (ip, &name, &func_addr, &func_end)) + return ip; + + /* Find end by prologue analysis. */ + m32c_analyze_prologue (current_gdbarch, ip, func_end, &p); + /* Find end by line info. */ + sal_end = skip_prologue_using_sal (ip); + /* Return whichever is lower. */ + if (sal_end != 0 && sal_end != ip && sal_end < p.prologue_end) + return sal_end; + else + return p.prologue_end; +} + + + +/* Stack unwinding. */ + +static struct m32c_prologue * +m32c_analyze_frame_prologue (struct frame_info *next_frame, + void **this_prologue_cache) +{ + if (! *this_prologue_cache) + { + CORE_ADDR func_start = frame_func_unwind (next_frame); + CORE_ADDR stop_addr = frame_pc_unwind (next_frame); + + /* If we couldn't find any function containing the PC, then + just initialize the prologue cache, but don't do anything. */ + if (! func_start) + stop_addr = func_start; + + *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct m32c_prologue); + m32c_analyze_prologue (get_frame_arch (next_frame), + func_start, stop_addr, *this_prologue_cache); + } + + return *this_prologue_cache; +} + + +static CORE_ADDR +m32c_frame_base (struct frame_info *next_frame, + void **this_prologue_cache) +{ + struct m32c_prologue *p + = m32c_analyze_frame_prologue (next_frame, this_prologue_cache); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame)); + + /* In functions that use alloca, the distance between the stack + pointer and the frame base varies dynamically, so we can't use + the SP plus static information like prologue analysis to find the + frame base. However, such functions must have a frame pointer, + to be able to restore the SP on exit. So whenever we do have a + frame pointer, use that to find the base. */ + switch (p->kind) + { + case prologue_with_frame_ptr: + { + CORE_ADDR fb + = frame_unwind_register_unsigned (next_frame, tdep->fb->num); + return fb - p->frame_ptr_offset; + } + + case prologue_sans_frame_ptr: + { + CORE_ADDR sp + = frame_unwind_register_unsigned (next_frame, tdep->sp->num); + return sp - p->frame_size; + } + + case prologue_first_frame: + return 0; + + default: + gdb_assert (0); + } +} + + +static void +m32c_this_id (struct frame_info *next_frame, + void **this_prologue_cache, + struct frame_id *this_id) +{ + CORE_ADDR base = m32c_frame_base (next_frame, this_prologue_cache); + + if (base) + *this_id = frame_id_build (base, frame_func_unwind (next_frame)); + /* Otherwise, leave it unset, and that will terminate the backtrace. */ +} + + +static void +m32c_prev_register (struct frame_info *next_frame, + void **this_prologue_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, gdb_byte *bufferp) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame)); + struct m32c_prologue *p + = m32c_analyze_frame_prologue (next_frame, this_prologue_cache); + CORE_ADDR frame_base = m32c_frame_base (next_frame, this_prologue_cache); + int reg_size = register_size (get_frame_arch (next_frame), regnum); + + if (regnum == tdep->sp->num) + { + *optimizedp = 0; + *lvalp = not_lval; + *addrp = 0; + *realnump = -1; + if (bufferp) + store_unsigned_integer (bufferp, reg_size, frame_base); + } + + /* If prologue analysis says we saved this register somewhere, + return a description of the stack slot holding it. */ + else if (p->reg_offset[regnum] != 1) + { + *optimizedp = 0; + *lvalp = lval_memory; + *addrp = frame_base + p->reg_offset[regnum]; + *realnump = -1; + if (bufferp) + get_frame_memory (next_frame, *addrp, bufferp, reg_size); + } + + /* Otherwise, presume we haven't changed the value of this + register, and get it from the next frame. */ + else + frame_register_unwind (next_frame, regnum, + optimizedp, lvalp, addrp, realnump, bufferp); +} + + +static const struct frame_unwind m32c_unwind = { + NORMAL_FRAME, + m32c_this_id, + m32c_prev_register +}; + + +static const struct frame_unwind * +m32c_frame_sniffer (struct frame_info *next_frame) +{ + return &m32c_unwind; +} + + +static CORE_ADDR +m32c_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + return frame_unwind_register_unsigned (next_frame, tdep->pc->num); +} + + +static CORE_ADDR +m32c_unwind_sp (struct gdbarch *arch, struct frame_info *next_frame) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + return frame_unwind_register_unsigned (next_frame, tdep->sp->num); +} + + +/* Inferior calls. */ + +/* The calling conventions, according to GCC: + + r8c, m16c + --------- + First arg may be passed in r1l or r1 if it (1) fits (QImode or + HImode), (2) is named, and (3) is an integer or pointer type (no + structs, floats, etc). Otherwise, it's passed on the stack. + + Second arg may be passed in r2, same restrictions (but not QImode), + even if the first arg is passed on the stack. + + Third and further args are passed on the stack. No padding is + used, stack "alignment" is 8 bits. + + m32cm, m32c + ----------- + + First arg may be passed in r0l or r0, same restrictions as above. + + Second and further args are passed on the stack. Padding is used + after QImode parameters (i.e. lower-addressed byte is the value, + higher-addressed byte is the padding), stack "alignment" is 16 + bits. */ + + +/* Return true if TYPE is a type that can be passed in registers. (We + ignore the size, and pay attention only to the type code; + acceptable sizes depends on which register is being considered to + hold it.) */ +static int +m32c_reg_arg_type (struct type *type) +{ + enum type_code code = TYPE_CODE (type); + + return (code == TYPE_CODE_INT + || code == TYPE_CODE_ENUM + || code == TYPE_CODE_PTR + || code == TYPE_CODE_REF + || code == TYPE_CODE_BOOL + || code == TYPE_CODE_CHAR); +} + + +static CORE_ADDR +m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + struct regcache *regcache, CORE_ADDR bp_addr, int nargs, + struct value **args, CORE_ADDR sp, int struct_return, + CORE_ADDR struct_addr) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach; + CORE_ADDR cfa; + int i; + + /* The number of arguments given in this function's prototype, or + zero if it has a non-prototyped function type. The m32c ABI + passes arguments mentioned in the prototype differently from + those in the ellipsis of a varargs function, or from those passed + to a non-prototyped function. */ + int num_prototyped_args = 0; + + { + struct type *func_type = value_type (function); + + gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC || + TYPE_CODE (func_type) == TYPE_CODE_METHOD); + +#if 0 + /* The ABI description in gcc/config/m32c/m32c.abi says that + we need to handle prototyped and non-prototyped functions + separately, but the code in GCC doesn't actually do so. */ + if (TYPE_PROTOTYPED (func_type)) +#endif + num_prototyped_args = TYPE_NFIELDS (func_type); + } + + /* First, if the function returns an aggregate by value, push a + pointer to a buffer for it. This doesn't affect the way + subsequent arguments are allocated to registers. */ + if (struct_return) + { + int ptr_len = TYPE_LENGTH (tdep->ptr_voyd); + sp -= ptr_len; + write_memory_unsigned_integer (sp, ptr_len, struct_addr); + } + + /* Push the arguments. */ + for (i = nargs - 1; i >= 0; i--) + { + struct value *arg = args[i]; + const gdb_byte *arg_bits = value_contents (arg); + struct type *arg_type = value_type (arg); + ULONGEST arg_size = TYPE_LENGTH (arg_type); + + /* Can it go in r1 or r1l (for m16c) or r0 or r0l (for m32c)? */ + if (i == 0 + && arg_size <= 2 + && i < num_prototyped_args + && m32c_reg_arg_type (arg_type)) + { + /* Extract and re-store as an integer as a terse way to make + sure it ends up in the least significant end of r1. (GDB + should avoid assuming endianness, even on uni-endian + processors.) */ + ULONGEST u = extract_unsigned_integer (arg_bits, arg_size); + struct m32c_reg *reg = (mach == bfd_mach_m16c) ? tdep->r1 : tdep->r0; + regcache_cooked_write_unsigned (regcache, reg->num, u); + } + + /* Can it go in r2? */ + else if (mach == bfd_mach_m16c + && i == 1 + && arg_size == 2 + && i < num_prototyped_args + && m32c_reg_arg_type (arg_type)) + regcache_cooked_write (regcache, tdep->r2->num, arg_bits); + + /* Everything else goes on the stack. */ + else + { + sp -= arg_size; + + /* Align the stack. */ + if (mach == bfd_mach_m32c) + sp &= ~1; + + write_memory (sp, arg_bits, arg_size); + } + } + + /* This is the CFA we use to identify the dummy frame. */ + cfa = sp; + + /* Push the return address. */ + sp -= tdep->ret_addr_bytes; + write_memory_unsigned_integer (sp, tdep->ret_addr_bytes, bp_addr); + + /* Update the stack pointer. */ + regcache_cooked_write_unsigned (regcache, tdep->sp->num, sp); + + /* We need to borrow an odd trick from the i386 target here. + + The value we return from this function gets used as the stack + address (the CFA) for the dummy frame's ID. The obvious thing is + to return the new TOS. However, that points at the return + address, saved on the stack, which is inconsistent with the CFA's + described by GCC's DWARF 2 .debug_frame information: DWARF 2 + .debug_frame info uses the address immediately after the saved + return address. So you end up with a dummy frame whose CFA + points at the return address, but the frame for the function + being called has a CFA pointing after the return address: the + younger CFA is *greater than* the older CFA. The sanity checks + in frame.c don't like that. + + So we try to be consistent with the CFA's used by DWARF 2. + Having a dummy frame and a real frame with the *same* CFA is + tolerable. */ + return cfa; +} + + +static struct frame_id +m32c_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + /* This needs to return a frame ID whose PC is the return address + passed to m32c_push_dummy_call, and whose stack_addr is the SP + m32c_push_dummy_call returned. + + m32c_unwind_sp gives us the CFA, which is the value the SP had + before the return address was pushed. */ + return frame_id_build (m32c_unwind_sp (gdbarch, next_frame), + frame_pc_unwind (next_frame)); +} + + + +/* Return values. */ + +/* Return value conventions, according to GCC: + + r8c, m16c + --------- + + QImode in r0l + HImode in r0 + SImode in r2r0 + near pointer in r0 + far pointer in r2r0 + + Aggregate values (regardless of size) are returned by pushing a + pointer to a temporary area on the stack after the args are pushed. + The function fills in this area with the value. Note that this + pointer on the stack does not affect how register arguments, if any, + are configured. + + m32cm, m32c + ----------- + Same. */ + +/* Return non-zero if values of type TYPE are returned by storing them + in a buffer whose address is passed on the stack, ahead of the + other arguments. */ +static int +m32c_return_by_passed_buf (struct type *type) +{ + enum type_code code = TYPE_CODE (type); + + return (code == TYPE_CODE_STRUCT + || code == TYPE_CODE_UNION); +} + +static enum return_value_convention +m32c_return_value (struct gdbarch *gdbarch, + struct type *valtype, + struct regcache *regcache, + gdb_byte *readbuf, + const gdb_byte *writebuf) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + enum return_value_convention conv; + ULONGEST valtype_len = TYPE_LENGTH (valtype); + + if (m32c_return_by_passed_buf (valtype)) + conv = RETURN_VALUE_STRUCT_CONVENTION; + else + conv = RETURN_VALUE_REGISTER_CONVENTION; + + if (readbuf) + { + /* We should never be called to find values being returned by + RETURN_VALUE_STRUCT_CONVENTION. Those can't be located, + unless we made the call ourselves. */ + gdb_assert (conv == RETURN_VALUE_REGISTER_CONVENTION); + + gdb_assert (valtype_len <= 8); + + /* Anything that fits in r0 is returned there. */ + if (valtype_len <= TYPE_LENGTH (tdep->r0->type)) + { + ULONGEST u; + regcache_cooked_read_unsigned (regcache, tdep->r0->num, &u); + store_unsigned_integer (readbuf, valtype_len, u); + } + else + { + /* Everything else is passed in mem0, using as many bytes as + needed. This is not what the Renesas tools do, but it's + what GCC does at the moment. */ + struct minimal_symbol *mem0 + = lookup_minimal_symbol ("mem0", NULL, NULL); + + if (! mem0) + error ("The return value is stored in memory at 'mem0', " + "but GDB cannot find\n" + "its address."); + read_memory (SYMBOL_VALUE_ADDRESS (mem0), readbuf, valtype_len); + } + } + + if (writebuf) + { + /* We should never be called to store values to be returned + using RETURN_VALUE_STRUCT_CONVENTION. We have no way of + finding the buffer, unless we made the call ourselves. */ + gdb_assert (conv == RETURN_VALUE_REGISTER_CONVENTION); + + gdb_assert (valtype_len <= 8); + + /* Anything that fits in r0 is returned there. */ + if (valtype_len <= TYPE_LENGTH (tdep->r0->type)) + { + ULONGEST u = extract_unsigned_integer (writebuf, valtype_len); + regcache_cooked_write_unsigned (regcache, tdep->r0->num, u); + } + else + { + /* Everything else is passed in mem0, using as many bytes as + needed. This is not what the Renesas tools do, but it's + what GCC does at the moment. */ + struct minimal_symbol *mem0 + = lookup_minimal_symbol ("mem0", NULL, NULL); + + if (! mem0) + error ("The return value is stored in memory at 'mem0', " + "but GDB cannot find\n" + " its address."); + write_memory (SYMBOL_VALUE_ADDRESS (mem0), + (char *) writebuf, valtype_len); + } + } + + return conv; +} + + + +/* Trampolines. */ + +/* The m16c and m32c use a trampoline function for indirect function + calls. An indirect call looks like this: + + ... push arguments ... + ... push target function address ... + jsr.a m32c_jsri16 + + The code for m32c_jsri16 looks like this: + + m32c_jsri16: + + # Save return address. + pop.w m32c_jsri_ret + pop.b m32c_jsri_ret+2 + + # Store target function address. + pop.w m32c_jsri_addr + + # Re-push return address. + push.b m32c_jsri_ret+2 + push.w m32c_jsri_ret + + # Call the target function. + jmpi.a m32c_jsri_addr + + Without further information, GDB will treat calls to m32c_jsri16 + like calls to any other function. Since m32c_jsri16 doesn't have + debugging information, that normally means that GDB sets a step- + resume breakpoint and lets the program continue --- which is not + what the user wanted. (Giving the trampoline debugging info + doesn't help: the user expects the program to stop in the function + their program is calling, not in some trampoline code they've never + seen before.) + + The SKIP_TRAMPOLINE_CODE gdbarch method tells GDB how to step + through such trampoline functions transparently to the user. When + given the address of a trampoline function's first instruction, + SKIP_TRAMPOLINE_CODE should return the address of the first + instruction of the function really being called. If GDB decides it + wants to step into that function, it will set a breakpoint there + and silently continue to it. + + We recognize the trampoline by name, and extract the target address + directly from the stack. This isn't great, but recognizing by its + code sequence seems more fragile. */ + +static CORE_ADDR +m32c_skip_trampoline_code (CORE_ADDR stop_pc) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + /* It would be nicer to simply look up the addresses of known + trampolines once, and then compare stop_pc with them. However, + we'd need to ensure that that cached address got invalidated when + someone loaded a new executable, and I'm not quite sure of the + best way to do that. find_pc_partial_function does do some + caching, so we'll see how this goes. */ + char *name; + CORE_ADDR start, end; + + if (find_pc_partial_function (stop_pc, &name, &start, &end)) + { + /* Are we stopped at the beginning of the trampoline function? */ + if (strcmp (name, "m32c_jsri16") == 0 + && stop_pc == start) + { + /* Get the stack pointer. The return address is at the top, + and the target function's address is just below that. We + know it's a two-byte address, since the trampoline is + m32c_jsri*16*. */ + CORE_ADDR sp = get_frame_sp (get_current_frame ()); + CORE_ADDR target + = read_memory_unsigned_integer (sp + tdep->ret_addr_bytes, 2); + + /* What we have now is the address of a jump instruction. + What we need is the destination of that jump. + The opcode is 1 byte, and the destination is the next 3 bytes. + */ + target = read_memory_unsigned_integer (target + 1, 3); + return target; + } + } + + return 0; +} + + +/* Address/pointer conversions. */ + +/* On the m16c, there is a 24-bit address space, but only a very few + instructions can generate addresses larger than 0xffff: jumps, + jumps to subroutines, and the lde/std (load/store extended) + instructions. + + Since GCC can only support one size of pointer, we can't have + distinct 'near' and 'far' pointer types; we have to pick one size + for everything. If we wanted to use 24-bit pointers, then GCC + would have to use lde and ste for all memory references, which + would be terrible for performance and code size. So the GNU + toolchain uses 16-bit pointers for everything, and gives up the + ability to have pointers point outside the first 64k of memory. + + However, as a special hack, we let the linker place functions at + addresses above 0xffff, as long as it also places a trampoline in + the low 64k for every function whose address is taken. Each + trampoline consists of a single jmp.a instruction that jumps to the + function's real entry point. Pointers to functions can be 16 bits + long, even though the functions themselves are at higher addresses: + the pointers refer to the trampolines, not the functions. + + This complicates things for GDB, however: given the address of a + function (from debug info or linker symbols, say) which could be + anywhere in the 24-bit address space, how can we find an + appropriate 16-bit value to use as a pointer to it? + + If the linker has not generated a trampoline for the function, + we're out of luck. Well, I guess we could malloc some space and + write a jmp.a instruction to it, but I'm not going to get into that + at the moment. + + If the linker has generated a trampoline for the function, then it + also emitted a symbol for the trampoline: if the function's linker + symbol is named NAME, then the function's trampoline's linker + symbol is named NAME.plt. + + So, given a code address: + - We try to find a linker symbol at that address. + - If we find such a symbol named NAME, we look for a linker symbol + named NAME.plt. + - If we find such a symbol, we assume it is a trampoline, and use + its address as the pointer value. + + And, given a function pointer: + - We try to find a linker symbol at that address named NAME.plt. + - If we find such a symbol, we look for a linker symbol named NAME. + - If we find that, we provide that as the function's address. + - If any of the above steps fail, we return the original address + unchanged; it might really be a function in the low 64k. + + See? You *knew* there was a reason you wanted to be a computer + programmer! :) */ + +static void +m32c_m16c_address_to_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr) +{ + gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || + TYPE_CODE (type) == TYPE_CODE_REF); + + enum type_code target_code = TYPE_CODE (TYPE_TARGET_TYPE (type)); + + if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD) + { + /* Try to find a linker symbol at this address. */ + struct minimal_symbol *func_msym = lookup_minimal_symbol_by_pc (addr); + + if (! func_msym) + error ("Cannot convert code address %s to function pointer:\n" + "couldn't find a symbol at that address, to find trampoline.", + paddr_nz (addr)); + + char *func_name = SYMBOL_LINKAGE_NAME (func_msym); + char *tramp_name = xmalloc (strlen (func_name) + 5); + strcpy (tramp_name, func_name); + strcat (tramp_name, ".plt"); + + /* Try to find a linker symbol for the trampoline. */ + struct minimal_symbol *tramp_msym + = lookup_minimal_symbol (tramp_name, NULL, NULL); + + /* We've either got another copy of the name now, or don't need + the name any more. */ + xfree (tramp_name); + + if (! tramp_msym) + error ("Cannot convert code address %s to function pointer:\n" + "couldn't find trampoline named '%s.plt'.", + paddr_nz (addr), func_name); + + /* The trampoline's address is our pointer. */ + addr = SYMBOL_VALUE_ADDRESS (tramp_msym); + } + + store_unsigned_integer (buf, TYPE_LENGTH (type), addr); +} + + +static CORE_ADDR +m32c_m16c_pointer_to_address (struct type *type, const gdb_byte *buf) +{ + gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || + TYPE_CODE (type) == TYPE_CODE_REF); + + CORE_ADDR ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); + + enum type_code target_code = TYPE_CODE (TYPE_TARGET_TYPE (type)); + + if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD) + { + /* See if there is a minimal symbol at that address whose name is + "NAME.plt". */ + struct minimal_symbol *ptr_msym = lookup_minimal_symbol_by_pc (ptr); + + if (ptr_msym) + { + char *ptr_msym_name = SYMBOL_LINKAGE_NAME (ptr_msym); + int len = strlen (ptr_msym_name); + + if (len > 4 + && strcmp (ptr_msym_name + len - 4, ".plt") == 0) + { + /* We have a .plt symbol; try to find the symbol for the + corresponding function. + + Since the trampoline contains a jump instruction, we + could also just extract the jump's target address. I + don't see much advantage one way or the other. */ + char *func_name = xmalloc (len - 4 + 1); + memcpy (func_name, ptr_msym_name, len - 4); + func_name[len - 4] = '\0'; + struct minimal_symbol *func_msym + = lookup_minimal_symbol (func_name, NULL, NULL); + + /* If we do have such a symbol, return its value as the + function's true address. */ + if (func_msym) + ptr = SYMBOL_VALUE_ADDRESS (func_msym); + } + } + } + + return ptr; +} + + + +/* Initialization. */ + +static struct gdbarch * +m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +{ + struct gdbarch *arch; + struct gdbarch_tdep *tdep; + unsigned long mach = info.bfd_arch_info->mach; + + /* Find a candidate among the list of architectures we've created + already. */ + for (arches = gdbarch_list_lookup_by_info (arches, &info); + arches != NULL; + arches = gdbarch_list_lookup_by_info (arches->next, &info)) + return arches->gdbarch; + + tdep = xcalloc (1, sizeof (*tdep)); + arch = gdbarch_alloc (&info, tdep); + + /* Essential types. */ + make_types (arch); + + /* Address/pointer conversions. */ + if (mach == bfd_mach_m16c) + { + set_gdbarch_address_to_pointer (arch, m32c_m16c_address_to_pointer); + set_gdbarch_pointer_to_address (arch, m32c_m16c_pointer_to_address); + } + + /* Register set. */ + make_regs (arch); + + /* Disassembly. */ + set_gdbarch_print_insn (arch, print_insn_m32c); + + /* Breakpoints. */ + set_gdbarch_breakpoint_from_pc (arch, m32c_breakpoint_from_pc); + + /* Prologue analysis and unwinding. */ + set_gdbarch_inner_than (arch, core_addr_lessthan); + set_gdbarch_skip_prologue (arch, m32c_skip_prologue); + set_gdbarch_unwind_pc (arch, m32c_unwind_pc); + set_gdbarch_unwind_sp (arch, m32c_unwind_sp); +#if 0 + /* I'm dropping the dwarf2 sniffer because it has a few problems. + They may be in the dwarf2 cfi code in GDB, or they may be in + the debug info emitted by the upstream toolchain. I don't + know which, but I do know that the prologue analyzer works better. + MVS 04/13/06 + */ + frame_unwind_append_sniffer (arch, dwarf2_frame_sniffer); +#endif + frame_unwind_append_sniffer (arch, m32c_frame_sniffer); + + /* Inferior calls. */ + set_gdbarch_push_dummy_call (arch, m32c_push_dummy_call); + set_gdbarch_return_value (arch, m32c_return_value); + set_gdbarch_unwind_dummy_id (arch, m32c_unwind_dummy_id); + + /* Trampolines. */ + set_gdbarch_skip_trampoline_code (arch, m32c_skip_trampoline_code); + + return arch; +} + + +void +_initialize_m32c_tdep (void) +{ + register_gdbarch_init (bfd_arch_m32c, m32c_gdbarch_init); + + m32c_dma_reggroup = reggroup_new ("dma", USER_REGGROUP); +} diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c index 79b23dc2556..bb0f50aaa46 100644 --- a/gdb/mingw-hdep.c +++ b/gdb/mingw-hdep.c @@ -167,6 +167,10 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, for (fd = 0, indx = 0; fd < n; ++fd) { HANDLE fd_h; + struct serial *scb; + + if (!FD_ISSET (fd, readfds) && !FD_ISSET (fd, writefds)) + continue; if (FD_ISSET (fd, readfds)) { @@ -189,6 +193,12 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, else num_ready++; } + + /* We created at least one event handle for this fd. Let the + device know we are finished with it. */ + scb = serial_for_fd (fd); + if (scb) + serial_done_wait_handle (scb); } return num_ready; diff --git a/gdb/mips-mdebug-tdep.c b/gdb/mips-mdebug-tdep.c index db79713a6f4..06cfba5371f 100644 --- a/gdb/mips-mdebug-tdep.c +++ b/gdb/mips-mdebug-tdep.c @@ -394,7 +394,7 @@ mips_mdebug_frame_prev_register (struct frame_info *next_frame, void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, void *valuep) + int *realnump, gdb_byte *valuep) { struct mips_frame_cache *info = mips_mdebug_frame_cache (next_frame, this_cache); diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index 9547fcd988c..57ba742c85a 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -246,8 +246,8 @@ static struct core_fns ppcnbsd_elfcore_fns = static enum return_value_convention ppcnbsd_return_value (struct gdbarch *gdbarch, struct type *valtype, - struct regcache *regcache, void *readbuf, - const void *writebuf) + struct regcache *regcache, gdb_byte *readbuf, + const gdb_byte *writebuf) { if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT || TYPE_CODE (valtype) == TYPE_CODE_UNION) diff --git a/gdb/remote.c b/gdb/remote.c index 22581a51fc2..d1ffdb55d8d 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -973,7 +973,7 @@ typedef unsigned char threadref[OPAQUETHREADBYTES]; typedef int gdb_threadref; /* Internal GDB thread reference. */ /* gdb_ext_thread_info is an internal GDB data structure which is - equivalint to the reply of the remote threadinfo packet. */ + equivalent to the reply of the remote threadinfo packet. */ struct gdb_ext_thread_info { diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index f932b4c52a5..f22236c672f 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -59,7 +59,6 @@ #include "frame-unwind.h" #include "frame-base.h" -#include "reggroups.h" #include "rs6000-tdep.h" /* If the kernel has to deliver a signal, it pushes a sigcontext diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c index 7a6f232379e..79e186b842d 100644 --- a/gdb/ser-mingw.c +++ b/gdb/ser-mingw.c @@ -26,6 +26,7 @@ #include "ser-tcp.h" #include +#include #include #include @@ -350,23 +351,22 @@ struct ser_console_state HANDLE start_select; HANDLE stop_select; + HANDLE exit_select; + HANDLE have_stopped; + + HANDLE thread; }; static DWORD WINAPI console_select_thread (void *arg) { struct serial *scb = arg; - struct ser_console_state *state, state_copy; - int event_index, fd; + struct ser_console_state *state; + int event_index; HANDLE h; - /* Copy useful information out of the control block, to make sure - that we do not race with freeing it. */ - state_copy = *(struct ser_console_state *) scb->state; - state = &state_copy; - fd = scb->fd; - - h = (HANDLE) _get_osfhandle (fd); + state = scb->state; + h = (HANDLE) _get_osfhandle (scb->fd); while (1) { @@ -374,14 +374,15 @@ console_select_thread (void *arg) INPUT_RECORD record; DWORD n_records; + SetEvent (state->have_stopped); + wait_events[0] = state->start_select; - wait_events[1] = state->stop_select; + wait_events[1] = state->exit_select; if (WaitForMultipleObjects (2, wait_events, FALSE, INFINITE) != WAIT_OBJECT_0) - { - CloseHandle (state->stop_select); - return 0; - } + return 0; + + ResetEvent (state->have_stopped); retry: wait_events[0] = state->stop_select; @@ -391,10 +392,7 @@ console_select_thread (void *arg) if (event_index == WAIT_OBJECT_0 || WaitForSingleObject (state->stop_select, 0) == WAIT_OBJECT_0) - { - CloseHandle (state->stop_select); - return 0; - } + continue; if (event_index != WAIT_OBJECT_0 + 1) { @@ -415,9 +413,30 @@ console_select_thread (void *arg) if (record.EventType == KEY_EVENT && record.Event.KeyEvent.bKeyDown) { - /* This is really a keypress. */ - SetEvent (state->read_event); - continue; + WORD keycode = record.Event.KeyEvent.wVirtualKeyCode; + + /* Ignore events containing only control keys. We must + recognize "enhanced" keys which we are interested in + reading via getch, if they do not map to ASCII. But we + do not want to report input available for e.g. the + control key alone. */ + + if (record.Event.KeyEvent.uChar.AsciiChar != 0 + || keycode == VK_PRIOR + || keycode == VK_NEXT + || keycode == VK_END + || keycode == VK_HOME + || keycode == VK_LEFT + || keycode == VK_UP + || keycode == VK_RIGHT + || keycode == VK_DOWN + || keycode == VK_INSERT + || keycode == VK_DELETE) + { + /* This is really a keypress. */ + SetEvent (state->read_event); + continue; + } } /* Otherwise discard it and wait again. */ @@ -439,31 +458,27 @@ static DWORD WINAPI pipe_select_thread (void *arg) { struct serial *scb = arg; - struct ser_console_state *state, state_copy; - int event_index, fd; + struct ser_console_state *state; + int event_index; HANDLE h; - /* Copy useful information out of the control block, to make sure - that we do not race with freeing it. */ - state_copy = *(struct ser_console_state *) scb->state; - state = &state_copy; - fd = scb->fd; - - h = (HANDLE) _get_osfhandle (fd); + state = scb->state; + h = (HANDLE) _get_osfhandle (scb->fd); while (1) { HANDLE wait_events[2]; DWORD n_avail; + SetEvent (state->have_stopped); + wait_events[0] = state->start_select; - wait_events[1] = state->stop_select; + wait_events[1] = state->exit_select; if (WaitForMultipleObjects (2, wait_events, FALSE, INFINITE) != WAIT_OBJECT_0) - { - CloseHandle (state->stop_select); - return 0; - } + return 0; + + ResetEvent (state->have_stopped); retry: if (!PeekNamedPipe (h, NULL, 0, NULL, &n_avail, NULL)) @@ -478,13 +493,11 @@ pipe_select_thread (void *arg) continue; } - if (WaitForSingleObject (state->stop_select, 0) == WAIT_OBJECT_0) - { - CloseHandle (state->stop_select); - return 0; - } + /* Delay 10ms before checking again, but allow the stop event + to wake us. */ + if (WaitForSingleObject (state->stop_select, 10) == WAIT_OBJECT_0) + continue; - Sleep (10); goto retry; } } @@ -511,29 +524,62 @@ ser_console_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except) memset (state, 0, sizeof (struct ser_console_state)); scb->state = state; - /* Create auto reset events to wake and terminate the select thread. */ + /* Create auto reset events to wake, stop, and exit the select + thread. */ state->start_select = CreateEvent (0, FALSE, FALSE, 0); state->stop_select = CreateEvent (0, FALSE, FALSE, 0); + state->exit_select = CreateEvent (0, FALSE, FALSE, 0); - /* Create our own events to report read and exceptions separately. - The exception event is currently never used. */ + /* Create a manual reset event to signal whether the thread is + stopped. This must be manual reset, because we may wait on + it multiple times without ever starting the thread. */ + state->have_stopped = CreateEvent (0, TRUE, FALSE, 0); + + /* Create our own events to report read and exceptions separately. */ state->read_event = CreateEvent (0, FALSE, FALSE, 0); state->except_event = CreateEvent (0, FALSE, FALSE, 0); - /* And finally start the select thread. */ if (is_tty) - CreateThread (NULL, 0, console_select_thread, scb, 0, &threadId); + state->thread = CreateThread (NULL, 0, console_select_thread, scb, 0, + &threadId); else - CreateThread (NULL, 0, pipe_select_thread, scb, 0, &threadId); + state->thread = CreateThread (NULL, 0, pipe_select_thread, scb, 0, + &threadId); } + *read = state->read_event; + *except = state->except_event; + + /* Start from a blank state. */ ResetEvent (state->read_event); ResetEvent (state->except_event); + ResetEvent (state->stop_select); + + /* First check for a key already in the buffer. If there is one, + we don't need a thread. This also catches the second key of + multi-character returns from getch, for instance for arrow + keys. The second half is in a C library internal buffer, + and PeekConsoleInput will not find it. */ + if (_kbhit ()) + { + SetEvent (state->read_event); + return; + } + /* Otherwise, start the select thread. */ SetEvent (state->start_select); +} - *read = state->read_event; - *except = state->except_event; +static void +ser_console_done_wait_handle (struct serial *scb) +{ + struct ser_console_state *state = scb->state; + + if (state == NULL) + return; + + SetEvent (state->stop_select); + WaitForSingleObject (state->have_stopped, INFINITE); } static void @@ -543,7 +589,14 @@ ser_console_close (struct serial *scb) if (scb->state) { - SetEvent (state->stop_select); + SetEvent (state->exit_select); + + WaitForSingleObject (state->thread, INFINITE); + + CloseHandle (state->start_select); + CloseHandle (state->stop_select); + CloseHandle (state->exit_select); + CloseHandle (state->have_stopped); CloseHandle (state->read_event); CloseHandle (state->except_event); @@ -571,6 +624,217 @@ ser_console_get_tty_state (struct serial *scb) return NULL; } +struct pipe_state +{ + /* Since we use the pipe_select_thread for our select emulation, + we need to place the state structure it requires at the front + of our state. */ + struct ser_console_state wait; + + /* The pex obj for our (one-stage) pipeline. */ + struct pex_obj *pex; + + /* Streams for the pipeline's input and output. */ + FILE *input, *output; +}; + +static struct pipe_state * +make_pipe_state (void) +{ + struct pipe_state *ps = XMALLOC (struct pipe_state); + + memset (ps, 0, sizeof (*ps)); + ps->wait.read_event = INVALID_HANDLE_VALUE; + ps->wait.except_event = INVALID_HANDLE_VALUE; + ps->wait.start_select = INVALID_HANDLE_VALUE; + ps->wait.stop_select = INVALID_HANDLE_VALUE; + + return ps; +} + +static void +free_pipe_state (struct pipe_state *ps) +{ + int saved_errno = errno; + + if (ps->wait.read_event != INVALID_HANDLE_VALUE) + CloseHandle (ps->wait.read_event); + if (ps->wait.except_event != INVALID_HANDLE_VALUE) + CloseHandle (ps->wait.except_event); + if (ps->wait.start_select != INVALID_HANDLE_VALUE) + CloseHandle (ps->wait.start_select); + + /* If we have a select thread running, let the select thread free + the stop event. */ + if (ps->wait.stop_select != INVALID_HANDLE_VALUE) + SetEvent (ps->wait.stop_select); + + /* Close the pipe to the child. We must close the pipe before + calling pex_free because pex_free will wait for the child to exit + and the child will not exit until the pipe is closed. */ + if (ps->input) + fclose (ps->input); + if (ps->pex) + pex_free (ps->pex); + /* pex_free closes ps->output. */ + + xfree (ps); + + errno = saved_errno; +} + +static void +cleanup_pipe_state (void *untyped) +{ + struct pipe_state *ps = untyped; + + free_pipe_state (ps); +} + +static int +pipe_windows_open (struct serial *scb, const char *name) +{ + char **argv = buildargv (name); + struct cleanup *back_to = make_cleanup_freeargv (argv); + if (! argv[0] || argv[0][0] == '\0') + error ("missing child command"); + + struct pipe_state *ps = make_pipe_state (); + make_cleanup (cleanup_pipe_state, ps); + + ps->pex = pex_init (PEX_USE_PIPES, "target remote pipe", NULL); + if (! ps->pex) + goto fail; + ps->input = pex_input_pipe (ps->pex, 1); + if (! ps->input) + goto fail; + + { + int err; + const char *err_msg + = pex_run (ps->pex, PEX_SEARCH | PEX_BINARY_INPUT | PEX_BINARY_OUTPUT, + argv[0], argv, NULL, NULL, + &err); + + if (err_msg) + { + /* Our caller expects us to return -1, but all they'll do with + it generally is print the message based on errno. We have + all the same information here, plus err_msg provided by + pex_run, so we just raise the error here. */ + if (err) + error ("error starting child process '%s': %s: %s", + name, err_msg, safe_strerror (err)); + else + error ("error starting child process '%s': %s", + name, err_msg); + } + } + + ps->output = pex_read_output (ps->pex, 1); + if (! ps->output) + goto fail; + + scb->fd = fileno (ps->output); + scb->state = (void *) ps; + + discard_cleanups (back_to); + return 0; + + fail: + do_cleanups (back_to); + return -1; +} + + +static void +pipe_windows_close (struct serial *scb) +{ + struct pipe_state *ps = scb->state; + + /* In theory, we should try to kill the subprocess here, but the pex + interface doesn't give us enough information to do that. Usually + closing the input pipe will get the message across. */ + + free_pipe_state (ps); +} + + +static int +pipe_windows_read (struct serial *scb, size_t count) +{ + HANDLE pipeline_out = (HANDLE) _get_osfhandle (scb->fd); + if (pipeline_out == INVALID_HANDLE_VALUE) + return -1; + + DWORD available; + if (! PeekNamedPipe (pipeline_out, NULL, 0, NULL, &available, NULL)) + return -1; + + if (count > available) + count = available; + + DWORD bytes_read; + if (! ReadFile (pipeline_out, scb->buf, count, &bytes_read, NULL)) + return -1; + + return bytes_read; +} + + +static int +pipe_windows_write (struct serial *scb, const void *buf, size_t count) +{ + struct pipe_state *ps = scb->state; + int pipeline_in_fd = fileno (ps->input); + if (pipeline_in_fd < 0) + return -1; + + HANDLE pipeline_in = (HANDLE) _get_osfhandle (pipeline_in_fd); + if (pipeline_in == INVALID_HANDLE_VALUE) + return -1; + + DWORD written; + if (! WriteFile (pipeline_in, buf, count, &written, NULL)) + return -1; + + return written; +} + + +static void +pipe_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except) +{ + struct pipe_state *ps = scb->state; + + /* Have we allocated our events yet? */ + if (ps->wait.read_event == INVALID_HANDLE_VALUE) + { + DWORD threadId; + + /* Create auto reset events to wake and terminate the select thread. */ + ps->wait.start_select = CreateEvent (0, FALSE, FALSE, 0); + ps->wait.stop_select = CreateEvent (0, FALSE, FALSE, 0); + + /* Create our own events to report read and exceptions separately. + The exception event is currently never used. */ + ps->wait.read_event = CreateEvent (0, FALSE, FALSE, 0); + ps->wait.except_event = CreateEvent (0, FALSE, FALSE, 0); + + /* Start the select thread. */ + CreateThread (NULL, 0, pipe_select_thread, scb, 0, &threadId); + } + + ResetEvent (ps->wait.read_event); + ResetEvent (ps->wait.except_event); + + SetEvent (ps->wait.start_select); + + *read = ps->wait.read_event; + *except = ps->wait.except_event; +} + + struct net_windows_state { HANDLE read_event; @@ -578,7 +842,12 @@ struct net_windows_state HANDLE start_select; HANDLE stop_select; + HANDLE exit_select; + HANDLE have_stopped; + HANDLE sock_event; + + HANDLE thread; }; static DWORD WINAPI @@ -586,27 +855,24 @@ net_windows_select_thread (void *arg) { struct serial *scb = arg; struct net_windows_state *state, state_copy; - int event_index, fd; + int event_index; - /* Copy useful information out of the control block, to make sure - that we do not race with freeing it. */ - state_copy = *(struct net_windows_state *) scb->state; - state = &state_copy; - fd = scb->fd; + state = scb->state; while (1) { HANDLE wait_events[2]; WSANETWORKEVENTS events; + SetEvent (state->have_stopped); + wait_events[0] = state->start_select; - wait_events[1] = state->stop_select; + wait_events[1] = state->exit_select; if (WaitForMultipleObjects (2, wait_events, FALSE, INFINITE) != WAIT_OBJECT_0) - { - CloseHandle (state->stop_select); - return 0; - } + return 0; + + ResetEvent (state->have_stopped); wait_events[0] = state->stop_select; wait_events[1] = state->sock_event; @@ -615,10 +881,7 @@ net_windows_select_thread (void *arg) if (event_index == WAIT_OBJECT_0 || WaitForSingleObject (state->stop_select, 0) == WAIT_OBJECT_0) - { - CloseHandle (state->stop_select); - return 0; - } + continue; if (event_index != WAIT_OBJECT_0 + 1) { @@ -630,7 +893,9 @@ net_windows_select_thread (void *arg) /* Enumerate the internal network events, and reset the object that signalled us to catch the next event. */ - WSAEnumNetworkEvents (fd, state->sock_event, &events); + WSAEnumNetworkEvents (scb->fd, state->sock_event, &events); + + gdb_assert (events.lNetworkEvents & (FD_READ | FD_CLOSE)); if (events.lNetworkEvents & FD_READ) SetEvent (state->read_event); @@ -645,13 +910,78 @@ net_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except) { struct net_windows_state *state = scb->state; + /* Start from a clean slate. */ ResetEvent (state->read_event); ResetEvent (state->except_event); - - SetEvent (state->start_select); + ResetEvent (state->stop_select); *read = state->read_event; *except = state->except_event; + + /* Check any pending events. This both avoids starting the thread + unnecessarily, and handles stray FD_READ events (see below). */ + if (WaitForSingleObject (state->sock_event, 0) == WAIT_OBJECT_0) + { + WSANETWORKEVENTS events; + int any = 0; + + /* Enumerate the internal network events, and reset the object that + signalled us to catch the next event. */ + WSAEnumNetworkEvents (scb->fd, state->sock_event, &events); + + /* You'd think that FD_READ or FD_CLOSE would be set here. But, + sometimes, neither is. I suspect that the FD_READ is set and + the corresponding event signalled while recv is running, and + the FD_READ is then lowered when recv consumes all the data, + but there's no way to un-signal the event. This isn't a + problem for the call in net_select_thread, since any new + events after this point will not have been drained by recv. + It just means that we can't have the obvious assert here. */ + + /* If there is a read event, it might be still valid, or it might + not be - it may have been signalled before we last called + recv. Double-check that there is data. */ + if (events.lNetworkEvents & FD_READ) + { + unsigned long available; + + if (ioctlsocket (scb->fd, FIONREAD, &available) == 0 + && available > 0) + { + SetEvent (state->read_event); + any = 1; + } + else + /* Oops, no data. This call to recv will cause future + data to retrigger the event, e.g. while we are + in net_select_thread. */ + recv (scb->fd, NULL, 0, 0); + } + + /* If there's a close event, then record it - it is obviously + still valid, and it will not be resignalled. */ + if (events.lNetworkEvents & FD_CLOSE) + { + SetEvent (state->except_event); + any = 1; + } + + /* If we set either handle, there's no need to wake the thread. */ + if (any) + return; + } + + /* Start the select thread. */ + SetEvent (state->start_select); +} + +static void +net_windows_done_wait_handle (struct serial *scb) +{ + struct net_windows_state *state = scb->state; + + SetEvent (state->stop_select); + WaitForSingleObject (state->have_stopped, INFINITE); } static int @@ -669,9 +999,16 @@ net_windows_open (struct serial *scb, const char *name) memset (state, 0, sizeof (struct net_windows_state)); scb->state = state; - /* Create auto reset events to wake and terminate the select thread. */ + /* Create auto reset events to wake, stop, and exit the select + thread. */ state->start_select = CreateEvent (0, FALSE, FALSE, 0); state->stop_select = CreateEvent (0, FALSE, FALSE, 0); + state->exit_select = CreateEvent (0, FALSE, FALSE, 0); + + /* Create a manual reset event to signal whether the thread is + stopped. This must be manual reset, because we may wait on + it multiple times without ever starting the thread. */ + state->have_stopped = CreateEvent (0, TRUE, FALSE, 0); /* Associate an event with the socket. */ state->sock_event = CreateEvent (0, TRUE, FALSE, 0); @@ -682,7 +1019,8 @@ net_windows_open (struct serial *scb, const char *name) state->except_event = CreateEvent (0, FALSE, FALSE, 0); /* And finally start the select thread. */ - CreateThread (NULL, 0, net_windows_select_thread, scb, 0, &threadId); + state->thread = CreateThread (NULL, 0, net_windows_select_thread, scb, 0, + &threadId); return 0; } @@ -693,11 +1031,17 @@ net_windows_close (struct serial *scb) { struct net_windows_state *state = scb->state; - SetEvent (state->stop_select); + SetEvent (state->exit_select); + WaitForSingleObject (state->thread, INFINITE); CloseHandle (state->read_event); CloseHandle (state->except_event); + CloseHandle (state->start_select); + CloseHandle (state->stop_select); + CloseHandle (state->exit_select); + CloseHandle (state->have_stopped); + CloseHandle (state->sock_event); xfree (scb->state); @@ -760,6 +1104,35 @@ _initialize_ser_windows (void) ops->noflush_set_tty_state = ser_base_noflush_set_tty_state; ops->drain_output = ser_base_drain_output; ops->wait_handle = ser_console_wait_handle; + ops->done_wait_handle = ser_console_done_wait_handle; + + serial_add_interface (ops); + + /* The pipe interface. */ + + ops = XMALLOC (struct serial_ops); + memset (ops, 0, sizeof (struct serial_ops)); + ops->name = "pipe"; + ops->next = 0; + ops->open = pipe_windows_open; + ops->close = pipe_windows_close; + ops->readchar = ser_base_readchar; + ops->write = ser_base_write; + ops->flush_output = ser_base_flush_output; + ops->flush_input = ser_base_flush_input; + ops->send_break = ser_base_send_break; + ops->go_raw = ser_base_raw; + ops->get_tty_state = ser_base_get_tty_state; + ops->set_tty_state = ser_base_set_tty_state; + ops->print_tty_state = ser_base_print_tty_state; + ops->noflush_set_tty_state = ser_base_noflush_set_tty_state; + ops->setbaudrate = ser_base_setbaudrate; + ops->setstopbits = ser_base_setstopbits; + ops->drain_output = ser_base_drain_output; + ops->async = ser_base_async; + ops->read_prim = pipe_windows_read; + ops->write_prim = pipe_windows_write; + ops->wait_handle = pipe_wait_handle; serial_add_interface (ops); @@ -792,5 +1165,6 @@ _initialize_ser_windows (void) ops->read_prim = net_read_prim; ops->write_prim = net_write_prim; ops->wait_handle = net_windows_wait_handle; + ops->done_wait_handle = net_windows_done_wait_handle; serial_add_interface (ops); } diff --git a/gdb/serial.c b/gdb/serial.c index fb74e1cde36..6a2c634cb34 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -557,6 +557,13 @@ serial_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except) *except = NULL; } } + +void +serial_done_wait_handle (struct serial *scb) +{ + if (scb->ops->done_wait_handle) + scb->ops->done_wait_handle (scb); +} #endif #if 0 diff --git a/gdb/serial.h b/gdb/serial.h index d9a395b3fc4..8d7ae6595bc 100644 --- a/gdb/serial.h +++ b/gdb/serial.h @@ -253,6 +253,7 @@ struct serial_ops when signaled, in *READ. Return a handle indicating errors in *EXCEPT. */ void (*wait_handle) (struct serial *scb, HANDLE *read, HANDLE *except); + void (*done_wait_handle) (struct serial *scb); #endif /* USE_WIN32API */ }; @@ -270,6 +271,9 @@ extern void serial_log_command (const char *); serial device. */ extern void serial_wait_handle (struct serial *, HANDLE *, HANDLE *); +/* Windows-only: signal that we are done with the wait handles. */ +extern void serial_done_wait_handle (struct serial *); + #endif /* USE_WIN32API */ #endif /* SERIAL_H */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 738ee69270f..a5a673c2859 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,25 @@ +2006-04-30 Mark Kettenis + + * gdb.base/sigbpt.exp (stepi_out): FAIL when inserting a + single-step breakpoint fails; make this a KFAIL on + sparc*-*-openbsd*. + * gdb.base/siginfo.exp: Likewise. + * gdb.base/sigstep.exp (advance, advancei): Likewise. + +2006-04-26 Michael Snyder + + * gdb.base/multi-forks.exp: Modify patterns for "run to exit", + which may have to consume output from other forks. + Add tests to make sure that "delete fork" succeeded. + +2006-04-20 Michael Snyder + + * 2006-03-22 Jim Blandy + Add support for the Renesas M32C and M16C. + + * gdb.asm/asm-source.exp: Add m32c target. + * gdb.asm/m32c.inc: Support for m32c target. + 2006-04-07 Andrew Stubbs * gdb.base/commands.exp (recursive_source_test): New test. diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index cbd38a45b36..03cc3553311 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -73,6 +73,9 @@ switch -glob -- [istarget] { "m32r*-linux*" { set asm-arch m32r-linux } + "m32c-*-*" { + set asm-arch m32c + } "m32r*-*" { set asm-arch m32r append link-flags "--whole-archive -lgloss --no-whole-archive" diff --git a/gdb/testsuite/gdb.asm/m32c.inc b/gdb/testsuite/gdb.asm/m32c.inc new file mode 100644 index 00000000000..7925e77539c --- /dev/null +++ b/gdb/testsuite/gdb.asm/m32c.inc @@ -0,0 +1,33 @@ + comment "subroutine prologue" + .macro gdbasm_enter + enter #0 + .endm + + comment "subroutine epilogue" + .macro gdbasm_leave + exitd + .endm + + .macro gdbasm_call subr + jsr.a \subr + .endm + + .macro gdbasm_several_nops + nop + nop + nop + nop + .endm + + comment "exit (0)" + .macro gdbasm_exit0 + mov.w #0, r1 + mov.b #1, r0l + ste.b r0l,0xe0000 + .endm + + comment "crt0 startup" + .macro gdbasm_startup + ldc #0xfc00, sp + .endm + diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp index 82fdc507eaf..5a706d71252 100644 --- a/gdb/testsuite/gdb.base/multi-forks.exp +++ b/gdb/testsuite/gdb.base/multi-forks.exp @@ -67,7 +67,7 @@ gdb_test "set follow child" "" "" send_gdb "continue\n" gdb_expect { - -re ".*Break.* main .*$gdb_prompt $" {} + -re ".*Break.* main .*$gdb_prompt.*$" {} -re ".*$gdb_prompt $" {fail "run to exit 1"} default {fail "run to exit 1 (timeout)"} } @@ -84,7 +84,7 @@ gdb_test "set follow parent" "" "" send_gdb "continue\n" gdb_expect { - -re ".*Break.* main .*$gdb_prompt $" {} + -re ".*Break.* main .*$gdb_prompt.*$" {} -re ".*$gdb_prompt $" {fail "run to exit 2"} default {fail "run to exit 2 (timeout)"} } @@ -136,22 +136,31 @@ gdb_test "detach-fork 3" "Detached .*" "Detach 3" gdb_test "detach-fork 4" "Detached .*" "Detach 4" # -# Test delete-fork +# Test delete fork # -gdb_test "delete-fork 5" "" "Delete 5" -gdb_test "delete-fork 6" "" "Delete 6" -gdb_test "delete-fork 7" "" "Delete 7" -gdb_test "delete-fork 8" "" "Delete 8" -gdb_test "delete-fork 9" "" "Delete 9" -gdb_test "delete-fork 10" "" "Delete 10" -gdb_test "delete-fork 11" "" "Delete 11" -gdb_test "delete-fork 12" "" "Delete 12" -gdb_test "delete-fork 13" "" "Delete 13" -gdb_test "delete-fork 14" "" "Delete 14" -gdb_test "delete-fork 15" "" "Delete 15" - - +gdb_test "delete fork 5" "" "Delete 5" +gdb_test "info fork 5" "No fork number 5." "Did delete 5" +gdb_test "delete fork 6" "" "Delete 6" +gdb_test "info fork 6" "No fork number 6." "Did delete 6" +gdb_test "delete fork 7" "" "Delete 7" +gdb_test "info fork 7" "No fork number 7." "Did delete 7" +gdb_test "delete fork 8" "" "Delete 8" +gdb_test "info fork 8" "No fork number 8." "Did delete 8" +gdb_test "delete fork 9" "" "Delete 9" +gdb_test "info fork 9" "No fork number 9." "Did delete 9" +gdb_test "delete fork 10" "" "Delete 10" +gdb_test "info fork 10" "No fork number 10." "Did delete 10" +gdb_test "delete fork 11" "" "Delete 11" +gdb_test "info fork 11" "No fork number 11." "Did delete 11" +gdb_test "delete fork 12" "" "Delete 12" +gdb_test "info fork 12" "No fork number 12." "Did delete 12" +gdb_test "delete fork 13" "" "Delete 13" +gdb_test "info fork 13" "No fork number 13." "Did delete 13" +gdb_test "delete fork 14" "" "Delete 14" +gdb_test "info fork 14" "No fork number 14." "Did delete 14" +gdb_test "delete fork 15" "" "Delete 15" +gdb_test "info fork 15" "No fork number 15." "Did delete 15" return 0 diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp index 9e010e214b5..0e69e3989ea 100644 --- a/gdb/testsuite/gdb.base/sigbpt.exp +++ b/gdb/testsuite/gdb.base/sigbpt.exp @@ -166,6 +166,10 @@ proc stepi_out { name args } { # trampoline, and back to the instruction that faulted. set test "${name}; stepi out of handler" gdb_test_multiple "stepi" "$test" { + -re "Could not insert single-step breakpoint.*$gdb_prompt $" { + setup_kfail "sparc*-*-openbsd*" gdb/1736 + fail "$test (could not insert single-step breakpoint)" + } -re "keeper.*$gdb_prompt $" { send_gdb "stepi\n" exp_continue diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp index a081ab8e887..d6008014012 100644 --- a/gdb/testsuite/gdb.base/siginfo.exp +++ b/gdb/testsuite/gdb.base/siginfo.exp @@ -75,6 +75,10 @@ gdb_expect_list "backtrace for nexti" ".*$gdb_prompt $" { # Check that GDB can step the inferior back to main set test "step out of handler" gdb_test_multiple "step" "${test}" { + -re "Could not insert single-step breakpoint.*$gdb_prompt $" { + setup_kfail sparc*-*-openbsd* gdb/1736 + fail "$test (could not insert single-step breakpoint)" + } -re "done = 1;.*${gdb_prompt} $" { send_gdb "$i\n" exp_continue diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp index 6addca7ebda..9069885dd4b 100644 --- a/gdb/testsuite/gdb.base/sigstep.exp +++ b/gdb/testsuite/gdb.base/sigstep.exp @@ -79,6 +79,10 @@ proc advance { i } { set test "$prefix; leave handler" gdb_test_multiple "$i" "${test}" { + -re "Could not insert single-step breakpoint.*$gdb_prompt $" { + setup_kfail "sparc*-*-openbsd*" gdb/1736 + fail "$test (could not insert single-step breakpoint)" + } -re "done = 1;.*${gdb_prompt} $" { send_gdb "$i\n" exp_continue -continue_timer @@ -122,6 +126,10 @@ proc advancei { i } { fail "$test (could not set breakpoint)" return } + -re "Could not insert single-step breakpoint.*$gdb_prompt $" { + setup_kfail "sparc*-*-openbsd*" gdb/1736 + fail "$test (could not insert single-step breakpoint)" + } -re "done = 1;.*${gdb_prompt} $" { send_gdb "$i\n" exp_continue -continue_timer diff --git a/gdb/version.in b/gdb/version.in index 70f27cdda5a..44c55b92aa4 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -6.4.50.20060420-cvs +6.4.50.20060501-cvs diff --git a/include/ChangeLog b/include/ChangeLog index 0a3787aac37..6f695ffc8a9 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -17,6 +17,11 @@ R_BFIN_GOTOFFLO): New relocs. (EF_BFIN_PIC, EF_BFIN_FDPIC, EF_BFIN_PIC_FLAGS): New macros. +2006-03-23 Michael Matz + + * elf/x86-64.h: Add the new relocations with their official + numbers. + 2006-02-17 Shrirang Khisti Anil Paranjape Shilin Shakti diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index ad4411a2c47..1d398f6f264 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,4 +1,24 @@ -2006-04-07 Joerg Wunsch +2006-04-30 Thiemo Seufer + David Ung + + * mips.h: Defines udi bits and masks. Add description of + characters which may appear in the args field of udi + instructions. + +2006-04-26 Thiemo Seufer + + * mips.h: Improve comments describing the bitfield instruction + fields. + +2006-04-26 Julian Brown + + * arm.h (FPU_VFP_EXT_V3): Define constant. + (FPU_NEON_EXT_V1): Likewise. + (FPU_VFP_HARD): Update. + (FPU_VFP_V3): Define macro. + (FPU_ARCH_VFP_V3, FPU_ARCH_VFP_V3_PLUS_NEON_V1): Define macros. + +2006-04-07 Joerg Wunsch * avr.h (AVR_ISA_PWMx): New. diff --git a/include/opcode/arm.h b/include/opcode/arm.h index 1d3aa5aeb3d..f142fca9a5c 100644 --- a/include/opcode/arm.h +++ b/include/opcode/arm.h @@ -58,6 +58,8 @@ #define FPU_VFP_EXT_V1xD 0x08000000 /* Base VFP instruction set. */ #define FPU_VFP_EXT_V1 0x04000000 /* Double-precision insns. */ #define FPU_VFP_EXT_V2 0x02000000 /* ARM10E VFPr1. */ +#define FPU_VFP_EXT_V3 0x01000000 /* VFPv3 insns. */ +#define FPU_NEON_EXT_V1 0x00800000 /* Neon (SIMD) insns. */ /* Architectures are the sum of the base and extensions. The ARM ARM (rev E) defines the following: ARMv3, ARMv3M, ARMv4xM, ARMv4, ARMv4TxM, ARMv4T, @@ -105,7 +107,9 @@ #define FPU_VFP_V1xD (FPU_VFP_EXT_V1xD | FPU_ENDIAN_PURE) #define FPU_VFP_V1 (FPU_VFP_V1xD | FPU_VFP_EXT_V1) #define FPU_VFP_V2 (FPU_VFP_V1 | FPU_VFP_EXT_V2) -#define FPU_VFP_HARD (FPU_VFP_EXT_V1xD | FPU_VFP_EXT_V1 | FPU_VFP_EXT_V2) +#define FPU_VFP_V3 (FPU_VFP_V2 | FPU_VFP_EXT_V3) +#define FPU_VFP_HARD (FPU_VFP_EXT_V1xD | FPU_VFP_EXT_V1 | FPU_VFP_EXT_V2 \ + | FPU_VFP_EXT_V3 | FPU_NEON_EXT_V1) #define FPU_FPA (FPU_FPA_EXT_V1 | FPU_FPA_EXT_V2) /* Deprecated */ @@ -117,6 +121,10 @@ #define FPU_ARCH_VFP_V1xD ARM_FEATURE (0, FPU_VFP_V1xD) #define FPU_ARCH_VFP_V1 ARM_FEATURE (0, FPU_VFP_V1) #define FPU_ARCH_VFP_V2 ARM_FEATURE (0, FPU_VFP_V2) +#define FPU_ARCH_VFP_V3 ARM_FEATURE (0, FPU_VFP_V3) +#define FPU_ARCH_NEON_V1 ARM_FEATURE (0, FPU_NEON_EXT_V1) +#define FPU_ARCH_VFP_V3_PLUS_NEON_V1 \ + ARM_FEATURE (0, FPU_VFP_V3 | FPU_NEON_EXT_V1) #define FPU_ARCH_VFP_HARD ARM_FEATURE (0, FPU_VFP_HARD) #define FPU_ARCH_ENDIAN_PURE ARM_FEATURE (0, FPU_ENDIAN_PURE) diff --git a/include/opcode/mips.h b/include/opcode/mips.h index 4bec5edcc8c..34ef26ef25b 100644 --- a/include/opcode/mips.h +++ b/include/opcode/mips.h @@ -203,6 +203,16 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, US #define MDMX_FMTSEL_VEC_QH 0x15 #define MDMX_FMTSEL_VEC_OB 0x16 +/* UDI */ +#define OP_SH_UDI1 6 +#define OP_MASK_UDI1 0x1f +#define OP_SH_UDI2 6 +#define OP_MASK_UDI2 0x3ff +#define OP_SH_UDI3 6 +#define OP_MASK_UDI3 0x7fff +#define OP_SH_UDI4 6 +#define OP_MASK_UDI4 0xfffff + /* This structure holds information for a particular instruction. */ struct mips_opcode @@ -268,19 +278,20 @@ struct mips_opcode "x" accept and ignore register name "z" must be zero register "K" 5 bit Hardware Register (rdhwr instruction) (OP_*_RD) - "+A" 5 bit ins/ext position, which becomes LSB (OP_*_SHAMT). + "+A" 5 bit ins/ext/dins/dext/dinsm/dextm position, which becomes + LSB (OP_*_SHAMT). Enforces: 0 <= pos < 32. - "+B" 5 bit ins size, which becomes MSB (OP_*_INSMSB). + "+B" 5 bit ins/dins size, which becomes MSB (OP_*_INSMSB). Requires that "+A" or "+E" occur first to set position. Enforces: 0 < (pos+size) <= 32. - "+C" 5 bit ext size, which becomes MSBD (OP_*_EXTMSBD). + "+C" 5 bit ext/dext size, which becomes MSBD (OP_*_EXTMSBD). Requires that "+A" or "+E" occur first to set position. Enforces: 0 < (pos+size) <= 32. (Also used by "dext" w/ different limits, but limits for that are checked by the M_DEXT macro.) - "+E" 5 bit dins/dext position, which becomes LSB-32 (OP_*_SHAMT). + "+E" 5 bit dinsu/dextu position, which becomes LSB-32 (OP_*_SHAMT). Enforces: 32 <= pos < 64. - "+F" 5 bit "dinsm" size, which becomes MSB-32 (OP_*_INSMSB). + "+F" 5 bit "dinsm/dinsu" size, which becomes MSB-32 (OP_*_INSMSB). Requires that "+A" or "+E" occur first to set position. Enforces: 32 < (pos+size) <= 64. "+G" 5 bit "dextm" size, which becomes MSBD-32 (OP_*_EXTMSBD). @@ -350,6 +361,12 @@ struct mips_opcode "+t" 5 bit coprocessor 0 destination register (OP_*_RT) "+T" 5 bit coprocessor 0 destination register (OP_*_RT) - disassembly only + UDI immediates: + "+1" UDI immediate bits 6-10 + "+2" UDI immediate bits 6-15 + "+3" UDI immediate bits 6-20 + "+4" UDI immediate bits 6-25 + Other: "()" parens surrounding optional value "," separates operands @@ -364,6 +381,7 @@ struct mips_opcode Extension character sequences used so far ("+" followed by the following), for quick reference when adding more: + "1234" "ABCDEFGHIT" "t" */ diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index fb328da633c..76baa3c3ac2 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2006-04-24 Julian Brown + + * floatformat.c (floatformat_to_double): Fix (biased) exponent=0 case. + 2006-03-29 Jim Blandy * pex-common.c (pex_input_file, pex_input_pipe): New functions. diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c index bd31efac7c1..0bbb8ed9889 100644 --- a/libiberty/floatformat.c +++ b/libiberty/floatformat.c @@ -394,7 +394,7 @@ floatformat_to_double (const struct floatformat *fmt, /* Handle denormalized numbers. FIXME: What should we do for non-IEEE formats? */ - if (exponent == 0 && mant != 0) + if (special_exponent && exponent == 0 && mant != 0) dto += ldexp ((double)mant, (- fmt->exp_bias - mant_bits diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 8637a8b53e0..c3840802d60 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,63 @@ +2006-04-30 Thiemo Seufer + David Ung + + * mips-opc.c (mips_builtin_opcodes): Add udi instructions + "udi0" to "udi15". + * mips-dis.c (print_insn_args): Adds udi argument handling. + +2006-04-28 James E Wilson + + * m68k-dis.c (match_insn_m68k): Restore fprintf_func before printing + error message. + +2006-04-28 Thiemo Seufer + David Ung + Nigel Stephens + + * mips-dis.c (mips_cp0sel_names_mips3264r2): Add MT register + names. + +2006-04-28 Thiemo Seufer + Nigel Stephens + David Ung + + * mips-dis.c (print_insn_args): Add mips_opcode argument. + (print_insn_mips): Adjust print_insn_args call. + +2006-04-28 Thiemo Seufer + Nigel Stephens + + * mips-dis.c (print_insn_args): Print $fcc only for FP + instructions, use $cc elsewise. + +2006-04-28 Thiemo Seufer + Nigel Stephens + + * opcodes/mips-dis.c (mips16_to_32_reg_map, mips16_reg_names): + Map MIPS16 registers to O32 names. + (print_mips16_insn_arg): Use mips16_reg_names. + +2006-04-26 Julian Brown + + * arm-dis.c (print_insn_neon): Disassemble floating-point constant + VMOV. + +2006-04-26 Nathan Sidwell + Julian Brown + + * opcodes/arm-dis.c (coprocessor_opcodes): Add %A, %B, %k, convert + %[zy] into %[zy]. Expand meaning of %['`?]. + Add unified load/store instruction names. + (neon_opcode_table): New. + (arm_opcodes): Expand meaning of %['`?]. + (arm_decode_bitfield): New. + (print_insn_coprocessor): Add pc argument. Add %A & %B specifiers. + Use arm_decode_bitfield and adjust numeric specifiers. Adjust %z & %y. + (print_insn_neon): New. + (print_insn_arm): Adjust print_insn_coprocessor call. Call + print_insn_neon. Use arm_decode_bitfield and adjust numeric specifiers. + (print_insn_thumb32): Likewise. + 2006-04-19 Alan Modra * Makefile.am: Run "make dep-am". diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index bc5b52cf9c0..6ca93335d38 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -26,6 +26,7 @@ #include "opcode/arm.h" #include "opintl.h" #include "safe-ctype.h" +#include "floatformat.h" /* FIXME: This shouldn't be done here. */ #include "coff/internal.h" @@ -63,6 +64,8 @@ struct opcode16 %c print condition code (always bits 28-31) %A print address for ldc/stc/ldf/stf instruction + %B print vstm/vldm register list + %C print vstr/vldr address operand %I print cirrus signed shift immediate: bits 0..3|4..6 %F print the COUNT field of a LFM/SFM instruction. %P print floating point precision in arithmetic insn @@ -71,6 +74,7 @@ struct opcode16 %r print as an ARM register %d print the bitfield in decimal + %k print immediate for VFPv3 conversion instruction %x print the bitfield in hex %X print the bitfield as 1 hex digit without leading "0x" %f print a floating point constant if >7 else a @@ -78,15 +82,18 @@ struct opcode16 %w print as an iWMMXt width field - [bhwd]ss/us %g print as an iWMMXt 64-bit register %G print as an iWMMXt general purpose or control register + %D print as a NEON D register + %Q print as a NEON Q register - %y print a single precision VFP reg. + %y print a single precision VFP reg. Codes: 0=>Sm, 1=>Sd, 2=>Sn, 3=>multi-list, 4=>Sm pair - %z print a double precision VFP reg + %z print a double precision VFP reg Codes: 0=>Dm, 1=>Dd, 2=>Dn, 3=>multi-list - %'c print specified char iff bit is one - %`c print specified char iff bit is zero - %?ab print a if bit is one else print b + %'c print specified char iff bitfield is all ones + %`c print specified char iff bitfield is all zeroes + %?ab... select from array of values in big endian order + %L print as an iWMMXt N/M width field. %Z print the Immediate of a WSHUFH instruction. %l like 'A' except use byte offsets for 'B' & 'H' @@ -201,80 +208,110 @@ static const struct opcode32 coprocessor_opcodes[] = {FPU_FPA_EXT_V2, 0x0c000200, 0x0e100f00, "sfm%c\t%12-14f, %F, %A"}, {FPU_FPA_EXT_V2, 0x0c100200, 0x0e100f00, "lfm%c\t%12-14f, %F, %A"}, + /* Register load/store */ + {FPU_NEON_EXT_V1, 0x0d000b00, 0x0f300f00, "vstr%c\t%12-15,22D, %C"}, + {FPU_NEON_EXT_V1, 0x0d100b00, 0x0f300f00, "vldr%c\t%12-15,22D, %C"}, + {FPU_NEON_EXT_V1, 0x0c800b00, 0x0f900f00, "vstmia%c\t%16-19r%21'!, %B"}, + {FPU_NEON_EXT_V1, 0x0c900b00, 0x0f900f00, "vldmia%c\t%16-19r%21'!, %B"}, + {FPU_NEON_EXT_V1, 0x0d000b00, 0x0f900f00, "vstmdb%c\t%16-19r%21'!, %B"}, + {FPU_NEON_EXT_V1, 0x0d100b00, 0x0f900f00, "vldmdb%c\t%16-19r%21'!, %B"}, + + /* Data transfer between ARM and NEON registers */ + {FPU_NEON_EXT_V1, 0x0e800b10, 0x0ff00f70, "vdup%c.32\t%16-19,7D, %12-15r"}, + {FPU_NEON_EXT_V1, 0x0e800b30, 0x0ff00f70, "vdup%c.16\t%16-19,7D, %12-15r"}, + {FPU_NEON_EXT_V1, 0x0ea00b10, 0x0ff00f70, "vdup%c.32\t%16-19,7Q, %12-15r"}, + {FPU_NEON_EXT_V1, 0x0ea00b30, 0x0ff00f70, "vdup%c.16\t%16-19,7Q, %12-15r"}, + {FPU_NEON_EXT_V1, 0x0ec00b10, 0x0ff00f70, "vdup%c.8\t%16-19,7D, %12-15r"}, + {FPU_NEON_EXT_V1, 0x0ee00b10, 0x0ff00f70, "vdup%c.8\t%16-19,7Q, %12-15r"}, + {FPU_NEON_EXT_V1, 0x0c400b10, 0x0ff00fd0, "vmov%c\t%0-3,5D, %12-15r, %16-19r"}, + {FPU_NEON_EXT_V1, 0x0c500b10, 0x0ff00fd0, "vmov%c\t%12-15r, %16-19r, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0x0e000b10, 0x0fd00f70, "vmov%c.32\t%16-19,7D[%21d], %12-15r"}, + {FPU_NEON_EXT_V1, 0x0e100b10, 0x0f500f70, "vmov%c.32\t%12-15r, %16-19,7D[%21d]"}, + {FPU_NEON_EXT_V1, 0x0e000b30, 0x0fd00f30, "vmov%c.16\t%16-19,7D[%6,21d], %12-15r"}, + {FPU_NEON_EXT_V1, 0x0e100b30, 0x0f500f30, "vmov%c.%23?us16\t%12-15r, %16-19,7D[%6,21d]"}, + {FPU_NEON_EXT_V1, 0x0e400b10, 0x0fd00f10, "vmov%c.8\t%16-19,7D[%5,6,21d], %12-15r"}, + {FPU_NEON_EXT_V1, 0x0e500b10, 0x0f500f10, "vmov%c.%23?us8\t%12-15r, %16-19,7D[%5,6,21d]"}, + /* Floating point coprocessor (VFP) instructions */ - {FPU_VFP_EXT_V1, 0x0eb00bc0, 0x0fff0ff0, "fabsd%c\t%1z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0eb00ac0, 0x0fbf0fd0, "fabss%c\t%1y, %0y"}, - {FPU_VFP_EXT_V1, 0x0e300b00, 0x0ff00ff0, "faddd%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e300a00, 0x0fb00f50, "fadds%c\t%1y, %2y, %0y"}, - {FPU_VFP_EXT_V1, 0x0eb40b40, 0x0fff0f70, "fcmp%7'ed%c\t%1z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0eb40a40, 0x0fbf0f50, "fcmp%7'es%c\t%1y, %0y"}, - {FPU_VFP_EXT_V1, 0x0eb50b40, 0x0fff0f70, "fcmp%7'ezd%c\t%1z"}, - {FPU_VFP_EXT_V1xD, 0x0eb50a40, 0x0fbf0f70, "fcmp%7'ezs%c\t%1y"}, - {FPU_VFP_EXT_V1, 0x0eb00b40, 0x0fff0ff0, "fcpyd%c\t%1z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0eb00a40, 0x0fbf0fd0, "fcpys%c\t%1y, %0y"}, - {FPU_VFP_EXT_V1, 0x0eb70ac0, 0x0fff0fd0, "fcvtds%c\t%1z, %0y"}, - {FPU_VFP_EXT_V1, 0x0eb70bc0, 0x0fbf0ff0, "fcvtsd%c\t%1y, %0z"}, - {FPU_VFP_EXT_V1, 0x0e800b00, 0x0ff00ff0, "fdivd%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e800a00, 0x0fb00f50, "fdivs%c\t%1y, %2y, %0y"}, - {FPU_VFP_EXT_V1, 0x0d100b00, 0x0f700f00, "fldd%c\t%1z, %A"}, - {FPU_VFP_EXT_V1xD, 0x0c900b00, 0x0fd00f00, "fldmia%0?xd%c\t%16-19r%21'!, %3z"}, - {FPU_VFP_EXT_V1xD, 0x0d300b00, 0x0ff00f00, "fldmdb%0?xd%c\t%16-19r!, %3z"}, - {FPU_VFP_EXT_V1xD, 0x0d100a00, 0x0f300f00, "flds%c\t%1y, %A"}, - {FPU_VFP_EXT_V1xD, 0x0c900a00, 0x0f900f00, "fldmias%c\t%16-19r%21'!, %3y"}, - {FPU_VFP_EXT_V1xD, 0x0d300a00, 0x0fb00f00, "fldmdbs%c\t%16-19r!, %3y"}, - {FPU_VFP_EXT_V1, 0x0e000b00, 0x0ff00ff0, "fmacd%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e000a00, 0x0fb00f50, "fmacs%c\t%1y, %2y, %0y"}, - {FPU_VFP_EXT_V1, 0x0e200b10, 0x0ff00fff, "fmdhr%c\t%2z, %12-15r"}, - {FPU_VFP_EXT_V1, 0x0e000b10, 0x0ff00fff, "fmdlr%c\t%2z, %12-15r"}, - {FPU_VFP_EXT_V2, 0x0c400b10, 0x0ff00ff0, "fmdrr%c\t%0z, %12-15r, %16-19r"}, - {FPU_VFP_EXT_V1, 0x0e300b10, 0x0ff00fff, "fmrdh%c\t%12-15r, %2z"}, - {FPU_VFP_EXT_V1, 0x0e100b10, 0x0ff00fff, "fmrdl%c\t%12-15r, %2z"}, - {FPU_VFP_EXT_V1, 0x0c500b10, 0x0ff00ff0, "fmrrd%c\t%12-15r, %16-19r, %0z"}, - {FPU_VFP_EXT_V2, 0x0c500a10, 0x0ff00fd0, "fmrrs%c\t%12-15r, %16-19r, %4y"}, - {FPU_VFP_EXT_V1xD, 0x0e100a10, 0x0ff00f7f, "fmrs%c\t%12-15r, %2y"}, {FPU_VFP_EXT_V1xD, 0x0ef1fa10, 0x0fffffff, "fmstat%c"}, - {FPU_VFP_EXT_V1xD, 0x0ef00a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpsid"}, - {FPU_VFP_EXT_V1xD, 0x0ef10a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpscr"}, - {FPU_VFP_EXT_V1xD, 0x0ef80a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpexc"}, - {FPU_VFP_EXT_V1xD, 0x0ef90a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpinst\t@ Impl def"}, - {FPU_VFP_EXT_V1xD, 0x0efa0a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpinst2\t@ Impl def"}, - {FPU_VFP_EXT_V1xD, 0x0ef00a10, 0x0ff00fff, "fmrx%c\t%12-15r, "}, - {FPU_VFP_EXT_V1, 0x0e100b00, 0x0ff00ff0, "fmscd%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e100a00, 0x0fb00f50, "fmscs%c\t%1y, %2y, %0y"}, - {FPU_VFP_EXT_V1xD, 0x0e000a10, 0x0ff00f7f, "fmsr%c\t%2y, %12-15r"}, - {FPU_VFP_EXT_V2, 0x0c400a10, 0x0ff00fd0, "fmsrr%c\t%12-15r, %16-19r, %4y"}, - {FPU_VFP_EXT_V1, 0x0e200b00, 0x0ff00ff0, "fmuld%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e200a00, 0x0fb00f50, "fmuls%c\t%1y, %2y, %0y"}, {FPU_VFP_EXT_V1xD, 0x0ee00a10, 0x0fff0fff, "fmxr%c\tfpsid, %12-15r"}, {FPU_VFP_EXT_V1xD, 0x0ee10a10, 0x0fff0fff, "fmxr%c\tfpscr, %12-15r"}, {FPU_VFP_EXT_V1xD, 0x0ee80a10, 0x0fff0fff, "fmxr%c\tfpexc, %12-15r"}, {FPU_VFP_EXT_V1xD, 0x0ee90a10, 0x0fff0fff, "fmxr%c\tfpinst, %12-15r\t@ Impl def"}, {FPU_VFP_EXT_V1xD, 0x0eea0a10, 0x0fff0fff, "fmxr%c\tfpinst2, %12-15r\t@ Impl def"}, + {FPU_VFP_EXT_V1xD, 0x0ef00a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpsid"}, + {FPU_VFP_EXT_V1xD, 0x0ef10a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpscr"}, + {FPU_VFP_EXT_V1xD, 0x0ef80a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpexc"}, + {FPU_VFP_EXT_V1xD, 0x0ef90a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpinst\t@ Impl def"}, + {FPU_VFP_EXT_V1xD, 0x0efa0a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpinst2\t@ Impl def"}, + {FPU_VFP_EXT_V1, 0x0e000b10, 0x0ff00fff, "fmdlr%c\t%z2, %12-15r"}, + {FPU_VFP_EXT_V1, 0x0e100b10, 0x0ff00fff, "fmrdl%c\t%12-15r, %z2"}, + {FPU_VFP_EXT_V1, 0x0e200b10, 0x0ff00fff, "fmdhr%c\t%z2, %12-15r"}, + {FPU_VFP_EXT_V1, 0x0e300b10, 0x0ff00fff, "fmrdh%c\t%12-15r, %z2"}, {FPU_VFP_EXT_V1xD, 0x0ee00a10, 0x0ff00fff, "fmxr%c\t, %12-15r"}, - {FPU_VFP_EXT_V1, 0x0eb10b40, 0x0fff0ff0, "fnegd%c\t%1z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0eb10a40, 0x0fbf0fd0, "fnegs%c\t%1y, %0y"}, - {FPU_VFP_EXT_V1, 0x0e000b40, 0x0ff00ff0, "fnmacd%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e000a40, 0x0fb00f50, "fnmacs%c\t%1y, %2y, %0y"}, - {FPU_VFP_EXT_V1, 0x0e100b40, 0x0ff00ff0, "fnmscd%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e100a40, 0x0fb00f50, "fnmscs%c\t%1y, %2y, %0y"}, - {FPU_VFP_EXT_V1, 0x0e200b40, 0x0ff00ff0, "fnmuld%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e200a40, 0x0fb00f50, "fnmuls%c\t%1y, %2y, %0y"}, - {FPU_VFP_EXT_V1, 0x0eb80bc0, 0x0fff0fd0, "fsitod%c\t%1z, %0y"}, - {FPU_VFP_EXT_V1xD, 0x0eb80ac0, 0x0fbf0fd0, "fsitos%c\t%1y, %0y"}, - {FPU_VFP_EXT_V1, 0x0eb10bc0, 0x0fff0ff0, "fsqrtd%c\t%1z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0eb10ac0, 0x0fbf0fd0, "fsqrts%c\t%1y, %0y"}, - {FPU_VFP_EXT_V1, 0x0d000b00, 0x0f700f00, "fstd%c\t%1z, %A"}, - {FPU_VFP_EXT_V1xD, 0x0c800b00, 0x0fd00f00, "fstmia%0?xd%c\t%16-19r%21'!, %3z"}, - {FPU_VFP_EXT_V1xD, 0x0d200b00, 0x0ff00f00, "fstmdb%0?xd%c\t%16-19r!, %3z"}, - {FPU_VFP_EXT_V1xD, 0x0d000a00, 0x0f300f00, "fsts%c\t%1y, %A"}, - {FPU_VFP_EXT_V1xD, 0x0c800a00, 0x0f900f00, "fstmias%c\t%16-19r%21'!, %3y"}, - {FPU_VFP_EXT_V1xD, 0x0d200a00, 0x0fb00f00, "fstmdbs%c\t%16-19r!, %3y"}, - {FPU_VFP_EXT_V1, 0x0e300b40, 0x0ff00ff0, "fsubd%c\t%1z, %2z, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0e300a40, 0x0fb00f50, "fsubs%c\t%1y, %2y, %0y"}, - {FPU_VFP_EXT_V1, 0x0ebc0b40, 0x0fbe0f70, "fto%16?sui%7'zd%c\t%1y, %0z"}, - {FPU_VFP_EXT_V1xD, 0x0ebc0a40, 0x0fbe0f50, "fto%16?sui%7'zs%c\t%1y, %0y"}, - {FPU_VFP_EXT_V1, 0x0eb80b40, 0x0fff0fd0, "fuitod%c\t%1z, %0y"}, - {FPU_VFP_EXT_V1xD, 0x0eb80a40, 0x0fbf0fd0, "fuitos%c\t%1y, %0y"}, + {FPU_VFP_EXT_V1xD, 0x0ef00a10, 0x0ff00fff, "fmrx%c\t%12-15r, "}, + {FPU_VFP_EXT_V1xD, 0x0e000a10, 0x0ff00f7f, "fmsr%c\t%y2, %12-15r"}, + {FPU_VFP_EXT_V1xD, 0x0e100a10, 0x0ff00f7f, "fmrs%c\t%12-15r, %y2"}, + {FPU_VFP_EXT_V1xD, 0x0eb50a40, 0x0fbf0f70, "fcmp%7'ezs%c\t%y1"}, + {FPU_VFP_EXT_V1, 0x0eb50b40, 0x0fbf0f70, "fcmp%7'ezd%c\t%z1"}, + {FPU_VFP_EXT_V1xD, 0x0eb00a40, 0x0fbf0fd0, "fcpys%c\t%y1, %y0"}, + {FPU_VFP_EXT_V1xD, 0x0eb00ac0, 0x0fbf0fd0, "fabss%c\t%y1, %y0"}, + {FPU_VFP_EXT_V1, 0x0eb00b40, 0x0fbf0fd0, "fcpyd%c\t%z1, %z0"}, + {FPU_VFP_EXT_V1, 0x0eb00bc0, 0x0fbf0fd0, "fabsd%c\t%z1, %z0"}, + {FPU_VFP_EXT_V1xD, 0x0eb10a40, 0x0fbf0fd0, "fnegs%c\t%y1, %y0"}, + {FPU_VFP_EXT_V1xD, 0x0eb10ac0, 0x0fbf0fd0, "fsqrts%c\t%y1, %y0"}, + {FPU_VFP_EXT_V1, 0x0eb10b40, 0x0fbf0fd0, "fnegd%c\t%z1, %z0"}, + {FPU_VFP_EXT_V1, 0x0eb10bc0, 0x0fbf0fd0, "fsqrtd%c\t%z1, %z0"}, + {FPU_VFP_EXT_V1, 0x0eb70ac0, 0x0fbf0fd0, "fcvtds%c\t%z1, %y0"}, + {FPU_VFP_EXT_V1, 0x0eb70bc0, 0x0fbf0fd0, "fcvtsd%c\t%y1, %z0"}, + {FPU_VFP_EXT_V1xD, 0x0eb80a40, 0x0fbf0fd0, "fuitos%c\t%y1, %y0"}, + {FPU_VFP_EXT_V1xD, 0x0eb80ac0, 0x0fbf0fd0, "fsitos%c\t%y1, %y0"}, + {FPU_VFP_EXT_V1, 0x0eb80b40, 0x0fbf0fd0, "fuitod%c\t%z1, %y0"}, + {FPU_VFP_EXT_V1, 0x0eb80bc0, 0x0fbf0fd0, "fsitod%c\t%z1, %y0"}, + {FPU_VFP_EXT_V1xD, 0x0eb40a40, 0x0fbf0f50, "fcmp%7'es%c\t%y1, %y0"}, + {FPU_VFP_EXT_V1, 0x0eb40b40, 0x0fbf0f50, "fcmp%7'ed%c\t%z1, %z0"}, + {FPU_VFP_EXT_V3, 0x0eba0a40, 0x0fbe0f50, "f%16?us%7?lhtos%c\t%y1, #%5,0-3k"}, + {FPU_VFP_EXT_V3, 0x0eba0b40, 0x0fbe0f50, "f%16?us%7?lhtod%c\t%z1, #%5,0-3k"}, + {FPU_VFP_EXT_V1xD, 0x0ebc0a40, 0x0fbe0f50, "fto%16?sui%7'zs%c\t%y1, %y0"}, + {FPU_VFP_EXT_V1, 0x0ebc0b40, 0x0fbe0f50, "fto%16?sui%7'zd%c\t%y1, %z0"}, + {FPU_VFP_EXT_V3, 0x0ebe0a40, 0x0fbe0f50, "fto%16?us%7?lhs%c\t%y1, #%5,0-3k"}, + {FPU_VFP_EXT_V3, 0x0ebe0b40, 0x0fbe0f50, "fto%16?us%7?lhd%c\t%z1, #%5,0-3k"}, + {FPU_VFP_EXT_V1, 0x0c500b10, 0x0fb00ff0, "fmrrd%c\t%12-15r, %16-19r, %z0"}, + {FPU_VFP_EXT_V3, 0x0eb00a00, 0x0fb00ff0, "fconsts%c\t%y1, #%16-19,0-3d"}, + {FPU_VFP_EXT_V3, 0x0eb00b00, 0x0fb00ff0, "fconstd%c\t%z1, #%16-19,0-3d"}, + {FPU_VFP_EXT_V2, 0x0c400a10, 0x0ff00fd0, "fmsrr%c\t%12-15r, %16-19r, %y4"}, + {FPU_VFP_EXT_V2, 0x0c400b10, 0x0ff00fd0, "fmdrr%c\t%z0, %12-15r, %16-19r"}, + {FPU_VFP_EXT_V2, 0x0c500a10, 0x0ff00fd0, "fmrrs%c\t%12-15r, %16-19r, %y4"}, + {FPU_VFP_EXT_V1xD, 0x0e000a00, 0x0fb00f50, "fmacs%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1xD, 0x0e000a40, 0x0fb00f50, "fnmacs%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0e000b00, 0x0fb00f50, "fmacd%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1, 0x0e000b40, 0x0fb00f50, "fnmacd%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1xD, 0x0e100a00, 0x0fb00f50, "fmscs%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1xD, 0x0e100a40, 0x0fb00f50, "fnmscs%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0e100b00, 0x0fb00f50, "fmscd%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1, 0x0e100b40, 0x0fb00f50, "fnmscd%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1xD, 0x0e200a00, 0x0fb00f50, "fmuls%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1xD, 0x0e200a40, 0x0fb00f50, "fnmuls%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0e200b00, 0x0fb00f50, "fmuld%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1, 0x0e200b40, 0x0fb00f50, "fnmuld%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1xD, 0x0e300a00, 0x0fb00f50, "fadds%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1xD, 0x0e300a40, 0x0fb00f50, "fsubs%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0e300b00, 0x0fb00f50, "faddd%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1, 0x0e300b40, 0x0fb00f50, "fsubd%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1xD, 0x0e800a00, 0x0fb00f50, "fdivs%c\t%y1, %y2, %y0"}, + {FPU_VFP_EXT_V1, 0x0e800b00, 0x0fb00f50, "fdivd%c\t%z1, %z2, %z0"}, + {FPU_VFP_EXT_V1xD, 0x0d200a00, 0x0fb00f00, "fstmdbs%c\t%16-19r!, %y3"}, + {FPU_VFP_EXT_V1xD, 0x0d200b00, 0x0fb00f00, "fstmdb%0?xd%c\t%16-19r!, %z3"}, + {FPU_VFP_EXT_V1xD, 0x0d300a00, 0x0fb00f00, "fldmdbs%c\t%16-19r!, %y3"}, + {FPU_VFP_EXT_V1xD, 0x0d300b00, 0x0fb00f00, "fldmdb%0?xd%c\t%16-19r!, %z3"}, + {FPU_VFP_EXT_V1xD, 0x0d000a00, 0x0f300f00, "fsts%c\t%y1, %A"}, + {FPU_VFP_EXT_V1, 0x0d000b00, 0x0f300f00, "fstd%c\t%z1, %A"}, + {FPU_VFP_EXT_V1xD, 0x0d100a00, 0x0f300f00, "flds%c\t%y1, %A"}, + {FPU_VFP_EXT_V1, 0x0d100b00, 0x0f300f00, "fldd%c\t%z1, %A"}, + {FPU_VFP_EXT_V1xD, 0x0c800a00, 0x0f900f00, "fstmias%c\t%16-19r%21'!, %y3"}, + {FPU_VFP_EXT_V1xD, 0x0c800b00, 0x0f900f00, "fstmia%0?xd%c\t%16-19r%21'!, %z3"}, + {FPU_VFP_EXT_V1xD, 0x0c900a00, 0x0f900f00, "fldmias%c\t%16-19r%21'!, %y3"}, + {FPU_VFP_EXT_V1xD, 0x0c900b00, 0x0f900f00, "fldmia%0?xd%c\t%16-19r%21'!, %z3"}, /* Cirrus coprocessor instructions. */ {ARM_CEXT_MAVERICK, 0x0d100400, 0x0f500f00, "cfldrs%c\tmvf%12-15d, %A"}, @@ -381,9 +418,286 @@ static const struct opcode32 coprocessor_opcodes[] = {ARM_EXT_V5, 0xfe000000, 0xff000010, "cdp2\t%8-11d, %20-23d, cr%12-15d, cr%16-19d, cr%0-3d, {%5-7d}"}, {ARM_EXT_V5, 0xfe000010, 0xff100010, "mcr2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, {ARM_EXT_V5, 0xfe100010, 0xff100010, "mrc2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, + {0, 0, 0, 0} }; +/* Neon opcode table: This does not encode the top byte -- that is + checked by the print_insn_neon routine, as it depends on whether we are + doing thumb32 or arm32 disassembly. */ + +/* print_insn_neon recognizes the following format control codes: + + %% % + + %A print v{st,ld}[1234] operands + %B print v{st,ld}[1234] any one operands + %C print v{st,ld}[1234] single->all operands + %D print scalar + %E print vmov, vmvn, vorr, vbic encoded constant + %F print vtbl,vtbx register list + + %r print as an ARM register + %d print the bitfield in decimal + %e print the 2^N - bitfield in decimal + %D print as a NEON D register + %Q print as a NEON Q register + %R print as a NEON D or Q register + %Sn print byte scaled width limited by n + %Tn print short scaled width limited by n + %Un print long scaled width limited by n + + %'c print specified char iff bitfield is all ones + %`c print specified char iff bitfield is all zeroes + %?ab... select from array of values in big endian order */ + +static const struct opcode32 neon_opcodes[] = +{ + /* Extract */ + {FPU_NEON_EXT_V1, 0xf2b00840, 0xffb00850, "vext.8\t%12-15,22R, %16-19,7R, %0-3,5R, #%8-11d"}, + {FPU_NEON_EXT_V1, 0xf2b00000, 0xffb00810, "vext.8\t%12-15,22R, %16-19,7R, %0-3,5R, #%8-11d"}, + + /* Move data element to all lanes */ + {FPU_NEON_EXT_V1, 0xf3b40c00, 0xffb70f90, "vdup.32\t%12-15,22R, %0-3,5D[%19d]"}, + {FPU_NEON_EXT_V1, 0xf3b20c00, 0xffb30f90, "vdup.16\t%12-15,22R, %0-3,5D[%18-19d]"}, + {FPU_NEON_EXT_V1, 0xf3b10c00, 0xffb10f90, "vdup.8\t%12-15,22R, %0-3,5D[%17-19d]"}, + + /* Table lookup */ + {FPU_NEON_EXT_V1, 0xf3b00800, 0xffb00c50, "vtbl.8\t%12-15,22D, %F, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf3b00840, 0xffb00c50, "vtbx.8\t%12-15,22D, %F, %0-3,5D"}, + + /* Two registers, miscellaneous */ + {FPU_NEON_EXT_V1, 0xf2880a10, 0xfebf0fd0, "vmovl.%24?us8\t%12-15,22Q, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2900a10, 0xfebf0fd0, "vmovl.%24?us16\t%12-15,22Q, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2a00a10, 0xfebf0fd0, "vmovl.%24?us32\t%12-15,22Q, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf3b00500, 0xffbf0f90, "vcnt.8\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00580, 0xffbf0f90, "vmvn\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b20000, 0xffbf0f90, "vswp\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b20200, 0xffb30fd0, "vmovn.i%18-19S2\t%12-15,22D, %0-3,5Q"}, + {FPU_NEON_EXT_V1, 0xf3b20240, 0xffb30fd0, "vqmovun.s%18-19T2\t%12-15,22D, %0-3,5Q"}, + {FPU_NEON_EXT_V1, 0xf3b20280, 0xffb30fd0, "vqmovn.s%18-19T2\t%12-15,22D, %0-3,5Q"}, + {FPU_NEON_EXT_V1, 0xf3b202c0, 0xffb30fd0, "vqmovn.u%18-19T2\t%12-15,22D, %0-3,5Q"}, + {FPU_NEON_EXT_V1, 0xf3b20300, 0xffb30fd0, "vshll.i%18-19S2\t%12-15,22Q, %0-3,5D, #%18-19S2"}, + {FPU_NEON_EXT_V1, 0xf3bb0400, 0xffbf0e90, "vrecpe.%8?fu%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3bb0480, 0xffbf0e90, "vrsqrte.%8?fu%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00000, 0xffb30f90, "vrev64.%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00080, 0xffb30f90, "vrev32.%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00100, 0xffb30f90, "vrev16.%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00400, 0xffb30f90, "vcls.s%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00480, 0xffb30f90, "vclz.i%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00700, 0xffb30f90, "vqabs.s%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00780, 0xffb30f90, "vqneg.s%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b20080, 0xffb30f90, "vtrn.%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b20100, 0xffb30f90, "vuzp.%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b20180, 0xffb30f90, "vzip.%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b10000, 0xffb30b90, "vcgt.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"}, + {FPU_NEON_EXT_V1, 0xf3b10080, 0xffb30b90, "vcge.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"}, + {FPU_NEON_EXT_V1, 0xf3b10100, 0xffb30b90, "vceq.%10?fi%18-19S2\t%12-15,22R, %0-3,5R, #0"}, + {FPU_NEON_EXT_V1, 0xf3b10180, 0xffb30b90, "vcle.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"}, + {FPU_NEON_EXT_V1, 0xf3b10200, 0xffb30b90, "vclt.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"}, + {FPU_NEON_EXT_V1, 0xf3b10300, 0xffb30b90, "vabs.%10?fs%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b10380, 0xffb30b90, "vneg.%10?fs%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00200, 0xffb30f10, "vpaddl.%7?us%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b00600, 0xffb30f10, "vpadal.%7?us%18-19S2\t%12-15,22R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3b30600, 0xffb30e10, "vcvt.%7-8?usff%18-19Sa.%7-8?ffus%18-19Sa\t%12-15,22R, %0-3,5R"}, + + /* Three registers of the same length */ + {FPU_NEON_EXT_V1, 0xf2000110, 0xffb00f10, "vand\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2100110, 0xffb00f10, "vbic\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2200110, 0xffb00f10, "vorr\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2300110, 0xffb00f10, "vorn\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000110, 0xffb00f10, "veor\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3100110, 0xffb00f10, "vbsl\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3200110, 0xffb00f10, "vbit\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3300110, 0xffb00f10, "vbif\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000d00, 0xffa00f10, "vadd.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000d10, 0xffa00f10, "vmla.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000e00, 0xffa00f10, "vceq.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000f00, 0xffa00f10, "vmax.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000f10, 0xffa00f10, "vrecps.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2200d00, 0xffa00f10, "vsub.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2200d10, 0xffa00f10, "vmls.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2200f00, 0xffa00f10, "vmin.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2200f10, 0xffa00f10, "vrsqrts.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000d00, 0xffa00f10, "vpadd.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000d10, 0xffa00f10, "vmul.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000e00, 0xffa00f10, "vcge.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000e10, 0xffa00f10, "vacge.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000f00, 0xffa00f10, "vpmax.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3200d00, 0xffa00f10, "vabd.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3200e00, 0xffa00f10, "vcgt.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3200e10, 0xffa00f10, "vacgt.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3200f00, 0xffa00f10, "vpmin.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000800, 0xff800f10, "vadd.i%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000810, 0xff800f10, "vtst.%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000900, 0xff800f10, "vmla.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000b00, 0xff800f10, "vqdmulh.s%20-21S6\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000b10, 0xff800f10, "vpadd.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000800, 0xff800f10, "vsub.i%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000810, 0xff800f10, "vceq.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000900, 0xff800f10, "vmls.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf3000b00, 0xff800f10, "vqrdmulh.s%20-21S6\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000000, 0xfe800f10, "vhadd.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000010, 0xfe800f10, "vqadd.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000100, 0xfe800f10, "vrhadd.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000200, 0xfe800f10, "vhsub.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000210, 0xfe800f10, "vqsub.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000300, 0xfe800f10, "vcgt.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000310, 0xfe800f10, "vcge.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000400, 0xfe800f10, "vshl.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000410, 0xfe800f10, "vqshl.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000500, 0xfe800f10, "vrshl.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000510, 0xfe800f10, "vqrshl.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000600, 0xfe800f10, "vmax.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000610, 0xfe800f10, "vmin.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000700, 0xfe800f10, "vabd.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000710, 0xfe800f10, "vaba.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000910, 0xfe800f10, "vmul.%24?pi%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000a00, 0xfe800f10, "vpmax.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + {FPU_NEON_EXT_V1, 0xf2000a10, 0xfe800f10, "vpmin.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"}, + + /* One register and an immediate value */ + {FPU_NEON_EXT_V1, 0xf2800e10, 0xfeb80fb0, "vmov.i8\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800e30, 0xfeb80fb0, "vmov.i64\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800f10, 0xfeb80fb0, "vmov.f32\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800810, 0xfeb80db0, "vmov.i16\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800830, 0xfeb80db0, "vmvn.i16\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800910, 0xfeb80db0, "vorr.i16\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800930, 0xfeb80db0, "vbic.i16\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800c10, 0xfeb80eb0, "vmov.i32\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800c30, 0xfeb80eb0, "vmvn.i32\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800110, 0xfeb809b0, "vorr.i32\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800130, 0xfeb809b0, "vbic.i32\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800010, 0xfeb808b0, "vmov.i32\t%12-15,22R, %E"}, + {FPU_NEON_EXT_V1, 0xf2800030, 0xfeb808b0, "vmvn.i32\t%12-15,22R, %E"}, + + /* Two registers and a shift amount */ + {FPU_NEON_EXT_V1, 0xf2880810, 0xffb80fd0, "vshrn.i16\t%12-15,22D, %0-3,5Q, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880850, 0xffb80fd0, "vrshrn.i16\t%12-15,22D, %0-3,5Q, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880810, 0xfeb80fd0, "vqshrun.s16\t%12-15,22D, %0-3,5Q, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880850, 0xfeb80fd0, "vqrshrun.s16\t%12-15,22D, %0-3,5Q, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880910, 0xfeb80fd0, "vqshrn.%24?us16\t%12-15,22D, %0-3,5Q, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880950, 0xfeb80fd0, "vqrshrn.%24?us16\t%12-15,22D, %0-3,5Q, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880a10, 0xfeb80fd0, "vshll.%24?us8\t%12-15,22D, %0-3,5Q, #%16-18d"}, + {FPU_NEON_EXT_V1, 0xf2900810, 0xffb00fd0, "vshrn.i32\t%12-15,22D, %0-3,5Q, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900850, 0xffb00fd0, "vrshrn.i32\t%12-15,22D, %0-3,5Q, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2880510, 0xffb80f90, "vshl.%24?us8\t%12-15,22R, %0-3,5R, #%16-18d"}, + {FPU_NEON_EXT_V1, 0xf3880410, 0xffb80f90, "vsri.8\t%12-15,22R, %0-3,5R, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf3880510, 0xffb80f90, "vsli.8\t%12-15,22R, %0-3,5R, #%16-18d"}, + {FPU_NEON_EXT_V1, 0xf3880610, 0xffb80f90, "vqshlu.s8\t%12-15,22R, %0-3,5R, #%16-18d"}, + {FPU_NEON_EXT_V1, 0xf2900810, 0xfeb00fd0, "vqshrun.s32\t%12-15,22D, %0-3,5Q, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900850, 0xfeb00fd0, "vqrshrun.s32\t%12-15,22D, %0-3,5Q, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900910, 0xfeb00fd0, "vqshrn.%24?us32\t%12-15,22D, %0-3,5Q, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900950, 0xfeb00fd0, "vqrshrn.%24?us32\t%12-15,22D, %0-3,5Q, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900a10, 0xfeb00fd0, "vshll.%24?us16\t%12-15,22D, %0-3,5Q, #%16-19d"}, + {FPU_NEON_EXT_V1, 0xf2880010, 0xfeb80f90, "vshr.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880110, 0xfeb80f90, "vsra.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880210, 0xfeb80f90, "vrshr.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880310, 0xfeb80f90, "vrsra.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"}, + {FPU_NEON_EXT_V1, 0xf2880710, 0xfeb80f90, "vqshl.%24?us8\t%12-15,22R, %0-3,5R, #%16-18d"}, + {FPU_NEON_EXT_V1, 0xf2a00810, 0xffa00fd0, "vshrn.i64\t%12-15,22D, %0-3,5Q, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2a00850, 0xffa00fd0, "vrshrn.i64\t%12-15,22D, %0-3,5Q, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2900510, 0xffb00f90, "vshl.%24?us16\t%12-15,22R, %0-3,5R, #%16-19d"}, + {FPU_NEON_EXT_V1, 0xf3900410, 0xffb00f90, "vsri.16\t%12-15,22R, %0-3,5R, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf3900510, 0xffb00f90, "vsli.16\t%12-15,22R, %0-3,5R, #%16-19d"}, + {FPU_NEON_EXT_V1, 0xf3900610, 0xffb00f90, "vqshlu.s16\t%12-15,22R, %0-3,5R, #%16-19d"}, + {FPU_NEON_EXT_V1, 0xf2a00a10, 0xfea00fd0, "vshll.%24?us32\t%12-15,22D, %0-3,5Q, #%16-20d"}, + {FPU_NEON_EXT_V1, 0xf2900010, 0xfeb00f90, "vshr.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900110, 0xfeb00f90, "vsra.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900210, 0xfeb00f90, "vrshr.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900310, 0xfeb00f90, "vrsra.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"}, + {FPU_NEON_EXT_V1, 0xf2900710, 0xfeb00f90, "vqshl.%24?us16\t%12-15,22R, %0-3,5R, #%16-19d"}, + {FPU_NEON_EXT_V1, 0xf2800810, 0xfec00fd0, "vqshrun.s64\t%12-15,22D, %0-3,5Q, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2800850, 0xfec00fd0, "vqrshrun.s64\t%12-15,22D, %0-3,5Q, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2800910, 0xfec00fd0, "vqshrn.%24?us64\t%12-15,22D, %0-3,5Q, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2800950, 0xfec00fd0, "vqrshrn.%24?us64\t%12-15,22D, %0-3,5Q, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2a00510, 0xffa00f90, "vshl.%24?us32\t%12-15,22R, %0-3,5R, #%16-20d"}, + {FPU_NEON_EXT_V1, 0xf3a00410, 0xffa00f90, "vsri.32\t%12-15,22R, %0-3,5R, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf3a00510, 0xffa00f90, "vsli.32\t%12-15,22R, %0-3,5R, #%16-20d"}, + {FPU_NEON_EXT_V1, 0xf3a00610, 0xffa00f90, "vqshlu.s32\t%12-15,22R, %0-3,5R, #%16-20d"}, + {FPU_NEON_EXT_V1, 0xf2a00010, 0xfea00f90, "vshr.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2a00110, 0xfea00f90, "vsra.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2a00210, 0xfea00f90, "vrshr.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2a00310, 0xfea00f90, "vrsra.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"}, + {FPU_NEON_EXT_V1, 0xf2a00710, 0xfea00f90, "vqshl.%24?us32\t%12-15,22R, %0-3,5R, #%16-20d"}, + {FPU_NEON_EXT_V1, 0xf2800590, 0xff800f90, "vshl.%24?us64\t%12-15,22R, %0-3,5R, #%16-21d"}, + {FPU_NEON_EXT_V1, 0xf3800490, 0xff800f90, "vsri.64\t%12-15,22R, %0-3,5R, #%16-21e"}, + {FPU_NEON_EXT_V1, 0xf3800590, 0xff800f90, "vsli.64\t%12-15,22R, %0-3,5R, #%16-21d"}, + {FPU_NEON_EXT_V1, 0xf3800690, 0xff800f90, "vqshlu.s64\t%12-15,22R, %0-3,5R, #%16-21d"}, + {FPU_NEON_EXT_V1, 0xf2800090, 0xfe800f90, "vshr.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"}, + {FPU_NEON_EXT_V1, 0xf2800190, 0xfe800f90, "vsra.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"}, + {FPU_NEON_EXT_V1, 0xf2800290, 0xfe800f90, "vrshr.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"}, + {FPU_NEON_EXT_V1, 0xf2800390, 0xfe800f90, "vrsra.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"}, + {FPU_NEON_EXT_V1, 0xf2800790, 0xfe800f90, "vqshl.%24?us64\t%12-15,22R, %0-3,5R, #%16-21d"}, + {FPU_NEON_EXT_V1, 0xf2a00e10, 0xfea00e90, "vcvt.%24,8?usff32.%24,8?ffus32\t%12-15,22R, %0-3,5R, #%16-20e"}, + + /* Three registers of different lengths */ + {FPU_NEON_EXT_V1, 0xf2800e00, 0xfea00f50, "vmull.p%20S0\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800400, 0xff800f50, "vaddhn.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"}, + {FPU_NEON_EXT_V1, 0xf2800600, 0xff800f50, "vsubhn.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"}, + {FPU_NEON_EXT_V1, 0xf2800900, 0xff800f50, "vqdmlal.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800b00, 0xff800f50, "vqdmlsl.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800d00, 0xff800f50, "vqdmull.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf3800400, 0xff800f50, "vraddhn.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"}, + {FPU_NEON_EXT_V1, 0xf3800600, 0xff800f50, "vrsubhn.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"}, + {FPU_NEON_EXT_V1, 0xf2800000, 0xfe800f50, "vaddl.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800100, 0xfe800f50, "vaddw.%24?us%20-21S2\t%12-15,22Q, %16-19,7Q, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800200, 0xfe800f50, "vsubl.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800300, 0xfe800f50, "vsubw.%24?us%20-21S2\t%12-15,22Q, %16-19,7Q, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800500, 0xfe800f50, "vabal.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800700, 0xfe800f50, "vabdl.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800800, 0xfe800f50, "vmlal.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800a00, 0xfe800f50, "vmlsl.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + {FPU_NEON_EXT_V1, 0xf2800c00, 0xfe800f50, "vmull.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"}, + + /* Two registers and a scalar */ + {FPU_NEON_EXT_V1, 0xf2800040, 0xff800f50, "vmla.i%20-21S6\t%12-15,22D, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800140, 0xff800f50, "vmla.f%20-21Sa\t%12-15,22D, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800340, 0xff800f50, "vqdmlal.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800440, 0xff800f50, "vmls.i%20-21S6\t%12-15,22D, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800540, 0xff800f50, "vmls.f%20-21S6\t%12-15,22D, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800740, 0xff800f50, "vqdmlsl.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800840, 0xff800f50, "vmul.i%20-21S6\t%12-15,22D, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800940, 0xff800f50, "vmul.f%20-21Sa\t%12-15,22D, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800b40, 0xff800f50, "vqdmull.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800c40, 0xff800f50, "vqdmulh.s%20-21S6\t%12-15,22D, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800d40, 0xff800f50, "vqrdmulh.s%20-21S6\t%12-15,22D, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf3800040, 0xff800f50, "vmla.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, + {FPU_NEON_EXT_V1, 0xf3800140, 0xff800f50, "vmla.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"}, + {FPU_NEON_EXT_V1, 0xf3800440, 0xff800f50, "vmls.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, + {FPU_NEON_EXT_V1, 0xf3800540, 0xff800f50, "vmls.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"}, + {FPU_NEON_EXT_V1, 0xf3800840, 0xff800f50, "vmul.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, + {FPU_NEON_EXT_V1, 0xf3800940, 0xff800f50, "vmul.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"}, + {FPU_NEON_EXT_V1, 0xf3800c40, 0xff800f50, "vqdmulh.s%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, + {FPU_NEON_EXT_V1, 0xf3800d40, 0xff800f50, "vqrdmulh.s%20-21S6\t%12-15,22Q, %16-19,7Q, %D"}, + {FPU_NEON_EXT_V1, 0xf2800240, 0xfe800f50, "vmlal.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800640, 0xfe800f50, "vmlsl.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, + {FPU_NEON_EXT_V1, 0xf2800a40, 0xfe800f50, "vmull.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"}, + + /* Element and structure load/store */ + {FPU_NEON_EXT_V1, 0xf4a00fc0, 0xffb00fc0, "vld4.32\t%C"}, + {FPU_NEON_EXT_V1, 0xf4a00c00, 0xffb00f00, "vld1.%6-7S2\t%C"}, + {FPU_NEON_EXT_V1, 0xf4a00d00, 0xffb00f00, "vld2.%6-7S2\t%C"}, + {FPU_NEON_EXT_V1, 0xf4a00e00, 0xffb00f00, "vld3.%6-7S2\t%C"}, + {FPU_NEON_EXT_V1, 0xf4a00f00, 0xffb00f00, "vld4.%6-7S2\t%C"}, + {FPU_NEON_EXT_V1, 0xf4000200, 0xff900f00, "v%21?ls%21?dt1.%6-7S3\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000300, 0xff900f00, "v%21?ls%21?dt2.%6-7S2\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000400, 0xff900f00, "v%21?ls%21?dt3.%6-7S2\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000500, 0xff900f00, "v%21?ls%21?dt3.%6-7S2\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000600, 0xff900f00, "v%21?ls%21?dt1.%6-7S3\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000700, 0xff900f00, "v%21?ls%21?dt1.%6-7S3\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000800, 0xff900f00, "v%21?ls%21?dt2.%6-7S2\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000900, 0xff900f00, "v%21?ls%21?dt2.%6-7S2\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000a00, 0xff900f00, "v%21?ls%21?dt1.%6-7S3\t%A"}, + {FPU_NEON_EXT_V1, 0xf4000000, 0xff900e00, "v%21?ls%21?dt4.%6-7S2\t%A"}, + {FPU_NEON_EXT_V1, 0xf4800000, 0xff900300, "v%21?ls%21?dt1.%10-11S2\t%B"}, + {FPU_NEON_EXT_V1, 0xf4800100, 0xff900300, "v%21?ls%21?dt2.%10-11S2\t%B"}, + {FPU_NEON_EXT_V1, 0xf4800200, 0xff900300, "v%21?ls%21?dt3.%10-11S2\t%B"}, + {FPU_NEON_EXT_V1, 0xf4800300, 0xff900300, "v%21?ls%21?dt4.%10-11S2\t%B"}, + + {0,0 ,0, 0} +}; + /* Opcode tables: ARM, 16-bit Thumb, 32-bit Thumb. All three are partially ordered: they must be searched linearly from the top to obtain a correct match. */ @@ -410,10 +724,10 @@ static const struct opcode32 coprocessor_opcodes[] = %W print the bitfield plus one in decimal %x print the bitfield in hex %X print the bitfield as 1 hex digit without leading "0x" - - %'c print specified char iff bit is one - %`c print specified char iff bit is zero - %?ab print a if bit is one else print b + + %'c print specified char iff bitfield is all ones + %`c print specified char iff bitfield is all zeroes + %?ab... select from array of values in big endian order %e print arm SMI operand (bits 0..7,8..19). %E print the LSB and WIDTH fields of a BFI or BFC instruction. @@ -844,9 +1158,9 @@ static const struct opcode16 thumb_opcodes[] = %r print bitfield as an ARM register %c print bitfield as a condition code - %'c print "c" iff bit is one - %`c print "c" iff bit is zero - %?ab print "a" if bit is one, else "b" + %'c print specified char iff bitfield is all ones + %`c print specified char iff bitfield is all zeroes + %?ab... select from array of values in big endian order With one exception at the bottom (done because BL and BLX(1) need to come dead last), this table was machine-sorted first in @@ -1149,6 +1463,43 @@ get_arm_regnames (int option, const char **setname, const char **setdescription, return 16; } +/* Decode a bitfield of the form matching regexp (N(-N)?,)*N(-N)?. + Returns pointer to following character of the format string and + fills in *VALUEP and *WIDTHP with the extracted value and number of + bits extracted. WIDTHP can be NULL. */ + +static const char * +arm_decode_bitfield (const char *ptr, unsigned long insn, + unsigned long *valuep, int *widthp) +{ + unsigned long value = 0; + int width = 0; + + do + { + int start, end; + int bits; + + for (start = 0; *ptr >= '0' && *ptr <= '9'; ptr++) + start = start * 10 + *ptr - '0'; + if (*ptr == '-') + for (end = 0, ptr++; *ptr >= '0' && *ptr <= '9'; ptr++) + end = end * 10 + *ptr - '0'; + else + end = start; + bits = end - start; + if (bits < 0) + abort (); + value |= ((insn >> start) & ((2ul << bits) - 1)) << width; + width += bits + 1; + } + while (*ptr++ == ','); + *valuep = value; + if (widthp) + *widthp = width; + return ptr - 1; +} + static void arm_decode_shift (long given, fprintf_ftype func, void *stream) { @@ -1185,7 +1536,7 @@ arm_decode_shift (long given, fprintf_ftype func, void *stream) recognised coprocessor instruction. */ static bfd_boolean -print_insn_coprocessor (struct disassemble_info *info, long given, +print_insn_coprocessor (bfd_vma pc, struct disassemble_info *info, long given, bfd_boolean thumb) { const struct opcode32 *insn; @@ -1265,6 +1616,46 @@ print_insn_coprocessor (struct disassemble_info *info, long given, } break; + case 'B': + { + int regno = ((given >> 12) & 0xf) | ((given >> (22 - 4)) & 0x10); + int offset = (given >> 1) & 0x3f; + + if (offset == 1) + func (stream, "{d%d}", regno); + else if (regno + offset > 32) + func (stream, "{d%d-}", regno, regno + offset - 1); + else + func (stream, "{d%d-d%d}", regno, regno + offset - 1); + } + break; + + case 'C': + { + int rn = (given >> 16) & 0xf; + int offset = (given & 0xff) * 4; + int add = (given >> 23) & 1; + + func (stream, "[%s", arm_regnames[rn]); + + if (offset) + { + if (!add) + offset = -offset; + func (stream, ", #%d", offset); + } + func (stream, "]"); + if (rn == 15) + { + func (stream, "\t; "); + /* FIXME: Unsure if info->bytes_per_chunk is the + right thing to use here. */ + info->print_address_func (offset + pc + + info->bytes_per_chunk * 2, info); + } + } + break; + case 'c': func (stream, "%s", arm_conditional [(given >> 28) & 0xf]); @@ -1360,206 +1751,158 @@ print_insn_coprocessor (struct disassemble_info *info, long given, case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { - int bitstart = *c++ - '0'; - int bitend = 0; - while (*c >= '0' && *c <= '9') - bitstart = (bitstart * 10) + *c++ - '0'; + int width; + unsigned long value; + + c = arm_decode_bitfield (c, given, &value, &width); switch (*c) { - case '-': - c++; - - while (*c >= '0' && *c <= '9') - bitend = (bitend * 10) + *c++ - '0'; - - if (!bitend) - abort (); - - switch (*c) - { - case 'r': - { - long reg; - - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; + case 'r': + func (stream, "%s", arm_regnames[value]); + break; + case 'D': + func (stream, "d%ld", value); + break; + case 'Q': + if (value & 1) + func (stream, "", value >> 1); + else + func (stream, "q%ld", value >> 1); + break; + case 'd': + func (stream, "%ld", value); + break; + case 'k': + { + int from = (given & (1 << 7)) ? 32 : 16; + func (stream, "%ld", from - value); + } + break; + + case 'f': + if (value > 7) + func (stream, "#%s", arm_fp_const[value & 7]); + else + func (stream, "f%ld", value); + break; - func (stream, "%s", arm_regnames[reg]); - } - break; - case 'd': - { - long reg; + case 'w': + if (width == 2) + func (stream, "%s", iwmmxt_wwnames[value]); + else + func (stream, "%s", iwmmxt_wwssnames[value]); + break; - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; + case 'g': + func (stream, "%s", iwmmxt_regnames[value]); + break; + case 'G': + func (stream, "%s", iwmmxt_cregnames[value]); + break; + case '`': + c++; + if (value == 0) + func (stream, "%c", *c); + break; + case '\'': + c++; + if (value == ((1ul << width) - 1)) + func (stream, "%c", *c); + break; + case '?': + func (stream, "%c", c[(1 << width) - (int)value]); + c += 1 << width; + break; + default: + abort (); + } + break; - func (stream, "%ld", reg); - } - break; - case 'f': + case 'y': + case 'z': + { + int single = *c++ == 'y'; + int regno; + + switch (*c) + { + case '4': /* Sm pair */ + func (stream, "{"); + /* Fall through. */ + case '0': /* Sm, Dm */ + regno = given & 0x0000000f; + if (single) { - long reg; - - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - - if (reg > 7) - func (stream, "#%s", - arm_fp_const[reg & 7]); - else - func (stream, "f%ld", reg); + regno <<= 1; + regno += (given >> 5) & 1; } - break; + else + regno += ((given >> 5) & 1) << 4; + break; - case 'w': + case '1': /* Sd, Dd */ + regno = (given >> 12) & 0x0000000f; + if (single) { - long reg; - - if (bitstart != bitend) - { - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - if (bitend - bitstart == 1) - func (stream, "%s", iwmmxt_wwnames[reg]); - else - func (stream, "%s", iwmmxt_wwssnames[reg]); - } - else - { - reg = (((given >> 8) & 0x1) | - ((given >> 22) & 0x1)); - func (stream, "%s", iwmmxt_wwnames[reg]); - } + regno <<= 1; + regno += (given >> 22) & 1; } - break; + else + regno += ((given >> 22) & 1) << 4; + break; - case 'g': + case '2': /* Sn, Dn */ + regno = (given >> 16) & 0x0000000f; + if (single) { - long reg; - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - func (stream, "%s", iwmmxt_regnames[reg]); + regno <<= 1; + regno += (given >> 7) & 1; } - break; - - case 'G': + else + regno += ((given >> 7) & 1) << 4; + break; + + case '3': /* List */ + func (stream, "{"); + regno = (given >> 12) & 0x0000000f; + if (single) { - long reg; - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - func (stream, "%s", iwmmxt_cregnames[reg]); + regno <<= 1; + regno += (given >> 22) & 1; } - break; + else + regno += ((given >> 22) & 1) << 4; + break; + + default: + abort (); + } - default: - abort (); - } - break; + func (stream, "%c%d", single ? 's' : 'd', regno); - case 'y': - case 'z': + if (*c == '3') { - int single = *c == 'y'; - int regno; - - switch (bitstart) - { - case 4: /* Sm pair */ - func (stream, "{"); - /* Fall through. */ - case 0: /* Sm, Dm */ - regno = given & 0x0000000f; - if (single) - { - regno <<= 1; - regno += (given >> 5) & 1; - } - break; - - case 1: /* Sd, Dd */ - regno = (given >> 12) & 0x0000000f; - if (single) - { - regno <<= 1; - regno += (given >> 22) & 1; - } - break; - - case 2: /* Sn, Dn */ - regno = (given >> 16) & 0x0000000f; - if (single) - { - regno <<= 1; - regno += (given >> 7) & 1; - } - break; - - case 3: /* List */ - func (stream, "{"); - regno = (given >> 12) & 0x0000000f; - if (single) - { - regno <<= 1; - regno += (given >> 22) & 1; - } - break; - - - default: - abort (); - } - - func (stream, "%c%d", single ? 's' : 'd', regno); - - if (bitstart == 3) + int count = given & 0xff; + + if (single == 0) + count >>= 1; + + if (--count) { - int count = given & 0xff; - - if (single == 0) - count >>= 1; - - if (--count) - { - func (stream, "-%c%d", - single ? 's' : 'd', - regno + count); - } - - func (stream, "}"); + func (stream, "-%c%d", + single ? 's' : 'd', + regno + count); } - else if (bitstart == 4) - func (stream, ", %c%d}", single ? 's' : 'd', - regno + 1); - - break; + + func (stream, "}"); } - - break; - - case '`': - c++; - if ((given & (1 << bitstart)) == 0) - func (stream, "%c", *c); - break; - case '\'': - c++; - if ((given & (1 << bitstart)) != 0) - func (stream, "%c", *c); - break; - case '?': - ++c; - if ((given & (1 << bitstart)) != 0) - func (stream, "%c", *c++); - else - func (stream, "%c", *++c); - break; - default: - abort (); - } + else if (*c == '4') + func (stream, ", %c%d}", single ? 's' : 'd', + regno + 1); + } break; - + case 'L': switch (given & 0x00400100) { @@ -1712,6 +2055,458 @@ print_arm_address (bfd_vma pc, struct disassemble_info *info, long given) } } +/* Print one neon instruction on INFO->STREAM. + Return TRUE if the instuction matched, FALSE if this is not a + recognised neon instruction. */ + +static bfd_boolean +print_insn_neon (struct disassemble_info *info, long given, bfd_boolean thumb) +{ + const struct opcode32 *insn; + void *stream = info->stream; + fprintf_ftype func = info->fprintf_func; + + if (thumb) + { + if ((given & 0xef000000) == 0xef000000) + { + /* move bit 28 to bit 24 to translate Thumb2 to ARM encoding. */ + unsigned long bit28 = given & (1 << 28); + + given &= 0x00ffffff; + if (bit28) + given |= 0xf3000000; + else + given |= 0xf2000000; + } + else if ((given & 0xff000000) == 0xf9000000) + given ^= 0xf9000000 ^ 0xf4000000; + else + return FALSE; + } + + for (insn = neon_opcodes; insn->assembler; insn++) + { + if ((given & insn->mask) == insn->value) + { + const char *c; + + for (c = insn->assembler; *c; c++) + { + if (*c == '%') + { + switch (*++c) + { + case '%': + func (stream, "%%"); + break; + + case 'A': + { + static const unsigned char enc[16] = + { + 0x4, 0x14, /* st4 0,1 */ + 0x4, /* st1 2 */ + 0x4, /* st2 3 */ + 0x3, /* st3 4 */ + 0x13, /* st3 5 */ + 0x3, /* st1 6 */ + 0x1, /* st1 7 */ + 0x2, /* st2 8 */ + 0x12, /* st2 9 */ + 0x2, /* st1 10 */ + 0, 0, 0, 0, 0 + }; + int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4); + int rn = ((given >> 16) & 0xf); + int rm = ((given >> 0) & 0xf); + int align = ((given >> 4) & 0x3); + int type = ((given >> 8) & 0xf); + int n = enc[type] & 0xf; + int stride = (enc[type] >> 4) + 1; + int ix; + + func (stream, "{"); + if (stride > 1) + for (ix = 0; ix != n; ix++) + func (stream, "%sd%d", ix ? "," : "", rd + ix * stride); + else if (n == 1) + func (stream, "d%d", rd); + else + func (stream, "d%d-d%d", rd, rd + n - 1); + func (stream, "}, [%s", arm_regnames[rn]); + if (align) + func (stream, ", :%d", 32 << align); + func (stream, "]"); + if (rm == 0xd) + func (stream, "!"); + else if (rm != 0xf) + func (stream, ", %s", arm_regnames[rm]); + } + break; + + case 'B': + { + int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4); + int rn = ((given >> 16) & 0xf); + int rm = ((given >> 0) & 0xf); + int idx_align = ((given >> 4) & 0xf); + int align = 0; + int size = ((given >> 10) & 0x3); + int idx = idx_align >> (size + 1); + int length = ((given >> 8) & 3) + 1; + int stride = 1; + int i; + + if (length > 1 && size > 0) + stride = (idx_align & (1 << size)) ? 2 : 1; + + switch (length) + { + case 1: + { + int amask = (1 << size) - 1; + if ((idx_align & (1 << size)) != 0) + return FALSE; + if (size > 0) + { + if ((idx_align & amask) == amask) + align = 8 << size; + else if ((idx_align & amask) != 0) + return FALSE; + } + } + break; + + case 2: + if (size == 2 && (idx_align & 2) != 0) + return FALSE; + align = (idx_align & 1) ? 16 << size : 0; + break; + + case 3: + if ((size == 2 && (idx_align & 3) != 0) + || (idx_align & 1) != 0) + return FALSE; + break; + + case 4: + if (size == 2) + { + if ((idx_align & 3) == 3) + return FALSE; + align = (idx_align & 3) * 64; + } + else + align = (idx_align & 1) ? 32 << size : 0; + break; + + default: + abort (); + } + + func (stream, "{"); + for (i = 0; i < length; i++) + func (stream, "%sd%d[%d]", (i == 0) ? "" : ",", + rd + i * stride, idx); + func (stream, "}, [%s", arm_regnames[rn]); + if (align) + func (stream, ", :%d", align); + func (stream, "]"); + if (rm == 0xd) + func (stream, "!"); + else if (rm != 0xf) + func (stream, ", %s", arm_regnames[rm]); + } + break; + + case 'C': + { + int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4); + int rn = ((given >> 16) & 0xf); + int rm = ((given >> 0) & 0xf); + int align = ((given >> 4) & 0x1); + int size = ((given >> 6) & 0x3); + int type = ((given >> 8) & 0x3); + int n = type + 1; + int stride = ((given >> 5) & 0x1); + int ix; + + if (stride && (n == 1)) + n++; + else + stride++; + + func (stream, "{"); + if (stride > 1) + for (ix = 0; ix != n; ix++) + func (stream, "%sd%d[]", ix ? "," : "", rd + ix * stride); + else if (n == 1) + func (stream, "d%d[]", rd); + else + func (stream, "d%d[]-d%d[]", rd, rd + n - 1); + func (stream, "}, [%s", arm_regnames[rn]); + if (align) + { + int align = (8 * (type + 1)) << size; + if (type == 3) + align = (size > 1) ? align >> 1 : align; + if (type == 2 || (type == 0 && !size)) + func (stream, ", :", align); + else + func (stream, ", :%d", align); + } + func (stream, "]"); + if (rm == 0xd) + func (stream, "!"); + else if (rm != 0xf) + func (stream, ", %s", arm_regnames[rm]); + } + break; + + case 'D': + { + int raw_reg = (given & 0xf) | ((given >> 1) & 0x10); + int size = (given >> 20) & 3; + int reg = raw_reg & ((4 << size) - 1); + int ix = raw_reg >> size >> 2; + + func (stream, "d%d[%d]", reg, ix); + } + break; + + case 'E': + /* Neon encoded constant for mov, mvn, vorr, vbic */ + { + int bits = 0; + int cmode = (given >> 8) & 0xf; + int op = (given >> 5) & 0x1; + unsigned long value = 0, hival = 0; + unsigned shift; + int size = 0; + int isfloat = 0; + + bits |= ((given >> 24) & 1) << 7; + bits |= ((given >> 16) & 7) << 4; + bits |= ((given >> 0) & 15) << 0; + + if (cmode < 8) + { + shift = (cmode >> 1) & 3; + value = (unsigned long)bits << (8 * shift); + size = 32; + } + else if (cmode < 12) + { + shift = (cmode >> 1) & 1; + value = (unsigned long)bits << (8 * shift); + size = 16; + } + else if (cmode < 14) + { + shift = (cmode & 1) + 1; + value = (unsigned long)bits << (8 * shift); + value |= (1ul << (8 * shift)) - 1; + size = 32; + } + else if (cmode == 14) + { + if (op) + { + /* bit replication into bytes */ + int ix; + unsigned long mask; + + value = 0; + hival = 0; + for (ix = 7; ix >= 0; ix--) + { + mask = ((bits >> ix) & 1) ? 0xff : 0; + if (ix <= 3) + value = (value << 8) | mask; + else + hival = (hival << 8) | mask; + } + size = 64; + } + else + { + /* byte replication */ + value = (unsigned long)bits; + size = 8; + } + } + else if (!op) + { + /* floating point encoding */ + int tmp; + + value = (unsigned long)(bits & 0x7f) << 19; + value |= (unsigned long)(bits & 0x80) << 24; + tmp = bits & 0x40 ? 0x3c : 0x40; + value |= (unsigned long)tmp << 24; + size = 32; + isfloat = 1; + } + else + { + func (stream, "", + bits, cmode, op); + size = 32; + break; + } + switch (size) + { + case 8: + func (stream, "#%ld\t; 0x%.2lx", value, value); + break; + + case 16: + func (stream, "#%ld\t; 0x%.4lx", value, value); + break; + + case 32: + if (isfloat) + { + unsigned char valbytes[4]; + double fvalue; + + /* Do this a byte at a time so we don't have to + worry about the host's endianness. */ + valbytes[0] = value & 0xff; + valbytes[1] = (value >> 8) & 0xff; + valbytes[2] = (value >> 16) & 0xff; + valbytes[3] = (value >> 24) & 0xff; + + floatformat_to_double + (&floatformat_ieee_single_little, valbytes, + &fvalue); + + func (stream, "#%.7g\t; 0x%.8lx", fvalue, + value); + } + else + func (stream, "#%ld\t; 0x%.8lx", value, value); + break; + + case 64: + func (stream, "#0x%.8lx%.8lx", hival, value); + break; + + default: + abort (); + } + } + break; + + case 'F': + { + int regno = ((given >> 16) & 0xf) | ((given >> (7 - 4)) & 0x10); + int num = (given >> 8) & 0x3; + + if (!num) + func (stream, "{d%d}", regno); + else if (num + regno >= 32) + func (stream, "{d%d-= '0' && *c <= '9') + limit = *c - '0'; + else if (*c >= 'a' && *c <= 'f') + limit = *c - 'a' + 10; + else + abort (); + low = limit >> 2; + high = limit & 3; + + if (value < low || value > high) + func (stream, "", base << value); + else + func (stream, "%d", base << value); + } + break; + case 'R': + if (given & (1 << 6)) + goto Q; + /* FALLTHROUGH */ + case 'D': + func (stream, "d%ld", value); + break; + case 'Q': + Q: + if (value & 1) + func (stream, "", value >> 1); + else + func (stream, "q%ld", value >> 1); + break; + + case '`': + c++; + if (value == 0) + func (stream, "%c", *c); + break; + case '\'': + c++; + if (value == ((1ul << width) - 1)) + func (stream, "%c", *c); + break; + case '?': + func (stream, "%c", c[(1 << width) - (int)value]); + c += 1 << width; + break; + default: + abort (); + } + break; + + default: + abort (); + } + } + } + else + func (stream, "%c", *c); + } + return TRUE; + } + } + return FALSE; +} + /* Print one ARM instruction from PC on INFO->STREAM. */ static void @@ -1721,7 +2516,10 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given) void *stream = info->stream; fprintf_ftype func = info->fprintf_func; - if (print_insn_coprocessor (info, given, FALSE)) + if (print_insn_coprocessor (pc, info, given, FALSE)) + return; + + if (print_insn_neon (info, given, FALSE)) return; for (insn = arm_opcodes; insn->assembler; insn++) @@ -1964,102 +2762,51 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given) case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { - int bitstart = *c++ - '0'; - int bitend = 0; - while (*c >= '0' && *c <= '9') - bitstart = (bitstart * 10) + *c++ - '0'; + int width; + unsigned long value; + c = arm_decode_bitfield (c, given, &value, &width); + switch (*c) { - case '-': - c++; - - while (*c >= '0' && *c <= '9') - bitend = (bitend * 10) + *c++ - '0'; - - if (!bitend) - abort (); - - switch (*c) - { - case 'r': - { - long reg; - - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - - func (stream, "%s", arm_regnames[reg]); - } - break; - case 'd': - { - long reg; - - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - - func (stream, "%ld", reg); - } - break; - case 'W': - { - long reg; - - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - - func (stream, "%ld", reg + 1); - } - break; - case 'x': - { - long reg; - - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - - func (stream, "0x%08lx", reg); - - /* Some SWI instructions have special - meanings. */ - if ((given & 0x0fffffff) == 0x0FF00000) - func (stream, "\t; IMB"); - else if ((given & 0x0fffffff) == 0x0FF00001) - func (stream, "\t; IMBRange"); - } - break; - case 'X': - { - long reg; - - reg = given >> bitstart; - reg &= (2 << (bitend - bitstart)) - 1; - - func (stream, "%01lx", reg & 0xf); - } - break; - default: - abort (); - } + case 'r': + func (stream, "%s", arm_regnames[value]); + break; + case 'd': + func (stream, "%ld", value); + break; + case 'b': + func (stream, "%ld", value * 8); + break; + case 'W': + func (stream, "%ld", value + 1); + break; + case 'x': + func (stream, "0x%08lx", value); + + /* Some SWI instructions have special + meanings. */ + if ((given & 0x0fffffff) == 0x0FF00000) + func (stream, "\t; IMB"); + else if ((given & 0x0fffffff) == 0x0FF00001) + func (stream, "\t; IMBRange"); + break; + case 'X': + func (stream, "%01lx", value & 0xf); break; - case '`': c++; - if ((given & (1 << bitstart)) == 0) + if (value == 0) func (stream, "%c", *c); break; case '\'': c++; - if ((given & (1 << bitstart)) != 0) + if (value == ((1ul << width) - 1)) func (stream, "%c", *c); break; case '?': - ++c; - if ((given & (1 << bitstart)) != 0) - func (stream, "%c", *c++); - else - func (stream, "%c", *++c); + func (stream, "%c", c[(1 << width) - (int)value]); + c += 1 << width; break; default: abort (); @@ -2373,7 +3120,10 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) void *stream = info->stream; fprintf_ftype func = info->fprintf_func; - if (print_insn_coprocessor (info, given, TRUE)) + if (print_insn_coprocessor (pc, info, given, TRUE)) + return; + + if (print_insn_neon (info, given, TRUE)) return; for (insn = thumb32_opcodes; insn->assembler; insn++) @@ -2752,30 +3502,15 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { - int bitstart = *c++ - '0'; - int bitend = 0; - unsigned int val; - while (*c >= '0' && *c <= '9') - bitstart = (bitstart * 10) + *c++ - '0'; - - if (*c == '-') - { - c++; - while (*c >= '0' && *c <= '9') - bitend = (bitend * 10) + *c++ - '0'; - if (!bitend) - abort (); - - val = given >> bitstart; - val &= (2 << (bitend - bitstart)) - 1; - } - else - val = (given >> bitstart) & 1; + int width; + unsigned long val; + c = arm_decode_bitfield (c, given, &val, &width); + switch (*c) { - case 'd': func (stream, "%u", val); break; - case 'W': func (stream, "%u", val * 4); break; + case 'd': func (stream, "%lu", val); break; + case 'W': func (stream, "%lu", val * 4); break; case 'r': func (stream, "%s", arm_regnames[val]); break; case 'c': @@ -2786,20 +3521,20 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given) break; case '\'': - if (val) - func (stream, "%c", c[1]); c++; + if (val == ((1ul << width) - 1)) + func (stream, "%c", *c); break; case '`': - if (!val) - func (stream, "%c", c[1]); c++; + if (val == 0) + func (stream, "%c", *c); break; case '?': - func (stream, "%c", val ? c[1] : c[2]); - c += 2; + func (stream, "%c", c[(1 << width) - (int)val]); + c += 1 << width; break; default: diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c index 8fc70152663..309496381de 100644 --- a/opcodes/m68k-dis.c +++ b/opcodes/m68k-dis.c @@ -1308,12 +1308,14 @@ match_insn_m68k (bfd_vma memaddr, } else { + /* We must restore the print functions before trying to print the + error message. */ + info->fprintf_func = save_printer; + info->print_address_func = save_print_address; info->fprintf_func (info->stream, /* xgettext:c-format */ _("\n"), best->name, best->args); - info->fprintf_func = save_printer; - info->print_address_func = save_print_address; return 2; } } diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c index 9a48d86d2d1..ee1e9af0c9a 100644 --- a/opcodes/mips-dis.c +++ b/opcodes/mips-dis.c @@ -51,12 +51,15 @@ struct mips_cp0sel_name const char * const name; }; -/* The mips16 register names. */ -static const char * const mips16_reg_names[] = +/* The mips16 registers. */ +static const unsigned int mips16_to_32_reg_map[] = { - "s0", "s1", "v0", "v1", "a0", "a1", "a2", "a3" + 16, 17, 2, 3, 4, 5, 6, 7 }; +#define mips16_reg_names(rn) mips_gpr_names[mips16_to_32_reg_map[rn]] + + static const char * const mips_gpr_names_numeric[32] = { "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", @@ -181,7 +184,28 @@ static const char * const mips_cp0_names_mips3264r2[32] = static const struct mips_cp0sel_name mips_cp0sel_names_mips3264r2[] = { { 4, 1, "c0_contextconfig" }, + { 0, 1, "c0_mvpcontrol" }, + { 0, 2, "c0_mvpconf0" }, + { 0, 3, "c0_mvpconf1" }, + { 1, 1, "c0_vpecontrol" }, + { 1, 2, "c0_vpeconf0" }, + { 1, 3, "c0_vpeconf1" }, + { 1, 4, "c0_yqmask" }, + { 1, 5, "c0_vpeschedule" }, + { 1, 6, "c0_vpeschefback" }, + { 2, 1, "c0_tcstatus" }, + { 2, 2, "c0_tcbind" }, + { 2, 3, "c0_tcrestart" }, + { 2, 4, "c0_tchalt" }, + { 2, 5, "c0_tccontext" }, + { 2, 6, "c0_tcschedule" }, + { 2, 7, "c0_tcschefback" }, { 5, 1, "c0_pagegrain" }, + { 6, 1, "c0_srsconf0" }, + { 6, 2, "c0_srsconf1" }, + { 6, 3, "c0_srsconf2" }, + { 6, 4, "c0_srsconf3" }, + { 6, 5, "c0_srsconf4" }, { 12, 1, "c0_intctl" }, { 12, 2, "c0_srsctl" }, { 12, 3, "c0_srsmap" }, @@ -688,7 +712,8 @@ static void print_insn_args (const char *d, register unsigned long int l, bfd_vma pc, - struct disassemble_info *info) + struct disassemble_info *info, + const struct mips_opcode *opp) { int op, delta; unsigned int lsb, msb, msbd; @@ -728,6 +753,26 @@ print_insn_args (const char *d, (*info->fprintf_func) (info->stream, "0x%x", msb - lsb + 1); break; + case '1': + (*info->fprintf_func) (info->stream, "0x%lx", + (l >> OP_SH_UDI1) & OP_MASK_UDI1); + break; + + case '2': + (*info->fprintf_func) (info->stream, "0x%lx", + (l >> OP_SH_UDI2) & OP_MASK_UDI2); + break; + + case '3': + (*info->fprintf_func) (info->stream, "0x%lx", + (l >> OP_SH_UDI3) & OP_MASK_UDI3); + break; + + case '4': + (*info->fprintf_func) (info->stream, "0x%lx", + (l >> OP_SH_UDI4) & OP_MASK_UDI4); + break; + case 'C': case 'H': msbd = (l >> OP_SH_EXTMSBD) & OP_MASK_EXTMSBD; @@ -1069,7 +1114,9 @@ print_insn_args (const char *d, break; case 'N': - (*info->fprintf_func) (info->stream, "$fcc%ld", + (*info->fprintf_func) (info->stream, + ((opp->pinfo & (FP_D | FP_S)) != 0 + ? "$fcc%ld" : "$cc%ld"), (l >> OP_SH_BCC) & OP_MASK_BCC); break; @@ -1247,7 +1294,7 @@ print_insn_mips (bfd_vma memaddr, if (d != NULL && *d != '\0') { (*info->fprintf_func) (info->stream, "\t"); - print_insn_args (d, word, memaddr, info); + print_insn_args (d, word, memaddr, info, op); } return INSNLEN; @@ -1283,27 +1330,27 @@ print_mips16_insn_arg (char type, case 'y': case 'w': (*info->fprintf_func) (info->stream, "%s", - mips16_reg_names[((l >> MIPS16OP_SH_RY) - & MIPS16OP_MASK_RY)]); + mips16_reg_names(((l >> MIPS16OP_SH_RY) + & MIPS16OP_MASK_RY))); break; case 'x': case 'v': (*info->fprintf_func) (info->stream, "%s", - mips16_reg_names[((l >> MIPS16OP_SH_RX) - & MIPS16OP_MASK_RX)]); + mips16_reg_names(((l >> MIPS16OP_SH_RX) + & MIPS16OP_MASK_RX))); break; case 'z': (*info->fprintf_func) (info->stream, "%s", - mips16_reg_names[((l >> MIPS16OP_SH_RZ) - & MIPS16OP_MASK_RZ)]); + mips16_reg_names(((l >> MIPS16OP_SH_RZ) + & MIPS16OP_MASK_RZ))); break; case 'Z': (*info->fprintf_func) (info->stream, "%s", - mips16_reg_names[((l >> MIPS16OP_SH_MOVE32Z) - & MIPS16OP_MASK_MOVE32Z)]); + mips16_reg_names(((l >> MIPS16OP_SH_MOVE32Z) + & MIPS16OP_MASK_MOVE32Z))); break; case '0': diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c index 42da7485c0e..e6cca40c8be 100644 --- a/opcodes/mips-opc.c +++ b/opcodes/mips-opc.c @@ -1263,6 +1263,72 @@ const struct mips_opcode mips_builtin_opcodes[] = {"yield", "s", 0x7c000009, 0xfc1fffff, TRAP|RD_s, 0, MT32 }, {"yield", "d,s", 0x7c000009, 0xfc1f07ff, TRAP|WR_d|RD_s, 0, MT32 }, +/* User Defined Instruction. */ +{"udi0", "s,t,d,+1",0x70000010, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi0", "s,t,+2", 0x70000010, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi0", "s,+3", 0x70000010, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi0", "+4", 0x70000010, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi1", "s,t,d,+1",0x70000011, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi1", "s,t,+2", 0x70000011, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi1", "s,+3", 0x70000011, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi1", "+4", 0x70000011, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi2", "s,t,d,+1",0x70000012, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi2", "s,t,+2", 0x70000012, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi2", "s,+3", 0x70000012, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi2", "+4", 0x70000012, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi3", "s,t,d,+1",0x70000013, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi3", "s,t,+2", 0x70000013, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi3", "s,+3", 0x70000013, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi3", "+4", 0x70000013, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi4", "s,t,d,+1",0x70000014, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi4", "s,t,+2", 0x70000014, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi4", "s,+3", 0x70000014, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi4", "+4", 0x70000014, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi5", "s,t,d,+1",0x70000015, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi5", "s,t,+2", 0x70000015, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi5", "s,+3", 0x70000015, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi5", "+4", 0x70000015, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi6", "s,t,d,+1",0x70000016, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi6", "s,t,+2", 0x70000016, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi6", "s,+3", 0x70000016, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi6", "+4", 0x70000016, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi7", "s,t,d,+1",0x70000017, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi7", "s,t,+2", 0x70000017, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi7", "s,+3", 0x70000017, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi7", "+4", 0x70000017, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi8", "s,t,d,+1",0x70000018, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi8", "s,t,+2", 0x70000018, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi8", "s,+3", 0x70000018, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi8", "+4", 0x70000018, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi9", "s,t,d,+1",0x70000019, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi9", "s,t,+2", 0x70000019, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi9", "s,+3", 0x70000019, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi9", "+4", 0x70000019, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi10", "s,t,d,+1",0x7000001a, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi10", "s,t,+2", 0x7000001a, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi10", "s,+3", 0x7000001a, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi10", "+4", 0x7000001a, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi11", "s,t,d,+1",0x7000001b, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi11", "s,t,+2", 0x7000001b, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi11", "s,+3", 0x7000001b, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi11", "+4", 0x7000001b, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi12", "s,t,d,+1",0x7000001c, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi12", "s,t,+2", 0x7000001c, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi12", "s,+3", 0x7000001c, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi12", "+4", 0x7000001c, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi13", "s,t,d,+1",0x7000001d, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi13", "s,t,+2", 0x7000001d, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi13", "s,+3", 0x7000001d, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi13", "+4", 0x7000001d, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi14", "s,t,d,+1",0x7000001e, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi14", "s,t,+2", 0x7000001e, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi14", "s,+3", 0x7000001e, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi14", "+4", 0x7000001e, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi15", "s,t,d,+1",0x7000001f, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi15", "s,t,+2", 0x7000001f, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi15", "s,+3", 0x7000001f, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, +{"udi15", "+4", 0x7000001f, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 }, + /* Coprocessor 2 move/branch operations overlap with VR5400 .ob format instructions so they are here for the latters to take precedence. */ {"bc2f", "p", 0x49000000, 0xffff0000, CBD|RD_CC, 0, I1 }, diff --git a/readline/examples/rlfe/ChangeLog b/readline/examples/rlfe/ChangeLog deleted file mode 100644 index ba41b2b7205..00000000000 --- a/readline/examples/rlfe/ChangeLog +++ /dev/null @@ -1,37 +0,0 @@ -2004-11-04 Per Bothner - - * pty.c: Import from screen-4.0.2. - * configure.in, Makefile.in, config.h.in: Set up autoconf handling, - copying a bunk of stuff over from screen. - * rlfe.c: Use OpenPTY from pty.c instead of get_master_pty. - -2004-11-03 Per Bothner - - * rlfe.c: Get input emphasis (boldening) more robust. - - * rlfe.c: Various cleanups on comments and names. - -2003-11-07 Wolfgang Taeuber - - * Specify a history file and the size of the history file with command - * line options; use EDITOR/VISUAL to set vi/emacs preference. - -1999-09-03 Chet Ramey - - * fep.c: Memmove is not universally available. This patch assumes - that an autoconf test has been performed, and that memcpy is - available without checking. - - * fep.c: VDISCARD is not universally available, even when termios is. - - * fep.c: If a system doesn't have TIOCSCTTY, the first `open' - performed after setsid allocates a controlling terminal. The - original code would leave the child process running on the slave pty - without a controlling tty if TIOCSCTTY was not available. - - * fep.c: Most versions of SVR4, including solaris, don't allow - terminal ioctl calls on the master side of the pty. - -1999-08-28 Per Bothner - - * fep.c: Initial release. diff --git a/readline/examples/rlfe/Makefile.in b/readline/examples/rlfe/Makefile.in deleted file mode 100644 index 4653dec4e9b..00000000000 --- a/readline/examples/rlfe/Makefile.in +++ /dev/null @@ -1,176 +0,0 @@ -# -# Makefile template for rlfe -# -# See machine dependant config.h for more configuration options. -# - -srcdir = @srcdir@ -VPATH = @srcdir@ - -DESTDIR = - -# Where to install screen. - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -# don't forget to change mandir and infodir in doc/Makefile. -bindir = $(exec_prefix)/bin - -VERSION = @VERSION@ -SCREEN = screen-$(VERSION) - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -#LDFLAGS = -L$(READLINE_DIR) -LDFLAGS = @LDFLAGS@ -LIBS = -lreadline -lhistory -lncurses - -CPP=@CPP@ -CPP_DEPEND=$(CC) -MM - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -AWK = @AWK@ - -OPTIONS= -#OPTIONS= -DDEBUG - -SHELL=/bin/sh - -CFILES= rlfe.c pty.c -HFILES= extern.h os.h screen.h -EXTRA_DIST=configure.in configure Makefile.in config.h.in ChangeLog README -OFILES= rlfe.o pty.o - -all: rlfe - -rlfe: $(OFILES) - $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) - -rlfe-$(VERSION).tar.gz: - tar czf $@ $(CFILES) $(HFILES) $(EXTRA_DIST) - -.c.o: - $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $< - -install_bin: .version screen - -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \ - then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi - $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN) - -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN) -# This doesn't work if $(bindir)/screen is a symlink - -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi - rm -f $(DESTDIR)$(bindir)/screen - (cd $(DESTDIR)$(bindir) && ln -sf $(SCREEN) screen) - cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS) - - -uninstall: .version - rm -f $(DESTDIR)$(bindir)/$(SCREEN) - rm -f $(DESTDIR)$(bindir)/screen - -mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen - rm -f $(DESTDIR)$(ETCSCREENRC) - cd doc; $(MAKE) uninstall - -shadow: - mkdir shadow; - cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc . - rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h - echo "install all Makefiles and config:" > shadow/Makefile - echo " rm -f config.cache" >> shadow/Makefile - echo " sh ./configure" >> shadow/Makefile - -term.h: term.c term.sh - AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh - -kmapdef.c: term.h - -tty.c: tty.sh - sh $(srcdir)/tty.sh tty.c - -mostlyclean: - rm -f $(OFILES) rlfe *.o - -clean celan: mostlyclean - rm -f tty.c term.h comm.h osdef.h kmapdef.c core - -# Delete all files from the current directory that are created by -# configuring or building the program. -# building of term.h/comm.h requires awk. Keep it in the distribution -# we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC. -#distclean: mostlyclean -# rm -f $(SCREEN).tar $(SCREEN).tar.gz -# rm -f config.status Makefile -# rm -f osdef.h doc/Makefile - -maintainer-clean: - @echo "This command is not even intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - - -# Delete everything from the current directory that can be -# reconstructed with this Makefile. -realclean: .version mostlyclean - rm -f $(SCREEN).tar $(SCREEN).tar.gz - rm -f config.status Makefile doc/Makefile - rm -f tty.c term.h comm.h osdef.h kmapdef.c - rm -f config.h - echo "install all Makefiles and config:" > Makefile - echo " sh ./configure" >> Makefile - -tags TAGS: $(CFILES) - -ctags *.sh $(CFILES) *.h - -ctags -e *.sh $(CFILES) *.h - -dist: .version $(SCREEN).tar.gz - - -# Perform self-tests (if any). -check: - -config: - rm -f config.cache - sh ./configure - - -############################################################################### - -.version: - @rev=`sed < $(srcdir)/patchlevel.h -n -e '/#define REV/s/#define REV *//p'`; \ - vers=`sed < $(srcdir)/patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`; \ - pat=`sed < $(srcdir)/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`; \ - if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \ - echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \ - echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi - -############################################################################### - -mdepend: $(CFILES) term.h - @rm -f DEPEND ; \ - for i in ${CFILES} ; do \ - echo "$$i" ; \ - echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\ - cc -E $$i |\ - grep '^# .*"\./.*\.h"' |\ - (sort -t'"' -u -k 2,2 2>/dev/null || sort -t'"' -u +1 -2) |\ - sed -e 's/.*"\.\/\(.*\)".*/\1/'\ - ` >> DEPEND ; \ - done - -depend: depend.in - ./config.status || ./configure - -depend.in: $(CFILES) term.h - cp Makefile.in Makefile.in~ - sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make - for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done - mv tmp_make Makefile.in - -############################################################################### - -### Dependencies: -pty.o: pty.c config.h diff --git a/readline/examples/rlfe/README b/readline/examples/rlfe/README deleted file mode 100644 index 9e1f689dc97..00000000000 --- a/readline/examples/rlfe/README +++ /dev/null @@ -1,78 +0,0 @@ -rlfe (ReadLine Front-End) is a "universal wrapper" around readline. -You specify an interactive program to run (typically a shell), and -readline is used to edit input lines. - -There are other such front-ends; what distinguishes this one is that -it monitors the state of the inferior pty, and if the inferior program -switches its terminal to raw mode, then rlfe passes your characters -through directly. This basically means you can run your entire -session (including bash and terminal-mode emacs) under rlfe. - -FEATURES - -* Can use all readline commands (and history) in commands that -read input lines in "canonical mode" - even 'cat'! - -* Automatically switches between "readline-editing mode" and "raw mode" -depending on the terminal mode. If the inferior program invokes -readline itself, it will do its own line editing. (The inferior -readline will not know about rlfe, and it will have its own history.) -You can even run programs like 'emavs -nw' and 'vi' under rlfe. -The goal is you could leave rlfe always on without even knowing -about it. (We're not quite there, but it works tolerably well.) - -* The input line (after any prompt) is changed to bold-face. - -INSTALL - -The usual: ./configure && make && make install - -Note so far rlfe has only been tested on GNU Linux (Fedora Core 2) -and Mac OS X (10.3). - -This assumes readline header files and libraries are in the default -places. If not, you can create a link named readline pointing to the -readline sources. To link with libreadline.a and libhistory.a -you can copy or link them, or add LDFLAGS='-/path/to/readline' to -the make command-line. - -USAGE - -Just run it. That by default runs bash. You can run some other -command by giving it as command-line arguments. - -There are a few tweaks: -h allows you to name the history file, -and -s allows you to specify its size. It default to "emacs" mode, -but if the the environment variable EDITOR is set to "vi" that -mode is chosen. - -ISSUES - -* The mode switching depends on the terminal mode set by the inferior -program. Thus ssh/telnet/screen-type programs will typically be in -raw mode, so rlfe won't be much use, even if remote programs run in -canonical mode. The work-around is to run rlfe on the remote end. - -* Echo supression and prompt recognition are somewhat fragile. -(A protocol so that the o/s tty code can reliably communicate its -state to rlfe could solve this problem, and the previous one.) - -* See the intro to rlfe.c for more notes. - -* Assumes a VT100-compatible terminal, though that could be generalized -if anybody cares. - -* Requires ncurses. - -* It would be useful to integrate rlfe's logic in a terminal emulator. -That would make it easier to reposition the edit position with a mouse, -integrate cut-and-paste with the system clipboard, and more robustly -handle escape sequence and multi-byte characters more robustly. - -AUTHOR - -Per Bothner - -LICENSE - -GPL. diff --git a/readline/examples/rlfe/config.h.in b/readline/examples/rlfe/config.h.in deleted file mode 100644 index f8ff13b1b14..00000000000 --- a/readline/examples/rlfe/config.h.in +++ /dev/null @@ -1,375 +0,0 @@ -/* Copyright 2004 Per Bothner - * Based on config.h from screen-4.0.2. - * Copyright (c) 1993-2000 - * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) - * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) - * Copyright (c) 1987 Oliver Laumann - * - * 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 (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - **************************************************************** - * $Id$ FAU - */ - - - - - -/********************************************************************** - * - * User Configuration Section - */ - - -/* - * define PTYMODE if you do not like the default of 0622, which allows - * public write to your pty. - * define PTYGROUP to some numerical group-id if you do not want the - * tty to be in "your" group. - * Note, screen is unable to change mode or group of the pty if it - * is not installed with sufficient privilege. (e.g. set-uid-root) - * define PTYROFS if the /dev/pty devices are mounted on a read-only - * filesystem so screen should not even attempt to set mode or group - * even if running as root (e.g. on TiVo). - */ -#undef PTYMODE -#undef PTYGROUP -#undef PTYROFS - -/* - * If screen is NOT installed set-uid root, screen can provide tty - * security by exclusively locking the ptys. While this keeps other - * users from opening your ptys, it also keeps your own subprocesses - * from being able to open /dev/tty. Define LOCKPTY to add this - * exclusive locking. - */ -#undef LOCKPTY - - -/********************************************************************** - * - * End of User Configuration Section - * - * Rest of this file is modified by 'configure' - * Change at your own risk! - * - */ - -/* - * Some defines to identify special unix variants - */ -#ifndef SVR4 -#undef SVR4 -#endif - -#ifndef _POSIX_SOURCE -#undef _POSIX_SOURCE -#endif - -/* - * Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX). - */ -#undef POSIX - -/* - * Define TERMIO if you have struct termio instead of struct sgttyb. - * This is usually the case for SVID systems, where BSD uses sgttyb. - * POSIX systems should define this anyway, even though they use - * struct termios. - */ -#undef TERMIO - -/* - * Define CYTERMIO if you have cyrillic termio modes. - */ -#undef CYTERMIO - -/* - * Define TERMINFO if your machine emulates the termcap routines - * with the terminfo database. - * Thus the .screenrc file is parsed for - * the command 'terminfo' and not 'termcap'. - */ -#undef TERMINFO - -/* - * If your library does not define ospeed, define this. - */ -#undef NEED_OSPEED - -/* - * Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX) - */ -#ifndef SYSV -#undef SYSV -#endif - -/* - * Define SIGVOID if your signal handlers return void. On older - * systems, signal returns int, but on newer ones, it returns void. - */ -#undef SIGVOID - -/* - * Define USESIGSET if you have sigset for BSD 4.1 reliable signals. - */ -#undef USESIGSET - -/* - * Define SYSVSIGS if signal handlers must be reinstalled after - * they have been called. - */ -#undef SYSVSIGS - -/* - * Define BSDWAIT if your system defines a 'union wait' in - * - * Only allow BSDWAIT i.e. wait3 on nonposix systems, since - * posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl - * - */ -#ifndef POSIX -#undef BSDWAIT -#endif - -/* - * On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com - */ -#ifdef BSDWAIT -#undef USE_WAIT2 -#endif - -/* - * Define if you have the utempter utmp helper program - */ -#undef HAVE_UTEMPTER - -/* - * If ttyslot() breaks getlogin() by returning indexes to utmp entries - * of type DEAD_PROCESS, then our getlogin() replacement should be - * selected by defining BUGGYGETLOGIN. - */ -#undef BUGGYGETLOGIN - -/* - * If your system has the calls setreuid() and setregid(), - * define HAVE_SETREUID. Otherwise screen will use a forked process to - * safely create output files without retaining any special privileges. - */ -#undef HAVE_SETREUID - -/* - * If your system supports BSD4.4's seteuid() and setegid(), define - * HAVE_SETEUID. - */ -#undef HAVE_SETEUID - -/* - * If you want the "time" command to display the current load average - * define LOADAV. Maybe you must install screen with the needed - * privileges to read /dev/kmem. - * Note that NLIST_ stuff is only checked, when getloadavg() is not available. - */ -#undef LOADAV - -#undef LOADAV_NUM -#undef LOADAV_TYPE -#undef LOADAV_SCALE -#undef LOADAV_GETLOADAVG -#undef LOADAV_UNIX -#undef LOADAV_AVENRUN -#undef LOADAV_USE_NLIST64 - -#undef NLIST_DECLARED -#undef NLIST_STRUCT -#undef NLIST_NAME_UNION - -/* - * If your system has the new format /etc/ttys (like 4.3 BSD) and the - * getttyent(3) library functions, define GETTTYENT. - */ -#undef GETTTYENT - -/* - * Define USEBCOPY if the bcopy/memcpy from your system's C library - * supports the overlapping of source and destination blocks. When - * undefined, screen uses its own (probably slower) version of bcopy(). - * - * SYSV machines may have a working memcpy() -- Oh, this is - * quite unlikely. Tell me if you see one. - * "But then, memmove() should work, if at all available" he thought... - * Boing, never say "works everywhere" unless you checked SCO UNIX. - * Their memove fails the test in the configure script. Sigh. (Juergen) - */ -#undef USEBCOPY -#undef USEMEMCPY -#undef USEMEMMOVE - -/* - * If your system has vsprintf() and requires the use of the macros in - * "varargs.h" to use functions with variable arguments, - * define USEVARARGS. - */ -#undef USEVARARGS - -/* - * If your system has strerror() define this. - */ -#undef HAVE_STRERROR - -/* - * If the select return value doesn't treat a descriptor that is - * usable for reading and writing as two hits, define SELECT_BROKEN. - */ -#undef SELECT_BROKEN - -/* - * Define this if your system supports named pipes. - */ -#undef NAMEDPIPE - -/* - * Define this if your system exits select() immediatly if a pipe is - * opened read-only and no writer has opened it. - */ -#undef BROKEN_PIPE - -/* - * Define this if the unix-domain socket implementation doesn't - * create a socket in the filesystem. - */ -#undef SOCK_NOT_IN_FS - -/* - * If your system has setenv() and unsetenv() define USESETENV - */ -#undef USESETENV - -/* - * If your system does not come with a setenv()/putenv()/getenv() - * functions, you may bring in our own code by defining NEEDPUTENV. - */ -#undef NEEDPUTENV - -/* - * If the passwords are stored in a shadow file and you want the - * builtin lock to work properly, define SHADOWPW. - */ -#undef SHADOWPW - -/* - * If you are on a SYS V machine that restricts filename length to 14 - * characters, you may need to enforce that by setting NAME_MAX to 14 - */ -#undef NAME_MAX /* KEEP_UNDEF_HERE override system value */ -#undef NAME_MAX - -/* - * define HAVE_RENAME if your system has a rename() function - */ -#undef HAVE_RENAME - -/* - * define HAVE__EXIT if your system has the _exit() call. - */ -#undef HAVE__EXIT - -/* - * define HAVE_LSTAT if your system has symlinks and the lstat() call. - */ -#undef HAVE_LSTAT - -/* - * define HAVE_UTIMES if your system has the utimes() call. - */ -#undef HAVE_UTIMES - -/* - * define HAVE_FCHOWN if your system has the fchown() call. - */ -#undef HAVE_FCHOWN - -/* - * define HAVE_FCHMOD if your system has the fchmod() call. - */ -#undef HAVE_FCHMOD - -/* - * define HAVE_VSNPRINTF if your system has vsnprintf() (GNU lib). - */ -#undef HAVE_VSNPRINTF - -/* - * define HAVE_GETCWD if your system has the getcwd() call. - */ -#undef HAVE_GETCWD - -/* - * define HAVE_SETLOCALE if your system has the setlocale() call. - */ -#undef HAVE_SETLOCALE - -/* - * define HAVE_STRFTIME if your system has the strftime() call. - */ -#undef HAVE_STRFTIME - -/* - * define HAVE_NL_LANGINFO if your system has the nl_langinfo() call - * and defines CODESET. - */ -#undef HAVE_NL_LANGINFO - -/* - * Newer versions of Solaris include fdwalk, which can greatly improve - * the startup time of screen; otherwise screen spends a lot of time - * closing file descriptors. - */ -#undef HAVE_FDWALK - -/* - * define HAVE_DEV_PTC if you have a /dev/ptc character special - * device. - */ -#undef HAVE_DEV_PTC - -/* - * define HAVE_SVR4_PTYS if you have a /dev/ptmx character special - * device and support the ptsname(), grantpt(), unlockpt() functions. - */ -#undef HAVE_SVR4_PTYS - -/* - * define HAVE_GETPT if you have the getpt() function. - */ -#undef HAVE_GETPT - -/* - * define HAVE_OPENPTY if your system has the openpty() call. - */ -#undef HAVE_OPENPTY - -/* - * define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen - * to unusual environments. E.g. For SunOs the defaults are "qpr" and - * "0123456789abcdef". For SunOs 4.1.2 - * #define PTYRANGE0 "pqrstuvwxyzPQRST" - * is recommended by Dan Jacobson. - */ -#undef PTYRANGE0 -#undef PTYRANGE1 - -#define USEVARARGS diff --git a/readline/examples/rlfe/configure b/readline/examples/rlfe/configure deleted file mode 100755 index ba820261cb8..00000000000 --- a/readline/examples/rlfe/configure +++ /dev/null @@ -1,5400 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. -# -# Copyright (C) 2003 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="rlfe.c" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AWK WRITEPATH XTERMPATH LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pty-mode=mode default mode for ptys - --with-pty-group=group default group for ptys - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - ac_config_headers="$ac_config_headers config.h" - -VERSION=0.4 - - - -old_CFLAGS="$CFLAGS" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TIOCGETP -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -else - ac_cv_prog_gcc_traditional=no -fi -rm -f conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TCGETA -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -fi -rm -f conftest* - - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - -echo "$as_me:$LINENO: checking for library containing strerror" >&5 -echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 -if test "${ac_cv_search_strerror+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_strerror=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char strerror (); -int -main () -{ -strerror (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_strerror="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_strerror" = no; then - for ac_lib in cposix; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char strerror (); -int -main () -{ -strerror (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_strerror="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 -echo "${ECHO_T}$ac_cv_search_strerror" >&6 -if test "$ac_cv_search_strerror" != no; then - test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" - -fi - - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -main(){exit(0);} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) - -if test $CC != cc ; then -echo "Your $CC failed - restarting with CC=cc" 1>&6 - -echo "" 1>&6 - -CC=cc -export CC -exec $0 $configure_args -fi - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -main(){exit(0);} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -exec 5>&2 -eval $ac_link -echo "CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;" 1>&6 - -echo "$ac_compile" 1>&6 - -{ { echo "$as_me:$LINENO: error: Can't run the compiler - sorry" >&5 -echo "$as_me: error: Can't run the compiler - sorry" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -main() -{ - int __something_strange_(); - __something_strange_(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - { { echo "$as_me:$LINENO: error: Your compiler does not set the exit status - sorry" >&5 -echo "$as_me: error: Your compiler does not set the exit status - sorry" >&2;} - { (exit 1); exit 1; }; } -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - - -if test -f etc/toolcheck; then -{ echo "$as_me:$LINENO: checking for buggy tools..." >&5 -echo "$as_me: checking for buggy tools..." >&6;} -sh etc/toolcheck 1>&6 -fi - - -{ echo "$as_me:$LINENO: checking for System V..." >&5 -echo "$as_me: checking for System V..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -int -main () -{ -int x = SIGCHLD | FNDELAY; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >>confdefs.h <<\_ACEOF -#define SYSV 1 -_ACEOF - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking for Solaris 2.x..." >&5 -echo "$as_me: checking for Solaris 2.x..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if defined(SVR4) && defined(sun) - yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - LIBS="$LIBS -lsocket -lnsl -lkstat" -fi -rm -f conftest* - - - -{ echo "$as_me:$LINENO: checking select..." >&5 -echo "$as_me: checking select..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -select(0, 0, 0, 0, 0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$LIBS -lnet -lnsl" -{ echo "$as_me:$LINENO: checking select with $LIBS..." >&5 -echo "$as_me: checking select with $LIBS..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -select(0, 0, 0, 0, 0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: !!! no select - no screen" >&5 -echo "$as_me: error: !!! no select - no screen" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking select return value..." >&5 -echo "$as_me: checking select return value..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#include - -char *nam = "/tmp/conftest$$"; - -#ifdef NAMEDPIPE - -#ifndef O_NONBLOCK -#define O_NONBLOCK O_NDELAY -#endif -#ifndef S_IFIFO -#define S_IFIFO 0010000 -#endif - - -main() -{ -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - -#ifdef __FreeBSD__ -/* From Andrew A. Chernov (ache@astral.msk.su): - * opening RDWR fifo fails in BSD 4.4, but select return values are - * right. - */ - exit(0); -#endif - (void)alarm(5); -#ifdef POSIX - if (mkfifo(nam, 0777)) -#else - if (mknod(nam, S_IFIFO|0777, 0)) -#endif - exit(1); - close(0); - if (open(nam, O_RDWR | O_NONBLOCK)) - exit(1); - if (write(0, "TEST", 4) == -1) - exit(1); - -#else - -#include -#include -#include - -main() -{ - int s1, s2, l; - struct sockaddr_un a; -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - - (void)alarm(5); - if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - exit(1); - a.sun_family = AF_UNIX; - strcpy(a.sun_path, nam); - (void) unlink(nam); - if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1) - exit(1); - if (listen(s1, 2)) - exit(1); - if (fork() == 0) - { - if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - kill(getppid(), 3); - (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2); - if (write(s2, "HELLO", 5) == -1) - kill(getppid(), 3); - exit(0); - } - l = sizeof(a); - close(0); - if (accept(s1, (struct sockaddr *)&a, &l)) - exit(1); -#endif - - -#ifdef FD_SET - FD_SET(0, &f); -#else - f = 1; -#endif - if (select(1, &f, 0, 0, 0) == -1) - exit(1); - if (select(1, &f, &f, 0, 0) != 2) - exit(1); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- select is ok" 1>&6 - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- select can't count" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define SELECT_BROKEN 1 -_ACEOF - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -{ echo "$as_me:$LINENO: checking for tgetent..." >&5 -echo "$as_me: checking for tgetent..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -tgetent((char *)0, (char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -olibs="$LIBS" -LIBS="-lcurses $olibs" -{ echo "$as_me:$LINENO: checking libcurses..." >&5 -echo "$as_me: checking libcurses..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - -#ifdef __hpux -__sorry_hpux_libcurses_is_totally_broken_in_10_10(); -#else -tgetent((char *)0, (char *)0); -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="-ltermcap $olibs" -{ echo "$as_me:$LINENO: checking libtermcap..." >&5 -echo "$as_me: checking libtermcap..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -tgetent((char *)0, (char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="-ltermlib $olibs" -{ echo "$as_me:$LINENO: checking libtermlib..." >&5 -echo "$as_me: checking libtermlib..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -tgetent((char *)0, (char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="-lncurses $olibs" -{ echo "$as_me:$LINENO: checking libncurses..." >&5 -echo "$as_me: checking libncurses..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -tgetent((char *)0, (char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: !!! no tgetent - no screen" >&5 -echo "$as_me: error: !!! no tgetent - no screen" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -main() -{ - exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- you use the termcap database" 1>&6 - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- you use the terminfo database" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define TERMINFO 1 -_ACEOF - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: checking ospeed..." >&5 -echo "$as_me: checking ospeed..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -extern short ospeed; -int -main () -{ -ospeed=5; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >>confdefs.h <<\_ACEOF -#define NEED_OSPEED 1 -_ACEOF - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking for /dev/ptc..." >&5 -echo "$as_me: checking for /dev/ptc..." >&6;} -if test -r /dev/ptc; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_DEV_PTC 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking for SVR4 ptys..." >&5 -echo "$as_me: checking for SVR4 ptys..." >&6;} -sysvr4ptys= -if test -c /dev/ptmx ; then -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -ptsname(0);grantpt(0);unlockpt(0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_SVR4_PTYS 1 -_ACEOF - -sysvr4ptys=1 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - -for ac_func in getpt -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -if test -z "$sysvr4ptys"; then - -for ac_func in openpty -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 -echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6 -if test "${ac_cv_lib_util_openpty+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lutil $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char openpty (); -int -main () -{ -openpty (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_util_openpty=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_util_openpty=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 -echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6 -if test $ac_cv_lib_util_openpty = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_OPENPTY 1 -_ACEOF - LIBS="$LIBS -lutil" -fi - -fi -done - -fi - -{ echo "$as_me:$LINENO: checking for ptyranges..." >&5 -echo "$as_me: checking for ptyranges..." >&6;} -if test -d /dev/ptym ; then -pdir='/dev/ptym' -else -pdir='/dev' -fi -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef M_UNIX - yes; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - ptys=`echo /dev/ptyp??` -else - ptys=`echo $pdir/pty??` -fi -rm -f conftest* - -if test "$ptys" != "$pdir/pty??" ; then -p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` -p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` -cat >>confdefs.h <<_ACEOF -#define PTYRANGE0 "$p0" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PTYRANGE1 "$p1" -_ACEOF - -fi - - -# Check whether --with-pty-mode or --without-pty-mode was given. -if test "${with_pty_mode+set}" = set; then - withval="$with_pty_mode" - ptymode="${withval}" -fi; - -# Check whether --with-pty-group or --without-pty-group was given. -if test "${with_pty_group+set}" = set; then - withval="$with_pty_group" - ptygrp="${withval}" -fi; -test -n "$ptymode" || ptymode=0620 -if test -n "$ptygrp" ; then -cat >>confdefs.h <<_ACEOF -#define PTYMODE $ptymode -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PTYGROUP $ptygrp -_ACEOF - -else - -{ echo "$as_me:$LINENO: checking default tty permissions/group..." >&5 -echo "$as_me: checking default tty permissions/group..." >&6;} -rm -f conftest_grp -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -#include -main() -{ - struct stat sb; - char *x,*ttyname(); - int om, m; - FILE *fp; - - if (!(x = ttyname(0))) exit(1); - if (stat(x, &sb)) exit(1); - om = sb.st_mode; - if (om & 002) exit(0); - m = system("mesg y"); - if (m == -1 || m == 127) exit(1); - if (stat(x, &sb)) exit(1); - m = sb.st_mode; - if (chmod(x, om)) exit(1); - if (m & 002) exit(0); - if (sb.st_gid == getgid()) exit(1); - if (!(fp=fopen("conftest_grp", "w"))) - exit(1); - fprintf(fp, "%d\n", sb.st_gid); - fclose(fp); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - if test -f conftest_grp; then - ptygrp=`cat conftest_grp` - echo "- pty mode: $ptymode, group: $ptygrp" 1>&6 - - cat >>confdefs.h <<_ACEOF -#define PTYMODE $ptymode -_ACEOF - - cat >>confdefs.h <<_ACEOF -#define PTYGROUP $ptygrp -_ACEOF - - else - echo "- ptys are world accessable" 1>&6 - - fi - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) - - WRITEPATH='' - XTERMPATH='' - # Extract the first word of "write", so it can be a program name with args. -set dummy write; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_WRITEPATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $WRITEPATH in - [\\/]* | ?:[\\/]*) - ac_cv_path_WRITEPATH="$WRITEPATH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_WRITEPATH="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -WRITEPATH=$ac_cv_path_WRITEPATH - -if test -n "$WRITEPATH"; then - echo "$as_me:$LINENO: result: $WRITEPATH" >&5 -echo "${ECHO_T}$WRITEPATH" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - # Extract the first word of "xterm", so it can be a program name with args. -set dummy xterm; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XTERMPATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $XTERMPATH in - [\\/]* | ?:[\\/]*) - ac_cv_path_XTERMPATH="$XTERMPATH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_XTERMPATH="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -XTERMPATH=$ac_cv_path_XTERMPATH - -if test -n "$XTERMPATH"; then - echo "$as_me:$LINENO: result: $XTERMPATH" >&5 -echo "${ECHO_T}$XTERMPATH" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - found= - if test -n "$WRITEPATH$XTERMPATH"; then - findfollow= - lsfollow= - found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null` - if test -n "$found"; then - findfollow=-follow - lsfollow=L - fi - if test -n "$XTERMPATH"; then - ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'` - if test tty != "$ptygrpn"; then - XTERMPATH= - fi - fi - fi - if test -n "$WRITEPATH$XTERMPATH"; then - found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print` - if test -n "$found"; then - ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'` - echo "- pty mode: $ptymode, group: $ptygrp" 1>&6 - - cat >>confdefs.h <<_ACEOF -#define PTYMODE $ptymode -_ACEOF - - cat >>confdefs.h <<_ACEOF -#define PTYGROUP $ptygrp -_ACEOF - - else - echo "- ptys are world accessable" 1>&6 - - fi - else - echo "- can't determine - assume ptys are world accessable" 1>&6 - - fi - - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest_grp -fi - -if test -n "$posix" ; then - -echo "assuming posix signal definition" 1>&6 - -cat >>confdefs.h <<\_ACEOF -#define SIGVOID 1 -_ACEOF - - -else - -{ echo "$as_me:$LINENO: checking return type of signal handlers..." >&5 -echo "$as_me: checking return type of signal handlers..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#ifdef signal -#undef signal -#endif -extern void (*signal ()) (); -int -main () -{ -int i; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define SIGVOID 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: checking sigset..." >&5 -echo "$as_me: checking sigset..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include - -int -main () -{ - -#ifdef SIGVOID -sigset(0, (void (*)())0); -#else -sigset(0, (int (*)())0); -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define USESIGSET 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -{ echo "$as_me:$LINENO: checking signal implementation..." >&5 -echo "$as_me: checking signal implementation..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include - -#ifndef SIGCLD -#define SIGCLD SIGCHLD -#endif -#ifdef USESIGSET -#define signal sigset -#endif - -int got; - -#ifdef SIGVOID -void -#endif -hand() -{ - got++; -} - -main() -{ - /* on hpux we use sigvec to get bsd signals */ -#ifdef __hpux - (void)signal(SIGCLD, hand); - kill(getpid(), SIGCLD); - kill(getpid(), SIGCLD); - if (got < 2) - exit(1); -#endif - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -cat >>confdefs.h <<\_ACEOF -#define SYSVSIGS 1 -_ACEOF - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -fi - - ac_config_files="$ac_config_files Makefile" -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - - - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@VERSION@,$VERSION,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@AWK@,$AWK,;t t -s,@WRITEPATH@,$WRITEPATH,;t t -s,@XTERMPATH@,$XTERMPATH,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/readline/examples/rlfe/configure.in b/readline/examples/rlfe/configure.in deleted file mode 100644 index ad685416b79..00000000000 --- a/readline/examples/rlfe/configure.in +++ /dev/null @@ -1,438 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(rlfe.c) -AC_CONFIG_HEADER(config.h) -VERSION=0.4 -AC_SUBST(VERSION) - -dnl -dnl Define some useful macros -dnl -AC_DEFUN(AC_PROGRAM_SOURCE, -[AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out" -. ./conftest.out -rm -f conftest* -])dnl -dnl -define(AC_NOTE, -[echo "$1" 1>&AC_FD_MSG -])dnl - -old_CFLAGS="$CFLAGS" -AC_PROG_CC -AC_PROG_CPP -AC_PROG_GCC_TRADITIONAL -AC_ISC_POSIX - -AC_TRY_RUN(main(){exit(0);},,[ -if test $CC != cc ; then -AC_NOTE(Your $CC failed - restarting with CC=cc) -AC_NOTE() -CC=cc -export CC -exec $0 $configure_args -fi -]) - -AC_TRY_RUN(main(){exit(0);},, -exec 5>&2 -eval $ac_link -AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;) -AC_NOTE($ac_compile) -AC_MSG_ERROR(Can't run the compiler - sorry)) - -AC_TRY_RUN([ -main() -{ - int __something_strange_(); - __something_strange_(0); -} -],AC_MSG_ERROR(Your compiler does not set the exit status - sorry)) - -AC_PROG_AWK - -if test -f etc/toolcheck; then -AC_CHECKING(for buggy tools) -sh etc/toolcheck 1>&AC_FD_MSG -fi - -dnl -dnl **** special unix variants **** -dnl - -AC_CHECKING(for System V) -AC_TRY_COMPILE( -[#include -#include -#include ], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV)) - -AC_CHECKING(for Solaris 2.x) -AC_EGREP_CPP(yes, -[#if defined(SVR4) && defined(sun) - yes -#endif -], LIBS="$LIBS -lsocket -lnsl -lkstat") - -dnl -dnl **** select() **** -dnl - -AC_CHECKING(select) -AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, -LIBS="$LIBS -lnet -lnsl" -AC_CHECKING(select with $LIBS) -AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, -AC_MSG_ERROR(!!! no select - no screen)) -) -dnl -dnl **** check the select implementation **** -dnl - -AC_CHECKING(select return value) -AC_TRY_RUN([ -#include -#include -#include - -char *nam = "/tmp/conftest$$"; - -#ifdef NAMEDPIPE - -#ifndef O_NONBLOCK -#define O_NONBLOCK O_NDELAY -#endif -#ifndef S_IFIFO -#define S_IFIFO 0010000 -#endif - - -main() -{ -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - -#ifdef __FreeBSD__ -/* From Andrew A. Chernov (ache@astral.msk.su): - * opening RDWR fifo fails in BSD 4.4, but select return values are - * right. - */ - exit(0); -#endif - (void)alarm(5); -#ifdef POSIX - if (mkfifo(nam, 0777)) -#else - if (mknod(nam, S_IFIFO|0777, 0)) -#endif - exit(1); - close(0); - if (open(nam, O_RDWR | O_NONBLOCK)) - exit(1); - if (write(0, "TEST", 4) == -1) - exit(1); - -#else - -#include -#include -#include - -main() -{ - int s1, s2, l; - struct sockaddr_un a; -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - - (void)alarm(5); - if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - exit(1); - a.sun_family = AF_UNIX; - strcpy(a.sun_path, nam); - (void) unlink(nam); - if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1) - exit(1); - if (listen(s1, 2)) - exit(1); - if (fork() == 0) - { - if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - kill(getppid(), 3); - (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2); - if (write(s2, "HELLO", 5) == -1) - kill(getppid(), 3); - exit(0); - } - l = sizeof(a); - close(0); - if (accept(s1, (struct sockaddr *)&a, &l)) - exit(1); -#endif - - -#ifdef FD_SET - FD_SET(0, &f); -#else - f = 1; -#endif - if (select(1, &f, 0, 0, 0) == -1) - exit(1); - if (select(1, &f, &f, 0, 0) != 2) - exit(1); - exit(0); -} -],AC_NOTE(- select is ok), -AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN)) - -dnl -dnl **** termcap or terminfo **** -dnl -AC_CHECKING(for tgetent) -AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, -olibs="$LIBS" -LIBS="-lcurses $olibs" -AC_CHECKING(libcurses) -AC_TRY_LINK(,[ -#ifdef __hpux -__sorry_hpux_libcurses_is_totally_broken_in_10_10(); -#else -tgetent((char *)0, (char *)0); -#endif -],, -LIBS="-ltermcap $olibs" -AC_CHECKING(libtermcap) -AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, -LIBS="-ltermlib $olibs" -AC_CHECKING(libtermlib) -AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, -LIBS="-lncurses $olibs" -AC_CHECKING(libncurses) -AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, -AC_MSG_ERROR(!!! no tgetent - no screen)))))) - -AC_TRY_RUN([ -main() -{ - exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); -}], AC_NOTE(- you use the termcap database), -AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO)) -AC_CHECKING(ospeed) -AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED)) - -dnl -dnl **** PTY specific things **** -dnl -AC_CHECKING(for /dev/ptc) -if test -r /dev/ptc; then -AC_DEFINE(HAVE_DEV_PTC) -fi - -AC_CHECKING(for SVR4 ptys) -sysvr4ptys= -if test -c /dev/ptmx ; then -AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS) -sysvr4ptys=1]) -fi - -AC_CHECK_FUNCS(getpt) - -dnl check for openpty() -if test -z "$sysvr4ptys"; then -AC_CHECK_FUNCS(openpty,, -[AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])]) -fi - -AC_CHECKING(for ptyranges) -if test -d /dev/ptym ; then -pdir='/dev/ptym' -else -pdir='/dev' -fi -dnl SCO uses ptyp%d -AC_EGREP_CPP(yes, -[#ifdef M_UNIX - yes; -#endif -], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`) -dnl if test -c /dev/ptyp19; then -dnl ptys=`echo /dev/ptyp??` -dnl else -dnl ptys=`echo $pdir/pty??` -dnl fi -if test "$ptys" != "$pdir/pty??" ; then -p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` -p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` -AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0") -AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1") -fi - -dnl **** pty mode/group handling **** -dnl -dnl support provided by Luke Mewburn , 931222 -AC_ARG_WITH(pty-mode, [ --with-pty-mode=mode default mode for ptys], [ ptymode="${withval}" ]) -AC_ARG_WITH(pty-group, [ --with-pty-group=group default group for ptys], [ ptygrp="${withval}" ]) -test -n "$ptymode" || ptymode=0620 -if test -n "$ptygrp" ; then -AC_DEFINE_UNQUOTED(PTYMODE, $ptymode) -AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) -else - -AC_CHECKING(default tty permissions/group) -rm -f conftest_grp -AC_TRY_RUN([ -#include -#include -#include -main() -{ - struct stat sb; - char *x,*ttyname(); - int om, m; - FILE *fp; - - if (!(x = ttyname(0))) exit(1); - if (stat(x, &sb)) exit(1); - om = sb.st_mode; - if (om & 002) exit(0); - m = system("mesg y"); - if (m == -1 || m == 127) exit(1); - if (stat(x, &sb)) exit(1); - m = sb.st_mode; - if (chmod(x, om)) exit(1); - if (m & 002) exit(0); - if (sb.st_gid == getgid()) exit(1); - if (!(fp=fopen("conftest_grp", "w"))) - exit(1); - fprintf(fp, "%d\n", sb.st_gid); - fclose(fp); - exit(0); -} -],[ - if test -f conftest_grp; then - ptygrp=`cat conftest_grp` - AC_NOTE([- pty mode: $ptymode, group: $ptygrp]) - AC_DEFINE_UNQUOTED(PTYMODE, $ptymode) - AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) - else - AC_NOTE(- ptys are world accessable) - fi -],[ - WRITEPATH='' - XTERMPATH='' - AC_PATH_PROG(WRITEPATH, write) - AC_PATH_PROG(XTERMPATH, xterm) - found= - if test -n "$WRITEPATH$XTERMPATH"; then - findfollow= - lsfollow= - found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null` - if test -n "$found"; then - findfollow=-follow - lsfollow=L - fi - if test -n "$XTERMPATH"; then - ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'` - if test tty != "$ptygrpn"; then - XTERMPATH= - fi - fi - fi - if test -n "$WRITEPATH$XTERMPATH"; then - found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print` - if test -n "$found"; then - ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'` - AC_NOTE([- pty mode: $ptymode, group: $ptygrp]) - AC_DEFINE_UNQUOTED(PTYMODE, $ptymode) - AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) - else - AC_NOTE(- ptys are world accessable) - fi - else - AC_NOTE(- can't determine - assume ptys are world accessable) - fi - ] -) -rm -f conftest_grp -fi - -dnl -dnl **** signal handling **** -dnl -if test -n "$posix" ; then - -dnl POSIX has reliable signals with void return type. -AC_NOTE(assuming posix signal definition) -AC_DEFINE(SIGVOID) - -else - -AC_CHECKING(return type of signal handlers) -AC_TRY_COMPILE( -[#include -#include -#ifdef signal -#undef signal -#endif -extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID)) -AC_CHECKING(sigset) -AC_TRY_LINK([ -#include -#include -],[ -#ifdef SIGVOID -sigset(0, (void (*)())0); -#else -sigset(0, (int (*)())0); -#endif -], AC_DEFINE(USESIGSET)) -AC_CHECKING(signal implementation) -AC_TRY_RUN([ -#include -#include - -#ifndef SIGCLD -#define SIGCLD SIGCHLD -#endif -#ifdef USESIGSET -#define signal sigset -#endif - -int got; - -#ifdef SIGVOID -void -#endif -hand() -{ - got++; -} - -main() -{ - /* on hpux we use sigvec to get bsd signals */ -#ifdef __hpux - (void)signal(SIGCLD, hand); - kill(getpid(), SIGCLD); - kill(getpid(), SIGCLD); - if (got < 2) - exit(1); -#endif - exit(0); -} -],,AC_DEFINE(SYSVSIGS)) - -fi - -AC_OUTPUT(Makefile) diff --git a/readline/examples/rlfe/extern.h b/readline/examples/rlfe/extern.h deleted file mode 100644 index 2cace2c9c2e..00000000000 --- a/readline/examples/rlfe/extern.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 1993-2002 - * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) - * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) - * Copyright (c) 1987 Oliver Laumann - * - * 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 (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - **************************************************************** - * $Id$ FAU - */ - -#if !defined(__GNUC__) || __GNUC__ < 2 -#undef __attribute__ -#define __attribute__(x) -#endif - -/* pty.c */ -extern int OpenPTY __P((char **)); -extern void InitPTY __P((int)); - diff --git a/readline/examples/rlfe/os.h b/readline/examples/rlfe/os.h deleted file mode 100644 index 1994fe62409..00000000000 --- a/readline/examples/rlfe/os.h +++ /dev/null @@ -1,530 +0,0 @@ -/* Copyright (c) 1993-2002 - * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) - * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) - * Copyright (c) 1987 Oliver Laumann - * - * 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 (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - **************************************************************** - * $Id$ FAU - */ - -#include -#include - -#include - -/* In strict ANSI mode, HP-UX machines define __hpux but not hpux */ -#if defined(__hpux) && !defined(hpux) -# define hpux -#endif - -#if defined(__bsdi__) || defined(__386BSD__) || defined(_CX_UX) || defined(hpux) || defined(_IBMR2) || defined(linux) -# include -#endif /* __bsdi__ || __386BSD__ || _CX_UX || hpux || _IBMR2 || linux */ - -#ifdef ISC -# ifdef ENAMETOOLONG -# undef ENAMETOOLONG -# endif -# ifdef ENOTEMPTY -# undef ENOTEMPTY -# endif -# include -# include -#endif - -#ifdef sun -# define getpgrp __getpgrp -# define exit __exit -#endif -#ifdef POSIX -# include -# if defined(__STDC__) -# include -# endif /* __STDC__ */ -#endif /* POSIX */ -#ifdef sun -# undef getpgrp -# undef exit -#endif /* sun */ - -#ifndef linux /* all done in */ -extern int errno; -#endif /* linux */ -#ifndef HAVE_STRERROR -/* No macros, please */ -#undef strerror -#endif - -#if !defined(SYSV) && !defined(linux) -# ifdef NEWSOS -# define strlen ___strlen___ -# include -# undef strlen -# else /* NEWSOS */ -# include -# endif /* NEWSOS */ -#else /* SYSV */ -# if defined(SVR4) || defined(NEWSOS) -# define strlen ___strlen___ -# include -# undef strlen -# if !defined(NEWSOS) && !defined(__hpux) - extern size_t strlen(const char *); -# endif -# else /* SVR4 */ -# include -# endif /* SVR4 */ -#endif /* SYSV */ - -#ifdef USEVARARGS -# if defined(__STDC__) -# include -# define VA_LIST(var) va_list var; -# define VA_DOTS ... -# define VA_DECL -# define VA_START(ap, fmt) va_start(ap, fmt) -# define VA_ARGS(ap) ap -# define VA_END(ap) va_end(ap) -# else -# include -# define VA_LIST(var) va_list var; -# define VA_DOTS va_alist -# define VA_DECL va_dcl -# define VA_START(ap, fmt) va_start(ap) -# define VA_ARGS(ap) ap -# define VA_END(ap) va_end(ap) -# endif -#else -# define VA_LIST(var) -# define VA_DOTS p1, p2, p3, p4, p5, p6 -# define VA_DECL unsigned long VA_DOTS; -# define VA_START(ap, fmt) -# define VA_ARGS(ap) VA_DOTS -# define VA_END(ap) -# undef vsnprintf -# define vsnprintf xsnprintf -#endif - -#if !defined(sun) && !defined(B43) && !defined(ISC) && !defined(pyr) && !defined(_CX_UX) -# include -#endif -#include - -#ifdef M_UNIX /* SCO */ -# include -# include -# define ftruncate(fd, s) chsize(fd, s) -#endif - -#ifdef SYSV -# define index strchr -# define rindex strrchr -# define bzero(poi,len) memset(poi,0,len) -# define bcmp memcmp -# define killpg(pgrp,sig) kill( -(pgrp), sig) -#endif - -#ifndef HAVE_GETCWD -# define getcwd(b,l) getwd(b) -#endif - -#ifndef USEBCOPY -# ifdef USEMEMMOVE -# define bcopy(s,d,len) memmove(d,s,len) -# else -# ifdef USEMEMCPY -# define bcopy(s,d,len) memcpy(d,s,len) -# else -# define NEED_OWN_BCOPY -# define bcopy xbcopy -# endif -# endif -#endif - -#ifdef hpux -# define setreuid(ruid, euid) setresuid(ruid, euid, -1) -# define setregid(rgid, egid) setresgid(rgid, egid, -1) -#endif - -#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID) -# define USE_SETEUID -#endif - -#if !defined(HAVE__EXIT) && !defined(_exit) -#define _exit(x) exit(x) -#endif - -#ifndef HAVE_UTIMES -# define utimes utime -#endif - -#ifdef BUILTIN_TELNET -# include -# include -#endif - -#if defined(USE_LOCALE) && (!defined(HAVE_SETLOCALE) || !defined(HAVE_STRFTIME)) -# undef USE_LOCALE -#endif - -/***************************************************************** - * terminal handling - */ - -#ifdef POSIX -# include -# ifdef hpux -# include -# endif /* hpux */ -# ifdef NCCS -# define MAXCC NCCS -# else -# define MAXCC 256 -# endif -#else /* POSIX */ -# ifdef TERMIO -# include -# ifdef NCC -# define MAXCC NCC -# else -# define MAXCC 256 -# endif -# ifdef CYTERMIO -# include -# endif -# else /* TERMIO */ -# include -# endif /* TERMIO */ -#endif /* POSIX */ - -#ifndef VDISABLE -# ifdef _POSIX_VDISABLE -# define VDISABLE _POSIX_VDISABLE -# else -# define VDISABLE 0377 -# endif /* _POSIX_VDISABLE */ -#endif /* !VDISABLE */ - - -/* on sgi, regardless of the stream head's read mode (RNORM/RMSGN/RMSGD) - * TIOCPKT mode causes data loss if our buffer is too small (IOSIZE) - * to hold the whole packet at first read(). - * (Marc Boucher) - * - * matthew green: - * TIOCPKT is broken on dgux 5.4.1 generic AViiON mc88100 - * - * Joe Traister: On AIX4, programs like irc won't work if screen - * uses TIOCPKT (select fails to return on pty read). - */ -#if defined(sgi) || defined(DGUX) || defined(_IBMR2) -# undef TIOCPKT -#endif - -/* linux ncurses is broken, we have to use our own tputs */ -#if defined(linux) && defined(TERMINFO) -# define tputs xtputs -#endif - -/* Alexandre Oliva: SVR4 style ptys don't work with osf */ -#ifdef __osf__ -# undef HAVE_SVR4_PTYS -#endif - -/***************************************************************** - * utmp handling - */ - -#ifdef GETUTENT - typedef char *slot_t; -#else - typedef int slot_t; -#endif - -#if defined(UTMPOK) || defined(BUGGYGETLOGIN) -# if defined(SVR4) && !defined(DGUX) && !defined(__hpux) && !defined(linux) -# include -# define UTMPFILE UTMPX_FILE -# define utmp utmpx -# define getutent getutxent -# define getutid getutxid -# define getutline getutxline -# define pututline pututxline -# define setutent setutxent -# define endutent endutxent -# define ut_time ut_xtime -# else /* SVR4 */ -# include -# endif /* SVR4 */ -# ifdef apollo - /* - * We don't have GETUTENT, so we dig into utmp ourselves. - * But we save the permanent filedescriptor and - * open utmp just when we need to. - * This code supports an unsorted utmp. jw. - */ -# define UTNOKEEP -# endif /* apollo */ - -# ifndef UTMPFILE -# ifdef UTMP_FILE -# define UTMPFILE UTMP_FILE -# else -# ifdef _PATH_UTMP -# define UTMPFILE _PATH_UTMP -# else -# define UTMPFILE "/etc/utmp" -# endif /* _PATH_UTMP */ -# endif -# endif - -#endif /* UTMPOK || BUGGYGETLOGIN */ - -#if !defined(UTMPOK) && defined(USRLIMIT) -# undef USRLIMIT -#endif - -#ifdef LOGOUTOK -# ifndef LOGINDEFAULT -# define LOGINDEFAULT 0 -# endif -#else -# ifdef LOGINDEFAULT -# undef LOGINDEFAULT -# endif -# define LOGINDEFAULT 1 -#endif - - -/***************************************************************** - * file stuff - */ - -#ifndef F_OK -#define F_OK 0 -#endif -#ifndef X_OK -#define X_OK 1 -#endif -#ifndef W_OK -#define W_OK 2 -#endif -#ifndef R_OK -#define R_OK 4 -#endif - -#ifndef S_IFIFO -#define S_IFIFO 0010000 -#endif -#ifndef S_IREAD -#define S_IREAD 0000400 -#endif -#ifndef S_IWRITE -#define S_IWRITE 0000200 -#endif -#ifndef S_IEXEC -#define S_IEXEC 0000100 -#endif - -#if defined(S_IFIFO) && defined(S_IFMT) && !defined(S_ISFIFO) -#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) -#endif -#if defined(S_IFSOCK) && defined(S_IFMT) && !defined(S_ISSOCK) -#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) -#endif -#if defined(S_IFCHR) && defined(S_IFMT) && !defined(S_ISCHR) -#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) -#endif -#if defined(S_IFDIR) && defined(S_IFMT) && !defined(S_ISDIR) -#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) -#endif -#if defined(S_IFLNK) && defined(S_IFMT) && !defined(S_ISLNK) -#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) -#endif - -/* - * SunOS 4.1.3: `man 2V open' has only one line that mentions O_NOBLOCK: - * - * O_NONBLOCK Same as O_NDELAY above. - * - * on the very same SunOS 4.1.3, I traced the open system call and found - * that an open("/dev/ttyy08", O_RDWR|O_NONBLOCK|O_NOCTTY) was blocked, - * whereas open("/dev/ttyy08", O_RDWR|O_NDELAY |O_NOCTTY) went through. - * - * For this simple reason I now favour O_NDELAY. jw. 4.5.95 - */ -#if defined(sun) && !defined(SVR4) -# undef O_NONBLOCK -#endif - -#if !defined(O_NONBLOCK) && defined(O_NDELAY) -# define O_NONBLOCK O_NDELAY -#endif - -#if !defined(FNBLOCK) && defined(FNONBLOCK) -# define FNBLOCK FNONBLOCK -#endif -#if !defined(FNBLOCK) && defined(FNDELAY) -# define FNBLOCK FNDELAY -#endif -#if !defined(FNBLOCK) && defined(O_NONBLOCK) -# define FNBLOCK O_NONBLOCK -#endif - -#ifndef POSIX -#undef mkfifo -#define mkfifo(n,m) mknod(n,S_IFIFO|(m),0) -#endif - -#if !defined(HAVE_LSTAT) && !defined(lstat) -# define lstat stat -#endif - -/***************************************************************** - * signal handling - */ - -#ifdef SIGVOID -# define SIGRETURN -# define sigret_t void -#else -# define SIGRETURN return 0; -# define sigret_t int -#endif - -/* Geeeee, reverse it? */ -#if defined(SVR4) || (defined(SYSV) && defined(ISC)) || defined(_AIX) || defined(linux) || defined(ultrix) || defined(__386BSD__) || defined(__bsdi__) || defined(POSIX) || defined(NeXT) -# define SIGHASARG -#endif - -#ifdef SIGHASARG -# define SIGPROTOARG (int) -# define SIGDEFARG (sigsig) int sigsig; -# define SIGARG 0 -#else -# define SIGPROTOARG (void) -# define SIGDEFARG () -# define SIGARG -#endif - -#ifndef SIGCHLD -#define SIGCHLD SIGCLD -#endif - -#if defined(POSIX) || defined(hpux) -# define signal xsignal -#else -# ifdef USESIGSET -# define signal sigset -# endif /* USESIGSET */ -#endif - -/* used in screen.c and attacher.c */ -#ifndef NSIG /* kbeal needs these w/o SYSV */ -# define NSIG 32 -#endif /* !NSIG */ - - -/***************************************************************** - * Wait stuff - */ - -#if (!defined(sysV68) && !defined(M_XENIX)) || defined(NeXT) || defined(M_UNIX) -# include -#endif - -#ifndef WTERMSIG -# ifndef BSDWAIT /* if wait is NOT a union: */ -# define WTERMSIG(status) (status & 0177) -# else -# define WTERMSIG(status) status.w_T.w_Termsig -# endif -#endif - -#ifndef WSTOPSIG -# ifndef BSDWAIT /* if wait is NOT a union: */ -# define WSTOPSIG(status) ((status >> 8) & 0377) -# else -# define WSTOPSIG(status) status.w_S.w_Stopsig -# endif -#endif - -/* NET-2 uses WCOREDUMP */ -#if defined(WCOREDUMP) && !defined(WIFCORESIG) -# define WIFCORESIG(status) WCOREDUMP(status) -#endif - -#ifndef WIFCORESIG -# ifndef BSDWAIT /* if wait is NOT a union: */ -# define WIFCORESIG(status) (status & 0200) -# else -# define WIFCORESIG(status) status.w_T.w_Coredump -# endif -#endif - -#ifndef WEXITSTATUS -# ifndef BSDWAIT /* if wait is NOT a union: */ -# define WEXITSTATUS(status) ((status >> 8) & 0377) -# else -# define WEXITSTATUS(status) status.w_T.w_Retcode -# endif -#endif - - -/***************************************************************** - * select stuff - */ - -#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_) -#include /* for timeval + FD... */ -#endif - -/* - * SunOS 3.5 - Tom Schmidt - Micron Semiconductor, Inc - 27-Jul-93 - * tschmidt@vax.micron.com - */ -#ifndef FD_SET -# ifndef SUNOS3 -typedef struct fd_set { int fds_bits[1]; } fd_set; -# endif -# define FD_ZERO(fd) ((fd)->fds_bits[0] = 0) -# define FD_SET(b, fd) ((fd)->fds_bits[0] |= 1 << (b)) -# define FD_ISSET(b, fd) ((fd)->fds_bits[0] & 1 << (b)) -# define FD_SETSIZE 32 -#endif - - -/***************************************************************** - * user defineable stuff - */ - -#ifndef TERMCAP_BUFSIZE -# define TERMCAP_BUFSIZE 2048 -#endif - -#ifndef MAXPATHLEN -# define MAXPATHLEN 1024 -#endif - -/* - * you may try to vary this value. Use low values if your (VMS) system - * tends to choke when pasting. Use high values if you want to test - * how many characters your pty's can buffer. - */ -#define IOSIZE 4096 - diff --git a/readline/examples/rlfe/pty.c b/readline/examples/rlfe/pty.c deleted file mode 100644 index f89d44ca8cc..00000000000 --- a/readline/examples/rlfe/pty.c +++ /dev/null @@ -1,387 +0,0 @@ -/* Copyright (c) 1993-2002 - * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) - * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) - * Copyright (c) 1987 Oliver Laumann - * - * 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 (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - **************************************************************** - */ - -#include -#include -#include -#include - -#include "config.h" -#include "screen.h" - -#ifndef sun -# include -#endif - -/* for solaris 2.1, Unixware (SVR4.2) and possibly others */ -#ifdef HAVE_SVR4_PTYS -# include -#endif - -#if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL) -# include -#endif - -#ifdef ISC -# include -# include -# include -#endif - -#ifdef sgi -# include -#endif /* sgi */ - -#include "extern.h" - -/* - * if no PTYRANGE[01] is in the config file, we pick a default - */ -#ifndef PTYRANGE0 -# define PTYRANGE0 "qpr" -#endif -#ifndef PTYRANGE1 -# define PTYRANGE1 "0123456789abcdef" -#endif - -/* SVR4 pseudo ttys don't seem to work with SCO-5 */ -#ifdef M_UNIX -# undef HAVE_SVR4_PTYS -#endif - -extern int eff_uid; - -/* used for opening a new pty-pair: */ -static char PtyName[32], TtyName[32]; - -#if !(defined(sequent) || defined(_SEQUENT_) || defined(HAVE_SVR4_PTYS)) -# ifdef hpux -static char PtyProto[] = "/dev/ptym/ptyXY"; -static char TtyProto[] = "/dev/pty/ttyXY"; -# else -# ifdef M_UNIX -static char PtyProto[] = "/dev/ptypXY"; -static char TtyProto[] = "/dev/ttypXY"; -# else -static char PtyProto[] = "/dev/ptyXY"; -static char TtyProto[] = "/dev/ttyXY"; -# endif -# endif /* hpux */ -#endif - -static void initmaster __P((int)); - -#if defined(sun) -/* sun's utmp_update program opens the salve side, thus corrupting - */ -int pty_preopen = 1; -#else -int pty_preopen = 0; -#endif - -/* - * Open all ptys with O_NOCTTY, just to be on the safe side - * (RISCos mips breaks otherwise) - */ -#ifndef O_NOCTTY -# define O_NOCTTY 0 -#endif - -/***************************************************************/ - -static void -initmaster(f) -int f; -{ -#ifdef POSIX - tcflush(f, TCIOFLUSH); -#else -# ifdef TIOCFLUSH - (void) ioctl(f, TIOCFLUSH, (char *) 0); -# endif -#endif -#ifdef LOCKPTY - (void) ioctl(f, TIOCEXCL, (char *) 0); -#endif -} - -void -InitPTY(f) -int f; -{ - if (f < 0) - return; -#if defined(I_PUSH) && defined(HAVE_SVR4_PTYS) && !defined(sgi) && !defined(linux) && !defined(__osf__) && !defined(M_UNIX) - if (ioctl(f, I_PUSH, "ptem")) - Panic(errno, "InitPTY: cannot I_PUSH ptem"); - if (ioctl(f, I_PUSH, "ldterm")) - Panic(errno, "InitPTY: cannot I_PUSH ldterm"); -# ifdef sun - if (ioctl(f, I_PUSH, "ttcompat")) - Panic(errno, "InitPTY: cannot I_PUSH ttcompat"); -# endif -#endif -} - -/***************************************************************/ - -#if defined(OSX) && !defined(PTY_DONE) -#define PTY_DONE -int -OpenPTY(ttyn) -char **ttyn; -{ - register int f; - if ((f = open_controlling_pty(TtyName)) < 0) - return -1; - initmaster(f); - *ttyn = TtyName; - return f; -} -#endif - -/***************************************************************/ - -#if (defined(sequent) || defined(_SEQUENT_)) && !defined(PTY_DONE) -#define PTY_DONE -int -OpenPTY(ttyn) -char **ttyn; -{ - char *m, *s; - register int f; - - if ((f = getpseudotty(&s, &m)) < 0) - return -1; -#ifdef _SEQUENT_ - fvhangup(s); -#endif - strncpy(PtyName, m, sizeof(PtyName)); - strncpy(TtyName, s, sizeof(TtyName)); - initmaster(f); - *ttyn = TtyName; - return f; -} -#endif - -/***************************************************************/ - -#if defined(__sgi) && !defined(PTY_DONE) -#define PTY_DONE -int -OpenPTY(ttyn) -char **ttyn; -{ - int f; - char *name, *_getpty(); - sigret_t (*sigcld)__P(SIGPROTOARG); - - /* - * SIGCHLD set to SIG_DFL for _getpty() because it may fork() and - * exec() /usr/adm/mkpts - */ - sigcld = signal(SIGCHLD, SIG_DFL); - name = _getpty(&f, O_RDWR | O_NONBLOCK, 0600, 0); - signal(SIGCHLD, sigcld); - - if (name == 0) - return -1; - initmaster(f); - *ttyn = name; - return f; -} -#endif - -/***************************************************************/ - -#if defined(MIPS) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE) -#define PTY_DONE -int -OpenPTY(ttyn) -char **ttyn; -{ - register int f; - struct stat buf; - - strcpy(PtyName, "/dev/ptc"); - if ((f = open(PtyName, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) - return -1; - if (fstat(f, &buf) < 0) - { - close(f); - return -1; - } - sprintf(TtyName, "/dev/ttyq%d", minor(buf.st_rdev)); - initmaster(f); - *ttyn = TtyName; - return f; -} -#endif - -/***************************************************************/ - -#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) -#define PTY_DONE -int -OpenPTY(ttyn) -char **ttyn; -{ - register int f; - char *m, *ptsname(); - int unlockpt __P((int)), grantpt __P((int)); -#if defined(HAVE_GETPT) && defined(linux) - int getpt __P((void)); -#endif - sigret_t (*sigcld)__P(SIGPROTOARG); - - strcpy(PtyName, "/dev/ptmx"); -#if defined(HAVE_GETPT) && defined(linux) - if ((f = getpt()) == -1) -#else - if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1) -#endif - return -1; - - /* - * SIGCHLD set to SIG_DFL for grantpt() because it fork()s and - * exec()s pt_chmod - */ - sigcld = signal(SIGCHLD, SIG_DFL); - if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f)) - { - signal(SIGCHLD, sigcld); - close(f); - return -1; - } - signal(SIGCHLD, sigcld); - strncpy(TtyName, m, sizeof(TtyName)); - initmaster(f); - *ttyn = TtyName; - return f; -} -#endif - -/***************************************************************/ - -#if defined(_AIX) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE) -#define PTY_DONE - -int -OpenPTY(ttyn) -char **ttyn; -{ - register int f; - - /* a dumb looking loop replaced by mycrofts code: */ - strcpy (PtyName, "/dev/ptc"); - if ((f = open (PtyName, O_RDWR | O_NOCTTY)) < 0) - return -1; - strncpy(TtyName, ttyname(f), sizeof(TtyName)); - if (eff_uid && access(TtyName, R_OK | W_OK)) - { - close(f); - return -1; - } - initmaster(f); -# ifdef _IBMR2 - pty_preopen = 1; -# endif - *ttyn = TtyName; - return f; -} -#endif - -/***************************************************************/ - -#if defined(HAVE_OPENPTY) && !defined(PTY_DONE) -#define PTY_DONE -int -OpenPTY(ttyn) -char **ttyn; -{ - int f, s; - if (openpty(&f, &s, TtyName, NULL, NULL) != 0) - return -1; - close(s); - initmaster(f); - pty_preopen = 1; - *ttyn = TtyName; - return f; -} -#endif - -/***************************************************************/ - -#ifndef PTY_DONE -int -OpenPTY(ttyn) -char **ttyn; -{ - register char *p, *q, *l, *d; - register int f; - - debug("OpenPTY: Using BSD style ptys.\n"); - strcpy(PtyName, PtyProto); - strcpy(TtyName, TtyProto); - for (p = PtyName; *p != 'X'; p++) - ; - for (q = TtyName; *q != 'X'; q++) - ; - for (l = PTYRANGE0; (*p = *l) != '\0'; l++) - { - for (d = PTYRANGE1; (p[1] = *d) != '\0'; d++) - { - debug1("OpenPTY tries '%s'\n", PtyName); - if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1) - continue; - q[0] = *l; - q[1] = *d; - if (eff_uid && access(TtyName, R_OK | W_OK)) - { - close(f); - continue; - } -#if defined(sun) && defined(TIOCGPGRP) && !defined(SUNOS3) - /* Hack to ensure that the slave side of the pty is - * unused. May not work in anything other than SunOS4.1 - */ - { - int pgrp; - - /* tcgetpgrp does not work (uses TIOCGETPGRP)! */ - if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO) - { - close(f); - continue; - } - } -#endif - initmaster(f); - *ttyn = TtyName; - return f; - } - } - return -1; -} -#endif - diff --git a/readline/examples/rlfe/rlfe.c b/readline/examples/rlfe/rlfe.c deleted file mode 100644 index 6d747dcb42e..00000000000 --- a/readline/examples/rlfe/rlfe.c +++ /dev/null @@ -1,780 +0,0 @@ -/* A front-end using readline to "cook" input lines. - * - * Copyright (C) 2004, 1999 Per Bothner - * - * This front-end 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. - * - * Some code from Johnson & Troan: "Linux Application Development" - * (Addison-Wesley, 1998) was used directly or for inspiration. - * - * 2003-11-07 Wolfgang Taeuber - * Specify a history file and the size of the history file with command - * line options; use EDITOR/VISUAL to set vi/emacs preference. - */ - -/* PROBLEMS/TODO: - * - * Only tested under GNU/Linux and Mac OS 10.x; needs to be ported. - * - * Switching between line-editing-mode vs raw-char-mode depending on - * what tcgetattr returns is inherently not robust, plus it doesn't - * work when ssh/telnetting in. A better solution is possible if the - * tty system can send in-line escape sequences indicating the current - * mode, echo'd input, etc. That would also allow a user preference - * to set different colors for prompt, input, stdout, and stderr. - * - * When running mc -c under the Linux console, mc does not recognize - * mouse clicks, which mc does when not running under rlfe. - * - * Pasting selected text containing tabs is like hitting the tab character, - * which invokes readline completion. We don't want this. I don't know - * if this is fixable without integrating rlfe into a terminal emulator. - * - * Echo suppression is a kludge, but can only be avoided with better kernel - * support: We need a tty mode to disable "real" echoing, while still - * letting the inferior think its tty driver to doing echoing. - * Stevens's book claims SCR$ and BSD4.3+ have TIOCREMOTE. - * - * The latest readline may have some hooks we can use to avoid having - * to back up the prompt. (See HAVE_ALREADY_PROMPTED.) - * - * Desirable readline feature: When in cooked no-echo mode (e.g. password), - * echo characters are they are types with '*', but remove them when done. - * - * Asynchronous output while we're editing an input line should be - * inserted in the output view *before* the input line, so that the - * lines being edited (with the prompt) float at the end of the input. - * - * A "page mode" option to emulate more/less behavior: At each page of - * output, pause for a user command. This required parsing the output - * to keep track of line lengths. It also requires remembering the - * output, if we want an option to scroll back, which suggests that - * this should be integrated with a terminal emulator like xterm. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "config.h" - -#ifdef READLINE_LIBRARY -# include "readline.h" -# include "history.h" -#else -# include -# include -#endif - -#ifndef COMMAND -#define COMMAND "/bin/bash" -#endif -#ifndef COMMAND_ARGS -#define COMMAND_ARGS COMMAND -#endif - -#ifndef ALT_COMMAND -#define ALT_COMMAND "/bin/sh" -#endif -#ifndef ALT_COMMAND_ARGS -#define ALT_COMMAND_ARGS ALT_COMMAND -#endif - -#ifndef HAVE_MEMMOVE -# if __GNUC__ > 1 -# define memmove(d, s, n) __builtin_memcpy(d, s, n) -# else -# define memmove(d, s, n) memcpy(d, s, n) -# endif -#else -# define memmove(d, s, n) memcpy(d, s, n) -#endif - -#define APPLICATION_NAME "rlfe" - -static int in_from_inferior_fd; -static int out_to_inferior_fd; -static void set_edit_mode (); -static void usage_exit (); -static char *hist_file = 0; -static int hist_size = 0; - -/* Unfortunately, we cannot safely display echo from the inferior process. - The reason is that the echo bit in the pty is "owned" by the inferior, - and if we try to turn it off, we could confuse the inferior. - Thus, when echoing, we get echo twice: First readline echoes while - we're actually editing. Then we send the line to the inferior, and the - terminal driver send back an extra echo. - The work-around is to remember the input lines, and when we see that - line come back, we supress the output. - A better solution (supposedly available on SVR4) would be a smarter - terminal driver, with more flags ... */ -#define ECHO_SUPPRESS_MAX 1024 -char echo_suppress_buffer[ECHO_SUPPRESS_MAX]; -int echo_suppress_start = 0; -int echo_suppress_limit = 0; - -/*#define DEBUG*/ - -#ifdef DEBUG -FILE *logfile = NULL; -#define DPRINT0(FMT) (fprintf(logfile, FMT), fflush(logfile)) -#define DPRINT1(FMT, V1) (fprintf(logfile, FMT, V1), fflush(logfile)) -#define DPRINT2(FMT, V1, V2) (fprintf(logfile, FMT, V1, V2), fflush(logfile)) -#else -#define DPRINT0(FMT) ((void) 0) /* Do nothing */ -#define DPRINT1(FMT, V1) ((void) 0) /* Do nothing */ -#define DPRINT2(FMT, V1, V2) ((void) 0) /* Do nothing */ -#endif - -struct termios orig_term; - -/* Pid of child process. */ -static pid_t child = -1; - -static void -sig_child (int signo) -{ - int status; - wait (&status); - if (hist_file != 0) - { - write_history (hist_file); - if (hist_size) - history_truncate_file (hist_file, hist_size); - } - DPRINT0 ("(Child process died.)\n"); - tcsetattr(STDIN_FILENO, TCSANOW, &orig_term); - exit (0); -} - -volatile int propagate_sigwinch = 0; - -/* sigwinch_handler - * propagate window size changes from input file descriptor to - * master side of pty. - */ -void sigwinch_handler(int signal) { - propagate_sigwinch = 1; -} - - -/* get_slave_pty() returns an integer file descriptor. - * If it returns < 0, an error has occurred. - * Otherwise, it has returned the slave file descriptor. - */ - -int get_slave_pty(char *name) { - struct group *gptr; - gid_t gid; - int slave = -1; - - /* chown/chmod the corresponding pty, if possible. - * This will only work if the process has root permissions. - * Alternatively, write and exec a small setuid program that - * does just this. - */ - if ((gptr = getgrnam("tty")) != 0) { - gid = gptr->gr_gid; - } else { - /* if the tty group does not exist, don't change the - * group on the slave pty, only the owner - */ - gid = -1; - } - - /* Note that we do not check for errors here. If this is code - * where these actions are critical, check for errors! - */ - chown(name, getuid(), gid); - /* This code only makes the slave read/writeable for the user. - * If this is for an interactive shell that will want to - * receive "write" and "wall" messages, OR S_IWGRP into the - * second argument below. - */ - chmod(name, S_IRUSR|S_IWUSR); - - /* open the corresponding slave pty */ - slave = open(name, O_RDWR); - return (slave); -} - -/* Certain special characters, such as ctrl/C, we want to pass directly - to the inferior, rather than letting readline handle them. */ - -static char special_chars[20]; -static int special_chars_count; - -static void -add_special_char(int ch) -{ - if (ch != 0) - special_chars[special_chars_count++] = ch; -} - -static int eof_char; - -static int -is_special_char(int ch) -{ - int i; -#if 0 - if (ch == eof_char && rl_point == rl_end) - return 1; -#endif - for (i = special_chars_count; --i >= 0; ) - if (special_chars[i] == ch) - return 1; - return 0; -} - -static char buf[1024]; -/* buf[0 .. buf_count-1] is the what has been emitted on the current line. - It is used as the readline prompt. */ -static int buf_count = 0; - -int do_emphasize_input = 1; -int current_emphasize_input; - -char *start_input_mode = "\033[1m"; -char *end_input_mode = "\033[0m"; - -int num_keys = 0; - -static void maybe_emphasize_input (int on) -{ - if (on == current_emphasize_input - || (on && ! do_emphasize_input)) - return; - fprintf (rl_outstream, on ? start_input_mode : end_input_mode); - fflush (rl_outstream); - current_emphasize_input = on; -} - -static void -null_prep_terminal (int meta) -{ -} - -static void -null_deprep_terminal () -{ - maybe_emphasize_input (0); -} - -static int -pre_input_change_mode (void) -{ - return 0; -} - -char pending_special_char; - -static void -line_handler (char *line) -{ - if (line == NULL) - { - char buf[1]; - DPRINT0("saw eof!\n"); - buf[0] = '\004'; /* ctrl/d */ - write (out_to_inferior_fd, buf, 1); - } - else - { - static char enter[] = "\r"; - /* Send line to inferior: */ - int length = strlen (line); - if (length > ECHO_SUPPRESS_MAX-2) - { - echo_suppress_start = 0; - echo_suppress_limit = 0; - } - else - { - if (echo_suppress_limit + length > ECHO_SUPPRESS_MAX - 2) - { - if (echo_suppress_limit - echo_suppress_start + length - <= ECHO_SUPPRESS_MAX - 2) - { - memmove (echo_suppress_buffer, - echo_suppress_buffer + echo_suppress_start, - echo_suppress_limit - echo_suppress_start); - echo_suppress_limit -= echo_suppress_start; - echo_suppress_start = 0; - } - else - { - echo_suppress_limit = 0; - } - echo_suppress_start = 0; - } - memcpy (echo_suppress_buffer + echo_suppress_limit, - line, length); - echo_suppress_limit += length; - echo_suppress_buffer[echo_suppress_limit++] = '\r'; - echo_suppress_buffer[echo_suppress_limit++] = '\n'; - } - write (out_to_inferior_fd, line, length); - if (pending_special_char == 0) - { - write (out_to_inferior_fd, enter, sizeof(enter)-1); - if (*line) - add_history (line); - } - free (line); - } - rl_callback_handler_remove (); - buf_count = 0; - num_keys = 0; - if (pending_special_char != 0) - { - write (out_to_inferior_fd, &pending_special_char, 1); - pending_special_char = 0; - } -} - -/* Value of rl_getc_function. - Use this because readline should read from stdin, not rl_instream, - points to the pty (so readline has monitor its terminal modes). */ - -int -my_rl_getc (FILE *dummy) -{ - int ch = rl_getc (stdin); - if (is_special_char (ch)) - { - pending_special_char = ch; - return '\r'; - } - return ch; -} - -int -main(int argc, char** argv) -{ - char *path; - int i; - int master; - char *name; - int in_from_tty_fd; - struct sigaction act; - struct winsize ws; - struct termios t; - int maxfd; - fd_set in_set; - static char empty_string[1] = ""; - char *prompt = empty_string; - int ioctl_err = 0; - int arg_base = 1; - -#ifdef DEBUG - logfile = fopen("/tmp/rlfe.log", "w"); -#endif - - while (arg_base= argc ) - usage_exit(); - switch(argv[arg_base][1]) - { - case 'h': - arg_base++; - hist_file = argv[arg_base]; - break; - case 's': - arg_base++; - hist_size = atoi(argv[arg_base]); - if (hist_size<0) - usage_exit(); - break; - default: - usage_exit(); - } - arg_base++; - } - if (hist_file) - read_history (hist_file); - - set_edit_mode (); - - rl_readline_name = APPLICATION_NAME; - - if ((master = OpenPTY (&name)) < 0) - { - perror("ptypair: could not open master pty"); - exit(1); - } - - DPRINT1("pty name: '%s'\n", name); - - /* set up SIGWINCH handler */ - act.sa_handler = sigwinch_handler; - sigemptyset(&(act.sa_mask)); - act.sa_flags = 0; - if (sigaction(SIGWINCH, &act, NULL) < 0) - { - perror("ptypair: could not handle SIGWINCH "); - exit(1); - } - - if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) < 0) - { - perror("ptypair: could not get window size"); - exit(1); - } - - if ((child = fork()) < 0) - { - perror("cannot fork"); - exit(1); - } - - if (child == 0) - { - int slave; /* file descriptor for slave pty */ - - /* We are in the child process */ - close(master); - -#ifdef TIOCSCTTY - if ((slave = get_slave_pty(name)) < 0) - { - perror("ptypair: could not open slave pty"); - exit(1); - } -#endif - - /* We need to make this process a session group leader, because - * it is on a new PTY, and things like job control simply will - * not work correctly unless there is a session group leader - * and process group leader (which a session group leader - * automatically is). This also disassociates us from our old - * controlling tty. - */ - if (setsid() < 0) - { - perror("could not set session leader"); - } - - /* Tie us to our new controlling tty. */ -#ifdef TIOCSCTTY - if (ioctl(slave, TIOCSCTTY, NULL)) - { - perror("could not set new controlling tty"); - } -#else - if ((slave = get_slave_pty(name)) < 0) - { - perror("ptypair: could not open slave pty"); - exit(1); - } -#endif - - /* make slave pty be standard in, out, and error */ - dup2(slave, STDIN_FILENO); - dup2(slave, STDOUT_FILENO); - dup2(slave, STDERR_FILENO); - - /* at this point the slave pty should be standard input */ - if (slave > 2) - { - close(slave); - } - - /* Try to restore window size; failure isn't critical */ - if (ioctl(STDOUT_FILENO, TIOCSWINSZ, &ws) < 0) - { - perror("could not restore window size"); - } - - /* now start the shell */ - { - static char* command_args[] = { COMMAND_ARGS, NULL }; - static char* alt_command_args[] = { ALT_COMMAND_ARGS, NULL }; - if (argc <= 1) - { - execvp (COMMAND, command_args); - execvp (ALT_COMMAND, alt_command_args); - } - else - execvp (argv[arg_base], &argv[arg_base]); - } - - /* should never be reached */ - exit(1); - } - - /* parent */ - signal (SIGCHLD, sig_child); - - /* Note that we only set termios settings for standard input; - * the master side of a pty is NOT a tty. - */ - tcgetattr(STDIN_FILENO, &orig_term); - - t = orig_term; - eof_char = t.c_cc[VEOF]; - /* add_special_char(t.c_cc[VEOF]);*/ - add_special_char(t.c_cc[VINTR]); - add_special_char(t.c_cc[VQUIT]); - add_special_char(t.c_cc[VSUSP]); -#if defined (VDISCARD) - add_special_char(t.c_cc[VDISCARD]); -#endif - - t.c_lflag &= ~(ICANON | ISIG | ECHO | ECHOCTL | ECHOE | \ - ECHOK | ECHOKE | ECHONL | ECHOPRT ); - t.c_iflag &= ~ICRNL; - t.c_iflag |= IGNBRK; - t.c_cc[VMIN] = 1; - t.c_cc[VTIME] = 0; - tcsetattr(STDIN_FILENO, TCSANOW, &t); - in_from_inferior_fd = master; - out_to_inferior_fd = master; - rl_instream = fdopen (master, "r"); - rl_getc_function = my_rl_getc; - - rl_prep_term_function = null_prep_terminal; - rl_deprep_term_function = null_deprep_terminal; - rl_pre_input_hook = pre_input_change_mode; - rl_callback_handler_install (prompt, line_handler); - - in_from_tty_fd = STDIN_FILENO; - FD_ZERO (&in_set); - maxfd = in_from_inferior_fd > in_from_tty_fd ? in_from_inferior_fd - : in_from_tty_fd; - for (;;) - { - int num; - FD_SET (in_from_inferior_fd, &in_set); - FD_SET (in_from_tty_fd, &in_set); - - num = select(maxfd+1, &in_set, NULL, NULL, NULL); - - if (propagate_sigwinch) - { - struct winsize ws; - if (ioctl (STDIN_FILENO, TIOCGWINSZ, &ws) >= 0) - { - ioctl (master, TIOCSWINSZ, &ws); - } - propagate_sigwinch = 0; - continue; - } - - if (num <= 0) - { - perror ("select"); - exit (-1); - } - if (FD_ISSET (in_from_tty_fd, &in_set)) - { - extern int readline_echoing_p; - struct termios term_master; - int do_canon = 1; - int do_icrnl = 1; - int ioctl_ret; - - DPRINT1("[tty avail num_keys:%d]\n", num_keys); - - /* If we can't get tty modes for the master side of the pty, we - can't handle non-canonical-mode programs. Always assume the - master is in canonical echo mode if we can't tell. */ - ioctl_ret = tcgetattr(master, &term_master); - - if (ioctl_ret >= 0) - { - do_canon = (term_master.c_lflag & ICANON) != 0; - do_icrnl = (term_master.c_lflag & ICRNL) != 0; - readline_echoing_p = (term_master.c_lflag & ECHO) != 0; - DPRINT1 ("echo,canon,crnl:%03d\n", - 100 * readline_echoing_p - + 10 * do_canon - + 1 * do_icrnl); - } - else - { - if (ioctl_err == 0) - DPRINT1("tcgetattr on master fd failed: errno = %d\n", errno); - ioctl_err = 1; - } - - if (do_canon == 0 && num_keys == 0) - { - char ch[10]; - int count = read (STDIN_FILENO, ch, sizeof(ch)); - DPRINT1("[read %d chars from stdin: ", count); - DPRINT2(" \"%.*s\"]\n", count, ch); - if (do_icrnl) - { - int i = count; - while (--i >= 0) - { - if (ch[i] == '\r') - ch[i] = '\n'; - } - } - maybe_emphasize_input (1); - write (out_to_inferior_fd, ch, count); - } - else - { - if (num_keys == 0) - { - int i; - /* Re-install callback handler for new prompt. */ - if (prompt != empty_string) - free (prompt); - if (prompt == NULL) - { - DPRINT0("New empty prompt\n"); - prompt = empty_string; - } - else - { - if (do_emphasize_input && buf_count > 0) - { - prompt = malloc (buf_count + strlen (end_input_mode) - + strlen (start_input_mode) + 5); - sprintf (prompt, "\001%s\002%.*s\001%s\002", - end_input_mode, - buf_count, buf, - start_input_mode); - } - else - { - prompt = malloc (buf_count + 1); - memcpy (prompt, buf, buf_count); - prompt[buf_count] = '\0'; - } - DPRINT1("New prompt '%s'\n", prompt); -#if 0 /* ifdef HAVE_RL_ALREADY_PROMPTED */ - /* Doesn't quite work when do_emphasize_input is 1. */ - rl_already_prompted = buf_count > 0; -#else - if (buf_count > 0) - write (1, "\r", 1); -#endif - } - - rl_callback_handler_install (prompt, line_handler); - } - num_keys++; - maybe_emphasize_input (1); - rl_callback_read_char (); - } - } - else /* output from inferior. */ - { - int i; - int count; - int old_count; - if (buf_count > (sizeof(buf) >> 2)) - buf_count = 0; - count = read (in_from_inferior_fd, buf+buf_count, - sizeof(buf) - buf_count); - DPRINT2("read %d from inferior, buf_count=%d", count, buf_count); - DPRINT2(": \"%.*s\"", count, buf+buf_count); - maybe_emphasize_input (0); - if (count <= 0) - { - DPRINT0 ("(Connection closed by foreign host.)\n"); - tcsetattr(STDIN_FILENO, TCSANOW, &orig_term); - exit (0); - } - old_count = buf_count; - - /* Look for any pending echo that we need to suppress. */ - while (echo_suppress_start < echo_suppress_limit - && count > 0 - && buf[buf_count] == echo_suppress_buffer[echo_suppress_start]) - { - count--; - buf_count++; - echo_suppress_start++; - } - DPRINT1("suppressed %d characters of echo.\n", buf_count-old_count); - - /* Write to the terminal anything that was not suppressed. */ - if (count > 0) - write (1, buf + buf_count, count); - - /* Finally, look for a prompt candidate. - * When we get around to going input (from the keyboard), - * we will consider the prompt to be anything since the last - * line terminator. So we need to save that text in the - * initial part of buf. However, anything before the - * most recent end-of-line is not interesting. */ - buf_count += count; -#if 1 - for (i = buf_count; --i >= old_count; ) -#else - for (i = buf_count - 1; i-- >= buf_count - count; ) -#endif - { - if (buf[i] == '\n' || buf[i] == '\r') - { - i++; - memmove (buf, buf+i, buf_count - i); - buf_count -= i; - break; - } - } - DPRINT2("-> i: %d, buf_count: %d\n", i, buf_count); - } - } -} - -static void set_edit_mode () -{ - int vi = 0; - char *shellopts; - - shellopts = getenv ("SHELLOPTS"); - while (shellopts != 0) - { - if (strncmp ("vi", shellopts, 2) == 0) - { - vi = 1; - break; - } - shellopts = index (shellopts + 1, ':'); - } - - if (!vi) - { - if (getenv ("EDITOR") != 0) - vi |= strcmp (getenv ("EDITOR"), "vi") == 0; - } - - if (vi) - rl_variable_bind ("editing-mode", "vi"); - else - rl_variable_bind ("editing-mode", "emacs"); -} - - -static void usage_exit () -{ - fprintf (stderr, "Usage: rlfe [-h histfile] [-s size] cmd [arg1] [arg2] ...\n\n"); - exit (1); -} diff --git a/readline/examples/rlfe/screen.h b/readline/examples/rlfe/screen.h deleted file mode 100644 index 5b040c3dacf..00000000000 --- a/readline/examples/rlfe/screen.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Dummy header to avoid modifying pty.c */ -#include "os.h" diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 4268294a410..6be4b7e7168 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,9 @@ +2006-04-23 Andreas Schwab + + * Makefile.in (tmp-ld-decode): Fix dependencies. + (tmp-ld-cache): Likewise. + (tmp-ld-insn): Likewise. + 2006-02-01 Mark Mitchell * emul_netbsd.c (emul_netbsd_create): Quote file-name property. diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index 79fec05e057..ff9efee2be6 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -745,17 +745,17 @@ tmp-filter: filter.c $(MISC_H) misc.o ld-decode.o: ld-decode.c $(MISC_H) $(LF_H) $(TABLE_H) $(LD_DECODE_H) $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-decode.c -tmp-ld-decode: ld-decode.o misc.o lf.o table.o filter_host.o +tmp-ld-decode: ld-decode.c misc.o lf.o table.o filter_host.o $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-decode -DMAIN $(srcdir)/ld-decode.c misc.o lf.o table.o filter_host.o $(BUILD_LIBS) ld-cache.o: ld-cache.c $(MISC_H) $(LF_H) $(TABLE_H) $(LD_CACHE_H) $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-cache.c -tmp-ld-cache: ld-cache.o misc.o lf.o table.o filter_host.o +tmp-ld-cache: ld-cache.c misc.o lf.o table.o filter_host.o $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-cache -DMAIN $(srcdir)/ld-cache.c misc.o lf.o table.o filter_host.o $(BUILD_LIBS) ld-insn.o: ld-insn.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-insn.c -tmp-ld-insn: ld-insn.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o +tmp-ld-insn: ld-insn.c ld-cache.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-insn -DMAIN $(srcdir)/ld-insn.c ld-cache.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o $(BUILD_LIBS) gen-model.o: gen-model.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_CACHE_H) $(LD_DECODE_H) $(LD_INSN_H) $(GEN_MODEL_H) diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms deleted file mode 100644 index c41f51f1809..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms +++ /dev/null @@ -1,8 +0,0 @@ -#mach: crisv32 -#sim(crisv32): --hw-device "/rv/host localhost" - -# Check that we trivially resolve a hostname. - -#r @,@srcdir@/trivial4.r - - .include "trivial4.ms" diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms deleted file mode 100644 index f3e6f2e7bee..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms +++ /dev/null @@ -1,69 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" -#sim(crisv32): --hw-device "/rv/trace? true" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000032\n -#output: /rv: := 0xabcdef01\n -#output: /rv: IRQ 0x4\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543211\n -#output: /rv: REG R 0xd0000030\n -#output: /rv: IRQ 0x0\n -#output: /rv: := 0xeeff4455\n -#output: pass\n - -# Trivial test of interrupts. -# Locations of IRQ notifiers above depend on when the simulator is -# polled; adjustments may be needed (after checking that no poll is -# gone due to a bug!) - -#r W, -#r r,a8832,abcdef01 -#r I,4 -#r r,a8836,76543210 -#r r,a8836,76543211 -#r I,0 -#r r,a8830,eeff4455 - - .lcomm dummy,4 - - .include "testutils.inc" - start - .if ..asm.arch.cris.v32 - move irqvec1,$ebp - .else - move irqvec1,$ibr - .endif - test_h_mem 0xabcdef01 0xd0000032 - nop - nop - test_h_mem 0x76543210 0xd0000036 - ei - test_h_mem 0,dummy -wouldreturnhere: - nop -killme: - fail - -returnhere: - test_h_mem 0x76543211 0xd0000036 - test_h_mem 0xeeff4455 0xd0000030 - pass - -irq0x33: - .if ..asm.arch.cris.v32 - test_h_dr wouldreturnhere,$erp - move returnhere,$erp - rete - rfe - .else - move $dccr,$r0 - test_h_dr wouldreturnhere,$irp - move returnhere,$irp - reti - move $r0,$dccr - .endif - - singlevec irqvec1,0x33,irq0x33 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms deleted file mode 100644 index 19709e4d932..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms +++ /dev/null @@ -1,44 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/rv/intmultiple 0xaa" -#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/rv/intmultiple 0xaa" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000032\n -#output: /rv: := 0xabcdef01\n -#output: /rv: IRQ 0xaa\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: REG R 0xd0000030\n -#output: /rv: IRQ 0x0\n -#output: /rv: := 0xeeff4455\n -#output: pass\n - -# Primarily to test multiple-int-bits set in dv-rv.c. - -#r W, -#r r,a8832,abcdef01 -#r I,6 -#r r,a8836,76543210 -#r I,0 -#r r,a8830,eeff4455 - - .lcomm dummy,4 - - .include "testutils.inc" - start - test_h_mem 0xabcdef01 0xd0000032 - .if ..asm.arch.cris.v32 - move irqvec1,$ebp - .else - move irqvec1,$ibr - .endif - ei - test_h_mem 0,dummy -killme: - fail - -irq0xea: - test_h_mem 0x76543210 0xd0000036 - test_h_mem 0xeeff4455 0xd0000030 - pass - - singlevec irqvec1,0xea,irq0xea diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms deleted file mode 100644 index d96b6f542c3..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms +++ /dev/null @@ -1,46 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/rv/intmultiple 0xaa" -#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/rv/intmultiple 0xaa" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000032\n -#output: /rv: := 0xabcdef01\n -#output: /rv: IRQ 0xaa\n -#output: /rv: IRQ 0xaa\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: REG R 0xd0000030\n -#output: /rv: IRQ 0x0\n -#output: /rv: := 0xeeff4455\n -#output: pass\n - -# Much like irq2.ms, but modified to check same-int-port-value-twice. - -#r W, -#r r,a8832,abcdef01 -#r I,6 -#r I,6 -#r r,a8836,76543210 -#r I,0 -#r r,a8830,eeff4455 - - .lcomm dummy,4 - - .include "testutils.inc" - start - test_h_mem 0xabcdef01 0xd0000032 - .if ..asm.arch.cris.v32 - move irqvec1,$ebp - .else - move irqvec1,$ibr - .endif - ei - test_h_mem 0,dummy -killme: - fail - -irq0xea: - test_h_mem 0x76543210 0xd0000036 - test_h_mem 0xeeff4455 0xd0000030 - pass - - singlevec irqvec1,0xea,irq0xea diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms deleted file mode 100644 index 9e16b5c3a0d..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms +++ /dev/null @@ -1,46 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/cris/multiple-int ignore_previous" -#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/cris/multiple-int ignore_previous" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000032\n -#output: /rv: := 0xabcdef01\n -#output: /rv: IRQ 0x4\n -#output: /rv: IRQ 0x8\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: REG R 0xd0000030\n -#output: /rv: IRQ 0x0\n -#output: /rv: := 0xeeff4455\n -#output: pass\n - -# Much like irq3.ms, but modified to test multiple-int ignore_previous. - -#r W, -#r r,a8832,abcdef01 -#r I,4 -#r I,8 -#r r,a8836,76543210 -#r I,0 -#r r,a8830,eeff4455 - - .lcomm dummy,4 - - .include "testutils.inc" - start - test_h_mem 0xabcdef01 0xd0000032 - .if ..asm.arch.cris.v32 - move irqvec1,$ebp - .else - move irqvec1,$ibr - .endif - ei - test_h_mem 0,dummy -killme: - fail - -irq0x34: - test_h_mem 0x76543210 0xd0000036 - test_h_mem 0xeeff4455 0xd0000030 - pass - - singlevec irqvec1,0x34,irq0x34 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms deleted file mode 100644 index 4ecc5a69bac..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms +++ /dev/null @@ -1,46 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/cris/multiple-int 0xae" -#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/cris/multiple-int 0xae" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000032\n -#output: /rv: := 0xabcdef01\n -#output: /rv: IRQ 0x4\n -#output: /rv: IRQ 0x8\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: REG R 0xd0000030\n -#output: /rv: IRQ 0x0\n -#output: /rv: := 0xeeff4455\n -#output: pass\n - -# Much like irq4.ms, but modified to test vector case for multiple-int. - -#r W, -#r r,a8832,abcdef01 -#r I,4 -#r I,8 -#r r,a8836,76543210 -#r I,0 -#r r,a8830,eeff4455 - - .lcomm dummy,4 - - .include "testutils.inc" - start - test_h_mem 0xabcdef01 0xd0000032 - .if ..asm.arch.cris.v32 - move irqvec1,$ebp - .else - move irqvec1,$ibr - .endif - ei - test_h_mem 0,dummy -killme: - fail - -irq0xae: - test_h_mem 0x76543210 0xd0000036 - test_h_mem 0xeeff4455 0xd0000030 - pass - - singlevec irqvec1,0xae,irq0xae diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms deleted file mode 100644 index 9e40f4a58f6..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms +++ /dev/null @@ -1,99 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" -#sim(crisv32): --hw-device "/rv/trace? true" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000032\n -#output: /rv: := 0xabcdef01\n -#output: /rv: IRQ 0x4\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: REG R 0xd0000030\n -#output: /rv: IRQ 0x0\n -#output: /rv: IRQ 0x8\n -#output: /rv: := 0xeeff4455\n -#output: /rv: REG R 0xd0000034\n -#output: /rv: := 0xdd001122\n -#output: /rv: REG R 0xd0000038\n -#output: /rv: := 0xaaeeff44\n -#output: /rv: REG R 0xd000003c\n -#output: /rv: := 0xff445511\n -#output: pass\n - -# Test two successive ints; that flags are disabled when an interrupt -# is taken, and then automatically (or by register restore) enabled at -# return. - -#r W, -#r r,a8832,abcdef01 -#r I,4 -#r r,a8836,76543210 -#r I,0 -#r I,8 -#r r,a8830,eeff4455 -#r r,a8834,dd001122 -#r r,a8838,aaeeff44 -#r r,a883c,ff445511 - - .lcomm dummy,4 - - .include "testutils.inc" - start - test_h_mem 0xabcdef01 0xd0000032 - moveq -1,$r4 - - .if ..asm.arch.cris.v32 - move irqvec1,$ebp - .else - move irqvec1,$ibr - .endif - - ei - test_h_mem 0,dummy - - ; Here after the first interrupt, or perhaps the second interrupt is - ; taken directly; leave it optional. Anyway, the second interrupt - ; should be taken no later than this branch. - test_h_mem 0,dummy - -killme: - fail - -irq0x33: - .if ..asm.arch.cris.v32 - ; Nothing needed to save flags - "shift" should happen, and back at rfe. - .else - ; The missing sim support for interrupt-excluding instructions is matched - ; by the flaw that sim doesn't service interrupts in straight code. - ; So, we can use a sequence that would work on actual hardware. - move $dccr,$r5 - di - .endif - - test_h_mem 0x76543210 0xd0000036 - test_h_mem 0xeeff4455 0xd0000030 - test_h_mem 0xdd001122 0xd0000034 - moveq -22,$r4 - - .if ..asm.arch.cris.v32 - move irqvec2,$ebp - rete - rfe - .else - move irqvec2,$ibr - reti - move $r5,$dccr - .endif - - pass - -irq0x34: - test_h_mem 0xaaeeff44 0xd0000038 - test_h_mem 0xff445511 0xd000003c - cmpq -22,$r4 - bne killme - nop - pass - - singlevec irqvec1,0x33,irq0x33 - - singlevec irqvec2,0x34,irq0x34 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms deleted file mode 100644 index ee0f54c6c7b..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms +++ /dev/null @@ -1,88 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" -#sim(crisv32): --hw-device "/rv/trace? true" -#output: /rv: WD\n -#output: /rv: MBOX H 0x1001d..0x10037\n -#output: /rv: 0x10020: 12 23 34 56 79 8a bd de\n -#output: /rv: 0x10028: fb ad ba db ad 56 78 9a\n -#output: /rv: 0x10030: fd e1 23 45 66 54 32 1a\n -#output: /rv: -> 0x1001d..0x10027\n -#output: /rv: 0x10020: aa 55 77 88 32 10 ee cc\n -#output: /rv: MBOX P 0xfffd..0x1001f\n -#output: /rv: 0x10000: aa 55 12 23 34 56 79 8a\n -#output: /rv: 0x10008: bd de fb ad ba db ad 56\n -#output: /rv: 0x10010: 78 9a fd e1 23 45 66 54\n -#output: /rv: 0x10018: 32 1a ac cb be ed db ed\n -#output: /rv: -> 0xfffd..0x10017\n -#output: /rv: 0x10000: 11 22 56 78 ee dd 12 ab\n -#output: /rv: 0x10008: 55 aa ee 00 42 12 27 98\n -#output: /rv: 0x10010: 88 55 22 33 66 77 22 45\n -#output: /rv: REG R 0xd0000038\n -#output: /rv: := 0x76543211\n -#output: pass\n - -# Trivial test of mailbox commands. - -#r W, -#r i,1b000512233456798abddefbadbadbad56789afde123456654321a -#r o,0b0005aa5577883210eecc -#r i,230006aa5512233456798abddefbadbadbad56789afde123456654321aaccbbeeddbed -#r o,1b000511225678eedd12ab55aaee00421227988855223366772245 -#r r,a8838,76543211 - - .include "testutils.inc" - start - move.w 0x1b,$r0 - move.d 0x1001d,$r1 - move.w $r0,[$r1+] - moveq 5,$r0 - move.b $r0,[$r1] - mvi_h_mem 0x56342312 0x10020 - mvi_h_mem 0xdebd8a79 0x10024 - mvi_h_mem 0xdbbaadfb 0x10028 - mvi_h_mem 0x9a7856ad 0x1002c - mvi_h_mem 0x4523e1fd 0x10030 - mvi_h_mem 0x1a325466 0x10034 - - mvi_h_mem 0x1001d 0xc000f000 - - move.d 0x1001d,$r0 - movu.w [$r0+],$r1 - test_h_gr 0xb $r1 - movu.b [$r0],$r1 - test_h_gr 0x5 $r1 - test_h_mem 0x887755aa 0x10020 - test_h_mem 0xccee1032 0x10024 - - move.w 0x23,$r0 - move.d 0xfffd,$r1 - move.w $r0,[$r1+] - moveq 6,$r0 - move.b $r0,[$r1] - mvi_h_mem 0x231255aa 0x10000 - mvi_h_mem 0x8a795634 0x10004 - mvi_h_mem 0xadfbdebd 0x10008 - mvi_h_mem 0x56addbba 0x1000c - mvi_h_mem 0xe1fd9a78 0x10010 - mvi_h_mem 0x54664523 0x10014 - mvi_h_mem 0xcbac1a32 0x10018 - mvi_h_mem 0xeddbedbe 0x1001c - - mvi_h_mem 0xfffd 0xc000f000 - - move.d 0xfffd,$r0 - movu.w [$r0+],$r1 - test_h_gr 0x1b $r1 - movu.b [$r0],$r1 - test_h_gr 0x6 $r1 - test_h_mem 0x78562211 0x10000 - test_h_mem 0xab12ddee 0x10004 - test_h_mem 0x00eeaa55 0x10008 - test_h_mem 0x98271242 0x1000c - test_h_mem 0x33225588 0x10010 - test_h_mem 0x45227766 0x10014 - - test_h_mem 0x76543211 0xd0000038 - pass - - .fill 65536*2+128,1,0 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms deleted file mode 100644 index ee5c4f566cc..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms +++ /dev/null @@ -1,100 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" -#sim(crisv32): --hw-device "/rv/trace? true" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: DMA W 0x20020..0x2003f\n -#output: /rv: 0x20020: 12 23 34 56\n -#output: /rv: 0x20024: 79 8a bd de\n -#output: /rv: 0x20028: fb ad ba db\n -#output: /rv: 0x2002c: ad 56 78 9a\n -#output: /rv: 0x20030: fd e1 23 45\n -#output: /rv: 0x20034: 66 54 32 1a\n -#output: /rv: 0x20038: ac cb be ed\n -#output: /rv: 0x2003c: db ed aa da\n -#output: /rv: REG R 0xd0000038\n -#output: /rv: := 0x76543211\n -#output: /rv: DMA R 0x20000..0x2001f\n -#output: /rv: 0x20000: aa 55 12 23\n -#output: /rv: 0x20004: 34 56 79 8a\n -#output: /rv: 0x20008: bd de fb ad\n -#output: /rv: 0x2000c: ba db ad 56\n -#output: /rv: 0x20010: 78 9a fd e1\n -#output: /rv: 0x20014: 23 45 66 54\n -#output: /rv: 0x20018: 32 1a ac cb\n -#output: /rv: 0x2001c: be ed db ed\n -#output: /rv: IRQ 0x8\n -#output: /rv: REG R 0xd0000038\n -#output: /rv: := 0x76543212\n -#output: pass\n - -# Trivial test of DMA. - -# Locations of IRQ notifiers above depend on when the simulator is -# polled; adjustments may be needed (after checking that no poll is -# gone due to a bug!) - -#r W, -#r r,a8836,76543210 -#r s,e020,12233456798abddefbadbadbad56789afde123456654321aaccbbeeddbedaada -#r r,a8838,76543211 -#r l,e000,aa5512233456798abddefbadbadbad56789afde123456654321aaccbbeeddbed -#r I,8 -#r r,a8838,76543212 - - .include "testutils.inc" - start - test_h_mem 0x76543210 0xd0000036 - - move.d 0x2003f,$r1 - move.d 0x10000,$r3 -0: - test.b [$r1] - bne 1f - subq 1,$r3 - bne 0b - nop - -1: - test_h_mem 0x56342312 0x20020 - test_h_mem 0xdebd8a79 0x20024 - test_h_mem 0xdbbaadfb 0x20028 - test_h_mem 0x9a7856ad 0x2002c - test_h_mem 0x4523e1fd 0x20030 - test_h_mem 0x1a325466 0x20034 - test_h_mem 0xedbecbac 0x20038 - test_h_mem 0xdaaaeddb 0x2003c - - move.d 0x20020,$r0 - move.d 0x20000,$r1 - move.w 0x55aa,$r2 - move.w $r2,[r1+] - .rept 8 - move.d [$r0+],$r2 - move.d $r2,[$r1+] - .endr - - test_h_mem 0x76543211 0xd0000038 - - .if ..asm.arch.cris.v32 - move irqvec1,$ebp - .else - move irqvec1,$ibr - .endif - ei - move.d 0x100000,$r9 -0: - subq 1,$r9 - bne 0b - nop -killme: - fail - -irq0x34: - test_h_mem 0x76543212 0xd0000038 - pass - - .fill 65536*2+128,1,0 - - singlevec irqvec1,0x34,irq0x34 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms deleted file mode 100644 index b67624964d8..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms +++ /dev/null @@ -1,104 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" -#sim(crisv32): --hw-device "/rv/trace? true" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: DMA W 0x20020..0x20043\n -#output: /rv: 0x20020: 12 23 34 56\n -#output: /rv: 0x20024: 79 8a bd de\n -#output: /rv: 0x20028: fb ad ba db\n -#output: /rv: 0x2002c: ad 56 78 9a\n -#output: /rv: 0x20030: fd e1 23 45\n -#output: /rv: 0x20034: 66 54 32 1a\n -#output: /rv: 0x20038: ac cb be ed\n -#output: /rv: 0x2003c: db ed aa da\n -#output: /rv: 0x20040: 00 aa bb cc\n -#output: /rv: REG R 0xd0000038\n -#output: /rv: := 0x76543211\n -#output: /rv: DMA R 0x20000..0x20023\n -#output: /rv: 0x20000: aa 55 12 23\n -#output: /rv: 0x20004: 34 56 79 8a\n -#output: /rv: 0x20008: bd de fb ad\n -#output: /rv: 0x2000c: ba db ad 56\n -#output: /rv: 0x20010: 78 9a fd e1\n -#output: /rv: 0x20014: 23 45 66 54\n -#output: /rv: 0x20018: 32 1a ac cb\n -#output: /rv: 0x2001c: be ed db ed\n -#output: /rv: 0x20020: aa da 00 aa\n -#output: /rv: IRQ 0x8\n -#output: /rv: REG R 0xd0000038\n -#output: /rv: := 0x76543212\n -#output: pass\n - -# This is a slight variation of mem1.ms just to trig the "buffer needs -# to be malloced for large request size" for the DMA request. - -# Locations of IRQ notifiers above depend on when the simulator is -# polled; adjustments may be needed (after checking that no poll is -# gone due to a bug!) - -#r W, -#r r,a8836,76543210 -#r s,e020,12233456798abddefbadbadbad56789afde123456654321aaccbbeeddbedaada00aabbcc -#r r,a8838,76543211 -#r l,e000,aa5512233456798abddefbadbadbad56789afde123456654321aaccbbeeddbedaada00aa -#r I,8 -#r r,a8838,76543212 - - .include "testutils.inc" - start - test_h_mem 0x76543210 0xd0000036 - - move.d 0x2003f,$r1 - move.d 0x10000,$r3 -0: - test.b [$r1] - bne 1f - subq 1,$r3 - bne 0b - nop - -1: - test_h_mem 0x56342312 0x20020 - test_h_mem 0xdebd8a79 0x20024 - test_h_mem 0xdbbaadfb 0x20028 - test_h_mem 0x9a7856ad 0x2002c - test_h_mem 0x4523e1fd 0x20030 - test_h_mem 0x1a325466 0x20034 - test_h_mem 0xedbecbac 0x20038 - test_h_mem 0xdaaaeddb 0x2003c - test_h_mem 0xccbbaa00 0x20040 - - move.d 0x20020,$r0 - move.d 0x20000,$r1 - move.w 0x55aa,$r2 - move.w $r2,[r1+] - .rept 9 - move.d [$r0+],$r2 - move.d $r2,[$r1+] - .endr - - test_h_mem 0x76543211 0xd0000038 - - .if ..asm.arch.cris.v32 - move irqvec1,$ebp - .else - move irqvec1,$ibr - .endif - ei - move.d 0x100000,$r9 -0: - subq 1,$r9 - bne 0b - nop -killme: - fail - -irq0x34: - test_h_mem 0x76543212 0xd0000038 - pass - - .fill 65536*2+128,1,0 - - singlevec irqvec1,0x34,irq0x34 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms deleted file mode 100644 index baf1ed9de28..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms +++ /dev/null @@ -1,22 +0,0 @@ -#mach: crisv32 -#sim(crisv32): --hw-device "/rv/dummy 0x12" - -# A variant of trivial2.ms to check that the right thing happens when -# we reach the poll function with a dummy device. - - .include "testutils.inc" - start - move.d 0xd0000000,$r0 - move.d [$r0+],$r3 - cmp.d 0x12121212,$r3 - beq ok - nop -bad: - fail -ok: - move.d 0x10000,$r10 -0: - bne 0b - subq 1,$r10 - - pass diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/quit.s b/sim/testsuite/sim/cris/hw/rv-n-cris/quit.s deleted file mode 100644 index 8c1d239bb22..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/quit.s +++ /dev/null @@ -1,4 +0,0 @@ -; Trivial target simulator program that just exits. - .include "testutils.inc" - startnostack - quit diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp b/sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp deleted file mode 100644 index 6f3c8f378a9..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp +++ /dev/null @@ -1,241 +0,0 @@ -# Copyright (C) 2006 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Miscellaneous CRIS simulator testcases in assembly code, testing -# dv-rv.c and dv-cris.c functions. - -# Check whether dv-rv and dv-cris are present. - -proc sim_has_rv_and_cris {} { - global srcdir - global subdir - global SIMFLAGS - global global_as_options - global global_ld_options - global global_sim_options - - # We need to assemble and link a trivial program and pass that, in - # order to test successful exit. - - # A bit of duplication here for the assembling and linking part; - # what we want to do it to run the simulator without affecting the - # PASS/FAIL counters, and we can use e.g. run_sim_test for that. - - if ![info exists global_as_options] { - set global_as_options "" - } - if ![info exists global_ld_options] { - set global_ld_options "" - } - if ![info exists global_sim_options] { - set global_sim_options "" - } - - set comp_output [target_assemble $srcdir/$subdir/quit.s quit.o \ - "-I$srcdir/$subdir $global_as_options"] - - if ![string match "" $comp_output] { - verbose -log "$comp_output" 3 - fail "rv sim test setup (assembling)" - return 0 - } - - set comp_output [target_link quit.o quit.x "$global_ld_options"] - - if ![string match "" $comp_output] { - verbose -log "$comp_output" 3 - fail "rv sim test setup (linking)" - return 0 - } - - set result \ - [sim_run quit.x \ - "$global_sim_options --hw-device rv --hw-device cris --hw-info" \ - "" "" ""] - set return_code [lindex $result 0] - set output [lindex $result 1] - - if { "$return_code" == "pass" } { - return 1 - } - - return 0 -} - -# Similar to slurp_options, but lines are fixed format "^#r ..." (not -# "^#{ws}*r:{ws}+" to avoid intruding on slurp_options syntax). Only -# trailing whitespace of the "..." is trimmed. Beware that lines -# including parameters may not contain ":". - -proc slurp_rv { file } { - if [catch { set f [open $file r] } x] { - #perror "couldn't open `$file': $x" - perror "$x" - return -1 - } - set rv_array {} - # whitespace expression - set ws {[ ]*} - # whitespace is ignored at the end of a line. - set pat "^#r (.*)$ws\$" - # Allow arbitrary lines until the first option is seen. - set seen_opt 0 - while { [gets $f line] != -1 } { - set line [string trim $line] - # Whitespace here is space-tab. - if [regexp $pat $line xxx cmd] { - # match! - lappend rv_array $cmd - set seen_opt 1 - } else { - if { $seen_opt } { - break - } - } - } - close $f - return $rv_array -} - -# The main test loop. - -if [istarget cris*-*-*] { - global ASFLAGS_FOR_TARGET - set has_rv_and_cris [sim_has_rv_and_cris] - global global_as_options - global global_ld_options - global global_sim_options - - set saved_global_sim_options $global_sim_options - set saved_global_ld_options $global_ld_options - set rvdummy "[file dirname [board_info target sim]]/rvdummy" - - # All machines we test and the corresponding assembler option. - # We'll only ever test v10 and higher here. - - set combos {{"crisv10" "--march=v10 --no-mul-bug-abort"} - {"crisv32" "--march=v32"}} - - # We need to pass different assembler flags for each machine. - # Specifying it here rather than adding a specifier to each and every - # test-file is preferrable. - - foreach combo $combos { - set mach [lindex $combo 0] - set ASFLAGS_FOR_TARGET "[lindex $combo 1]" - - # The .ms suffix is for "miscellaneous .s". - foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.ms]] { - - # If we're only testing specific files and this isn't one of them, - # skip it. - if ![runtest_file_p $runtests $src] { - continue - } - - # Whoever runs the test should be alerted that not all - # testcases have been checked; that's why we do the loop - # and don't just return at the top. - if !$has_rv_and_cris { - untested $src - continue - } - - set sim_defaults "--hw-file $srcdir/$subdir/std.dev" - set ld_defaults "--section-start=.text=0" - - # We parse options an extra time besides in run_sim_test, - # to determine if our defaults should be overridden. - - set opt_array [slurp_options $src] - foreach i $opt_array { - set opt_name [lindex $i 0] - set opt_machs [lindex $i 1] - set opt_val [lindex $i 2] - - # Allow concatenating to the default options by - # specifying a mach. - if { $opt_name == "sim" && $opt_machs == "" } { - set sim_defaults "" - } - - if { $opt_name == "ld" && $opt_machs == "" } { - set ld_defaults "" - } - } - - set rvdummy_id -1 - set hostcmds [slurp_rv $src] - - if { $hostcmds != "" } { - # I guess we could ask to have rvdummy executed on a - # remote host, but it looks like too much trouble for - # a feature rarely used. - if [is_remote host] { - untested $src - continue - } - - set src_components [file split $src] - set rvfile "[lindex $src_components \ - [expr [llength $src_components] - 1]].r" - - if [catch { set f [open $rvfile w] } x] { - error "$x" - } { - set contents [join $hostcmds "\n"] - - # Make it possible to use files from the test - # source directory; expected with the @-command. - regsub -all "@srcdir@" $contents "$srcdir/$subdir" contents - - verbose "rv: $contents" 2 - puts $f $contents - close $f - } - - spawn -noecho $rvdummy "$rvfile" - if { $spawn_id < 0 } { - error "Couldn't spawn $rvdummy" - continue - } - set rvdummy_id $spawn_id - } - - # Unfortunately this seems like the only way to pass - # additional sim, ld etc. options to run_sim_test. - set global_sim_options "$saved_global_sim_options $sim_defaults" - set global_ld_options "$saved_global_ld_options $ld_defaults" - run_sim_test $src $mach - set global_sim_options $saved_global_sim_options - set global_ld_options $saved_global_ld_options - - # Stop the rvdummy, if it's still running. We need to - # wait on it anyway to avoid it turning into a zombie. - if { $rvdummy_id != -1 } { - close -i $rvdummy_id - wait -i $rvdummy_id - - # Gleaned from framework.exp, this seems an indicator - # to whether the test had expected outcome. If so, we - # want to remove the rv-file. - if { $exit_status == 0 } { - file delete $rvfile - } - } - } - } -} diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/std.dev b/sim/testsuite/sim/cris/hw/rv-n-cris/std.dev deleted file mode 100644 index 9fefcbb8a11..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/std.dev +++ /dev/null @@ -1,8 +0,0 @@ -/rv/reg 0xd0000000 64 -/rv/remote-reg 0xa8800 -/rv/intnum 4 2 -/cris/vec-for-int 4 0x33 8 0x34 0xaa 0xea -/rv/mem 0x20000 0x400 -/rv/remote-mem 0xe000 -/rv/mbox 0xc000f000 -/rv > int int /cris diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc b/sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc deleted file mode 100644 index e707abf4530..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc +++ /dev/null @@ -1,22 +0,0 @@ - .include "../../asm/testutils.inc" - -# Define an exception vector table "vecname" with a single -# vector number "n" as "entry", all others "other". -# V32 only needs 1<<10 alignment, earlier versions need 1<<16. - .macro singlevec vecname vecno entry other=killme - .section .text.exvec - .p2align 16 -\vecname: - .if (\vecno) - .rept \vecno - .dword \other - .endr - .endif - .dword \entry - .if (\vecno)-255 - .rept 256-(\vecno)-1 - .dword \other - .endr - .endif - .previous - .endm diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms deleted file mode 100644 index a219b0450ee..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms +++ /dev/null @@ -1,17 +0,0 @@ -#mach: crisv32 -#sim(crisv32): --hw-info -#output: /\n -#output: /rv\n -#output: /rv/reg 0xd0000000 0x40\n -#output: /rv/remote-reg 0xa8800\n -#output: /rv/intnum 0x4 0x2\n -#output: /rv/mem 0x20000 0x400\n -#output: /rv/remote-mem 0xe000\n -#output: /rv/mbox 0xc000f000\n -#output: /rv > int int /cris\n -#output: /cris\n -#output: /cris/vec-for-int 0x4 0x33 0x8 0x34 0xaa 0xea\n - -# Test expected --hw-info output and startup paths of components. - - .include "quit.s" diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms deleted file mode 100644 index b6334458517..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms +++ /dev/null @@ -1,21 +0,0 @@ -#mach: crisv32 -#sim(crisv32): --hw-device "/rv/dummy 0x12" - -# Test dummy settings: set from value. - - .include "testutils.inc" - start - move.d 0xd0000000,$r0 - move.d [$r0+],$r3 - cmp.d 0x12121212,$r3 - beq ok - nop -bad: - fail -ok: - moveq -1,$r3 - move.d $r3,[$r0] - cmp.d [$r0],$r3 - bne bad - nop - pass diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms deleted file mode 100644 index 1f23b496fb2..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms +++ /dev/null @@ -1,20 +0,0 @@ -#mach: crisv32 -#sim(crisv32): --hw-device "/rv/dummy /dev/zero" - -# Test dummy settings: set from file. - - .include "testutils.inc" - start - move.d 0xd0000000,$r0 - move.d [$r0+],$r3 - beq ok - nop -bad: - fail -ok: - moveq -1,$r3 - move.d $r3,[$r0] - cmp.d [$r0],$r3 - bne bad - nop - pass diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms deleted file mode 100644 index 6108160f962..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms +++ /dev/null @@ -1,22 +0,0 @@ -#mach: crisv32 -#r @,@srcdir@/trivial4.r - -# Test read and writes. - - .include "testutils.inc" - start - move.d 0xd0000032,$r0 - move.d [$r0+],$r3 - cmp.d 0xabcdef01,$r3 - beq ok - nop -bad: - fail -ok: - move.d 0xaabbccdd,$r3 - move.d $r3,[$r0] - move.d [$r0],$r3 - cmp.d 0x76543210,$r3 - bne bad - nop - pass diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r deleted file mode 100644 index b4896a0a281..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r +++ /dev/null @@ -1,4 +0,0 @@ -W, -r,a8832,abcdef01 -w,a8836,aabbccdd -r,a8836,76543210 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms deleted file mode 100644 index 849f17ebb45..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms +++ /dev/null @@ -1,16 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" -#sim(crisv32): --hw-device "/rv/trace? true" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000032\n -#output: /rv: := 0xabcdef01\n -#output: /rv: REG W 0xd0000036 := 0xaabbccdd\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: pass\n - -# Test trace output for read and write. - -#r @,@srcdir@/trivial4.r - - .include "trivial4.ms" diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms deleted file mode 100644 index 91af7fc1370..00000000000 --- a/sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms +++ /dev/null @@ -1,33 +0,0 @@ -#mach: crisv10 crisv32 -#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/rv/watchdog-interval 1" -#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/rv/watchdog-interval 1" --hw-device "/rv/max-poll-ticks 1000" -#output: /rv: WD\n -#output: /rv: REG R 0xd0000036\n -#output: /rv: := 0x76543210\n -#output: /rv: WD\n -#output: /rv: DMA W 0x20000..0x20003\n -#output: /rv: 0x20000: 01 02 03 04\n -#output: /rv: REG R 0xd0000038\n -#output: /rv: := 0x76543211\n -#output: pass\n - -#r W, -#r r,a8836,76543210 -#r W, -#r s,e000,01020304 -#r r,a8838,76543211 - - .include "testutils.inc" - start - mvi_h_mem 0 0x20000 - test_h_mem 0x76543210 0xd0000036 - - move.d 0x20000,$r1 -0: - test.b [$r1] - beq 0b - nop - test_h_mem 0x76543211 0xd0000038 - pass - - .fill 65536*2+128,1,0 -- 2.47.2