From 01d1590babc04e0950cdcbde17a69a677322c855 Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Tue, 15 Dec 1992 01:45:15 +0000 Subject: [PATCH] * convex-xdep.c, hppab-nat.c, i860-tdep.c, infptrace.c: Remove decl for attach_flag, it now lives in inferior.h. * hppa-pinsn.c: Reformat opcode tables. Add function prototypes. Make most functions static. * hppah-nat.c: General cleanups, remove BSD specific code (since that all lives in hppab-nat.c). * hppah-tdep.c (frame_chain_valid), tm-hppa.h (FRAME_CHAIN): Change sense of test against inside_entry_file(). This fix is from U. of Utah. * tm-hppa.h (PUSH_DUMMY_FRAME, POP_FRAME): Use char * for 2nd arg to read/write_register_bytes(). --- gdb/ChangeLog | 18 ++++++++++++- gdb/convex-xdep.c | 7 ----- gdb/gdbtypes.c | 2 +- gdb/gdbtypes.h | 6 ++--- gdb/hppa-pinsn.c | 68 ++++++++++++++++++++++++++++------------------- gdb/hppab-nat.c | 3 --- gdb/hppah-nat.c | 67 +++++----------------------------------------- gdb/hppah-tdep.c | 3 +-- gdb/tm-hppa.h | 18 ++++++------- 9 files changed, 78 insertions(+), 114 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0660265719..d91122cc27 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,14 +1,30 @@ +Mon Dec 14 17:18:42 1992 Stu Grossman (grossman at cygnus.com) + + * convex-xdep.c, hppab-nat.c, i860-tdep.c, infptrace.c: Remove + decl for attach_flag, it now lives in inferior.h. + * hppa-pinsn.c: Reformat opcode tables. Add function prototypes. + Make most functions static. + * hppah-nat.c: General cleanups, remove BSD specific code (since + that all lives in hppab-nat.c). + * hppah-tdep.c (frame_chain_valid), tm-hppa.h (FRAME_CHAIN): + Change sense of test against inside_entry_file(). This fix is + from U. of Utah. + * tm-hppa.h (PUSH_DUMMY_FRAME, POP_FRAME): Use char * for 2nd arg + to read/write_register_bytes(). + Wed Dec 9 19:53:25 1992 John Gilmore (gnu@cygnus.com) * mipsread.c (parse_symbol): When checking whether a structured type is an enum, check qualifiers of its first member, as well as the base type of the member. Bug found and fixed by John M. - Farrell, . + Farrell, . * vx-share/{reg.h,xdr_regs.h,xdr_regs.c}: Remove, unused. * remote-vx.c: Don't include vx-share/reg.h. * vx-share/ptrace.h: Reproduce from scratch. * config/{vxworks68,vxworks960}: Don't include xdr_regs.o. + * Makefile.in: Remove references to removed files, and to removed + 29k-share directories. Tue Dec 8 13:30:58 1992 Fred Fish (fnf@cygnus.com) diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c index 8282b302b7..08ce2654a3 100644 --- a/gdb/convex-xdep.c +++ b/gdb/convex-xdep.c @@ -189,13 +189,6 @@ static int exec_trap_timer; #include "gdbcmd.h" -/* Nonzero if we are debugging an attached outside process - rather than an inferior. */ - -extern int attach_flag; - - - static struct type *vector_type (); static long *read_vector_register (); static long *read_vector_register_1 (); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 53f651ed7f..dfb98acb97 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -848,7 +848,7 @@ check_stub_method (type, i, j) TYPE_FN_FIELD_STUB (f, j) = 0; } -const struct cplus_struct_type cplus_struct_default; +struct cplus_struct_type cplus_struct_default; void allocate_cplus_struct_type (type) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 9c7bf1174d..dfddc89db6 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -364,7 +364,7 @@ struct cplus_struct_type /* The default value of TYPE_CPLUS_SPECIFIC(T) points to the this shared static structure. */ -extern const struct cplus_struct_type cplus_struct_default; +extern struct cplus_struct_type cplus_struct_default; extern void allocate_cplus_struct_type PARAMS ((struct type *)); @@ -491,7 +491,7 @@ extern struct type *builtin_type_m2_card; extern struct type *builtin_type_m2_real; extern struct type *builtin_type_m2_bool; -/* start-sanitize-chill +/* start-sanitize-chill */ /* Chill types */ extern struct type *builtin_type_chill_bool; @@ -499,7 +499,7 @@ extern struct type *builtin_type_chill_char; extern struct type *builtin_type_chill_long; extern struct type *builtin_type_chill_ulong; extern struct type *builtin_type_chill_real; -/* end-sanitize-chill +/* end-sanitize-chill */ /* LONG_LONG is defined if the host has "long long". */ diff --git a/gdb/hppa-pinsn.c b/gdb/hppa-pinsn.c index 68e9bd897c..12df5f388f 100644 --- a/gdb/hppa-pinsn.c +++ b/gdb/hppa-pinsn.c @@ -24,33 +24,44 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "symtab.h" #include "opcode/hppa.h" -char *control_reg[] = {"rctr", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", - "pidr1", "pidr2", "ccr", "sar", "pidr3", "pidr4", - "iva", "eiem", "itmr", "pcsq", "pcoq", "iir", "isr", - "ior", "ipsw", "eirr", "tr0", "tr1", "tr2", "tr3", - "tr4", "tr5", "tr6", "tr7" - }; +static char *control_reg[] = +{ "rctr", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", + "pidr1", "pidr2", "ccr", "sar", "pidr3", "pidr4", + "iva", "eiem", "itmr", "pcsq", "pcoq", "iir", "isr", + "ior", "ipsw", "eirr", "tr0", "tr1", "tr2", "tr3", + "tr4", "tr5", "tr6", "tr7" + }; -char *compare_cond_names[] = {"", ",=", ",<", ",<=", ",<<", ",<<=", ",sv", - ",od", ",tr", ",<>", ",>=", ",>", ",>>=", - ",>>", ",nsv", ",ev" - }; -char *add_cond_names[] = {"", ",=", ",<", ",<=", ",nuv", ",znv", ",sv", - ",od", ",tr", ",<>", ",>=", ",>", ",uv", - ",vnz", ",nsv", ",ev" - }; -char *logical_cond_names[] = {"", ",=", ",<", ",<=", 0, 0, 0, ",od", - ",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev"}; -char *unit_cond_names[] = {"", 0, ",sbz", ",shz", ",sdc", 0, ",sbc", ",shc", - ",tr", 0, ",nbz", ",nhz", ",ndc", 0, ",nbc", ",nhc" - }; -char *shift_cond_names[] = {"", ",=", ",<", ",od", ",tr", ",<>", ",>=", ",ev"}; +static char *compare_cond_names[] = +{ "", ",=", ",<", ",<=", ",<<", ",<<=", ",sv", + ",od", ",tr", ",<>", ",>=", ",>", ",>>=", + ",>>", ",nsv", ",ev" + }; -char *index_compl_names[] = {"", ",m", ",s", ",sm"}; -char *short_ldst_compl_names[] = {"", ",ma", "", ",mb"}; -char *short_bytes_compl_names[] = {"", ",b,m", ",e", ",e,m"}; -char *float_format_names[] = {",sgl", ",dbl", ",quad"}; -char *float_comp_names[] = +static char *add_cond_names[] = +{ "", ",=", ",<", ",<=", ",nuv", ",znv", ",sv", + ",od", ",tr", ",<>", ",>=", ",>", ",uv", + ",vnz", ",nsv", ",ev" + }; + +static char *logical_cond_names[] = +{ "", ",=", ",<", ",<=", 0, 0, 0, ",od", + ",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev" + }; + +static char *unit_cond_names[] = +{ "", 0, ",sbz", ",shz", ",sdc", 0, ",sbc", ",shc", + ",tr", 0, ",nbz", ",nhz", ",ndc", 0, ",nbc", ",nhc" + }; + +static char *shift_cond_names[] = +{"", ",=", ",<", ",od", ",tr", ",<>", ",>=", ",ev"}; + +static char *index_compl_names[] = {"", ",m", ",s", ",sm"}; +static char *short_ldst_compl_names[] = {"", ",ma", "", ",mb"}; +static char *short_bytes_compl_names[] = {"", ",b,m", ",e", ",e,m"}; +static char *float_format_names[] = {",sgl", ",dbl", ",quad"}; +static char *float_comp_names[] = {",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>", ",!?>=", ",<", ",?<", ",!>=", ",!?>", ",<=", ",?<=", ",!>", ",!?<=", ",>", ",?>", ",!<=", ",!?<", ",>=", ",?>=", ",!<", @@ -65,7 +76,10 @@ char *float_comp_names[] = #define GET_COND(insn) (GET_FIELD ((insn), 16, 18) + \ (GET_FIELD ((insn), 19, 19) ? 8 : 0)) -void fput_reg (), fput_const (); +static void fput_reg PARAMS ((unsigned reg, FILE *stream)); +static void fput_const PARAMS ((unsigned num, FILE *stream)); +static void fput_reg_r PARAMS ((unsigned reg, FILE *stream)); +static void fput_creg PARAMS ((unsigned reg, FILE *stream)); /* Print one instruction from MEMADDR on STREAM. */ int @@ -335,7 +349,7 @@ print_insn (memaddr, stream) /* Utility function to print registers */ -void +static void fput_reg (reg, stream) unsigned reg; FILE *stream; diff --git a/gdb/hppab-nat.c b/gdb/hppab-nat.c index 752b370f40..c0c49b8c20 100644 --- a/gdb/hppab-nat.c +++ b/gdb/hppab-nat.c @@ -63,9 +63,6 @@ kill_inferior () } #ifdef ATTACH_DETACH -/* Nonzero if we are debugging an attached process rather than - an inferior. */ -extern int attach_flag; /* Start debugging the process whose number is PID. */ int diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c index 4a85fe1268..afdb14cca4 100644 --- a/gdb/hppah-nat.c +++ b/gdb/hppah-nat.c @@ -25,18 +25,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "inferior.h" +#include "target.h" +#include -#ifndef PT_ATTACH -#define PT_ATTACH PTRACE_ATTACH -#endif -#ifndef PT_DETACH -#define PT_DETACH PTRACE_DETACH -#endif +static void fetch_register (); /* This function simply calls ptrace with the given arguments. It exists so that all calls to ptrace are isolated in this machine-dependent file. */ -#ifdef WANT_NATIVE_TARGET int call_ptrace (request, pid, addr, data) int request, pid; @@ -45,29 +41,17 @@ call_ptrace (request, pid, addr, data) { return ptrace (request, pid, addr, data, 0); } -#endif /* WANT_NATIVE_TARGET */ - -#ifdef DEBUG_PTRACE -/* For the rest of the file, use an extra level of indirection */ -/* This lets us breakpoint usefully on call_ptrace. */ -#define ptrace call_ptrace -#endif void kill_inferior () { if (inferior_pid == 0) return; - ptrace (PT_EXIT, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0, 0); /* PT_EXIT = PT_KILL ? */ + ptrace (PT_EXIT, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0, 0); wait ((int *)0); target_mourn_inferior (); } -#ifdef ATTACH_DETACH -/* Nonzero if we are debugging an attached process rather than - an inferior. */ -extern int attach_flag; - /* Start debugging the process whose number is PID. */ int attach (pid) @@ -95,7 +79,6 @@ detach (signal) perror_with_name ("ptrace"); attach_flag = 0; } -#endif /* ATTACH_DETACH */ /* Fetch all registers, or just one, from the child process. */ @@ -110,11 +93,6 @@ fetch_inferior_registers (regno) fetch_register (regno); } -/* Registers we shouldn't try to store. */ -#if !defined (CANNOT_STORE_REGISTER) -#define CANNOT_STORE_REGISTER(regno) 0 -#endif - /* Store our register values back into the inferior. If REGNO is -1, do this for all registers. Otherwise, REGNO specifies which register (so we can save time). */ @@ -150,8 +128,6 @@ store_inferior_registers (regno) { for (regno = 0; regno < NUM_REGS; regno++) { - if (CANNOT_STORE_REGISTER (regno)) - continue; regaddr = register_addr (regno, offset); for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) { @@ -172,27 +148,7 @@ store_inferior_registers (regno) /* KERNEL_U_ADDR is the amount to subtract from u.u_ar0 to get the offset in the core file of the register values. */ -#if defined (KERNEL_U_ADDR_BSD) -/* Get kernel_u_addr using BSD-style nlist(). */ -CORE_ADDR kernel_u_addr; - -#include /* For struct nlist */ - -void -_initialize_kernel_u_addr () -{ - struct nlist names[2]; - - names[0].n_un.n_name = "_u"; - names[1].n_un.n_name = NULL; - if (nlist ("/vmunix", names) == 0) - kernel_u_addr = names[0].n_value; - else - fatal ("Unable to get kernel u area address."); -} -#endif /* KERNEL_U_ADDR_BSD. */ -#if defined (KERNEL_U_ADDR_HPUX) /* Get kernel_u_addr using HPUX-style nlist(). */ CORE_ADDR kernel_u_addr; @@ -209,11 +165,12 @@ static struct hpnlist nl[] = {{ "_u", -1, }, { (char *) 0, }}; /* read the value of the u area from the hp-ux kernel */ void _initialize_kernel_u_addr () { +#if 0 struct user u; +#endif nlist ("/hp-ux", &nl); kernel_u_addr = nl[0].n_value; } -#endif /* KERNEL_U_ADDR_HPUX. */ #if !defined (offsetof) #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) @@ -227,11 +184,6 @@ void _initialize_kernel_u_addr () - KERNEL_U_ADDR #endif -/* Registers we shouldn't try to fetch. */ -#if !defined (CANNOT_FETCH_REGISTER) -#define CANNOT_FETCH_REGISTER(regno) 0 -#endif - /* Fetch one register. */ static void @@ -246,13 +198,6 @@ fetch_register (regno) /* Offset of registers within the u area. */ unsigned int offset; - if (CANNOT_FETCH_REGISTER (regno)) - { - bzero (buf, REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ - supply_register (regno, buf); - return; - } - offset = U_REGS_OFFSET; regaddr = register_addr (regno, offset); diff --git a/gdb/hppah-tdep.c b/gdb/hppah-tdep.c index 8b7dc61db9..9473400c97 100644 --- a/gdb/hppah-tdep.c +++ b/gdb/hppah-tdep.c @@ -759,7 +759,7 @@ int frame_chain_valid (chain, thisframe) { CORE_ADDR pc = get_pc_function_start (FRAME_SAVED_PC (thisframe)); - if (!inside_entry_file (pc)) + if (inside_entry_file (pc)) return 0; /* look for stw rp, -20(0,sp); copy 4,1; copy sp, 4 */ if (read_memory_integer (pc, 4) == 0x6BC23FD9) @@ -802,7 +802,6 @@ gcc_p (pc) return 0; } - find_dummy_frame_regs (frame, frame_saved_regs) struct frame_info *frame; struct frame_saved_regs *frame_saved_regs; diff --git a/gdb/tm-hppa.h b/gdb/tm-hppa.h index 7b672a5a47..b374a8b45e 100644 --- a/gdb/tm-hppa.h +++ b/gdb/tm-hppa.h @@ -287,7 +287,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ address (previous FP). */ #define FRAME_CHAIN(thisframe) \ - (inside_entry_file ((thisframe)->pc) ? \ + (!inside_entry_file ((thisframe)->pc) ? \ read_memory_integer ((thisframe)->frame, 4) :\ 0) @@ -419,21 +419,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ { register CORE_ADDR sp = read_register (SP_REGNUM); \ register int regnum; \ int int_buffer; \ - double freg_buffer; \ + char freg_buffer[8]; \ /* Space for "arguments"; the RP goes in here. */ \ sp += 48; \ int_buffer = read_register (RP_REGNUM) | 0x3; \ - write_memory (sp - 20, &int_buffer, 4); \ + write_memory (sp - 20, (char *)&int_buffer, 4); \ int_buffer = read_register (FP_REGNUM); \ - write_memory (sp, &int_buffer, 4); \ + write_memory (sp, (char *)&int_buffer, 4); \ write_register (FP_REGNUM, sp); \ sp += 4; \ for (regnum = 1; regnum < 31; regnum++) \ if (regnum != RP_REGNUM && regnum != FP_REGNUM) \ sp = push_word (sp, read_register (regnum)); \ for (regnum = FP0_REGNUM; regnum < NUM_REGS; regnum++) \ - { read_register_bytes (REGISTER_BYTE (regnum), &freg_buffer, 8); \ - sp = push_bytes (sp, &freg_buffer, 8);} \ + { read_register_bytes (REGISTER_BYTE (regnum), freg_buffer, 8); \ + sp = push_bytes (sp, freg_buffer, 8);} \ sp = push_word (sp, read_register (IPSW_REGNUM)); \ sp = push_word (sp, read_register (SAR_REGNUM)); \ sp = push_word (sp, read_register (PCOQ_TAIL_REGNUM)); \ @@ -448,7 +448,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ register int regnum; \ struct frame_saved_regs fsr; \ struct frame_info *fi; \ - double freg_buffer; \ + char freg_buffer[8]; \ fi = get_frame_info (frame); \ fp = fi->frame; \ get_frame_saved_regs (fi, &fsr); \ @@ -457,8 +457,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \ for (regnum = NUM_REGS - 1; regnum >= FP0_REGNUM ; regnum--) \ if (fsr.regs[regnum]) \ - { read_memory (fsr.regs[regnum], &freg_buffer, 8); \ - write_register_bytes (REGISTER_BYTE (regnum), &freg_buffer, 8); }\ + { read_memory (fsr.regs[regnum], freg_buffer, 8); \ + write_register_bytes (REGISTER_BYTE (regnum), freg_buffer, 8); }\ if (fsr.regs[IPSW_REGNUM]) \ write_register (IPSW_REGNUM, \ read_memory_integer (fsr.regs[IPSW_REGNUM], 4)); \ -- 2.34.1