From bad7deeefd1fa35f148ce755f6ee1e00c3c0d05e Mon Sep 17 00:00:00 2001 From: nobody <> Date: Sun, 6 Apr 2003 14:50:16 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'kettenis_i386newframe-20030406-branch'. Sprout from cagney_frameaddr-20030403-branch 2003-04-03 16:34:49 UTC nobody 'This commit was manufactured by cvs2svn to create branch' Cherrypick from master 2003-04-06 14:50:15 UTC Andrew Cagney '2003-04-06 Andrew Cagney ': bfd/ChangeLog bfd/archures.c bfd/bfd-in2.h bfd/coff-tic4x.c bfd/cpu-tic4x.c bfd/elf32-m68hc11.c bfd/simple.c bfd/version.h gdb/ChangeLog gdb/Makefile.in gdb/arm-tdep.c gdb/blockframe.c gdb/config/i386/tm-ptx.h gdb/config/pa/tm-hppa.h gdb/config/pa/tm-hppa64.h gdb/config/pa/tm-hppah.h gdb/config/sparc/tm-sparc.h gdb/cris-tdep.c gdb/d10v-tdep.c gdb/dummy-frame.c gdb/frame-unwind.h gdb/frame.c gdb/frame.h gdb/gdbarch.h gdb/gdbarch.sh gdb/hppa-hpux-tdep.c gdb/hppa-tdep.c gdb/i386-tdep.c gdb/ia64-tdep.c gdb/m68k-tdep.c gdb/objc-lang.c gdb/remote-vxsparc.c gdb/rs6000-tdep.c gdb/s390-tdep.c gdb/sentinel-frame.c gdb/sh-tdep.c gdb/sparc-tdep.c gdb/stack.c gdb/testsuite/ChangeLog gdb/testsuite/gdb.base/break.exp gdb/valprint.c gdb/version.in gdb/x86-64-tdep.c include/ChangeLog include/coff/tic4x.h include/opcode/tic4x.h opcodes/ChangeLog opcodes/tic4x-dis.c sim/v850/ChangeLog sim/v850/simops.c sim/v850/simops.h sim/v850/v850.igen --- bfd/ChangeLog | 24 +++ bfd/archures.c | 4 +- bfd/bfd-in2.h | 4 +- bfd/coff-tic4x.c | 15 +- bfd/cpu-tic4x.c | 22 +-- bfd/elf32-m68hc11.c | 46 +++--- bfd/simple.c | 11 ++ bfd/version.h | 2 +- gdb/ChangeLog | 152 +++++++++++++++++++ gdb/Makefile.in | 8 +- gdb/arm-tdep.c | 4 +- gdb/blockframe.c | 2 +- gdb/config/i386/tm-ptx.h | 6 - gdb/config/pa/tm-hppa.h | 8 +- gdb/config/pa/tm-hppa64.h | 6 +- gdb/config/pa/tm-hppah.h | 3 +- gdb/config/sparc/tm-sparc.h | 47 ------ gdb/cris-tdep.c | 2 +- gdb/d10v-tdep.c | 12 +- gdb/dummy-frame.c | 8 +- gdb/frame-unwind.h | 6 +- gdb/frame.c | 185 ++++++++++++++---------- gdb/frame.h | 55 +++---- gdb/gdbarch.h | 32 +--- gdb/gdbarch.sh | 18 +-- gdb/hppa-hpux-tdep.c | 8 +- gdb/hppa-tdep.c | 190 +++++++++++++----------- gdb/i386-tdep.c | 4 +- gdb/ia64-tdep.c | 2 +- gdb/m68k-tdep.c | 2 +- gdb/objc-lang.c | 32 +--- gdb/remote-vxsparc.c | 7 +- gdb/rs6000-tdep.c | 16 +- gdb/s390-tdep.c | 2 +- gdb/sentinel-frame.c | 2 + gdb/sh-tdep.c | 6 +- gdb/sparc-tdep.c | 5 +- gdb/stack.c | 2 +- gdb/testsuite/ChangeLog | 14 ++ gdb/testsuite/gdb.base/break.exp | 4 + gdb/valprint.c | 4 - gdb/version.in | 2 +- gdb/x86-64-tdep.c | 27 ++-- include/ChangeLog | 7 + include/coff/tic4x.h | 6 +- include/opcode/tic4x.h | 58 ++++---- opcodes/ChangeLog | 5 + opcodes/tic4x-dis.c | 305 ++++++++++++++++++++------------------- sim/v850/ChangeLog | 6 + sim/v850/simops.c | 44 ------ sim/v850/simops.h | 1 - sim/v850/v850.igen | 43 +++++- 52 files changed, 829 insertions(+), 657 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 809e9f74249..1264aa384df 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,27 @@ +2003-04-06 Andrew Cagney + + * simple.c (bfd_simple_get_relocated_section_contents): Disable + free that leads to GDB vs BFD memory corruption. + +2003-04-04 Stephane Carrez + + * elf32-m68hc11.c (m68hc11_elf_relax_delete_bytes): Also adjust + symbols that mark the end of the section. + (m68hc11_elf_relax_section): Use R_M68HC11_PCREL_8 relocs when + converting to a relative branch so that the offset is computed after + the relaxation; also relocate a jsr into a bsr if possible but don't + relax them if they are to a far symbol as we need to call the + trampoline code. + (elf_m68hc11_howto_table): Set pcrel_offset to true. + +2003-04-04 Svein E. Seldal + + * archures.c: Namespace cleanup. Rename bfd_mach_c3x to + bfd_mach_tic3x and bfd_mach_c4x to bfd_mach_tic4x + * bfd-in2.h: Regenerate + * coff-tic4x.c: Namespace cleanup. Replace s/c4x/tic4x/ + * cpu-tic4x.c: Ditto + 2003-04-03 Nick Clifton * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Compute ps and ss diff --git a/bfd/archures.c b/bfd/archures.c index 9337fb19273..efed99333c5 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -241,8 +241,8 @@ DESCRIPTION . bfd_arch_w65, {* WDC 65816 *} . bfd_arch_tic30, {* Texas Instruments TMS320C30 *} . bfd_arch_tic4x, {* Texas Instruments TMS320C3X/4X *} -.#define bfd_mach_c3x 30 -.#define bfd_mach_c4x 40 +.#define bfd_mach_tic3x 30 +.#define bfd_mach_tic4x 40 . bfd_arch_tic54x, {* Texas Instruments TMS320C54X *} . bfd_arch_tic80, {* TI TMS320c80 (MVP) *} . bfd_arch_v850, {* NEC V850 *} diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index a5ff0c0599b..749e6aa6770 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1707,8 +1707,8 @@ enum bfd_architecture bfd_arch_w65, /* WDC 65816 */ bfd_arch_tic30, /* Texas Instruments TMS320C30 */ bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */ -#define bfd_mach_c3x 30 -#define bfd_mach_c4x 40 +#define bfd_mach_tic3x 30 +#define bfd_mach_tic4x 40 bfd_arch_tic54x, /* Texas Instruments TMS320C54X */ bfd_arch_tic80, /* TI TMS320c80 (MVP) */ bfd_arch_v850, /* NEC V850 */ diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c index 3062b9f86f7..5c8de41995c 100644 --- a/bfd/coff-tic4x.c +++ b/bfd/coff-tic4x.c @@ -1,6 +1,7 @@ /* BFD back-end for TMS320C4X coff binaries. - Copyright 1996, 1997, 1998, 1999, 2000, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) This file is part of BFD, the Binary File Descriptor library. @@ -365,7 +366,7 @@ static const bfd_coff_backend_data ticoff1_swap_table = /* TI COFF v0, DOS tools (little-endian headers). */ const bfd_target tic4x_coff0_vec = { - "coff0-c4x", /* Name. */ + "coff0-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -409,7 +410,7 @@ const bfd_target tic4x_coff0_vec = /* TI COFF v0, SPARC tools (big-endian headers). */ const bfd_target tic4x_coff0_beh_vec = { - "coff0-beh-c4x", /* Name. */ + "coff0-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ @@ -454,7 +455,7 @@ const bfd_target tic4x_coff0_beh_vec = /* TI COFF v1, DOS tools (little-endian headers). */ const bfd_target tic4x_coff1_vec = { - "coff1-c4x", /* Name. */ + "coff1-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -499,7 +500,7 @@ const bfd_target tic4x_coff1_vec = /* TI COFF v1, SPARC tools (big-endian headers). */ const bfd_target tic4x_coff1_beh_vec = { - "coff1-beh-c4x", /* Name. */ + "coff1-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ @@ -544,7 +545,7 @@ const bfd_target tic4x_coff1_beh_vec = /* TI COFF v2, TI DOS tools output (little-endian headers). */ const bfd_target tic4x_coff2_vec = { - "coff2-c4x", /* Name. */ + "coff2-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -589,7 +590,7 @@ const bfd_target tic4x_coff2_vec = /* TI COFF v2, TI SPARC tools output (big-endian headers). */ const bfd_target tic4x_coff2_beh_vec = { - "coff2-beh-c4x", /* Name. */ + "coff2-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ diff --git a/bfd/cpu-tic4x.c b/bfd/cpu-tic4x.c index 2260f703343..a7f40e1a4fa 100644 --- a/bfd/cpu-tic4x.c +++ b/bfd/cpu-tic4x.c @@ -1,5 +1,5 @@ /* bfd back-end for TMS320C[34]x support - Copyright 1996, 1997, 2002 Free Software Foundation, Inc. + Copyright 1996, 1997, 2002, 2003 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) @@ -23,12 +23,12 @@ #include "sysdep.h" #include "libbfd.h" -static bfd_boolean c4x_scan +static bfd_boolean tic4x_scan PARAMS ((const struct bfd_arch_info *, const char * )); static bfd_boolean -c4x_scan (info, string) +tic4x_scan (info, string) const struct bfd_arch_info *info; const char *string; { @@ -42,9 +42,9 @@ c4x_scan (info, string) return FALSE; if (*string == '3') - return (info->mach == bfd_mach_c3x); + return (info->mach == bfd_mach_tic3x); else if (*string == '4') - return info->mach == bfd_mach_c4x; + return info->mach == bfd_mach_tic4x; return FALSE; } @@ -56,13 +56,13 @@ const bfd_arch_info_type bfd_tic3x_arch = 32, /* 32 bits in an address. */ 32, /* 32 bits in a byte. */ bfd_arch_tic4x, - bfd_mach_c3x, /* Machine number. */ - "c3x", /* Architecture name. */ + bfd_mach_tic3x, /* Machine number. */ + "tic3x", /* Architecture name. */ "tms320c3x", /* Printable name. */ 0, /* Alignment power. */ FALSE, /* Not the default architecture. */ bfd_default_compatible, - c4x_scan, + tic4x_scan, 0 }; @@ -72,13 +72,13 @@ const bfd_arch_info_type bfd_tic4x_arch = 32, /* 32 bits in an address. */ 32, /* 32 bits in a byte. */ bfd_arch_tic4x, - bfd_mach_c4x, /* Machine number. */ - "c4x", /* Architecture name. */ + bfd_mach_tic4x, /* Machine number. */ + "tic4x", /* Architecture name. */ "tms320c4x", /* Printable name. */ 0, /* Alignment power. */ TRUE, /* The default architecture. */ bfd_default_compatible, - c4x_scan, + tic4x_scan, &bfd_tic3x_arch, }; diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 98ea6a69cd5..26fa3933a74 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -1,5 +1,5 @@ /* Motorola 68HC11-specific support for 32-bit ELF - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr) (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) @@ -143,7 +143,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* partial_inplace */ 0x00ff, /* src_mask */ 0x00ff, /* dst_mask */ - FALSE), /* pcrel_offset */ + TRUE), /* pcrel_offset */ /* A 16 bit absolute relocation */ HOWTO (R_M68HC11_16, /* type */ @@ -204,7 +204,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* partial_inplace */ 0xffff, /* src_mask */ 0xffff, /* dst_mask */ - FALSE), /* pcrel_offset */ + TRUE), /* pcrel_offset */ /* GNU extension to record C++ vtable hierarchy */ HOWTO (R_M68HC11_GNU_VTINHERIT, /* type */ @@ -247,8 +247,8 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { bfd_elf_generic_reloc, /* special_function */ "R_M68HC11_24", /* name */ FALSE, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ FALSE), /* pcrel_offset */ /* A 16-bit low relocation */ @@ -445,6 +445,9 @@ elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) return TRUE; } + +/* 68HC11 Linker Relaxation. */ + struct m68hc11_direct_relax { const char *name; @@ -694,6 +697,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) bfd_vma value; Elf_Internal_Sym *isym; asection *sym_sec; + int is_far = 0; /* If this isn't something that can be relaxed, then ignore this reloc. */ @@ -747,7 +751,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) prev_insn_group = 0; /* Do nothing if this reloc is the last byte in the section. */ - if (irel->r_offset == sec->_cooked_size) + if (irel->r_offset + 2 >= sec->_cooked_size) continue; /* See if the next instruction is an unconditional pc-relative @@ -793,6 +797,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) { /* A local symbol. */ isym = isymbuf + ELF32_R_SYM (irel->r_info); + is_far = isym->st_other & STO_M68HC12_FAR; sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); symval = (isym->st_value + sym_sec->output_section->vma @@ -818,6 +823,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) continue; } + is_far = h->other & STO_M68HC12_FAR; isym = 0; sym_sec = h->root.u.def.section; symval = (h->root.u.def.value @@ -891,23 +897,25 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) { code = 0x20; bfd_put_8 (abfd, code, contents + prev_insn_branch->r_offset); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + prev_insn_branch->r_offset + 1); + irel->r_offset = prev_insn_branch->r_offset + 1; irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, - irel->r_offset, 1); + irel->r_offset + 1, 1); } else { code ^= 0x1; bfd_put_8 (abfd, code, contents + prev_insn_branch->r_offset); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + prev_insn_branch->r_offset + 1); + irel->r_offset = prev_insn_branch->r_offset + 1; irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, - irel->r_offset - 1, 3); + irel->r_offset + 1, 3); } prev_insn_branch = 0; *again = TRUE; @@ -991,14 +999,14 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) /* That will change things, so, we should relax again. */ *again = TRUE; } - else if (ELF32_R_TYPE (irel->r_info) == R_M68HC11_16) + else if (ELF32_R_TYPE (irel->r_info) == R_M68HC11_16 && !is_far) { unsigned char code; bfd_vma offset; prev_insn_branch = 0; code = bfd_get_8 (abfd, contents + irel->r_offset - 1); - if (code == 0x7e) + if (code == 0x7e || code == 0xbd) { offset = value - (irel->r_offset + sec->output_section->vma @@ -1021,13 +1029,13 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) free_extsyms = NULL; /* Shrink the branch. */ - code = 0x20; + code = (code == 0x7e) ? 0x20 : 0x8d; bfd_put_8 (abfd, code, contents + irel->r_offset - 1); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + irel->r_offset); irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, irel->r_offset + 1, 1); /* That will change things, so, we should relax again. */ @@ -1220,7 +1228,7 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) { if (isym->st_shndx == sec_shndx && isym->st_value > addr - && isym->st_value < toaddr) + && isym->st_value <= toaddr) isym->st_value -= count; } @@ -1236,7 +1244,7 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) || sym_hash->root.type == bfd_link_hash_defweak) && sym_hash->root.u.def.section == sec && sym_hash->root.u.def.value > addr - && sym_hash->root.u.def.value < toaddr) + && sym_hash->root.u.def.value <= toaddr) { sym_hash->root.u.def.value -= count; } diff --git a/bfd/simple.c b/bfd/simple.c index a91d118e40d..a247f1153ba 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -261,8 +261,19 @@ bfd_simple_get_relocated_section_contents (abfd, sec, outbuf, symbol_table) if (contents == NULL && data != NULL) free (data); +#if 0 + /* NOTE: cagney/2003-04-05: This free, which was introduced on + 2003-03-31 to stop a memory leak, caused a memory corruption + between GDB and BFD. The problem, which is stabs specific, can + be identified by a bunch of failures in relocate.exp vis: + + gdb.base/relocate.exp: get address of static_bar + + Details of the problem can be found on the binutils@ mailing + list, see the discussion thread: "gdb.mi/mi-cli.exp failures". */ if (storage_needed != 0) free (symbol_table); +#endif bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets); free (saved_offsets); diff --git a/bfd/version.h b/bfd/version.h index bd19d02b888..0afe6a6f0e3 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20030403 +#define BFD_VERSION_DATE 20030406 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e5d2ce6ac28..86520604bfe 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,155 @@ +2003-04-06 Andrew Cagney + + * valprint.c (val_print_type_code_int): Delete #ifdef + PRINT_TYPELESS_INTEGER code. + + * gdbarch.sh (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) + (CALL_DUMMY_LOCATION, DEPRECATED_PC_IN_CALL_DUMMY): Allow partial + multi-arch definition. + * gdbarch.h: Re-generate. + +2003-04-05 Andrew Cagney + + Eliminate FRAME_FIND_SAVED_REGS. + * config/pa/tm-hppah.h (hppa_hpux_frame_find_saved_regs_in_sigtramp): + Change FSR parameter to a pointer. + * config/pa/tm-hppa64.h (FRAME_FIND_SAVED_REGS_IN_SIGTRAMP): + Assume FSR parameter is a pointer. + * hppa-hpux-tdep.c (hppa_hpux_frame_find_saved_regs_in_sigtramp): + Make fsr a pointer. + * hppa-tdep.c (hppa_frame_find_saved_regs): New function. + (hppa_frame_saved_pc): Call hppa_frame_init_saved_regs. Make + saved_regs a pointer. + (hppa_frame_saved_pc): Ditto. + (find_dummy_frame_regs): Make frame_saved_regs a pointer + (hppa_pop_frame): Call hppa_frame_init_saved_regs. Make fsr a + pointer. + (restore_pc_queue): Make fsr a pointer. + (hppa_frame_find_saved_regs): Make frame_saved_regs a pointer. + (hppa_frame_chain): Make saved_regs a pointer, call + hppa_frame_init_saved_regs. + * sparc-tdep.c: Include "gdb_assert.h". + (sparc_frame_find_saved_regs): Replace internal_error with + gdb_assert. + * remote-vxsparc.c (vx_read_register): Delete reference to + FRAME_FIND_SAVED_REGS. + * gdbarch.sh: Delete check for FRAME_FIND_SAVED_REGS. + * gdbarch.h: Regenerate. + * frame.h (DEPRECATED_FRAME_INIT_SAVED_REGS): Delete macro. + (deprecated_get_frame_saved_regs): Delete declaration. + (struct frame_saved_regs): Delete definition. + * frame.c (deprecated_get_frame_saved_regs): Delete function. + * config/pa/tm-hppa.h (hppa_frame_init_saved_regs): Declare. + (hppa_frame_find_saved_regs): Delete declaration. + (FRAME_FIND_SAVED_REGS): Delete macro. + (DEPRECATED_FRAME_INIT_SAVED_REGS): Define. + * config/i386/tm-ptx.h (FRAME_FIND_SAVED_REGS): Delete + FRAME_FIND_SAVED_REGS in comment. + +2003-04-05 Andrew Cagney + + * frame.c (frame_func_unwind, get_frame_func): New functions. + * frame.h (get_frame_func, frame_func_unwind): Declare. + (struct frame_info): Add field "prev_func" for caching the + previous frame's function address. + * arm-tdep.c (arm_frameless_function_invocation): Combine + get_pc_function_start and get_frame_pc into get_frame_func. + * sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto. + (sh64_nofp_frame_init_saved_regs): Ditto. + * s390-tdep.c (s390_function_start): Ditto. + * rs6000-tdep.c (rs6000_pop_frame): Ditto. + (rs6000_frameless_function_invocation): Ditto. + (rs6000_frame_saved_pc): Ditto. + * m68k-tdep.c (m68k_frame_init_saved_regs): Ditto. + * ia64-tdep.c (ia64_frame_init_saved_regs): Ditto. + * i386-tdep.c (i386_frameless_signal_p): Ditto. + (i386_frame_init_saved_regs): Ditto. + * hppa-tdep.c (hppa_frame_find_saved_regs): Ditto. + * d10v-tdep.c (d10v_frame_unwind_cache): Combine + get_pc_function_start and frame_pc_unwind into frame_func_unwind. + * cris-tdep.c (cris_frame_init_saved_regs): Ditto. + * blockframe.c (frameless_look_for_prologue): Ditto. + +2003-04-05 Andrew Cagney + + * frame.c (legacy_get_prev_frame): Link prev to next at the + function start. Update comments. + +2003-04-05 Andrew Cagney + + * frame.c (get_frame_id): Update comment. + (legacy_get_prev_frame): Update comment. + * gdbarch.sh: Delete check for EXTRA_FRAME_INFO. + * gdbarch.h: Regenerate. + * config/sparc/tm-sparc.h (EXTRA_FRAME_INFO): Delete. + * frame.h: Delete #ifdef EXTRA_FRAME_INFO code. + +2003-04-05 Andrew Cagney + + * stack.c (print_frame_info): Use get_frame_pc. + +2003-04-04 Andrew Cagney + + * frame.c (get_prev_frame): Do not call frame_type_from_pc. Set + the frame's type from the unwinder. + (get_frame_type): Map UNKNOWN_FRAME onto NORMAL_FRAME. + (create_new_frame, legacy_get_prev_frame): When the unwinder's + type isn't UNKNOWN_FRAME, initalize "type" from the unwinder. + (get_frame_base_address): Use get_frame_type. + (get_frame_locals_address, get_frame_args_address): Ditto. + (legacy_saved_regs_unwinder): Set the type to UNKNOWN_TYPE. + * frame.h (enum frame_type): Add UNKNOWN_FRAME. + (struct frame_info): Add comment explaining why the frame contains + a "type" field. + * dummy-frame.c (dummy_frame_unwind): Set the type to DUMMY_FRAME. + * d10v-tdep.c (d10v_frame_unwind): Set the type to NORMAL_FRAME. + * sentinel-frame.c (sentinel_frame_unwinder): Set the type to + NORMAL_FRAME. + * frame-unwind.h: Include "frame.h". + (struct frame_unwind): Add "type" field. + * Makefile.in (frame_unwind_h): Add $(frame_h). + +2003-04-04 Andrew Cagney + + * x86-64-tdep.c (x86_64_unwind_dummy_id): Use frame_id_build. + * dummy-frame.c (dummy_frame_this_id): Use frame_id_build. + * d10v-tdep.c (d10v_frame_this_id): Use get_frame_pc and + get_frame_base. + (d10v_unwind_dummy_id): Use frame_id_build. + * frame.c (find_frame_sal): Use get_frame_pc. + (create_new_frame): Use deprecated_update_frame_pc_hack and + deprecated_update_frame_base_hack. + (create_sentinel_frame): Add comment about ->pc going away. + (get_prev_frame): Add comment about ->pc going away. + (legacy_get_prev_frame): Use get_frame_base, get_frame_pc, + frame_id_build, deprecated_update_frame_pc_hack and + deprecated_update_frame_base_hack. + (select_frame): Use get_frame_pc. + (legacy_saved_regs_this_id): Use frame_id_build. + +2003-04-04 Elena Zannoni + + * x86-64-tdep.c (x86_64_push_arguments): Handle correctly the + signed integer case. + (classify_argument): Handle enumerations and references. + +2003-04-04 Andrew Cagney + + * frame.c (create_sentinel_frame): Initialize the sentinel frame's + ID to NULL. + +2003-04-01 Adam Fedor + + * gdb/objc-lang.c (selectors_info): Replace calls to + SYMBOL_DEMANGLED_NAME and DEPRECATED_SYMBOL_NAME with + SYMBOL_NATURAL_NAME. + (classes_info, find_methods): Likewise. + +2003-04-03 Kevin Buettner + + * rs6000-tdep.c (rs6000_gdbarch_init): For xcoff executables, set + ``mach'' to the value determined by bfd_default_set_arch_mach(). + 2003-04-02 Bob Rossi * Makefile.in (SUBDIR_MI_OBS): Add "mi-cmd-file.o". diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c5ba5d84218..21255fe9142 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -641,7 +641,7 @@ event_top_h = event-top.h expression_h = expression.h $(symtab_h) $(doublest_h) f_lang_h = f-lang.h frame_h = frame.h -frame_unwind_h = frame-unwind.h +frame_unwind_h = frame-unwind.h $(frame_h) frame_base_h = frame-base.h gdb_events_h = gdb-events.h gdb_stabs_h = gdb-stabs.h @@ -2208,9 +2208,9 @@ sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(regcache_h) $(gregset_h) sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(regcache_h) $(gdb_wait_h) sparc-stub.o: sparc-stub.c -sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ - $(inferior_h) $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) \ - $(regcache_h) $(osabi_h) $(gregset_h) $(gdbcore_h) $(symfile_h) +sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \ + $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(regcache_h) \ + $(osabi_h) $(gregset_h) $(gdbcore_h) $(gdb_assert_h) $(symfile_h) sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(sparcnbsd_tdep_h) sparcl-stub.o: sparcl-stub.c diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 21d84887d7a..5d8c538290e 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -295,7 +295,7 @@ arm_frameless_function_invocation (struct frame_info *fi) stmdb sp!, {} sub sp, ip, #4. */ - func_start = (get_pc_function_start (get_frame_pc (fi)) + FUNCTION_START_OFFSET); + func_start = (get_frame_func (fi)) + FUNCTION_START_OFFSET); after_prologue = SKIP_PROLOGUE (func_start); /* There are some frameless functions whose first two instructions @@ -1383,7 +1383,7 @@ push_stack_item (struct stack_item *prev, void *contents, int len) { struct stack_item *si; si = xmalloc (sizeof (struct stack_item)); - si->data = malloc (len); + si->data = xmalloc (len); si->len = len; si->prev = prev; memcpy (si->data, contents, len); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 364be9e0ef1..cf691a35887 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -146,7 +146,7 @@ frameless_look_for_prologue (struct frame_info *frame) { CORE_ADDR func_start, after_prologue; - func_start = get_pc_function_start (get_frame_pc (frame)); + func_start = get_frame_func (frame); if (func_start) { func_start += FUNCTION_START_OFFSET; diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h index 80026e3568e..2f2bba3e58b 100644 --- a/gdb/config/i386/tm-ptx.h +++ b/gdb/config/i386/tm-ptx.h @@ -191,10 +191,4 @@ extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */ #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ symmetry_extract_return_value(TYPE, REGBUF, VALBUF) -/* - #undef FRAME_FIND_SAVED_REGS - #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - { ptx_frame_find_saved_regs((frame_info), &(frame_saved_regs)); } - */ - #endif /* ifndef TM_PTX_H */ diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 9c26c798258..6089b32b526 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -441,11 +441,9 @@ extern int hppa_frame_num_args (struct frame_info *frame); #define FRAME_ARGS_SKIP 0 #endif -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - hppa_frame_find_saved_regs (frame_info, &frame_saved_regs) -extern void hppa_frame_find_saved_regs (struct frame_info *, - struct frame_saved_regs *); - +extern void hppa_frame_init_saved_regs (struct frame_info *); +#define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) \ + hppa_frame_init_saved_regs (FI) /* Things needed for making the inferior call functions. */ diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h index b2b98e40895..503e42688df 100644 --- a/gdb/config/pa/tm-hppa64.h +++ b/gdb/config/pa/tm-hppa64.h @@ -312,11 +312,11 @@ call_dummy for (i = 0; i < NUM_REGS; i++) \ { \ if (i == SP_REGNUM) \ - (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \ + (FSR)[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \ else if (i >= FP0_REGNUM) \ - (FSR)->regs[i] = TMP2 + (i - FP0_REGNUM) * 8; \ + (FSR)[i] = TMP2 + (i - FP0_REGNUM) * 8; \ else \ - (FSR)->regs[i] = TMP1 + i * 8; \ + (FSR)[i] = TMP1 + i * 8; \ } \ } diff --git a/gdb/config/pa/tm-hppah.h b/gdb/config/pa/tm-hppah.h index 4e68de992f1..5a457a9db3a 100644 --- a/gdb/config/pa/tm-hppah.h +++ b/gdb/config/pa/tm-hppah.h @@ -46,9 +46,8 @@ extern void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ hppa_hpux_frame_base_before_sigtramp (FRAME, TMP) -struct frame_saved_regs; extern void hppa_hpux_frame_find_saved_regs_in_sigtramp - (struct frame_info *fi, struct frame_saved_regs *fsr); + (struct frame_info *fi, CORE_ADDR *fsr); #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ hppa_hpux_frame_find_saved_regs_in_sigtramp (FRAME, FSR) diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index ef3996232cc..544a562ffae 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -406,53 +406,6 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR); /* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces the frame's chain-pointer. */ -/* In the case of the Sun 4, the frame-chain's nominal address - is held in the frame pointer register. - - On the Sun4, the frame (in %fp) is %sp for the previous frame. - From the previous frame's %sp, we can find the previous frame's - %fp: it is in the save area just above the previous frame's %sp. - - If we are setting up an arbitrary frame, we'll need to know where - it ends. Hence the following. This part of the frame cache - structure should be checked before it is assumed that this frame's - bottom is in the stack pointer. - - If there isn't a frame below this one, the bottom of this frame is - in the stack pointer. - - If there is a frame below this one, and the frame pointers are - identical, it's a leaf frame and the bottoms are the same also. - - Otherwise the bottom of this frame is the top of the next frame. - - The bottom field is misnamed, since it might imply that memory from - bottom to frame contains this frame. That need not be true if - stack frames are allocated in different segments (e.g. some on a - stack, some on a heap in the data segment). - - GCC 2.6 and later can generate ``flat register window'' code that - makes frames by explicitly saving those registers that need to be - saved. %i7 is used as the frame pointer, and the frame is laid out - so that flat and non-flat calls can be intermixed freely within a - program. Unfortunately for GDB, this means it must detect and - record the flatness of frames. - - Since the prologue in a flat frame also tells us where fp and pc - have been stashed (the frame is of variable size, so their location - is not fixed), it's convenient to record them in the frame info. */ - -#define EXTRA_FRAME_INFO \ - CORE_ADDR bottom; \ - int in_prologue; \ - int flat; \ - /* Following fields only relevant for flat frames. */ \ - CORE_ADDR pc_addr; \ - CORE_ADDR fp_addr; \ - /* Add this to ->frame to get the value of the stack pointer at the */ \ - /* time of the register saves. */ \ - int sp_offset; - /* We need to override DEPRECATED_GET_SAVED_REGISTER so that we can deal with the way outs change into ins in different frames. */ diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 4f9ee9b84eb..2258a17b7cc 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1178,7 +1178,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) } else { - ip = get_pc_function_start (get_frame_pc (fi)); + ip = get_frame_func (fi); sal = find_pc_line (ip, 0); /* If there is no symbol information then sal.end == 0, and we end up diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 9d56169d7df..5e94de42650 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -720,7 +720,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, info->sp_offset = 0; info->uses_frame = 0; - for (pc = get_pc_function_start (frame_pc_unwind (next_frame)); + for (pc = frame_func_unwind (next_frame); pc < frame_pc_unwind (next_frame); pc += 4) { @@ -1474,8 +1474,8 @@ d10v_frame_this_id (struct frame_info *next_frame, compare the frame's PC value. */ if (frame_relative_level (next_frame) >= 0 && get_frame_type (next_frame) != DUMMY_FRAME - && get_frame_id (next_frame).pc == pc - && get_frame_id (next_frame).base == base) + && get_frame_pc (next_frame) == pc + && get_frame_base (next_frame) == base) return; (*this_id) = frame_id_build (base, pc); @@ -1553,6 +1553,7 @@ d10v_frame_prev_register (struct frame_info *next_frame, } static const struct frame_unwind d10v_frame_unwind = { + NORMAL_FRAME, d10v_frame_this_id, d10v_frame_prev_register }; @@ -1587,11 +1588,8 @@ static struct frame_id d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) { ULONGEST base; - struct frame_id id; - id.pc = frame_pc_unwind (next_frame); frame_unwind_unsigned_register (next_frame, SP_REGNUM, &base); - id.base = d10v_make_daddr (base); - return id; + return frame_id_build (d10v_make_daddr (base), frame_pc_unwind (next_frame)); } static gdbarch_init_ftype d10v_gdbarch_init; diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index f088405213e..991ee280832 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -374,8 +374,7 @@ dummy_frame_this_id (struct frame_info *next_frame, same sequence as is found a traditional unwinder. Once all architectures supply the unwind_dummy_id method, this code can go away. */ - (*this_id).base = read_fp (); - (*this_id).pc = read_pc (); + (*this_id) = frame_id_build (read_fp (), read_pc ()); } else if (legacy_frame_p (current_gdbarch) && get_prev_frame (next_frame)) @@ -384,8 +383,8 @@ dummy_frame_this_id (struct frame_info *next_frame, get_prev_frame code has already created THIS frame and linked it in to the frame chain (a pretty bold assumption), extract the ID from THIS base / pc. */ - (*this_id).base = get_frame_base (get_prev_frame (next_frame)); - (*this_id).pc = get_frame_pc (get_prev_frame (next_frame)); + (*this_id) = frame_id_build (get_frame_base (get_prev_frame (next_frame)), + get_frame_pc (get_prev_frame (next_frame))); } else { @@ -403,6 +402,7 @@ dummy_frame_this_id (struct frame_info *next_frame, static struct frame_unwind dummy_frame_unwind = { + DUMMY_FRAME, dummy_frame_this_id, dummy_frame_prev_register }; diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h index 099f9dee420..ad1efdf353b 100644 --- a/gdb/frame-unwind.h +++ b/gdb/frame-unwind.h @@ -28,6 +28,8 @@ struct frame_unwind; struct gdbarch; struct regcache; +#include "frame.h" /* For enum frame_type. */ + /* Return the frame unwind methods for the function that contains PC, or NULL if this this unwinder can't handle this frame. */ @@ -128,7 +130,9 @@ typedef void (frame_prev_register_ftype) (struct frame_info *next_frame, struct frame_unwind { - /* Should the frame's type go here? */ + /* The frame's type. Should this instead be a collection of + predicates that test the frame for various attributes? */ + enum frame_type type; /* Should an attribute indicating the frame's address-in-block go here? */ frame_this_id_ftype *this_id; diff --git a/gdb/frame.c b/gdb/frame.c index 09dea5e4c02..5e7f6f1ec05 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -65,12 +65,10 @@ get_frame_id (struct frame_info *fi) fi->unwind->this_id (fi->next, &fi->prologue_cache, &fi->id); fi->id_p = 1; /* FIXME: cagney/2002-12-18: Instead of this hack, should only - store the frame ID in PREV_FRAME. Unfortunatly, some - architectures (HP/UX) still reply on EXTRA_FRAME_INFO and, - hence, still poke at the "struct frame_info" object directly. */ + store the frame ID in PREV_FRAME. */ fi->frame = fi->id.base; } - return frame_id_build (fi->frame, fi->pc); + return frame_id_build (fi->frame, get_frame_pc (fi)); } const struct frame_id null_frame_id; /* All zeros. */ @@ -192,6 +190,23 @@ frame_pc_unwind (struct frame_info *this_frame) return this_frame->pc_unwind_cache; } +CORE_ADDR +frame_func_unwind (struct frame_info *fi) +{ + if (!fi->prev_func.p) + { + fi->prev_func.p = 1; + fi->prev_func.addr = get_pc_function_start (frame_pc_unwind (fi)); + } + return fi->prev_func.addr; +} + +CORE_ADDR +get_frame_func (struct frame_info *fi) +{ + return frame_func_unwind (fi->next); +} + static int do_frame_unwind_register (void *src, int regnum, void *buf) { @@ -511,7 +526,13 @@ create_sentinel_frame (struct regcache *regcache) /* FIXME: cagney/2003-01-10: Problem here. Unwinding a sentinel frame's PC may require information such as the frame's thread's stop reason. Is it possible to get to that? */ + /* FIXME: cagney/2003-04-04: Once ->pc is eliminated, this + assignment can go away. */ frame->pc = frame_pc_unwind (frame); + /* Make the sentinel frame's ID valid, but invalid. That way all + comparisons with it should fail. */ + frame->id_p = 1; + frame->id = null_frame_id; return frame; } @@ -641,7 +662,7 @@ select_frame (struct frame_info *fi) source language of this frame, and switch to it if desired. */ if (fi) { - s = find_pc_symtab (fi->pc); + s = find_pc_symtab (get_frame_pc (fi)); if (s && s->language != current_language->la_language && s->language != language_unknown @@ -756,8 +777,7 @@ legacy_saved_regs_this_id (struct frame_info *next_frame, unwinding a sentinel frame, the PC of which is pointing at a stack dummy. Fake up the dummy frame's ID using the same sequence as is found a traditional unwinder. */ - (*id).base = read_fp (); - (*id).pc = read_pc (); + (*id) = frame_id_build (read_fp (), read_pc ()); return; } @@ -810,11 +830,12 @@ legacy_saved_regs_this_id (struct frame_info *next_frame, /* FIXME: cagney/2002-06-08: This should probably return the frame's function and not the PC (a.k.a. resume address). */ pc = frame_pc_unwind (next_frame); - id->pc = pc; - id->base = base; + (*id) = frame_id_build (base, pc); } const struct frame_unwind legacy_saved_regs_unwinder = { + /* Not really. It gets overridden by legacy_get_prev_frame. */ + UNKNOWN_FRAME, legacy_saved_regs_this_id, legacy_saved_regs_prev_register }; @@ -955,17 +976,22 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) fi = frame_obstack_zalloc (sizeof (struct frame_info)); - fi->frame = addr; - fi->pc = pc; fi->next = create_sentinel_frame (current_regcache); - fi->type = frame_type_from_pc (pc); + + /* Select/initialize both the unwind function and the frame's type + based on the PC. */ + fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc); + if (fi->unwind->type != UNKNOWN_FRAME) + fi->type = fi->unwind->type; + else + fi->type = frame_type_from_pc (pc); + + deprecated_update_frame_base_hack (fi, addr); + deprecated_update_frame_pc_hack (fi, pc); if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()) DEPRECATED_INIT_EXTRA_FRAME_INFO (0, fi); - /* Select/initialize an unwind function. */ - fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc); - return fi; } @@ -1020,10 +1046,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) struct frame_info *prev; int fromleaf; - /* Allocate the new frame but do not wire it in to the frame chain. - Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along - frame->next to pull some fancy tricks (of course such code is, by - definition, recursive). Try to prevent it. + /* Allocate the new frame. There is no reason to worry about memory leaks, should the remainder of the function fail. The allocated memory will be @@ -1033,6 +1056,17 @@ legacy_get_prev_frame (struct frame_info *this_frame) prev = FRAME_OBSTACK_ZALLOC (struct frame_info); prev->level = this_frame->level + 1; + /* Do not completly wire it in to the frame chain. Some (bad) code + in INIT_FRAME_EXTRA_INFO tries to look along frame->prev to pull + some fancy tricks (of course such code is, by definition, + recursive). + + On the other hand, methods, such as get_frame_pc() and + get_frame_base() rely on being able to walk along the frame + chain. Make certain that at least they work by providing that + link. Of course things manipulating prev can't go back. */ + prev->next = this_frame; + /* NOTE: cagney/2002-11-18: Should have been correctly setting the frame's type here, before anything else, and not last, at the bottom of this function. The various @@ -1043,7 +1077,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) Unfortunatly those same work-arounds rely on the type defaulting to NORMAL_FRAME. Ulgh! The new frame code does not have this problem. */ - prev->type = NORMAL_FRAME; + prev->type = UNKNOWN_FRAME; /* A legacy frame's ID is always computed here. Mark it as valid. */ prev->id_p = 1; @@ -1069,8 +1103,8 @@ legacy_get_prev_frame (struct frame_info *this_frame) because (well ignoring the PPC) a dummy frame can be located using THIS_FRAME's frame ID. */ - prev->pc = frame_pc_unwind (this_frame); - if (prev->pc == 0) + deprecated_update_frame_pc_hack (prev, frame_pc_unwind (this_frame)); + if (get_frame_pc (prev) == 0) { /* The allocated PREV_FRAME will be reclaimed when the frame obstack is next purged. */ @@ -1079,10 +1113,14 @@ legacy_get_prev_frame (struct frame_info *this_frame) "Outermost frame - unwound PC zero\n"); return NULL; } - prev->type = frame_type_from_pc (prev->pc); - /* Set the unwind functions based on that identified PC. */ + /* Set the unwind functions based on that identified PC. Ditto + for the "type" but strongly prefer the unwinder's frame type. */ prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc); + if (prev->unwind->type == UNKNOWN_FRAME) + prev->type = frame_type_from_pc (prev->pc); + else + prev->type = prev->unwind->type; /* Find the prev's frame's ID. */ if (prev->type == DUMMY_FRAME @@ -1113,8 +1151,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) using the same sequence as is found a traditional unwinder. Once all architectures supply the unwind_dummy_id method, this code can go away. */ - prev->id.base = read_fp (); - prev->id.pc = read_pc (); + prev->id = frame_id_build (read_fp (), read_pc ()); } /* Check that the unwound ID is valid. */ @@ -1136,14 +1173,13 @@ legacy_get_prev_frame (struct frame_info *this_frame) frame base, in the frame object. */ /* FIXME: cagney/2002-12-18: Instead of this hack, should only - store the frame ID in PREV_FRAME. Unfortunatly, some - architectures (HP/UX) still reply on EXTRA_FRAME_INFO and, - hence, still poke at the "struct frame_info" object directly. */ + store the frame ID in PREV_FRAME. */ + /* FIXME: cagney/2003-04-04: Once ->frame is eliminated, this + assignment can go. */ prev->frame = prev->id.base; /* Link it in. */ this_frame->prev = prev; - prev->next = this_frame; /* FIXME: cagney/2002-01-19: This call will go away. Instead of initializing extra info, all frames will use the frame_cache @@ -1218,8 +1254,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) /* Link in the already allocated prev frame. */ this_frame->prev = prev; - prev->next = this_frame; - prev->frame = address; + deprecated_update_frame_base_hack (prev, address); /* This change should not be needed, FIXME! We should determine whether any targets *need* DEPRECATED_INIT_FRAME_PC to happen @@ -1295,7 +1330,9 @@ legacy_get_prev_frame (struct frame_info *this_frame) that PC value. */ if (DEPRECATED_INIT_FRAME_PC_FIRST_P ()) - prev->pc = (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev)); + deprecated_update_frame_pc_hack (prev, + DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, + prev)); if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()) DEPRECATED_INIT_EXTRA_FRAME_INFO (fromleaf, prev); @@ -1304,15 +1341,17 @@ legacy_get_prev_frame (struct frame_info *this_frame) FRAME_SAVED_PC may use that queue to figure out its value (see tm-sparc.h). We want the pc saved in the inferior frame. */ if (DEPRECATED_INIT_FRAME_PC_P ()) - prev->pc = DEPRECATED_INIT_FRAME_PC (fromleaf, prev); + deprecated_update_frame_pc_hack (prev, + DEPRECATED_INIT_FRAME_PC (fromleaf, + prev)); /* If ->frame and ->pc are unchanged, we are in the process of getting ourselves into an infinite backtrace. Some architectures check this in DEPRECATED_FRAME_CHAIN or thereabouts, but it seems like there is no reason this can't be an architecture-independent check. */ - if (prev->frame == this_frame->frame - && prev->pc == this_frame->pc) + if (get_frame_base (prev) == get_frame_base (this_frame) + && get_frame_pc (prev) == get_frame_pc (this_frame)) { this_frame->prev = NULL; obstack_free (&frame_cache_obstack, prev); @@ -1323,7 +1362,16 @@ legacy_get_prev_frame (struct frame_info *this_frame) (and probably other architectural information). The PC lets you check things like the debug info at that point (dwarf2cfi?) and use that to decide how the frame should be unwound. */ - prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc); + prev->unwind = frame_unwind_find_by_pc (current_gdbarch, + get_frame_pc (prev)); + + /* If the unwinder provides a frame type, use it. Otherwize + continue on to that heuristic mess. */ + if (prev->unwind->type != UNKNOWN_FRAME) + { + prev->type = prev->unwind->type; + return prev; + } /* NOTE: cagney/2002-11-18: The code segments, found in create_new_frame and get_prev_frame(), that initializes the @@ -1335,8 +1383,8 @@ legacy_get_prev_frame (struct frame_info *this_frame) before the INIT function has been called. */ if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES && (DEPRECATED_PC_IN_CALL_DUMMY_P () - ? DEPRECATED_PC_IN_CALL_DUMMY (prev->pc, 0, 0) - : pc_in_dummy_frame (prev->pc))) + ? DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (prev), 0, 0) + : pc_in_dummy_frame (get_frame_pc (prev)))) prev->type = DUMMY_FRAME; else { @@ -1347,8 +1395,8 @@ legacy_get_prev_frame (struct frame_info *this_frame) Unforunatly, its the INIT code that sets the PC (Hmm, catch 22). */ char *name; - find_pc_partial_function (prev->pc, &name, NULL, NULL); - if (PC_IN_SIGTRAMP (prev->pc, name)) + find_pc_partial_function (get_frame_pc (prev), &name, NULL, NULL); + if (PC_IN_SIGTRAMP (get_frame_pc (prev), name)) prev->type = SIGTRAMP_FRAME; /* FIXME: cagney/2002-11-11: Leave prev->type alone. Some architectures are forcing the frame's type in INIT so we @@ -1551,6 +1599,8 @@ get_prev_frame (struct frame_info *this_frame) because (well ignoring the PPC) a dummy frame can be located using THIS_FRAME's frame ID. */ + /* FIXME: cagney/2003-04-04: Once ->pc is eliminated, this + assignment can go away. */ prev_frame->pc = frame_pc_unwind (this_frame); if (prev_frame->pc == 0) { @@ -1561,12 +1611,22 @@ get_prev_frame (struct frame_info *this_frame) "Outermost frame - unwound PC zero\n"); return NULL; } - prev_frame->type = frame_type_from_pc (prev_frame->pc); /* Set the unwind functions based on that identified PC. */ prev_frame->unwind = frame_unwind_find_by_pc (current_gdbarch, prev_frame->pc); + /* FIXME: cagney/2003-04-02: Rather than storing the frame's type in + the frame, the unwinder's type should be returned directly. + Unfortunatly, legacy code, called by legacy_get_prev_frame, + explicitly set the frames type using the method + deprecated_set_frame_type(). */ + gdb_assert (prev_frame->unwind->type != UNKNOWN_FRAME); + prev_frame->type = prev_frame->unwind->type; + + /* Can the frame's type and unwinder be computed on demand? That + would make a frame's creation really really lite! */ + /* The prev's frame's ID is computed by demand in get_frame_id(). */ /* The unwound frame ID is validate at the start of this function, @@ -1614,7 +1674,7 @@ pc_notcurrent (struct frame_info *frame) void find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal) { - (*sal) = find_pc_line (frame->pc, pc_notcurrent (frame)); + (*sal) = find_pc_line (get_frame_pc (frame), pc_notcurrent (frame)); } /* Per "frame.h", return the ``address'' of the frame. Code should @@ -1636,7 +1696,7 @@ get_frame_base (struct frame_info *fi) CORE_ADDR get_frame_base_address (struct frame_info *fi) { - if (fi->type != NORMAL_FRAME) + if (get_frame_type (fi) != NORMAL_FRAME) return 0; if (fi->base == NULL) fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi)); @@ -1651,7 +1711,7 @@ CORE_ADDR get_frame_locals_address (struct frame_info *fi) { void **cache; - if (fi->type != NORMAL_FRAME) + if (get_frame_type (fi) != NORMAL_FRAME) return 0; /* If there isn't a frame address method, find it. */ if (fi->base == NULL) @@ -1669,7 +1729,7 @@ CORE_ADDR get_frame_args_address (struct frame_info *fi) { void **cache; - if (fi->type != NORMAL_FRAME) + if (get_frame_type (fi) != NORMAL_FRAME) return 0; /* If there isn't a frame address method, find it. */ if (fi->base == NULL) @@ -1703,7 +1763,10 @@ get_frame_type (struct frame_info *frame) if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES && deprecated_frame_in_dummy (frame)) return DUMMY_FRAME; - return frame->type; + if (frame->type == UNKNOWN_FRAME) + return NORMAL_FRAME; + else + return frame->type; } void @@ -1713,34 +1776,6 @@ deprecated_set_frame_type (struct frame_info *frame, enum frame_type type) frame->type = type; } -#ifdef FRAME_FIND_SAVED_REGS -/* XXX - deprecated. This is a compatibility function for targets - that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS. */ -/* Find the addresses in which registers are saved in FRAME. */ - -void -deprecated_get_frame_saved_regs (struct frame_info *frame, - struct frame_saved_regs *saved_regs_addr) -{ - if (frame->saved_regs == NULL) - { - frame->saved_regs = (CORE_ADDR *) - frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS); - } - if (saved_regs_addr == NULL) - { - struct frame_saved_regs saved_regs; - FRAME_FIND_SAVED_REGS (frame, saved_regs); - memcpy (frame->saved_regs, &saved_regs, SIZEOF_FRAME_SAVED_REGS); - } - else - { - FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr); - memcpy (frame->saved_regs, saved_regs_addr, SIZEOF_FRAME_SAVED_REGS); - } -} -#endif - struct frame_extra_info * get_frame_extra_info (struct frame_info *fi) { diff --git a/gdb/frame.h b/gdb/frame.h index 231aaadbd0f..f928b9c11ba 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -149,6 +149,12 @@ extern struct frame_info *frame_find_by_id (struct frame_id id); this frame. */ extern CORE_ADDR get_frame_pc (struct frame_info *); +/* Following on from the `resume' address. Return the entry point + address of the function containing that resume address, or zero if + that function isn't known. */ +extern CORE_ADDR frame_func_unwind (struct frame_info *fi); +extern CORE_ADDR get_frame_func (struct frame_info *fi); + /* Closely related to the resume address, various symbol table attributes that are determined by the PC. Note that for a normal frame, the PC refers to the resume address after the return, and @@ -225,6 +231,11 @@ extern int frame_relative_level (struct frame_info *fi); enum frame_type { + /* The frame's type hasn't yet been defined. This is a catch-all + for legacy code that uses really strange technicques, such as + deprecated_set_frame_type, to set the frame's type. New code + should not use this value. */ + UNKNOWN_FRAME, /* A true stack frame, created by the target program during normal execution. */ NORMAL_FRAME, @@ -313,24 +324,6 @@ extern CORE_ADDR frame_pc_unwind (struct frame_info *frame); of the caller. */ extern void frame_pop (struct frame_info *frame); -/* Describe the saved registers of a frame. */ - -#if defined (EXTRA_FRAME_INFO) || defined (FRAME_FIND_SAVED_REGS) -/* XXXX - deprecated */ -struct frame_saved_regs - { - /* For each register R (except the SP), regs[R] is the address at - which it was saved on entry to the frame, or zero if it was not - saved on entry to this frame. This includes special registers - such as pc and fp saved in special ways in the stack frame. - - regs[SP_REGNUM] is different. It holds the actual SP, not the - address at which it was saved. */ - - CORE_ADDR regs[NUM_REGS]; - }; -#endif - /* We keep a cache of stack frames, each of which is a "struct frame_info". The innermost one gets allocated (in wait_for_inferior) each time the inferior stops; current_frame @@ -367,6 +360,10 @@ struct frame_info int level; /* The frame's type. */ + /* FIXME: cagney/2003-04-02: Should instead be returning + ->unwind->type. Unfortunatly, legacy code is still explicitly + setting the type using the method deprecated_set_frame_type. + Eliminate that method and this field can be eliminated. */ enum frame_type type; /* For each register, address of where it was saved on entry to @@ -379,13 +376,6 @@ struct frame_info initialized by DEPRECATED_FRAME_INIT_SAVED_REGS(). */ CORE_ADDR *saved_regs; /*NUM_REGS + NUM_PSEUDO_REGS*/ -#ifdef EXTRA_FRAME_INFO - /* XXXX - deprecated */ - /* Anything extra for this structure that may have been defined - in the machine dependent files. */ - EXTRA_FRAME_INFO -#endif - /* Anything extra for this structure that may have been defined in the machine dependent files. */ /* Allocated by frame_extra_info_zalloc () which is called / @@ -408,6 +398,13 @@ struct frame_info int pc_unwind_cache_p; CORE_ADDR pc_unwind_cache; + /* Cached copy of the previous frame's function address. */ + struct + { + CORE_ADDR addr; + int p; + } prev_func; + /* This frame's ID. Note that the frame's ID, base and PC contain redundant information. */ int id_p; @@ -465,14 +462,6 @@ extern int frame_chain_valid (CORE_ADDR, struct frame_info *); extern void generic_save_dummy_frame_tos (CORE_ADDR sp); - -#ifdef FRAME_FIND_SAVED_REGS -/* XXX - deprecated */ -#define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) deprecated_get_frame_saved_regs (FI, NULL) -extern void deprecated_get_frame_saved_regs (struct frame_info *, - struct frame_saved_regs *); -#endif - extern struct block *get_frame_block (struct frame_info *, CORE_ADDR *addr_in_block); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 596f13194d3..b2644f766aa 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -55,18 +55,6 @@ extern struct gdbarch *current_gdbarch; /* If any of the following are defined, the target wasn't correctly converted. */ -#if GDB_MULTI_ARCH -#if defined (EXTRA_FRAME_INFO) -#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info" -#endif -#endif - -#if GDB_MULTI_ARCH -#if defined (FRAME_FIND_SAVED_REGS) -#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS" -#endif -#endif - #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE) #error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file." #endif @@ -1116,14 +1104,12 @@ extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get extern int gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch); extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch, int deprecated_use_generic_dummy_frames); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) #error "Non multi-arch definition of DEPRECATED_USE_GENERIC_DUMMY_FRAMES" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) +#if !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (gdbarch_deprecated_use_generic_dummy_frames (current_gdbarch)) #endif -#endif /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_LOCATION) @@ -1132,14 +1118,12 @@ extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdb extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) #error "Non multi-arch definition of CALL_DUMMY_LOCATION" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LOCATION) +#if !defined (CALL_DUMMY_LOCATION) #define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch)) #endif -#endif /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_ADDRESS) @@ -1204,10 +1188,10 @@ extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dum #endif extern int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY_P) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY_P) #error "Non multi-arch definition of DEPRECATED_PC_IN_CALL_DUMMY" #endif -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY_P) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY_P) #define DEPRECATED_PC_IN_CALL_DUMMY_P() (gdbarch_deprecated_pc_in_call_dummy_p (current_gdbarch)) #endif @@ -1219,11 +1203,11 @@ extern int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch); typedef int (gdbarch_deprecated_pc_in_call_dummy_ftype) (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); extern int gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); extern void set_gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, gdbarch_deprecated_pc_in_call_dummy_ftype *deprecated_pc_in_call_dummy); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY) #error "Non multi-arch definition of DEPRECATED_PC_IN_CALL_DUMMY" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY) #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) (gdbarch_deprecated_pc_in_call_dummy (current_gdbarch, pc, sp, frame_address)) #endif #endif diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index fa91815f8ef..e5cb51ddf33 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -518,8 +518,8 @@ F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc::0:0 # behaviour here (and hence entrench it further) gdbarch simply # reqires that these methods be set up from the word go. This also # avoids any potential problems with moving beyond multi-arch partial. -v:1:DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0 -v:1:CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0 +v::DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0 +v::CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0 f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0 v::CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset v::CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset @@ -529,7 +529,7 @@ v::CALL_DUMMY_LENGTH:int:call_dummy_length # is false, the corresponding function works. This simplifies the # migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(), # doesn't need to be modified. -F:1:DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy +F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy v::CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx v::SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0 V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0 @@ -820,18 +820,6 @@ extern struct gdbarch *current_gdbarch; /* If any of the following are defined, the target wasn't correctly converted. */ -#if GDB_MULTI_ARCH -#if defined (EXTRA_FRAME_INFO) -#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info" -#endif -#endif - -#if GDB_MULTI_ARCH -#if defined (FRAME_FIND_SAVED_REGS) -#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS" -#endif -#endif - #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE) #error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file." #endif diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index 3d1ca88ce50..1e1cb917820 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -35,7 +35,7 @@ void hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi, void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, CORE_ADDR *tmp); void hppa_hpux_frame_find_saved_regs_in_sigtramp - (struct frame_info *fi, struct frame_saved_regs *fsr); + (struct frame_info *fi, CORE_ADDR *fsr); int hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name) @@ -79,7 +79,7 @@ hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, void hppa_hpux_frame_find_saved_regs_in_sigtramp (struct frame_info *fi, - struct frame_saved_regs *fsr) + CORE_ADDR *fsr) { int i; const CORE_ADDR tmp = (fi)->frame + (10 * 4); @@ -87,9 +87,9 @@ hppa_hpux_frame_find_saved_regs_in_sigtramp (struct frame_info *fi, for (i = 0; i < NUM_REGS; i++) { if (i == SP_REGNUM) - (fsr)->regs[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4); + fsr[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4); else - (fsr)->regs[i] = tmp + i * 4; + fsr[i] = tmp + i * 4; } } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 2e0c192250c..896d638e9e7 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -78,8 +78,7 @@ static unsigned extract_5R_store (unsigned int); static unsigned extract_5r_store (unsigned int); -static void find_dummy_frame_regs (struct frame_info *, - struct frame_saved_regs *); +static void find_dummy_frame_regs (struct frame_info *, CORE_ADDR *); static int find_proc_framesize (CORE_ADDR); @@ -103,7 +102,7 @@ static int low_sign_extend (unsigned int, unsigned int); static int sign_extend (unsigned int, unsigned int); -static int restore_pc_queue (struct frame_saved_regs *); +static int restore_pc_queue (CORE_ADDR *); static int hppa_alignof (struct type *); @@ -943,13 +942,13 @@ hppa_frame_saved_pc (struct frame_info *frame) && ((get_frame_type (frame->next) == SIGTRAMP_FRAME) || pc_in_interrupt_handler (frame->next->pc))) { - struct frame_saved_regs saved_regs; - - deprecated_get_frame_saved_regs (frame->next, &saved_regs); - if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + CORE_ADDR *saved_regs; + hppa_frame_init_saved_regs (frame->next); + saved_regs = get_frame_saved_regs (frame->next); + if (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2) { - pc = read_memory_integer (saved_regs.regs[31], + pc = read_memory_integer (saved_regs[31], TARGET_PTR_BIT / 8) & ~0x3; /* Syscalls are really two frames. The syscall stub itself @@ -957,11 +956,11 @@ hppa_frame_saved_pc (struct frame_info *frame) a return pointer in %r31. We return the %rp variant if %r31 is the same as frame->pc. */ if (pc == frame->pc) - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else @@ -983,13 +982,13 @@ hppa_frame_saved_pc (struct frame_info *frame) && ((get_frame_type (frame->next) == SIGTRAMP_FRAME) || pc_in_interrupt_handler (frame->next->pc))) { - struct frame_saved_regs saved_regs; - - deprecated_get_frame_saved_regs (frame->next, &saved_regs); - if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + CORE_ADDR *saved_regs; + hppa_frame_init_saved_regs (frame->next); + saved_regs = get_frame_saved_regs (frame->next); + if (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2) { - pc = read_memory_integer (saved_regs.regs[31], + pc = read_memory_integer (saved_regs[31], TARGET_PTR_BIT / 8) & ~0x3; /* Syscalls are really two frames. The syscall stub itself @@ -997,11 +996,11 @@ hppa_frame_saved_pc (struct frame_info *frame) a return pointer in %r31. We return the %rp variant if %r31 is the same as frame->pc. */ if (pc == frame->pc) - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else if (rp_offset == 0) @@ -1129,9 +1128,9 @@ hppa_frame_chain (struct frame_info *frame) /* A frame in the current frame list, or zero. */ struct frame_info *saved_regs_frame = 0; - /* Where the registers were saved in saved_regs_frame. - If saved_regs_frame is zero, this is garbage. */ - struct frame_saved_regs saved_regs; + /* Where the registers were saved in saved_regs_frame. If + saved_regs_frame is zero, this is garbage. */ + CORE_ADDR *saved_regs = NULL; CORE_ADDR caller_pc; @@ -1258,11 +1257,12 @@ hppa_frame_chain (struct frame_info *frame) /* The unwind entry claims that r3 is saved here. However, in optimized code, GCC often doesn't actually save r3. We'll discover this if we look at the prologue. */ - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); saved_regs_frame = tmp_frame; /* If we have an address for r3, that's good. */ - if (saved_regs.regs[FP_REGNUM]) + if (saved_regs[FP_REGNUM]) break; } } @@ -1307,21 +1307,24 @@ hppa_frame_chain (struct frame_info *frame) system call has a variable sized stack frame. */ if (tmp_frame != saved_regs_frame) - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + { + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); + } /* Abominable hack. */ if (current_target.to_has_execution == 0 - && ((saved_regs.regs[FLAGS_REGNUM] - && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + && ((saved_regs[FLAGS_REGNUM] + && (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2)) - || (saved_regs.regs[FLAGS_REGNUM] == 0 + || (saved_regs[FLAGS_REGNUM] == 0 && read_register (FLAGS_REGNUM) & 0x2))) { u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } else @@ -1330,7 +1333,7 @@ hppa_frame_chain (struct frame_info *frame) } } - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } } @@ -1342,21 +1345,24 @@ hppa_frame_chain (struct frame_info *frame) tmp_frame = tmp_frame->next; if (tmp_frame != saved_regs_frame) - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + { + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); + } /* Abominable hack. See above. */ if (current_target.to_has_execution == 0 - && ((saved_regs.regs[FLAGS_REGNUM] - && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + && ((saved_regs[FLAGS_REGNUM] + && (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2)) - || (saved_regs.regs[FLAGS_REGNUM] == 0 + || (saved_regs[FLAGS_REGNUM] == 0 && read_register (FLAGS_REGNUM) & 0x2))) { u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } else @@ -1496,26 +1502,26 @@ hppa_push_dummy_frame (void) static void find_dummy_frame_regs (struct frame_info *frame, - struct frame_saved_regs *frame_saved_regs) + CORE_ADDR frame_saved_regs[]) { CORE_ADDR fp = frame->frame; int i; /* The 32bit and 64bit ABIs save RP into different locations. */ if (REGISTER_SIZE == 8) - frame_saved_regs->regs[RP_REGNUM] = (fp - 16) & ~0x3; + frame_saved_regs[RP_REGNUM] = (fp - 16) & ~0x3; else - frame_saved_regs->regs[RP_REGNUM] = (fp - 20) & ~0x3; + frame_saved_regs[RP_REGNUM] = (fp - 20) & ~0x3; - frame_saved_regs->regs[FP_REGNUM] = fp; + frame_saved_regs[FP_REGNUM] = fp; - frame_saved_regs->regs[1] = fp + (2 * REGISTER_SIZE); + frame_saved_regs[1] = fp + (2 * REGISTER_SIZE); for (fp += 3 * REGISTER_SIZE, i = 3; i < 32; i++) { if (i != FP_REGNUM) { - frame_saved_regs->regs[i] = fp; + frame_saved_regs[i] = fp; fp += REGISTER_SIZE; } } @@ -1525,14 +1531,14 @@ find_dummy_frame_regs (struct frame_info *frame, fp += 4; for (i = FP0_REGNUM; i < NUM_REGS; i++, fp += 8) - frame_saved_regs->regs[i] = fp; - - frame_saved_regs->regs[IPSW_REGNUM] = fp; - frame_saved_regs->regs[SAR_REGNUM] = fp + REGISTER_SIZE; - frame_saved_regs->regs[PCOQ_HEAD_REGNUM] = fp + 2 * REGISTER_SIZE; - frame_saved_regs->regs[PCSQ_HEAD_REGNUM] = fp + 3 * REGISTER_SIZE; - frame_saved_regs->regs[PCOQ_TAIL_REGNUM] = fp + 4 * REGISTER_SIZE; - frame_saved_regs->regs[PCSQ_TAIL_REGNUM] = fp + 5 * REGISTER_SIZE; + frame_saved_regs[i] = fp; + + frame_saved_regs[IPSW_REGNUM] = fp; + frame_saved_regs[SAR_REGNUM] = fp + REGISTER_SIZE; + frame_saved_regs[PCOQ_HEAD_REGNUM] = fp + 2 * REGISTER_SIZE; + frame_saved_regs[PCSQ_HEAD_REGNUM] = fp + 3 * REGISTER_SIZE; + frame_saved_regs[PCOQ_TAIL_REGNUM] = fp + 4 * REGISTER_SIZE; + frame_saved_regs[PCSQ_TAIL_REGNUM] = fp + 5 * REGISTER_SIZE; } void @@ -1541,44 +1547,45 @@ hppa_pop_frame (void) register struct frame_info *frame = get_current_frame (); register CORE_ADDR fp, npc, target_pc; register int regnum; - struct frame_saved_regs fsr; + CORE_ADDR *fsr; double freg_buffer; fp = get_frame_base (frame); - deprecated_get_frame_saved_regs (frame, &fsr); + hppa_frame_init_saved_regs (frame); + fsr = get_frame_saved_regs (frame); #ifndef NO_PC_SPACE_QUEUE_RESTORE - if (fsr.regs[IPSW_REGNUM]) /* Restoring a call dummy frame */ - restore_pc_queue (&fsr); + if (fsr[IPSW_REGNUM]) /* Restoring a call dummy frame */ + restore_pc_queue (fsr); #endif for (regnum = 31; regnum > 0; regnum--) - if (fsr.regs[regnum]) - write_register (regnum, read_memory_integer (fsr.regs[regnum], + if (fsr[regnum]) + write_register (regnum, read_memory_integer (fsr[regnum], REGISTER_SIZE)); for (regnum = NUM_REGS - 1; regnum >= FP0_REGNUM; regnum--) - if (fsr.regs[regnum]) + if (fsr[regnum]) { - read_memory (fsr.regs[regnum], (char *) &freg_buffer, 8); + read_memory (fsr[regnum], (char *) &freg_buffer, 8); deprecated_write_register_bytes (REGISTER_BYTE (regnum), (char *) &freg_buffer, 8); } - if (fsr.regs[IPSW_REGNUM]) + if (fsr[IPSW_REGNUM]) write_register (IPSW_REGNUM, - read_memory_integer (fsr.regs[IPSW_REGNUM], + read_memory_integer (fsr[IPSW_REGNUM], REGISTER_SIZE)); - if (fsr.regs[SAR_REGNUM]) + if (fsr[SAR_REGNUM]) write_register (SAR_REGNUM, - read_memory_integer (fsr.regs[SAR_REGNUM], + read_memory_integer (fsr[SAR_REGNUM], REGISTER_SIZE)); /* If the PC was explicitly saved, then just restore it. */ - if (fsr.regs[PCOQ_TAIL_REGNUM]) + if (fsr[PCOQ_TAIL_REGNUM]) { - npc = read_memory_integer (fsr.regs[PCOQ_TAIL_REGNUM], + npc = read_memory_integer (fsr[PCOQ_TAIL_REGNUM], REGISTER_SIZE); write_register (PCOQ_TAIL_REGNUM, npc); } @@ -1591,7 +1598,7 @@ hppa_pop_frame (void) write_register (FP_REGNUM, read_memory_integer (fp, REGISTER_SIZE)); - if (fsr.regs[IPSW_REGNUM]) /* call dummy */ + if (fsr[IPSW_REGNUM]) /* call dummy */ write_register (SP_REGNUM, fp - 48); else write_register (SP_REGNUM, fp); @@ -1604,7 +1611,7 @@ hppa_pop_frame (void) Don't skip through the trampoline if we're popping a dummy frame. */ target_pc = SKIP_TRAMPOLINE_CODE (npc & ~0x3) & ~0x3; - if (target_pc && !fsr.regs[IPSW_REGNUM]) + if (target_pc && !fsr[IPSW_REGNUM]) { struct symtab_and_line sal; struct breakpoint *breakpoint; @@ -1635,10 +1642,10 @@ hppa_pop_frame (void) queue space registers. */ static int -restore_pc_queue (struct frame_saved_regs *fsr) +restore_pc_queue (CORE_ADDR *fsr) { CORE_ADDR pc = read_pc (); - CORE_ADDR new_pc = read_memory_integer (fsr->regs[PCOQ_HEAD_REGNUM], + CORE_ADDR new_pc = read_memory_integer (fsr[PCOQ_HEAD_REGNUM], TARGET_PTR_BIT / 8); struct target_waitstatus w; int insn_count; @@ -1657,7 +1664,7 @@ restore_pc_queue (struct frame_saved_regs *fsr) So, load up the registers and single step until we are in the right place. */ - write_register (21, read_memory_integer (fsr->regs[PCSQ_HEAD_REGNUM], + write_register (21, read_memory_integer (fsr[PCSQ_HEAD_REGNUM], REGISTER_SIZE)); write_register (22, new_pc); @@ -3842,15 +3849,15 @@ hppa_skip_prologue (CORE_ADDR pc) return (skip_prologue_hard_way (pc)); } -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. */ +/* Put here the code to store, into the SAVED_REGS, the addresses of + the saved registers of frame described by FRAME_INFO. This + includes special registers such as pc and fp saved in special ways + in the stack frame. sp is even more special: the address we return + for it IS the sp for the next frame. */ void hppa_frame_find_saved_regs (struct frame_info *frame_info, - struct frame_saved_regs *frame_saved_regs) + CORE_ADDR frame_saved_regs[]) { CORE_ADDR pc; struct unwind_table_entry *u; @@ -3861,7 +3868,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, int final_iteration; /* Zero out everything. */ - memset (frame_saved_regs, '\0', sizeof (struct frame_saved_regs)); + memset (frame_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); /* Call dummy frames always look the same, so there's no need to examine the dummy code to determine locations of saved registers; @@ -3892,11 +3899,11 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, { /* SP is a little special. */ if (i == SP_REGNUM) - frame_saved_regs->regs[SP_REGNUM] + frame_saved_regs[SP_REGNUM] = read_memory_integer (frame_info->frame + SP_REGNUM * 4, TARGET_PTR_BIT / 8); else - frame_saved_regs->regs[i] = frame_info->frame + i * 4; + frame_saved_regs[i] = frame_info->frame + i * 4; } return; } @@ -3912,7 +3919,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* Get the starting address of the function referred to by the PC saved in frame. */ - pc = get_pc_function_start (frame_info->pc); + pc = get_frame_func (frame_info); /* Yow! */ u = find_unwind_entry (pc); @@ -3945,7 +3952,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* The frame always represents the value of %sp at entry to the current function (and is thus equivalent to the "saved" stack pointer. */ - frame_saved_regs->regs[SP_REGNUM] = frame_info->frame; + frame_saved_regs[SP_REGNUM] = frame_info->frame; /* Loop until we find everything of interest or hit a branch. @@ -3980,12 +3987,12 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, if (inst == 0x6bc23fd9) /* stw rp,-0x14(sr0,sp) */ { save_rp = 0; - frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 20; + frame_saved_regs[RP_REGNUM] = frame_info->frame - 20; } else if (inst == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */ { save_rp = 0; - frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 16; + frame_saved_regs[RP_REGNUM] = frame_info->frame - 16; } /* Note if we saved SP into the stack. This also happens to indicate @@ -3993,7 +4000,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, if ( (inst & 0xffffc000) == 0x6fc10000 /* stw,ma r1,N(sr0,sp) */ || (inst & 0xffffc00c) == 0x73c10008) /* std,ma r1,N(sr0,sp) */ { - frame_saved_regs->regs[FP_REGNUM] = frame_info->frame; + frame_saved_regs[FP_REGNUM] = frame_info->frame; save_sp = 0; } @@ -4007,10 +4014,10 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* stwm with a positive displacement is a *post modify*. */ if ((inst >> 26) == 0x1b && extract_14 (inst) >= 0) - frame_saved_regs->regs[reg] = frame_info->frame; + frame_saved_regs[reg] = frame_info->frame; /* A std has explicit post_modify forms. */ else if ((inst & 0xfc00000c0) == 0x70000008) - frame_saved_regs->regs[reg] = frame_info->frame; + frame_saved_regs[reg] = frame_info->frame; else { CORE_ADDR offset; @@ -4024,10 +4031,10 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* Handle code with and without frame pointers. */ if (u->Save_SP) - frame_saved_regs->regs[reg] + frame_saved_regs[reg] = frame_info->frame + offset; else - frame_saved_regs->regs[reg] + frame_saved_regs[reg] = (frame_info->frame + (u->Total_frame_size << 3) + offset); } @@ -4060,12 +4067,12 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* 1st HP CC FP register store. After this instruction we've set enough state that the GCC and HPCC code are both handled in the same manner. */ - frame_saved_regs->regs[reg + FP4_REGNUM + 4] = frame_info->frame; + frame_saved_regs[reg + FP4_REGNUM + 4] = frame_info->frame; fp_loc = 8; } else { - frame_saved_regs->regs[reg + FP0_REGNUM + 4] + frame_saved_regs[reg + FP0_REGNUM + 4] = frame_info->frame + fp_loc; fp_loc += 8; } @@ -4085,6 +4092,17 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, } } +/* XXX - deprecated. This is a compatibility function for targets + that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS. */ +/* Find the addresses in which registers are saved in FRAME. */ + +void +hppa_frame_init_saved_regs (struct frame_info *frame) +{ + if (get_frame_saved_regs (frame) == NULL) + frame_saved_regs_zalloc (frame); + hppa_frame_find_saved_regs (frame, get_frame_saved_regs (frame)); +} /* Exception handling support for the HP-UX ANSI C++ compiler. The compiler (aCC) provides a callback for exception events; diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 7ef1f6e80e0..317d7261e79 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -502,7 +502,7 @@ i386_frameless_signal_p (struct frame_info *frame) return (get_next_frame (frame) && get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME && (frameless_look_for_prologue (frame) - || get_frame_pc (frame) == get_pc_function_start (get_frame_pc (frame)))); + || get_frame_pc (frame) == get_frame_func (frame))); } /* Return the chain-pointer for FRAME. In the case of the i386, the @@ -714,7 +714,7 @@ i386_frame_init_saved_regs (struct frame_info *fip) frame_saved_regs_zalloc (fip); - pc = get_pc_function_start (get_frame_pc (fip)); + pc = get_frame_func (fip); if (pc != 0) locals = i386_get_frame_setup (pc); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index ecb49197291..5e46d6b8f40 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -1205,7 +1205,7 @@ ia64_frame_init_saved_regs (struct frame_info *frame) { CORE_ADDR func_start; - func_start = get_pc_function_start (get_frame_pc (frame)); + func_start = get_frame_func (frame); examine_prologue (func_start, get_frame_pc (frame), frame); } } diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 7a9886b5076..a93a156080e 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -614,7 +614,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) } else { - pc = get_pc_function_start (get_frame_pc (frame_info)); + pc = get_frame_func (frame_info); nextinsn = read_memory_unsigned_integer (pc, 2); if (P_PEA_FP == nextinsn diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 6fbbaa7fd2d..fe65bd81cea 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -897,9 +897,7 @@ selectors_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -930,9 +928,7 @@ selectors_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -956,9 +952,7 @@ selectors_info (char *regexp, int from_tty) char *p = asel; QUIT; - name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]); + name = SYMBOL_NATURAL_NAME (sym_arr[ix]); name = strchr (name, ' ') + 1; if (p[0] && specialcmp(name, p) == 0) continue; /* Seen this one already (not unique). */ @@ -1040,9 +1034,7 @@ classes_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -1066,9 +1058,7 @@ classes_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -1085,9 +1075,7 @@ classes_info (char *regexp, int from_tty) char *p = aclass; QUIT; - name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]); + name = SYMBOL_NATURAL_NAME (sym_arr[ix]); name += 2; if (p[0] && specialcmp(name, p) == 0) continue; /* Seen this one already (not unique). */ @@ -1348,9 +1336,7 @@ find_methods (struct symtab *symtab, char type, /* Not in the specified symtab. */ continue; - symname = SYMBOL_DEMANGLED_NAME (msymbol); - if (symname == NULL) - symname = DEPRECATED_SYMBOL_NAME (msymbol); + symname = SYMBOL_NATURAL_NAME (msymbol); if (symname == NULL) continue; @@ -1386,10 +1372,8 @@ find_methods (struct symtab *symtab, char type, sym = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol)); if (sym != NULL) { - const char *newsymname = SYMBOL_DEMANGLED_NAME (sym); + const char *newsymname = SYMBOL_NATURAL_NAME (sym); - if (newsymname == NULL) - newsymname = DEPRECATED_SYMBOL_NAME (sym); if (strcmp (symname, newsymname) == 0) { /* Found a high-level method sym: swap it into the diff --git a/gdb/remote-vxsparc.c b/gdb/remote-vxsparc.c index eb59b9fb43a..a97c18eed99 100644 --- a/gdb/remote-vxsparc.c +++ b/gdb/remote-vxsparc.c @@ -97,10 +97,9 @@ vx_read_register (int regno) bcopy (&sparc_greg_packet[SPARC_R_Y], &deprecated_registers[REGISTER_BYTE (Y_REGNUM)], 6 * SPARC_GREG_SIZE); - /* Now write the local and in registers to the register window - spill area in the frame. VxWorks does not do this for the - active frame automatically; it greatly simplifies debugging - (FRAME_FIND_SAVED_REGS, in particular, depends on this). */ + /* Now write the local and in registers to the register window spill + area in the frame. VxWorks does not do this for the active frame + automatically; it greatly simplifies debugging. */ sp = extract_address (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)], REGISTER_RAW_SIZE (SP_REGNUM)); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index ef330282782..08394dee1d5 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -990,7 +990,7 @@ rs6000_pop_frame (void) still in the link register, otherwise walk the frames and retrieve the saved %pc value in the previous frame. */ - addr = get_pc_function_start (get_frame_pc (frame)); + addr = get_frame_func (frame); (void) skip_prologue (addr, get_frame_pc (frame), &fdata); wordsize = gdbarch_tdep (current_gdbarch)->wordsize; @@ -1499,7 +1499,7 @@ rs6000_frameless_function_invocation (struct frame_info *fi) && !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME)) return 0; - func_start = get_pc_function_start (get_frame_pc (fi)); + func_start = get_frame_func (fi); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1540,7 +1540,7 @@ rs6000_frame_saved_pc (struct frame_info *fi) return deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), PC_REGNUM); - func_start = get_pc_function_start (get_frame_pc (fi)); + func_start = get_frame_func (fi); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1596,8 +1596,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) if (fdatap == NULL) { fdatap = &work_fdata; - (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)), - get_frame_pc (fi), fdatap); + (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), fdatap); } frame_saved_regs_zalloc (fi); @@ -1720,8 +1719,7 @@ frame_initial_stack_address (struct frame_info *fi) /* Find out if this function is using an alloca register. */ - (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)), - get_frame_pc (fi), &fdata); + (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), &fdata); /* If saved registers of this frame are not known yet, read and cache them. */ @@ -2741,9 +2739,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else { arch = bfd_arch_powerpc; - mach = 0; - bfd_default_set_arch_mach (&abfd, arch, mach); + bfd_default_set_arch_mach (&abfd, arch, 0); info.bfd_arch_info = bfd_get_arch_info (&abfd); + mach = info.bfd_arch_info->mach; } tdep = xmalloc (sizeof (struct gdbarch_tdep)); tdep->wordsize = wordsize; diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index deff25d4f2d..2f8f4ff971b 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -775,7 +775,7 @@ s390_function_start (struct frame_info *fi) if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised) function_start = get_frame_extra_info (fi)->function_start; else if (get_frame_pc (fi)) - function_start = get_pc_function_start (get_frame_pc (fi)); + function_start = get_frame_func (fi); return function_start; } diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c index e4060d27767..dab16478413 100644 --- a/gdb/sentinel-frame.c +++ b/gdb/sentinel-frame.c @@ -83,6 +83,8 @@ sentinel_frame_this_id (struct frame_info *next_frame, const struct frame_unwind sentinel_frame_unwinder = { + /* Should the sentinel frame be given a special type? */ + NORMAL_FRAME, sentinel_frame_this_id, sentinel_frame_prev_register }; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 804b34a5de5..d30586c7520 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1116,7 +1116,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1456,7 +1456,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1657,7 +1657,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 0e57aefd9d5..da50574aba3 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -41,6 +41,7 @@ #endif #include "gdbcore.h" +#include "gdb_assert.h" #include "symfile.h" /* for 'entry_point_address' */ @@ -1133,9 +1134,7 @@ sparc_frame_find_saved_regs (struct frame_info *fi, CORE_ADDR *saved_regs_addr) register int regnum; CORE_ADDR frame_addr = get_frame_base (fi); - if (!fi) - internal_error (__FILE__, __LINE__, - "Bad frame info struct in FRAME_FIND_SAVED_REGS"); + gdb_assert (fi != NULL); memset (saved_regs_addr, 0, NUM_REGS * sizeof (CORE_ADDR)); diff --git a/gdb/stack.c b/gdb/stack.c index 27fcaf6f6db..2cb9a95dc3d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -216,7 +216,7 @@ print_frame_info (struct frame_info *fi, int level, int source, int args) if (ui_out_is_mi_like_p (uiout)) { annotate_frame_address (); - ui_out_field_core_addr (uiout, "addr", fi->pc); + ui_out_field_core_addr (uiout, "addr", get_frame_pc (fi)); annotate_frame_address_end (); } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0cadc56900d..981ba360490 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2003-04-05 Stephane Carrez + + * gdb.base/break.exp: marker4() is defined at line 46 when compiled + with -DPROTOTYPES. + +2003-04-05 Stephane Carrez + + * gdb.base/break.exp: Revert last patch. + +2003-04-04 Stephane Carrez + + * gdb.base/break.exp: marker4() is defined at line 46 when compiled + with -DPROTOTYPES. + 2003-04-02 Andrew Cagney * gdb.base/callfuncs.exp: Make "print add" messages unique. diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index fbc0e117e0a..38820ec9fc9 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -914,6 +914,10 @@ gdb_expect { -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile:51\[\r\n\]+51\[\t \]+void marker4.*" { pass "run until breakpoint set at small function, optimized file" } + -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:46\[\r\n\]+46\[\t \]+void marker4.*" { + # marker4() is defined at line 46 when compiled with -DPROTOTYPES + pass "run until breakpoint set at small function, optimized file (line 46)" + } -re ".*$gdb_prompt " { fail "run until breakpoint set at small function, optimized file" } diff --git a/gdb/valprint.c b/gdb/valprint.c index b1c47a123d4..d4b8bf5faf7 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -205,12 +205,8 @@ val_print_type_code_int (struct type *type, char *valaddr, } else { -#ifdef PRINT_TYPELESS_INTEGER - PRINT_TYPELESS_INTEGER (stream, type, unpack_long (type, valaddr)); -#else print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0, unpack_long (type, valaddr)); -#endif } } diff --git a/gdb/version.in b/gdb/version.in index 8ba75cc4155..6ec3c5d99af 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-04-03-cvs +2003-04-06-cvs diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 5d43e015819..24b77af113b 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -471,6 +471,8 @@ classify_argument (struct type *type, return 2; } break; + case TYPE_CODE_ENUM: + case TYPE_CODE_REF: case TYPE_CODE_INT: case TYPE_CODE_PTR: switch (bytes) @@ -700,11 +702,17 @@ x86_64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, intreg += 2; break; case X86_64_INTEGERSI_CLASS: - deprecated_write_register_gen (int_parameter_registers[intreg / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); - offset += 8; - intreg++; - break; + { + LONGEST num + = extract_signed_integer (VALUE_CONTENTS_ALL (args[i]) + + offset, 4); + regcache_raw_write_signed (current_regcache, + int_parameter_registers[intreg / 2], num); + + offset += 8; + intreg++; + break; + } case X86_64_SSEDF_CLASS: case X86_64_SSESF_CLASS: case X86_64_SSE_CLASS: @@ -936,12 +944,9 @@ x86_64_save_dummy_frame_tos (CORE_ADDR sp) static struct frame_id x86_64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *frame) { - struct frame_id id; - - id.pc = frame_pc_unwind (frame); - frame_unwind_unsigned_register (frame, SP_REGNUM, &id.base); - - return id; + CORE_ADDR base; + frame_unwind_unsigned_register (frame, SP_REGNUM, &base); + return frame_id_build (base, frame_pc_unwind (frame)); } void diff --git a/include/ChangeLog b/include/ChangeLog index 9c16fddadb2..37bf7132a0f 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2003-04-04 Svein E. Seldal + + * coff/tic4x.h: Namespace cleanup. Replace s/c4x/tic4x + and s/c3x/tic3x/ + * coff/tc-tic4x.h: Ditto + * opcode/tic4x.h: Ditto + 2003-04-02 Bob Wilson * xtensa-config.h: Remove comment indicating that this is a diff --git a/include/coff/tic4x.h b/include/coff/tic4x.h index 083cc3b10d6..0d224b25335 100644 --- a/include/coff/tic4x.h +++ b/include/coff/tic4x.h @@ -1,7 +1,7 @@ /* TI COFF information for Texas Instruments TMS320C4X/C3X. This file customizes the settings in coff/ti.h. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 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 @@ -31,12 +31,12 @@ #define TICOFF_DEFAULT_MAGIC TICOFF2MAGIC #define TICOFF_TARGET_MACHINE_GET(FLAGS) \ - (((FLAGS) & F_VERS) ? bfd_mach_c4x : bfd_mach_c3x) + (((FLAGS) & F_VERS) ? bfd_mach_tic4x : bfd_mach_tic3x) #define TICOFF_TARGET_MACHINE_SET(FLAGSP, MACHINE) \ do \ { \ - if ((MACHINE) == bfd_mach_c4x) \ + if ((MACHINE) == bfd_mach_tic4x) \ *(FLAGSP) |= F_VERS; \ } \ while (0) diff --git a/include/opcode/tic4x.h b/include/opcode/tic4x.h index 214965df3dc..0e6af6460a7 100644 --- a/include/opcode/tic4x.h +++ b/include/opcode/tic4x.h @@ -1,6 +1,6 @@ /* Table of opcodes for the Texas Instruments TMS320C[34]X family. - Copyright (c) 2002 Free Software Foundation. + Copyright (C) 2002, 2003 Free Software Foundation. Contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz) @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define IS_CPU_C3X(v) ((v) == 30 || (v) == 31 || (v) == 32 || (v) == 33) -#define IS_CPU_C4X(v) ((v) == 0 || (v) == 40 || (v) == 44) +#define IS_CPU_TIC3X(v) ((v) == 30 || (v) == 31 || (v) == 32 || (v) == 33) +#define IS_CPU_TIC4X(v) ((v) == 0 || (v) == 40 || (v) == 44) /* Define some bitfield extraction/insertion macros. */ #define EXTR(inst, m, l) ((inst) << (31 - (m)) >> (31 - ((m) - (l)))) @@ -50,22 +50,22 @@ c4x_reg_t; #define REG_IF REG_IIE /* C3x only */ #define REG_IOF REG_IIF /* C3x only */ -#define C3X_REG_MAX REG_RC -#define C4X_REG_MAX REG_TVTP +#define TIC3X_REG_MAX REG_RC +#define TIC4X_REG_MAX REG_TVTP /* Register table size including C4x expansion regs. */ -#define REG_TABLE_SIZE (C4X_REG_MAX + 1) +#define REG_TABLE_SIZE (TIC4X_REG_MAX + 1) -struct c4x_register +struct tic4x_register { char * name; unsigned long regno; }; -typedef struct c4x_register c4x_register_t; +typedef struct tic4x_register tic4x_register_t; /* We could store register synonyms here. */ -static const c4x_register_t c3x_registers[] = +static const tic4x_register_t tic3x_registers[] = { {"f0", REG_R0}, {"r0", REG_R0}, @@ -106,10 +106,10 @@ static const c4x_register_t c3x_registers[] = {"", 0} }; -const unsigned int c3x_num_registers = (((sizeof c3x_registers) / (sizeof c3x_registers[0])) - 1); +const unsigned int tic3x_num_registers = (((sizeof tic3x_registers) / (sizeof tic3x_registers[0])) - 1); /* Define C4x registers in addition to C3x registers. */ -static const c4x_register_t c4x_registers[] = +static const tic4x_register_t tic4x_registers[] = { {"die", REG_DIE}, /* Clobbers C3x REG_IE */ {"iie", REG_IIE}, /* Clobbers C3x REG_IF */ @@ -127,19 +127,19 @@ static const c4x_register_t c4x_registers[] = {"", 0} }; -const unsigned int c4x_num_registers = (((sizeof c4x_registers) / (sizeof c4x_registers[0])) - 1); +const unsigned int tic4x_num_registers = (((sizeof tic4x_registers) / (sizeof tic4x_registers[0])) - 1); -struct c4x_cond +struct tic4x_cond { char * name; unsigned long cond; }; -typedef struct c4x_cond c4x_cond_t; +typedef struct tic4x_cond tic4x_cond_t; /* Define conditional branch/load suffixes. Put desired form for disassembler last. */ -static const c4x_cond_t c4x_conds[] = +static const tic4x_cond_t tic4x_conds[] = { { "u", 0x00 }, { "c", 0x01 }, { "lo", 0x01 }, @@ -167,22 +167,22 @@ static const c4x_cond_t c4x_conds[] = { "", 0x0} }; -const unsigned int num_conds = (((sizeof c4x_conds) / (sizeof c4x_conds[0])) - 1); +const unsigned int tic4x_num_conds = (((sizeof tic4x_conds) / (sizeof tic4x_conds[0])) - 1); -struct c4x_indirect +struct tic4x_indirect { char * name; unsigned long modn; }; -typedef struct c4x_indirect c4x_indirect_t; +typedef struct tic4x_indirect tic4x_indirect_t; /* Define indirect addressing modes where: d displacement (signed) y ir0 z ir1 */ -static const c4x_indirect_t c4x_indirects[] = +static const tic4x_indirect_t tic4x_indirects[] = { { "*+a(d)", 0x00 }, { "*-a(d)", 0x01 }, @@ -216,12 +216,12 @@ static const c4x_indirect_t c4x_indirects[] = { "", 0x0} }; -#define C3X_MODN_MAX 0x19 +#define TIC3X_MODN_MAX 0x19 -const unsigned int c4x_num_indirects = (((sizeof c4x_indirects) / (sizeof c4x_indirects[0])) - 1); +const unsigned int tic4x_num_indirects = (((sizeof tic4x_indirects) / (sizeof tic4x_indirects[0])) - 1); /* Instruction template. */ -struct c4x_inst +struct tic4x_inst { char * name; unsigned long opcode; @@ -230,7 +230,7 @@ struct c4x_inst unsigned long oplevel; }; -typedef struct c4x_inst c4x_inst_t; +typedef struct tic4x_inst tic4x_inst_t; /* Opcode infix B condition 16--20 U,C,Z,LO,HI, etc. @@ -278,8 +278,8 @@ typedef struct c4x_inst c4x_inst_t; Z expansion reg (C4x) 16--20 [Z] - IVTP, TVTP */ -#define C4X_OPERANDS_MAX 7 /* Max number of operands for an inst. */ -#define C4X_NAME_MAX 16 /* Max number of chars in parallel name. */ +#define TIC4X_OPERANDS_MAX 7 /* Max number of operands for an inst. */ +#define TIC4X_NAME_MAX 16 /* Max number of chars in parallel name. */ /* Define the instruction level */ #define OP_C3X 0x1 /* C30 support - supported by all */ @@ -873,8 +873,8 @@ typedef struct c4x_inst c4x_inst_t; */ -/* Define c3x opcodes for assembler and disassembler. */ -static const c4x_inst_t c4x_insts[] = +/* Define tic4x opcodes for assembler and disassembler. */ +static const tic4x_inst_t tic4x_insts[] = { /* Put synonyms after the desired forms in table so that they get overwritten in the lookup table. The disassembler will thus @@ -1070,10 +1070,10 @@ static const c4x_inst_t c4x_insts[] = TC_CLASS_INSN( "xor", 0x08000000, OP_C3X ), QC_CLASS_INSN( "xor", "sti", 0xee000000, OP_C3X ), - /* Dummy entry, not included in c3x_num_insts. This + /* Dummy entry, not included in tic4x_num_insts. This lets code examine entry i + 1 without checking if we've run off the end of the table. */ { "", 0x0, 0x00, "", 0 } }; -const unsigned int c4x_num_insts = (((sizeof c4x_insts) / (sizeof c4x_insts[0])) - 1); +const unsigned int tic4x_num_insts = (((sizeof tic4x_insts) / (sizeof tic4x_insts[0])) - 1); diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index f58e4259469..683b9133ecc 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2003-04-04 Svein E. Seldal + + * tic4x-dis.c: Namespace cleanup. Replace s/c4x/tic4x and + s/c3x/tic3x/ + 2003-04-01 Nick Clifton * arm-dis.c: Remove presence of (r) and (tm) symbols. diff --git a/opcodes/tic4x-dis.c b/opcodes/tic4x-dis.c index b9916934dc0..8e452c0d116 100644 --- a/opcodes/tic4x-dis.c +++ b/opcodes/tic4x-dis.c @@ -1,6 +1,6 @@ /* Print instructions for the Texas TMS320C[34]X, for GDB and GNU Binutils. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. Contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz) @@ -23,10 +23,10 @@ #include "dis-asm.h" #include "opcode/tic4x.h" -#define C4X_DEBUG 0 +#define TIC4X_DEBUG 0 -#define C4X_HASH_SIZE 11 /* 11 (bits) and above should give unique entries. */ -#define C4X_SPESOP_SIZE 8 /* Max 8. ops for special instructions */ +#define TIC4X_HASH_SIZE 11 /* 11 (bits) and above should give unique entries. */ +#define TIC4X_SPESOP_SIZE 8 /* Max 8. ops for special instructions */ typedef enum { @@ -43,49 +43,49 @@ typedef enum { INDIRECT_SHORT, INDIRECT_LONG, - INDIRECT_C4X + INDIRECT_TIC4X } indirect_t; -static int c4x_version = 0; -static int c4x_dp = 0; +static int tic4x_version = 0; +static int tic4x_dp = 0; -static int c4x_pc_offset +static int tic4x_pc_offset PARAMS ((unsigned int)); -static int c4x_print_char +static int tic4x_print_char PARAMS ((struct disassemble_info *, char)); -static int c4x_print_str +static int tic4x_print_str PARAMS ((struct disassemble_info *, char *)); -static int c4x_print_register +static int tic4x_print_register PARAMS ((struct disassemble_info *, unsigned long)); -static int c4x_print_addr +static int tic4x_print_addr PARAMS ((struct disassemble_info *, unsigned long)); -static int c4x_print_relative +static int tic4x_print_relative PARAMS ((struct disassemble_info *, unsigned long, long, unsigned long)); -void c4x_print_ftoa +void tic4x_print_ftoa PARAMS ((unsigned int, FILE *, fprintf_ftype)); -static int c4x_print_direct +static int tic4x_print_direct PARAMS ((struct disassemble_info *, unsigned long)); -static int c4x_print_immed +static int tic4x_print_immed PARAMS ((struct disassemble_info *, immed_t, unsigned long)); -static int c4x_print_cond +static int tic4x_print_cond PARAMS ((struct disassemble_info *, unsigned int)); -static int c4x_print_indirect +static int tic4x_print_indirect PARAMS ((struct disassemble_info *, indirect_t, unsigned long)); -static int c4x_print_op - PARAMS ((struct disassemble_info *, unsigned long, c4x_inst_t *, unsigned long)); -static void c4x_hash_opcode_special - PARAMS ((c4x_inst_t **, const c4x_inst_t *)); -static void c4x_hash_opcode - PARAMS ((c4x_inst_t **, c4x_inst_t **, const c4x_inst_t *, unsigned long)); -static int c4x_disassemble +static int tic4x_print_op + PARAMS ((struct disassemble_info *, unsigned long, tic4x_inst_t *, unsigned long)); +static void tic4x_hash_opcode_special + PARAMS ((tic4x_inst_t **, const tic4x_inst_t *)); +static void tic4x_hash_opcode + PARAMS ((tic4x_inst_t **, tic4x_inst_t **, const tic4x_inst_t *, unsigned long)); +static int tic4x_disassemble PARAMS ((unsigned long, unsigned long, struct disassemble_info *)); int print_insn_tic4x PARAMS ((bfd_vma, struct disassemble_info *)); static int -c4x_pc_offset (op) +tic4x_pc_offset (op) unsigned int op; { /* Determine the PC offset for a C[34]x instruction. @@ -143,7 +143,7 @@ c4x_pc_offset (op) } static int -c4x_print_char (info, ch) +tic4x_print_char (info, ch) struct disassemble_info * info; char ch; { @@ -153,7 +153,7 @@ c4x_print_char (info, ch) } static int -c4x_print_str (info, str) +tic4x_print_str (info, str) struct disassemble_info *info; char *str; { @@ -163,28 +163,28 @@ c4x_print_str (info, str) } static int -c4x_print_register (info, regno) +tic4x_print_register (info, regno) struct disassemble_info *info; unsigned long regno; { - static c4x_register_t **registertable = NULL; + static tic4x_register_t **registertable = NULL; unsigned int i; if (registertable == NULL) { - registertable = (c4x_register_t **) - xmalloc (sizeof (c4x_register_t *) * REG_TABLE_SIZE); - for (i = 0; i < c3x_num_registers; i++) - registertable[c3x_registers[i].regno] = (void *)&c3x_registers[i]; - if (IS_CPU_C4X (c4x_version)) + registertable = (tic4x_register_t **) + xmalloc (sizeof (tic4x_register_t *) * REG_TABLE_SIZE); + for (i = 0; i < tic3x_num_registers; i++) + registertable[tic3x_registers[i].regno] = (void *)&tic3x_registers[i]; + if (IS_CPU_TIC4X (tic4x_version)) { /* Add C4x additional registers, overwriting any C3x registers if necessary. */ - for (i = 0; i < c4x_num_registers; i++) - registertable[c4x_registers[i].regno] = (void *)&c4x_registers[i]; + for (i = 0; i < tic4x_num_registers; i++) + registertable[tic4x_registers[i].regno] = (void *)&tic4x_registers[i]; } } - if ((int) regno > (IS_CPU_C4X (c4x_version) ? C4X_REG_MAX : C3X_REG_MAX)) + if ((int) regno > (IS_CPU_TIC4X (tic4x_version) ? TIC4X_REG_MAX : TIC3X_REG_MAX)) return 0; if (info != NULL) (*info->fprintf_func) (info->stream, "%s", registertable[regno]->name); @@ -192,7 +192,7 @@ c4x_print_register (info, regno) } static int -c4x_print_addr (info, addr) +tic4x_print_addr (info, addr) struct disassemble_info *info; unsigned long addr; { @@ -202,24 +202,24 @@ c4x_print_addr (info, addr) } static int -c4x_print_relative (info, pc, offset, opcode) +tic4x_print_relative (info, pc, offset, opcode) struct disassemble_info *info; unsigned long pc; long offset; unsigned long opcode; { - return c4x_print_addr (info, pc + offset + c4x_pc_offset (opcode)); + return tic4x_print_addr (info, pc + offset + tic4x_pc_offset (opcode)); } static int -c4x_print_direct (info, arg) +tic4x_print_direct (info, arg) struct disassemble_info *info; unsigned long arg; { if (info != NULL) { (*info->fprintf_func) (info->stream, "@"); - c4x_print_addr (info, arg + (c4x_dp << 16)); + tic4x_print_addr (info, arg + (tic4x_dp << 16)); } return 1; } @@ -227,7 +227,7 @@ c4x_print_direct (info, arg) /* FIXME: make the floating point stuff not rely on host floating point arithmetic. */ void -c4x_print_ftoa (val, stream, pfunc) +tic4x_print_ftoa (val, stream, pfunc) unsigned int val; FILE *stream; fprintf_ftype pfunc; @@ -253,7 +253,7 @@ c4x_print_ftoa (val, stream, pfunc) } static int -c4x_print_immed (info, type, arg) +tic4x_print_immed (info, type, arg) struct disassemble_info *info; immed_t type; unsigned long arg; @@ -312,18 +312,18 @@ c4x_print_immed (info, type, arg) } static int -c4x_print_cond (info, cond) +tic4x_print_cond (info, cond) struct disassemble_info *info; unsigned int cond; { - static c4x_cond_t **condtable = NULL; + static tic4x_cond_t **condtable = NULL; unsigned int i; if (condtable == NULL) { - condtable = (c4x_cond_t **)xmalloc (sizeof (c4x_cond_t *) * 32); - for (i = 0; i < num_conds; i++) - condtable[c4x_conds[i].cond] = (void *)&c4x_conds[i]; + condtable = (tic4x_cond_t **)xmalloc (sizeof (tic4x_cond_t *) * 32); + for (i = 0; i < tic4x_num_conds; i++) + condtable[tic4x_conds[i].cond] = (void *)&tic4x_conds[i]; } if (cond > 31 || condtable[cond] == NULL) return 0; @@ -333,7 +333,7 @@ c4x_print_cond (info, cond) } static int -c4x_print_indirect (info, type, arg) +tic4x_print_indirect (info, type, arg) struct disassemble_info *info; indirect_t type; unsigned long arg; @@ -348,7 +348,7 @@ c4x_print_indirect (info, type, arg) disp = 1; switch(type) { - case INDIRECT_C4X: /* *+ARn(disp) */ + case INDIRECT_TIC4X: /* *+ARn(disp) */ disp = EXTRU (arg, 7, 3); aregno = EXTRU (arg, 2, 0) + REG_AR0; modn = 0; @@ -366,29 +366,30 @@ c4x_print_indirect (info, type, arg) return 0; break; default: - abort (); + (*info->fprintf_func)(info->stream, "# internal error: Unknown indirect type %d", type); + return 0; } - if (modn > C3X_MODN_MAX) + if (modn > TIC3X_MODN_MAX) return 0; - a = c4x_indirects[modn].name; + a = tic4x_indirects[modn].name; while (*a) { switch (*a) { case 'a': - c4x_print_register (info, aregno); + tic4x_print_register (info, aregno); break; case 'd': - c4x_print_immed (info, IMMED_UINT, disp); + tic4x_print_immed (info, IMMED_UINT, disp); break; case 'y': - c4x_print_str (info, "ir0"); + tic4x_print_str (info, "ir0"); break; case 'z': - c4x_print_str (info, "ir1"); + tic4x_print_str (info, "ir1"); break; default: - c4x_print_char (info, *a); + tic4x_print_char (info, *a); break; } a++; @@ -397,10 +398,10 @@ c4x_print_indirect (info, type, arg) } static int -c4x_print_op (info, instruction, p, pc) +tic4x_print_op (info, instruction, p, pc) struct disassemble_info *info; unsigned long instruction; - c4x_inst_t *p; + tic4x_inst_t *p; unsigned long pc; { int val; @@ -414,18 +415,18 @@ c4x_print_op (info, instruction, p, pc) switch (*s) { case 'B': - if (! c4x_print_cond (info, EXTRU (instruction, 20, 16))) + if (! tic4x_print_cond (info, EXTRU (instruction, 20, 16))) return 0; break; case 'C': - if (! c4x_print_cond (info, EXTRU (instruction, 27, 23))) + if (! tic4x_print_cond (info, EXTRU (instruction, 27, 23))) return 0; break; case '_': parallel = s + 1; /* Skip past `_' in name */ break; default: - c4x_print_char (info, *s); + tic4x_print_char (info, *s); break; } s++; @@ -434,45 +435,45 @@ c4x_print_op (info, instruction, p, pc) /* Print arguments. */ s = p->args; if (*s) - c4x_print_char (info, ' '); + tic4x_print_char (info, ' '); while (*s) { switch (*s) { case '*': /* indirect 0--15 */ - if (! c4x_print_indirect (info, INDIRECT_LONG, + if (! tic4x_print_indirect (info, INDIRECT_LONG, EXTRU (instruction, 15, 0))) return 0; break; case '#': /* only used for ldp, ldpk */ - c4x_print_immed (info, IMMED_UINT, EXTRU (instruction, 15, 0)); + tic4x_print_immed (info, IMMED_UINT, EXTRU (instruction, 15, 0)); break; case '@': /* direct 0--15 */ - c4x_print_direct (info, EXTRU (instruction, 15, 0)); + tic4x_print_direct (info, EXTRU (instruction, 15, 0)); break; case 'A': /* address register 24--22 */ - if (! c4x_print_register (info, EXTRU (instruction, 24, 22) + + if (! tic4x_print_register (info, EXTRU (instruction, 24, 22) + REG_AR0)) return 0; break; case 'B': /* 24-bit unsigned int immediate br(d)/call/rptb address 0--23. */ - if (IS_CPU_C4X (c4x_version)) - c4x_print_relative (info, pc, EXTRS (instruction, 23, 0), + if (IS_CPU_TIC4X (tic4x_version)) + tic4x_print_relative (info, pc, EXTRS (instruction, 23, 0), p->opcode); else - c4x_print_addr (info, EXTRU (instruction, 23, 0)); + tic4x_print_addr (info, EXTRU (instruction, 23, 0)); break; case 'C': /* indirect (short C4x) 0--7 */ - if (! IS_CPU_C4X (c4x_version)) + if (! IS_CPU_TIC4X (tic4x_version)) return 0; - if (! c4x_print_indirect (info, INDIRECT_C4X, + if (! tic4x_print_indirect (info, INDIRECT_TIC4X, EXTRU (instruction, 7, 0))) return 0; break; @@ -483,26 +484,26 @@ c4x_print_op (info, instruction, p, pc) case 'E': /* register 0--7 */ case 'e': - if (! c4x_print_register (info, EXTRU (instruction, 7, 0))) + if (! tic4x_print_register (info, EXTRU (instruction, 7, 0))) return 0; break; case 'F': /* 16-bit float immediate 0--15 */ - c4x_print_immed (info, IMMED_SFLOAT, + tic4x_print_immed (info, IMMED_SFLOAT, EXTRU (instruction, 15, 0)); break; case 'i': /* Extended indirect 0--7 */ if ( EXTRU (instruction, 7, 5) == 7 ) { - if( !c4x_print_register (info, EXTRU (instruction, 4, 0)) ) + if( !tic4x_print_register (info, EXTRU (instruction, 4, 0)) ) return 0; break; } /* Fallthrough */ case 'I': /* indirect (short) 0--7 */ - if (! c4x_print_indirect (info, INDIRECT_SHORT, + if (! tic4x_print_indirect (info, INDIRECT_SHORT, EXTRU (instruction, 7, 0))) return 0; break; @@ -510,106 +511,106 @@ c4x_print_op (info, instruction, p, pc) case 'j': /* Extended indirect 8--15 */ if ( EXTRU (instruction, 15, 13) == 7 ) { - if( !c4x_print_register (info, EXTRU (instruction, 12, 8)) ) + if( !tic4x_print_register (info, EXTRU (instruction, 12, 8)) ) return 0; break; } case 'J': /* indirect (short) 8--15 */ - if (! c4x_print_indirect (info, INDIRECT_SHORT, + if (! tic4x_print_indirect (info, INDIRECT_SHORT, EXTRU (instruction, 15, 8))) return 0; break; case 'G': /* register 8--15 */ case 'g': - if (! c4x_print_register (info, EXTRU (instruction, 15, 8))) + if (! tic4x_print_register (info, EXTRU (instruction, 15, 8))) return 0; break; case 'H': /* register 16--18 */ - if (! c4x_print_register (info, EXTRU (instruction, 18, 16))) + if (! tic4x_print_register (info, EXTRU (instruction, 18, 16))) return 0; break; case 'K': /* register 19--21 */ - if (! c4x_print_register (info, EXTRU (instruction, 21, 19))) + if (! tic4x_print_register (info, EXTRU (instruction, 21, 19))) return 0; break; case 'L': /* register 22--24 */ - if (! c4x_print_register (info, EXTRU (instruction, 24, 22))) + if (! tic4x_print_register (info, EXTRU (instruction, 24, 22))) return 0; break; case 'M': /* register 22--22 */ - c4x_print_register (info, EXTRU (instruction, 22, 22) + REG_R2); + tic4x_print_register (info, EXTRU (instruction, 22, 22) + REG_R2); break; case 'N': /* register 23--23 */ - c4x_print_register (info, EXTRU (instruction, 23, 23) + REG_R0); + tic4x_print_register (info, EXTRU (instruction, 23, 23) + REG_R0); break; case 'O': /* indirect (short C4x) 8--15 */ - if (! IS_CPU_C4X (c4x_version)) + if (! IS_CPU_TIC4X (tic4x_version)) return 0; - if (! c4x_print_indirect (info, INDIRECT_C4X, + if (! tic4x_print_indirect (info, INDIRECT_TIC4X, EXTRU (instruction, 15, 8))) return 0; break; case 'P': /* displacement 0--15 (used by Bcond and BcondD) */ - c4x_print_relative (info, pc, EXTRS (instruction, 15, 0), + tic4x_print_relative (info, pc, EXTRS (instruction, 15, 0), p->opcode); break; case 'Q': /* register 0--15 */ case 'q': - if (! c4x_print_register (info, EXTRU (instruction, 15, 0))) + if (! tic4x_print_register (info, EXTRU (instruction, 15, 0))) return 0; break; case 'R': /* register 16--20 */ case 'r': - if (! c4x_print_register (info, EXTRU (instruction, 20, 16))) + if (! tic4x_print_register (info, EXTRU (instruction, 20, 16))) return 0; break; case 'S': /* 16-bit signed immediate 0--15 */ - c4x_print_immed (info, IMMED_SINT, + tic4x_print_immed (info, IMMED_SINT, EXTRS (instruction, 15, 0)); break; case 'T': /* 5-bit signed immediate 16--20 (C4x stik) */ - if (! IS_CPU_C4X (c4x_version)) + if (! IS_CPU_TIC4X (tic4x_version)) return 0; - if (! c4x_print_immed (info, IMMED_SUINT, + if (! tic4x_print_immed (info, IMMED_SUINT, EXTRU (instruction, 20, 16))) return 0; break; case 'U': /* 16-bit unsigned int immediate 0--15 */ - c4x_print_immed (info, IMMED_SUINT, EXTRU (instruction, 15, 0)); + tic4x_print_immed (info, IMMED_SUINT, EXTRU (instruction, 15, 0)); break; case 'V': /* 5/9-bit unsigned vector 0--4/8 */ - c4x_print_immed (info, IMMED_SUINT, - IS_CPU_C4X (c4x_version) ? + tic4x_print_immed (info, IMMED_SUINT, + IS_CPU_TIC4X (tic4x_version) ? EXTRU (instruction, 8, 0) : EXTRU (instruction, 4, 0) & ~0x20); break; case 'W': /* 8-bit signed immediate 0--7 */ - if (! IS_CPU_C4X (c4x_version)) + if (! IS_CPU_TIC4X (tic4x_version)) return 0; - c4x_print_immed (info, IMMED_SINT, EXTRS (instruction, 7, 0)); + tic4x_print_immed (info, IMMED_SINT, EXTRS (instruction, 7, 0)); break; case 'X': /* expansion register 4--0 */ val = EXTRU (instruction, 4, 0) + REG_IVTP; if (val < REG_IVTP || val > REG_TVTP) return 0; - if (! c4x_print_register (info, val)) + if (! tic4x_print_register (info, val)) return 0; break; @@ -617,7 +618,7 @@ c4x_print_op (info, instruction, p, pc) val = EXTRU (instruction, 20, 16); if (val < REG_AR0 || val > REG_SP) return 0; - if (! c4x_print_register (info, val)) + if (! tic4x_print_register (info, val)) return 0; break; @@ -625,22 +626,22 @@ c4x_print_op (info, instruction, p, pc) val = EXTRU (instruction, 20, 16) + REG_IVTP; if (val < REG_IVTP || val > REG_TVTP) return 0; - if (! c4x_print_register (info, val)) + if (! tic4x_print_register (info, val)) return 0; break; case '|': /* Parallel instruction */ - c4x_print_str (info, " || "); - c4x_print_str (info, parallel); - c4x_print_char (info, ' '); + tic4x_print_str (info, " || "); + tic4x_print_str (info, parallel); + tic4x_print_char (info, ' '); break; case ';': - c4x_print_char (info, ','); + tic4x_print_char (info, ','); break; default: - c4x_print_char (info, *s); + tic4x_print_char (info, *s); break; } s++; @@ -649,13 +650,13 @@ c4x_print_op (info, instruction, p, pc) } static void -c4x_hash_opcode_special (optable_special, inst) - c4x_inst_t **optable_special; - const c4x_inst_t *inst; +tic4x_hash_opcode_special (optable_special, inst) + tic4x_inst_t **optable_special; + const tic4x_inst_t *inst; { int i; - for( i=0; iopcode == inst->opcode ) { @@ -664,7 +665,7 @@ c4x_hash_opcode_special (optable_special, inst) return; } - for( i=0; iopcode >> (32 - C4X_HASH_SIZE); - int opmask = inst->opmask >> (32 - C4X_HASH_SIZE); + int opcode = inst->opcode >> (32 - TIC4X_HASH_SIZE); + int opmask = inst->opmask >> (32 - TIC4X_HASH_SIZE); - /* Use a C4X_HASH_SIZE bit index as a hash index. We should + /* Use a TIC4X_HASH_SIZE bit index as a hash index. We should have unique entries so there's no point having a linked list for each entry? */ for (j = opcode; j < opmask; j++) if ( (j & opmask) == opcode - && inst->oplevel & c4x_oplevel ) + && inst->oplevel & tic4x_oplevel ) { -#if C4X_DEBUG +#if TIC4X_DEBUG /* We should only have collisions for synonyms like ldp for ldi. */ if (optable[j] != NULL) @@ -710,13 +711,13 @@ c4x_hash_opcode (optable, optable_special, inst, c4x_oplevel) hash. Store them in a special-list, that will handle full 32-bit INSN, not only the first 11-bit (or so). */ if ( optable[j] != NULL - && inst->opmask & ~(opmask << (32 - C4X_HASH_SIZE)) ) + && inst->opmask & ~(opmask << (32 - TIC4X_HASH_SIZE)) ) { /* Add the instruction already on the list */ - c4x_hash_opcode_special(optable_special, optable[j]); + tic4x_hash_opcode_special(optable_special, optable[j]); /* Add the new instruction */ - c4x_hash_opcode_special(optable_special, inst); + tic4x_hash_opcode_special(optable_special, inst); } optable[j] = (void *)inst; @@ -730,67 +731,67 @@ c4x_hash_opcode (optable, optable_special, inst, c4x_oplevel) The function returns the length of this instruction in words. */ static int -c4x_disassemble (pc, instruction, info) +tic4x_disassemble (pc, instruction, info) unsigned long pc; unsigned long instruction; struct disassemble_info *info; { - static c4x_inst_t **optable = NULL; - static c4x_inst_t **optable_special = NULL; - c4x_inst_t *p; + static tic4x_inst_t **optable = NULL; + static tic4x_inst_t **optable_special = NULL; + tic4x_inst_t *p; int i; - unsigned long c4x_oplevel; + unsigned long tic4x_oplevel; - c4x_version = info->mach; + tic4x_version = info->mach; - c4x_oplevel = (IS_CPU_C4X (c4x_version)) ? OP_C4X : 0; - c4x_oplevel |= OP_C3X|OP_LPWR|OP_IDLE2|OP_ENH; + tic4x_oplevel = (IS_CPU_TIC4X (tic4x_version)) ? OP_C4X : 0; + tic4x_oplevel |= OP_C3X|OP_LPWR|OP_IDLE2|OP_ENH; if (optable == NULL) { - optable = (c4x_inst_t **) - xcalloc (sizeof (c4x_inst_t *), (1 << C4X_HASH_SIZE)); + optable = (tic4x_inst_t **) + xcalloc (sizeof (tic4x_inst_t *), (1 << TIC4X_HASH_SIZE)); - optable_special = (c4x_inst_t **) - xcalloc (sizeof (c4x_inst_t *), C4X_SPESOP_SIZE ); + optable_special = (tic4x_inst_t **) + xcalloc (sizeof (tic4x_inst_t *), TIC4X_SPESOP_SIZE ); /* Install opcodes in reverse order so that preferred forms overwrite synonyms. */ - for (i = c4x_num_insts - 1; i >= 0; i--) - c4x_hash_opcode (optable, optable_special, &c4x_insts[i], c4x_oplevel); + for (i = tic4x_num_insts - 1; i >= 0; i--) + tic4x_hash_opcode (optable, optable_special, &tic4x_insts[i], tic4x_oplevel); /* We now need to remove the insn that are special from the "normal" optable, to make the disasm search this extra list for them. */ - for (i=0; iopcode >> (32 - C4X_HASH_SIZE)] = NULL; + optable[optable_special[i]->opcode >> (32 - TIC4X_HASH_SIZE)] = NULL; } /* See if we can pick up any loading of the DP register... */ if ((instruction >> 16) == 0x5070 || (instruction >> 16) == 0x1f70) - c4x_dp = EXTRU (instruction, 15, 0); + tic4x_dp = EXTRU (instruction, 15, 0); - p = optable[instruction >> (32 - C4X_HASH_SIZE)]; + p = optable[instruction >> (32 - TIC4X_HASH_SIZE)]; if ( p != NULL ) { if ( ((instruction & p->opmask) == p->opcode) - && c4x_print_op (NULL, instruction, p, pc) ) - c4x_print_op (info, instruction, p, pc); + && tic4x_print_op (NULL, instruction, p, pc) ) + tic4x_print_op (info, instruction, p, pc); else (*info->fprintf_func) (info->stream, "%08x", instruction); } else { - for (i = 0; iopcode == instruction ) { (*info->fprintf_func)(info->stream, "%s", optable_special[i]->name); break; } - if (i==C4X_SPESOP_SIZE) + if (i==TIC4X_SPESOP_SIZE) (*info->fprintf_func) (info->stream, "%08x", instruction); } @@ -822,5 +823,5 @@ print_insn_tic4x (memaddr, info) info->bytes_per_chunk = 4; info->octets_per_byte = 4; info->display_endian = BFD_ENDIAN_LITTLE; - return c4x_disassemble (pc, op, info) * 4; + return tic4x_disassemble (pc, op, info) * 4; } diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog index 9dcfd052785..134f0fdcc6f 100644 --- a/sim/v850/ChangeLog +++ b/sim/v850/ChangeLog @@ -1,3 +1,9 @@ +2003-04-06 Nick Clifton + + * simops.c (OP_40): Delete. Move code to: + * v850-igen.c (): Here. Sign extend the first operand. + * simops.h (OP_40): Remove prototype. + 2003-02-27 Andrew Cagney * interp.c (sim_open, sim_create_inferior): Rename _bfd to bfd. diff --git a/sim/v850/simops.c b/sim/v850/simops.c index fd0172ead78..87868f5b748 100644 --- a/sim/v850/simops.c +++ b/sim/v850/simops.c @@ -771,50 +771,6 @@ OP_6E0 () return 4; } -/* divh reg1, reg2 */ -int -OP_40 () -{ - unsigned int op0, op1, result, ov, s, z; - int temp; - - trace_input ("divh", OP_REG_REG, 0); - - /* Compute the result. */ - temp = EXTEND16 (State.regs[ OP[0] ]); - op0 = temp; - op1 = State.regs[OP[1]]; - - if (op0 == 0xffffffff && op1 == 0x80000000) - { - result = 0x80000000; - ov = 1; - } - else if (op0 != 0) - { - result = op1 / op0; - ov = 0; - } - else - { - result = 0x0; - ov = 1; - } - - /* Compute the condition codes. */ - z = (result == 0); - s = (result & 0x80000000); - - /* Store the result and condition codes. */ - State.regs[OP[1]] = result; - PSW &= ~(PSW_Z | PSW_S | PSW_OV); - PSW |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0) - | (ov ? PSW_OV : 0)); - trace_output (OP_REG_REG); - - return 2; -} - /* cmp reg, reg */ int OP_1E0 () diff --git a/sim/v850/simops.h b/sim/v850/simops.h index d4c0792bf5e..750fb700e47 100644 --- a/sim/v850/simops.h +++ b/sim/v850/simops.h @@ -17,7 +17,6 @@ int OP_180 (void); int OP_E0 (void); int OP_2E0 (void); int OP_6E0 (void); -int OP_40 (void); int OP_1E0 (void); int OP_260 (void); int OP_7E0 (void); diff --git a/sim/v850/v850.igen b/sim/v850/v850.igen index 0a4c08a30f0..3f14957965a 100644 --- a/sim/v850/v850.igen +++ b/sim/v850/v850.igen @@ -332,7 +332,48 @@ rrrrr,111111,RRRRR + wwwww,01011000000:XI:::div rrrrr!0,000010,RRRRR!0:I:::divh "divh r, r" { - COMPAT_1 (OP_40 ()); + unsigned32 ov, s, z; + signed long int op0, op1, result; + + trace_input ("divh", OP_REG_REG, 0); + + PC = cia; + OP[0] = instruction_0 & 0x1f; + OP[1] = (instruction_0 >> 11) & 0x1f; + + /* Compute the result. */ + op0 = EXTEND16 (State.regs[OP[0]]); + op1 = State.regs[OP[1]]; + + if (op0 == 0xffffffff && op1 == 0x80000000) + { + result = 0x80000000; + ov = 1; + } + else if (op0 != 0) + { + result = op1 / op0; + ov = 0; + } + else + { + result = 0x0; + ov = 1; + } + + /* Compute the condition codes. */ + z = (result == 0); + s = (result & 0x80000000); + + /* Store the result and condition codes. */ + State.regs[OP[1]] = result; + PSW &= ~(PSW_Z | PSW_S | PSW_OV); + PSW |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0) | (ov ? PSW_OV : 0)); + + trace_output (OP_REG_REG); + + PC += 2; + nia = PC; } rrrrr,111111,RRRRR + wwwww,01010000000:XI:::divh -- cgit v1.2.1