diff options
Diffstat (limited to 'gdb/=rt-changes')
-rw-r--r-- | gdb/=rt-changes | 3338 |
1 files changed, 3338 insertions, 0 deletions
diff --git a/gdb/=rt-changes b/gdb/=rt-changes new file mode 100644 index 0000000..1eda81c --- /dev/null +++ b/gdb/=rt-changes @@ -0,0 +1,3338 @@ +From: zs01#@andrew.cmu.edu (Zalman Stern) +Date: Sun, 24 May 87 03:20:57 edt +To: rms@prep.ai.mit.edu +Subject: RT diffs for gdb version 2.1 + +Here are the new files, followed by the diffs to old files. The first file below +is ITCMODS which is my attempt to document some of our changes. Unfortunately, +it has not been maintained particularly well and notably does not include info +about our changes to support the HIGH-C compiler. One big change we put in was +to use a number of initialize routines instead of the "linked list of object +modules" that is used on other machines. The RT object file format appears to +have a variable size header before the code, making it very difficult +(impossible?) to get the initialization stuff to work. If you have any +questions, don't hesitate to send me mail. + +-Z- + +Only in .: ITCMODS + +blockframe.c: + set_current_frame now takes an extra argument. + RT specific code for interpreting and caching of trace table entries. + Added initialize routine. + +breakpoint.c: + Added new_breakpoint_commands flag to prevent incorrect interpretation of command lists containing a continue statement. + Modified do_breakpoint_commands to know about new_breakpoint_commands. + Modified clear_breakpoint_commands to set new_breakpoint_commands. + Added initialize routine. + +core.c: + RT specific code to find the uarea. + RT specific code to indicate the start of the data segment. + set_current_frame now takes an extra argument. + Added initialize routine. + +dbxread.c: + Added support for the Camphor dynamic loading system. (All under #ifdef CAMPHOR). + Fix for multiple declarations of register variables (i.e. they are declared twice). The fix munges the incorrect declaration (i.e. the one which is not register). + set_rel_command to set relocation offset for camphor loaded files. (Under #ifdef CAMPHOR). + add_file_command to append a file's symbols to the current symbol table instead of replacing it. (Under #ifdef CAMPHOR). + RT specific code to deal with function names being _.foo instead of _foo. + Added initialize routine. + + Feb 8, 1987 Zalman Stern. + Added test in symbol_file_command to see if file was compiled with debugging. If not print an error message instead of dumping core. + Added same test in add_file_command and made it run through BZPATH, CLASSPATH, and PATH in that order (Under #ifdef CAMPHOR). + +environ.c: + Fixed error in calculating new size of a reallocated environment. + +eval.c: + Added initialize routine. + +expread.y: + Moved alloca call out of variable initializations. + +findvar.c: + Added initialize routine. + +firstfile.c: + Added main initialization driver routine. + +frame.h: + Added RT specific declarations to hold frame information, and to deal with trace table caching. + +ibm032-pinsn.c: + New file, contains RT disassembler. + +ibm032-opcode.h: + New file, contains RT opcode definitions. + +infcmd.c + Changed code to use csh instead of sh to avoid the anoyance of the environment bug. + Added initialize routine. + +inflow.c: + Added initialize routine. + +infrun.c: + set_current_frame now takes an extra argument. + Added some code to deal with stopping in the middle of a camphor link. (Under #ifdef CAMPHOR). + Added RT specific code to get the return values from the right registers. Replaces code that was there for RT. + RT specific code to do a "POP_DUMMY_FRAME." Dummy frames are to store more complete state than a normal frame. Makes calling a function in inferior more reliable. Perhaps this should be expanded to other machine types. + Added initialize routine. + + Feb 9, 1987 Zalman Stern. + Added call to select_frame after popping a stack dummy frame in normal_stop. This fixes the bug where you could not print variables without doing a "frame 0" after printing an expression with a function call in it. + +iniitialize.h: + Changed file to use #ifdef's for machine type. Allows one to use same sources for different machines. + +m-ibm032.h: + New file, contains RT specific macros and variables. + +param.h: + Changed file to use #ifdef's for machine type. Allows one to use same sources for different machines. + +pinsn.c: + Changed file to use #ifdef's for machine type. Allows one to use same sources for different machines. + +printcmd.c: + Moved alloca calls out of variable initialization. + Added initialize routine. + +source.c: + Added initialize routine. + +stack.c: + Added initialize routine. + +symmisc.c: + Added initialize routine. + +symtab.c: + RT specific code to deal with function names being _.foo instead of _foo. + Added initialize routine. + +utils.c: + Added comment. + +valarith.c: + Added initialize routine. + +valops.c: + Added initialize routine. + +valprint.c: + Added initialize routine. + +values.c: + Added initialize routine. + +Only in .: ibm032-opcode.h + +/* The opcode table consists of a 256 element array containing an + * instruction mnemonic and an instruction type field. This can be + * indexed directly by the first eight bits of an RT instruction. + * The instruction type consists of a type field and some flags. + * In addition to this, there is an ifdef'd out "instruction" table + * at the end of the file. This is an alphabetical listing of the instructions + * containing mnemonic, opcode, and type. This is useful for modification + * purposes. There is also some code in the ifdef to convert the + * instruction table into an opcode table. + */ + +/* Various useful bit masks. */ +#define ibm032_typeMask 0x0f /* Mask to get actual type info out of instruction type. */ +#define LOW4 0x0f +#define HIGH4 0xf0 +#define LOW16 0x0000ffff +#define HIGH16 0xffff0000 +#define LOW20 0x000fffff +#define LOW24 0x00ffffff + +/* Instruction types consist of a type id in the low 4 bits and flags above that. */ + +/* Flags. */ +#define ibm032_conditional 0x10 +#define ibm032_negative 0x20 + +/* Format types. */ +#define ibm032_JI 0x0 /* Jump immediate. */ +#define ibm032_X 0x1 /* ??? */ + +/* These next ones are in a special bit position. Do not change their defines. */ +#define ibm032_DS0 0x2 /* Data short with no shift for immediate value. */ +#define ibm032_DS1 0x3 /* Data short with 1 bit shift for immediate value. */ +#define ibm032_DS2 0x4 /* Data short with 2 bit shift for immediate value */ +#define ibm032_DSShiftOffset ibm032_DS0 /* Offset to get shift value from ibm032_DS? types. */ + +#define ibm032_RR 0x5 /* R format where second argument is a register */ +#define ibm032_RI 0x6 /* R format where second argument is 4 bit immediate. */ +#define ibm032_BI 0x7 /* Branch immediate. */ +#define ibm032_BA 0x8 /* Branch absolute. */ +#define ibm032_D 0x9 /* Data. */ + +/* What an instruction looks like. */ +struct ibm032_opcode { + char *mnemonic; /* the name. NULL indicates illegal instruction. */ + int type; /* See above. */ +}; + +#define MAXOPCODES 256 /* Pretty well hardwired. */ + +#ifndef BUILDTABLE +/* The actual data. */ +struct ibm032_opcode ibm032_opcodes[] = { + {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, + {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, + {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, + {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, + {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, + {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, + {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, + {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, + {"j%s", ibm032_JI | ibm032_conditional}, + {"j%s", ibm032_JI | ibm032_conditional}, + {"j%s", ibm032_JI | ibm032_conditional}, + {"j%s", ibm032_JI | ibm032_conditional}, + {"j%s", ibm032_JI | ibm032_conditional}, + {"j%s", ibm032_JI | ibm032_conditional}, + {"j%s", ibm032_JI | ibm032_conditional}, + {"j%s", ibm032_JI | ibm032_conditional}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"stcs", ibm032_DS0}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sths", ibm032_DS1}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"sts", ibm032_DS2}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lcs", ibm032_DS0}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"lhas", ibm032_DS1}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"cas", ibm032_X}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {"ls", ibm032_DS2}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {"b%s", ibm032_BI | ibm032_conditional | ibm032_negative}, + {"b%sx", ibm032_BI | ibm032_conditional | ibm032_negative}, + {"bala", ibm032_BA}, + {"balax", ibm032_BA}, + {"bali", ibm032_BI}, + {"balix", ibm032_BI}, + {"b%s", ibm032_BI | ibm032_conditional}, + {"b%sx", ibm032_BI | ibm032_conditional}, + {"ais", ibm032_RI}, + {"inc", ibm032_RI}, + {"sis", ibm032_RI}, + {"dec", ibm032_RI}, + {"cis", ibm032_RI}, + {"clrsb", ibm032_RI}, + {"mfs", ibm032_RR}, + {"setsb", ibm032_RI}, + {"clrbu", ibm032_RI}, + {"clrbl", ibm032_RI}, + {"setbu", ibm032_RI}, + {"setbl", ibm032_RI}, + {"mftbiu", ibm032_RI}, + {"mftbil", ibm032_RI}, + {"mttbiu", ibm032_RI}, + {"mttbil", ibm032_RI}, + {"sari", ibm032_RI}, + {"sari16", ibm032_RI}, + {0, 0}, + {0, 0}, + {"lis", ibm032_RI}, + {0, 0}, + {0, 0}, + {0, 0}, + {"sri", ibm032_RI}, + {"sri16", ibm032_RI}, + {"sli", ibm032_RI}, + {"sli16", ibm032_RI}, + {"srpi", ibm032_RI}, + {"srpi16", ibm032_RI}, + {"slpi", ibm032_RI}, + {"slpi16", ibm032_RI}, + {"sar", ibm032_RR}, + {"exts", ibm032_RR}, + {"sf", ibm032_RR}, + {"cl", ibm032_RR}, + {"c", ibm032_RR}, + {"mts", ibm032_RR}, + {"d", ibm032_RR}, + {0, 0}, + {"sr", ibm032_RR}, + {"srp", ibm032_RR}, + {"sl", ibm032_RR}, + {"slp", ibm032_RR}, + {"mftb", ibm032_RR}, + {"tgte", ibm032_RR}, + {"tlt", ibm032_RR}, + {"mttb", ibm032_RR}, + {"svc", ibm032_D}, + {"ai", ibm032_D}, + {"cal16", ibm032_D}, + {"oiu", ibm032_D}, + {"oil", ibm032_D}, + {"nilz", ibm032_D}, + {"nilo", ibm032_D}, + {"xil", ibm032_D}, + {"cal", ibm032_D}, + {"lm", ibm032_D}, + {"lha", ibm032_D}, + {"ior", ibm032_D}, + {"ti", ibm032_D}, + {"l", ibm032_D}, + {"lc", ibm032_D}, + {"tsh", ibm032_D}, + {"lps", ibm032_D}, + {"aei", ibm032_D}, + {"sfi", ibm032_D}, + {"cli", ibm032_D}, + {"ci", ibm032_D}, + {"niuz", ibm032_D}, + {"niuo", ibm032_D}, + {"xiu", ibm032_D}, + {"cau", ibm032_D}, + {"stm", ibm032_D}, + {"lh", ibm032_D}, + {"iow", ibm032_D}, + {"sth", ibm032_D}, + {"st", ibm032_D}, + {"stc", ibm032_D}, + {0, 0}, + {"abs", ibm032_RR}, + {"a", ibm032_RR}, + {"s", ibm032_RR}, + {"o", ibm032_RR}, + {"twoc", ibm032_RR}, + {"n", ibm032_RR}, + {"m", ibm032_RR}, + {"x", ibm032_RR}, + {"b%sr", ibm032_RR | ibm032_conditional | ibm032_negative}, + {"b%srx", ibm032_RR | ibm032_conditional | ibm032_negative}, + {0, 0}, + {"lhs", ibm032_RR}, + {"balr", ibm032_RR}, + {"balrx", ibm032_RR}, + {"b%sr", ibm032_RR | ibm032_conditional}, + {"b%srx", ibm032_RR | ibm032_conditional}, + {"wait", ibm032_RR}, + {"ae", ibm032_RR}, + {"se", ibm032_RR}, + {"ca16", ibm032_RR}, + {"onec", ibm032_RR}, + {"clz", ibm032_RR}, + {0, 0}, + {0, 0}, + {0, 0}, + {"mc03", ibm032_RR}, + {"mc13", ibm032_RR}, + {"mc23", ibm032_RR}, + {"mc33", ibm032_RR}, + {"mc30", ibm032_RR}, + {"mc31", ibm032_RR}, + {"mc32", ibm032_RR}, +}; + +#else +struct ibm032_opcode ibm032_opcodes[MAXOPCODES]; + +struct ibm032_instruction { + char *mnemonic; /* Mnemonic for this instruction */ + char opcode; /* Numerical value of opcode. */ + int type; /* This instructions format. */ +}; + +struct ibm032_instruction ibm032_instructions[] = +{ + {"a", 0xe1, ibm032_RR}, + {"abs", 0xe0, ibm032_RR}, + {"ae", 0xf1, ibm032_RR}, + {"aei", 0xd1, ibm032_D}, + {"ai", 0xc1, ibm032_D}, + {"ais", 0x90, ibm032_RI}, + {"bala", 0x8a, ibm032_BA}, + {"balax", 0x8b, ibm032_BA}, + {"bali", 0x8c, ibm032_BI}, + {"balix", 0x8d, ibm032_BI}, + {"balr", 0xec, ibm032_RR}, + {"balrx", 0xed, ibm032_RR}, + {"b%s", 0x8e, ibm032_BI | ibm032_conditional}, + {"b%sr", 0xee, ibm032_RR | ibm032_conditional}, + {"b%srx", 0xef, ibm032_RR | ibm032_conditional}, + {"b%sx", 0x8f, ibm032_BI | ibm032_conditional}, + {"b%s", 0x88, ibm032_BI | ibm032_conditional | ibm032_negative}, + {"b%sr", 0xe8, ibm032_RR | ibm032_conditional | ibm032_negative}, + {"b%srx", 0xe9, ibm032_RR | ibm032_conditional | ibm032_negative}, + {"b%sx", 0x89, ibm032_BI | ibm032_conditional | ibm032_negative}, + {"c", 0xb4, ibm032_RR}, + {"cal", 0xc8, ibm032_D}, + {"cal16", 0xc2, ibm032_D}, + {"cas", 0x60, ibm032_X}, + {"cau", 0xd8, ibm032_D}, + {"ca16", 0xf3, ibm032_RR}, + {"ci", 0xd4, ibm032_D}, + {"cis", 0x94, ibm032_RI}, + {"cl", 0xb3, ibm032_RR}, + {"cli", 0xd3, ibm032_D}, + {"clrbl", 0x99, ibm032_RI}, + {"clrbu", 0x98, ibm032_RI}, + {"clrsb", 0x95, ibm032_RI}, + {"clz", 0xf5, ibm032_RR}, + {"d", 0xb6, ibm032_RR}, + {"dec", 0x93, ibm032_RI}, + {"exts", 0xb1, ibm032_RR}, + {"inc", 0x91, ibm032_RI}, + {"ior", 0xcb, ibm032_D}, + {"iow", 0xdb, ibm032_D}, + + {"j%s", 0x08, ibm032_JI | ibm032_conditional}, + {"j%s", 0x00, ibm032_JI | ibm032_conditional | ibm032_negative}, + + {"l", 0xcd, ibm032_D}, + {"lc", 0xce, ibm032_D}, + {"lcs", 0x40, ibm032_DS0}, + {"lh", 0xda, ibm032_D}, + {"lha", 0xca, ibm032_D}, + {"lhas", 0x50, ibm032_DS1}, + {"lhs", 0xeb, ibm032_RR}, + {"lis", 0xa4, ibm032_RI}, + {"lm", 0xc9, ibm032_D}, + {"lps", 0xd0, ibm032_D}, + {"ls", 0x70, ibm032_DS2}, + {"m", 0xe6, ibm032_RR}, + {"mc03", 0xf9, ibm032_RR}, + {"mc13", 0xfa, ibm032_RR}, + {"mc23", 0xfb, ibm032_RR}, + {"mc33", 0xfc, ibm032_RR}, + {"mc30", 0xfd, ibm032_RR}, + {"mc31", 0xfe, ibm032_RR}, + {"mc32", 0xff, ibm032_RR}, + {"mfs", 0x96, ibm032_RR}, + {"mftb", 0xbc, ibm032_RR}, + {"mftbil", 0x9d, ibm032_RI}, + {"mftbiu", 0x9c, ibm032_RI}, + {"mts", 0xb5, ibm032_RR}, + {"mttb", 0xbf, ibm032_RR}, + {"mttbil", 0x9f, ibm032_RI}, + {"mttbiu", 0x9e, ibm032_RI}, + {"n", 0xe5, ibm032_RR}, + + {"nilo", 0xc6, ibm032_D}, + {"nilz", 0xc5, ibm032_D}, + {"niuo", 0xd6, ibm032_D}, + {"niuz", 0xd5, ibm032_D}, + {"o", 0xe3, ibm032_RR}, + {"oil", 0xc4, ibm032_D}, + {"oiu", 0xc3, ibm032_D}, + {"onec", 0xf4, ibm032_RR}, + {"s", 0xe2, ibm032_RR}, + {"sar", 0xb0, ibm032_RR}, + {"sari", 0xa0, ibm032_RI}, + {"sari16", 0xa1, ibm032_RI}, + {"se", 0xf2, ibm032_RR}, + {"setbl", 0x9b, ibm032_RI}, + {"setbu", 0x9a, ibm032_RI}, + {"setsb", 0x97, ibm032_RI}, + {"sf", 0xb2, ibm032_RR}, + + {"sfi", 0xd2, ibm032_D}, + + {"sis", 0x92, ibm032_RI}, + {"sl", 0xba, ibm032_RR}, + {"sli", 0xaa, ibm032_RI}, + {"sli16", 0xab, ibm032_RI}, + {"slp", 0xbb, ibm032_RR}, + {"slpi", 0xae, ibm032_RI}, + {"slpi16", 0xaf, ibm032_RI}, + {"sr", 0xb8, ibm032_RR}, + {"sri", 0xa8, ibm032_RI}, + {"sri16", 0xa9, ibm032_RI}, + {"srp", 0xb9, ibm032_RR}, + {"srpi", 0xac, ibm032_RI}, + {"srpi16", 0xad, ibm032_RI}, + + {"st", 0xdd, ibm032_D}, + + {"stc", 0xde, ibm032_D}, + {"stcs", 0x10, ibm032_DS0}, + {"sth", 0xdc, ibm032_D}, + {"sths", 0x20, ibm032_DS1}, + {"stm", 0xd9, ibm032_D}, + {"sts", 0x30, ibm032_DS2}, + {"svc", 0xc0, ibm032_D}, + {"tgte", 0xbd, ibm032_RR}, + {"ti", 0xcc, ibm032_D}, + {"tlt", 0xbe, ibm032_RR}, + {"tsh", 0xcf, ibm032_D}, + {"twoc", 0xe4, ibm032_RR}, + {"wait", 0xf0, ibm032_RR}, + {"x", 0xe7, ibm032_RR}, + {"xil", 0xc7, ibm032_D}, + {"xiu", 0xd7, ibm032_D} +}; + +/* Code to generate the packed opcode table from the instructions table. */ + +#include <stdio.h> + +char *typeNames[] = { + "ibm032_JI", + "ibm032_X", + "ibm032_DS0", + "ibm032_DS1", + "ibm032_DS2", + "ibm032_RR", + "ibm032_RI", + "ibm032_BI", + "ibm032_BA", + "ibm032_D" +}; + +main() +{ + + int i, j, opcode, type; + + for (j = (sizeof(ibm032_instructions) / sizeof(struct ibm032_instruction)); j >= 0; j--) { + opcode = ibm032_instructions[j].opcode; + switch (ibm032_instructions[j].type & ibm032_typeMask) { + case ibm032_JI: + i = 7; + break; + case ibm032_X: + case ibm032_DS0: + case ibm032_DS1: + case ibm032_DS2: + i = 15; + break; + case ibm032_RR: + case ibm032_RI: + default: + i = 0; + break; + } + for (;i >= 0; i--) { + ibm032_opcodes[opcode + i].mnemonic = ibm032_instructions[j].mnemonic; + ibm032_opcodes[opcode + i].type = ibm032_instructions[j].type; + } + } + + printf("struct ibm032_opcode ibm032_opcodes[] = {\n"); + for ( j = 0; j < 256; j++) { + type = ibm032_opcodes[j].type; + if (ibm032_opcodes[j].mnemonic != NULL) + printf(" {\"%s\",\t\t%s%s%s},\n", ibm032_opcodes[j].mnemonic, + typeNames[type & ibm032_typeMask], + (type & ibm032_conditional) ? " | ibm032_conditional" : "", + (type & ibm032_negative) ? " | ibm032_negative" : ""); + else + printf(" {0,\t\t\t0},\n"); + } + printf("};\n"); +} +#endif /* BUILDTABLE */ + +Only in .: ibm032-pinsn.c + +/* Print ibm032 instructions for GDB, the GNU debugger. + Copyright (C) 1986 Free Software Foundation, Inc. + +GDB is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY. No author or distributor accepts responsibility to anyone +for the consequences of using it or for whether it serves any +particular purpose or works at all, unless he says so in writing. +Refer to the GDB General Public License for full details. + +Everyone is granted permission to copy, modify and redistribute GDB, +but only under the conditions described in the GDB General Public +License. A copy of this license is supposed to have been given to you +along with GDB so you can know your rights and responsibilities. It +should be in a file named COPYING. Among other things, the copyright +notice and this notice must be preserved on all copies. + +In other words, go ahead and share GDB, but don't try to stop +anyone else from sharing it farther. Help stamp out software hoarding! +*/ + +#include <stdio.h> + +#include "defs.h" +#include "param.h" +#include "symtab.h" +#include "ibm032-opcode.h" + +/* ibm032 instructions are never longer than this many bytes. */ +#define MAXLEN 4 + +extern char *reg_names[]; + +static char *mapCondition(); + + +/* Print the ibm032 instruction at address MEMADDR in debugged memory, + on STREAM. Returns length of the instruction, in bytes. */ + +int +print_insn (memaddr, stream) + CORE_ADDR memaddr; + FILE *stream; +{ + unsigned char buffer[MAXLEN]; + int opcodeIndex, instructionBits, type; + char *mnemonic; + + read_memory (memaddr, buffer, MAXLEN); + instructionBits = (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]; /* Get it into an int for easy use. */ + + if ((mnemonic = ibm032_opcodes[opcodeIndex = buffer[0]].mnemonic) == NULL) + { + fprintf (stream, "0%o", (instructionBits & HIGH16) >> 16); + return 2; + } + type = ibm032_opcodes[opcodeIndex].type; + if (!(type & ibm032_conditional)) { + fprintf (stream, "%s", mnemonic); + + switch (type) { + + int displacement; /* Used for sign extensions. */ + char *sign; + + case ibm032_X: + fprintf(stream, "\t%s, %s(%s)", reg_names[buffer[0] & LOW4], (buffer[1] & HIGH4) ? (reg_names[(buffer[1] & HIGH4) >> 4]) : "", reg_names[buffer[1] & LOW4]); + return 2; + case ibm032_DS0: + case ibm032_DS1: + case ibm032_DS2: + fprintf(stream, "\t%s, %x", reg_names[(buffer[1] & HIGH4) >> 4], (buffer[0] & LOW4) << (ibm032_opcodes[opcodeIndex].type - ibm032_DSShiftOffset)); /* Hacked to shift imediate field. */ + if (buffer[1] & LOW4) + fprintf(stream, "(%s)", reg_names[buffer[1] & LOW4]); + return 2; + case ibm032_RR: + fprintf(stream, "\t%s, %s", reg_names[(buffer[1] & HIGH4) >> 4], reg_names[buffer[1] & 0x0f]); + return 2; + case ibm032_RI: + fprintf(stream, "\t%s, %x", reg_names[(buffer[1] & HIGH4) >> 4], buffer[1] & LOW4); + return 2; + case ibm032_BI: + fprintf(stream, "\t%s, ", reg_names[(buffer[1] & HIGH4) >> 4]); + displacement = (instructionBits & LOW20); + if ((displacement & (1 << 19)) != 0) /* Cover sign extension. */ + displacement |= 0xfff00000; + print_address(memaddr + (displacement * 2), stream); /* Need sign extension. */ + return 4; + case ibm032_BA: + print_address((instructionBits & LOW24) & ~1, stream); + return 4; + case ibm032_D: + displacement = (instructionBits & LOW16); + if ((displacement & (1 << 15)) != 0) { /* Cover sign extension. */ + displacement = - (displacement | 0xffff0000); + sign = "-"; + } + else + sign = ""; + fprintf(stream, "\t%s, %s, %s%x", reg_names[(buffer[1] & HIGH4) >> 4], reg_names[buffer[1] & LOW4], sign, displacement); + return 4; + } + } + else { /* Conditional branches are hacked. */ + switch (type & 0x0f) { + + int displacement; + + case ibm032_JI: + fprintf(stream, ibm032_opcodes[opcodeIndex].mnemonic, mapCondition(type & ibm032_negative, buffer[0] & LOW4)); + putc('\t', stream); + print_address((buffer[1] << 1) + memaddr, stream); + return 2; + case ibm032_BI: + fprintf(stream, ibm032_opcodes[opcodeIndex].mnemonic, mapCondition(type & ibm032_negative, (buffer[1] & HIGH4) >> 4)); + putc('\t', stream); + displacement = (instructionBits & LOW20); + if ((displacement & (1 << 19)) != 0) /* Cover sign extension. */ + displacement |= 0xfff00000; + print_address((displacement * 2) + memaddr, stream); + return 4; + case ibm032_RR: + fprintf(stream, ibm032_opcodes[opcodeIndex].mnemonic, mapCondition(type & ibm032_negative, (buffer[1] & HIGH4) >> 4)); + fprintf(stream, "\t%s", reg_names[buffer[1] & LOW4]); + return 2; + } + } +} + +/* Converts a 4 bit "conditional specifier" into a semi-meaningful name. */ +static char *mapCondition(negative, conditionBits) + int conditionBits; +{ + + char *condition; + + if (negative) + switch (conditionBits) { + case 0x8: + condition = ""; + break; + case 0x9: + condition = "ge"; + break; + case 0xa: + condition = "ne"; + break; + case 0xb: + condition = "le"; + break; + case 0xc: + condition = "nc"; + break; + case 0xd: /* Reserved. */ + condition = "notbogus"; + break; + case 0xe: + condition = "no"; + break; + case 0xf: + condition = "ntb"; + break; + default: + condition = "notbogus"; + break; + } + else + switch (conditionBits) { + case 0x8: + condition = "nop"; + break; + case 0x9: + condition = "lt"; + break; + case 0xa: + condition = "eq"; + break; + case 0xb: + condition = "gt"; + break; + case 0xc: + condition = "c"; + break; + case 0xd: /* Reserved. */ + condition = "bogus"; + break; + case 0xe: + condition = "o"; + break; + case 0xf: + condition = "tb"; + break; + default: + condition = "bogus"; + break; + } + return condition; +} + +Only in .: m-ibm032.h + +/* Parameters for execution on an IBM RT, for GDB, the GNU debugger. + Copyright (C) 1986 Free Software Foundation, Inc. + +GDB is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY. No author or distributor accepts responsibility to anyone +for the consequences of using it or for whether it serves any +particular purpose or works at all, unless he says so in writing. +Refer to the GDB General Public License for full details. + +Everyone is granted permission to copy, modify and redistribute GDB, +but only under the conditions described in the GDB General Public +License. A copy of this license is supposed to have been given to you +along with GDB so you can know your rights and responsibilities. It +should be in a file named COPYING. Among other things, the copyright +notice and this notice must be preserved on all copies. + +In other words, go ahead and share GDB, but don't try to stop +anyone else from sharing it farther. Help stamp out software hoarding! +*/ + +/* Define this if the C compiler puts an underscore at the front + of external names before giving them to the linker. */ + +#define NAMES_HAVE_UNDERSCORE + +/* Offset from address of function to start of its code. + Zero on most machines. */ + +#define FUNCTION_START_OFFSET 0 + +/* Advance PC across any function entry prologue instructions + to reach some "real" code. */ + +#define SKIP_PROLOGUE(pc) \ +{ register int op = read_memory_integer (pc, 1) & 0x00ff; \ + if (op == 0xd9) { \ + pc += 4; \ + op = read_memory_integer (pc, 2); \ + if ((op & 0xff00) == 0xc100) { /* pcc prolog add r1, number */ \ + pc += 4; \ + op = read_memory_integer (pc, 1) & 0x00ff; \ + if (op == 0x6e) { /* cas r14, 0 */ \ + pc += 2; \ + op = read_memory_integer (pc, 2) & 0xffff; \ + if (op == 0xc8d1) pc += 4; /* cal r13, junk(r1) */ \ + } \ + } \ + else if ((op & 0xffff) == 0x6e00) { /* hc prolog cas r14, 0 */ \ + pc += 4; \ + op = read_memory_integer(pc, 1) & 0xff; \ + if (op == 0x6d) { /* cas r13 junk, probably */ \ + pc += 2; \ + op = read_memory_integer(pc, 2) & 0xffff; \ + if (op == 0xc811) pc += 4; /* cal r1, foo(r1) */ \ + } \ + } \ + } \ + while (1) { \ + /* now watch for st, sth, stc, and short versions thereof, cas instructions and exts */ \ + /* which are all used to store the parameters from r2-r5 onto the stack or into reg vars */ \ + op = read_memory_integer (pc, 2); \ + if ((op & 0xff00) == 0x3000 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 2; \ + else if ((op & 0xff00) == 0x2300 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 2; \ + else if ((op & 0xff00) == 0x1b00 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 2; \ + else if ((op & 0xff00) == 0x6c00 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 2; \ + else if ((op & 0xff00) == 0xb100) pc += 2; /* extend sign */ \ + else if ((op & 0xff00) == 0xdd00 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 4; \ + else break; \ + } \ +} + +/* Immediately after a function call, return the saved pc. + Can't go through the frames for this because on some machines + the new frame is not set up until the new function executes + some instructions. */ + +#define SAVED_PC_AFTER_CALL(frame) \ +read_register (15) + +/* This is the amount to subtract from u.u_ar0 + to get the offset in the core file of the register values. */ + +#define KERNEL_U_ADDR (0x20000000 - NBPG * (UPAGES)) + +/* Address of end of stack space. */ + +/* extra page is for the "red zone" */ +#define STACK_END_ADDR (0x20000000 - NBPG * (UPAGES+1)) + +/* Stack grows downward. */ + +#define INNER_THAN < + +/* Sequence of bytes for breakpoint instruction. */ + +#define BREAKPOINT {0xbd, 0x00} + +/* Amount PC must be decremented by after a breakpoint. + This is often the number of bytes in BREAKPOINT + but not always. */ + +#define DECR_PC_AFTER_BREAK 0 + +/* Nonzero if instruction at PC is a return instruction. */ + +#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) & 0x00ff == 0xc9) + +/* Return 1 if P points to an invalid floating point value. */ + +#define INVALID_FLOAT(p) 0 /* Just a first guess; not checked */ + +/* Say how long (ordinary) registers are. */ + +#define REGISTER_TYPE long + +/* Number of machine registers */ + +#define NUM_REGS 18 + +/* Initializer for an array of names of registers. + There should be NUM_REGS strings in this initializer. */ + +#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "iar", "mq"} + +/* Register numbers of various important registers. + Note that some of these values are "real" register numbers, + and correspond to the general registers of the machine, + and some are "phony" register numbers which are too large + to be actual register numbers as far as the user is concerned + but do serve to get the desired values when passed to read_register. */ + +#define FP_REGNUM 13 /* Contains address of executing stack frame */ +#define SP_REGNUM 1 /* Contains address of top of stack */ +#define PS_REGNUM 17 /* Contains processor status */ +#define PC_REGNUM 16 /* Contains program counter */ + +#define REGISTER_U_ADDR(addr, blockend, regno) \ +{ addr = blockend + regno * 4; } + +/* Total amount of space needed to store our copies of the machine's + register state, the array `registers'. */ +#define REGISTER_BYTES (NUM_REGS*4) + +/* Index within `registers' of the first byte of the space for + register N. */ + +#define REGISTER_BYTE(N) ((N) * 4) + +/* Number of bytes of storage in the actual machine representation + for register N. On the vax, all regs are 4 bytes. */ + +#define REGISTER_RAW_SIZE(N) 4 + +/* Number of bytes of storage in the program's representation + for register N. On the vax, all regs are 4 bytes. */ + +#define REGISTER_VIRTUAL_SIZE(N) 4 + +/* Largest value REGISTER_RAW_SIZE can have. */ + +#define MAX_REGISTER_RAW_SIZE 4 + +/* Largest value REGISTER_VIRTUAL_SIZE can have. */ + +#define MAX_REGISTER_VIRTUAL_SIZE 4 + +/* Nonzero if register N requires conversion + from raw format to virtual format. */ + +#define REGISTER_CONVERTIBLE(N) 0 + +/* Convert data from raw format for register REGNUM + to virtual format for register REGNUM. */ + +#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \ + bcopy ((FROM), (TO), 4); + +/* Convert data from virtual format for register REGNUM + to raw format for register REGNUM. */ + +#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \ + bcopy ((FROM), (TO), 4); + +/* Return the GDB type object for the "standard" data type + of data in register N. */ + +#define REGISTER_VIRTUAL_TYPE(N) builtin_type_int + +/* Describe the pointer in each stack frame to the previous stack frame + (its caller). */ + +/* FRAME_CHAIN takes a frame's nominal address + and produces the frame's chain-pointer. + + FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address + and produces the nominal address of the caller frame. + + However, if FRAME_CHAIN_VALID returns zero, + it means the given frame is the outermost one and has no caller. + In that case, FRAME_CHAIN_COMBINE is not used. */ + +/* In the case of the Sun, the frame's nominal address + is the address of a 4-byte word containing the calling frame's address. */ + +#define FRAME_CHAIN(thisframe) (rt_prev_frame(thisframe)) + +#define FRAME_CHAIN_VALID(chain, thisframe) \ + (chain >= 0x10000000 && chain < 0x20000000) + +#define FRAME_CHAIN_COMBINE(chain, thisframe) (chain) + +/* Define other aspects of the stack frame. */ + +#define FRAME_SAVED_PC(frame) (rt_frame_reg(frame, 15)) + +#define FRAME_ARGS_ADDRESS(fi) (rt_frame_args(fi.frame)) + +#define FRAME_LOCALS_ADDRESS(fi) (fi.frame) + +/* Return number of args passed to a frame. + Can return -1, meaning no way to tell. */ + +#define FRAME_NUM_ARGS(val, fi) \ +{register struct rt_frame *tf; \ + tf = get_cached_frame(fi.frame); \ + val = -1; \ + if (tf) val = tf->nParms;\ +} + +/* Return number of bytes at start of arglist that are not really args. */ + +#define FRAME_ARGS_SKIP 0 + +/* 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. */ + +#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ +{ register int regnum; \ + register struct rt_frame *tf; \ + register CORE_ADDR next_addr; \ + bzero (&(frame_saved_regs), sizeof (frame_saved_regs)); \ + tf = get_cached_frame((frame_info).frame); \ + if (tf) { \ + for(regnum = tf->firstReg; regnum < 16; regnum++) { \ + (frame_saved_regs).regs[regnum] = tf->firstRLoc+ 4*(regnum - tf->firstReg); \ + } \ + } \ +} + + +/* Things needed for making the inferior call functions. */ + +/* Push an empty stack frame, to record the current PC, etc. */ + +#define PUSH_DUMMY_FRAME \ +{ register CORE_ADDR sp = read_register (SP_REGNUM);\ + register int regnum; \ + sp = push_word (sp, read_register (PC_REGNUM)); \ + for (regnum = 15; regnum >= 0; regnum--) \ + sp = push_word (sp, read_register (regnum)); \ + write_register (FP_REGNUM, sp+64); \ + write_register (SP_REGNUM, sp); } + +/* discard special frame pushed by PUSH_DUMMY_FRAME */ +#define POP_DUMMY_FRAME \ + {register CORE_ADDR sp; \ + register int regnum; \ + sp = read_register(FP_REGNUM)-64; \ + for(regnum = 0; regnum < 16;regnum++) { \ + write_register(regnum, read_memory_integer(sp, 4)); \ + sp += 4; \ + } \ + /* now get the pc */ \ + write_register(PC_REGNUM, read_memory_integer(sp, 4)); \ + sp += 4; \ + } + +/* Discard from the stack the innermost frame, restoring all registers. */ +/* THIS ROUTINE DOES NOT SET R1 (SP_REGNUM) CORRECTLY */ +/* REALLY MUST CONSULT TRACE TBL TO FIND OUT FRAME SIZE */ +#define POP_FRAME \ +{ register CORE_ADDR fp = read_register (FP_REGNUM); \ + register int regnum; \ + register struct rt_frame *tf; \ + tf = (struct rt_frame *) get_cached_frame(fp); \ + if (tf) { \ + for(regnum = tf->firstReg; regnum < 16; regnum++) { \ + write_register(regnum, \ + read_memory_integer (tf->firstRLoc + 4*(regnum-tf->firstReg), 4) \ + ); \ + } \ + write_register(PC_REGNUM, read_register(15)); \ + write_register(SP_REGNUM, tf->firstRLoc + 4*(16-tf->firstReg) + 36); \ + } \ +} + +/* This sequence of words is the instructions + ls r2,0(r1) 2 bytes pick up args + ls r3,4(r1) 2 bytes pick up args + ls r4,8(r1) 2 bytes pick up args + ls r5,c(r1) 2 bytes pick up args + cal r1,16(r1) 4 bytes fix up ap (==sp) + cal16 r15,<low> 4 bytes do call + oiu r15,<high>(r15) 4 + lr r0,r15 2 + ls r15,0(r15) 2 + balr r15 2 + bpt 2 get back to gdb + <4 byte trace table> 4 + +This is 16 bytes. +*/ + +#define CALL_DUMMY {0x70217131, 0x72417351, 0xc8110010, 0xc2f06969, \ + 0xc3ff6969, 0x60f070ff, 0xecffbd00, 0xdf7fdf00} + +#define CALL_DUMMY_LENGTH 32 + +#define CALL_DUMMY_START_OFFSET 0 + +/* Insert the specified number of args and function address + into a call sequence of the above form stored at DUMMYNAME. */ + +#define FIX_CALL_DUMMY(dummyname, fun, nargs) \ +{ *((short *)(((char *)dummyname)+14)) = fun&0xffff; \ +*((short *)(((char *)dummyname)+18)) = (fun>>16)&0xffff; \ +} + +/* Interface definitions for kernel debugger KDB. */ + +/* Map machine fault codes into signal numbers. + First subtract 0, divide by 4, then index in a table. + Faults for which the entry in this table is 0 + are not handled by KDB; the program's own trap handler + gets to handle then. */ + +#define FAULT_CODE_ORIGIN 0 +#define FAULT_CODE_UNITS 4 +#define FAULT_TABLE \ +{ 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ + 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ + 0, 0, 0, 0, 0, 0, 0, 0, \ + SIGILL } + +/* Start running with a stack stretching from BEG to END. + BEG and END should be symbols meaningful to the assembler. + This is used only for kdb, which we do not support. */ + +#define INIT_STACK(beg, end) \ +{ } + +/* Push the frame pointer register on the stack. */ +#define PUSH_FRAME_PTR \ +{ } + +/* Copy the top-of-stack to the frame pointer register. */ +#define POP_FRAME_PTR \ +{ } + +/* After KDB is entered by a fault, push all registers + that GDB thinks about (all NUM_REGS of them), + so that they appear in order of ascending GDB register number. + The fault code will be on the stack beyond the last register. */ + +#define PUSH_REGISTERS \ +{ } + +/* Assuming the registers (including processor status) have been + pushed on the stack in order of ascending GDB register number, + restore them and return to the address in the saved PC register. */ + +#define POP_REGISTERS \ +{ } + +Only in .: m-ibm032init.h + +/* This is how the size of an individual .o file's text segment + is rounded on a sun. */ + +#define FILEADDR_ROUND(addr) ((addr + 3) & -4) + +diff -c ../../gnu/gdb/blockframe.c ./blockframe.c +*** ../../gnu/gdb/blockframe.c Sat Apr 4 22:06:18 1987 +--- ./blockframe.c Mon Apr 27 01:06:06 1987 +*************** +*** 53,62 **** + } + + void +! set_current_frame (frame) + FRAME frame; + { + current_frame = frame; + } + + /* Return the frame that called FRAME. +--- 53,67 ---- + } + + void +! set_current_frame (frame, validp) + FRAME frame; ++ int validp; + { + current_frame = frame; ++ #ifdef ibm032 ++ if (validp) ++ recache_frames(); ++ #endif + } + + /* Return the frame that called FRAME. +*************** +*** 291,301 **** + CORE_ADDR pc; + { + register int i; + + /* Note that the last thing in the vector is always _etext. */ + for (i = 0; i < misc_function_count; i++) + { +! if (pc < misc_function_vector[i].address) + return i - 1; + } + return -1; +--- 296,309 ---- + CORE_ADDR pc; + { + register int i; ++ register long j; + + /* Note that the last thing in the vector is always _etext. */ + for (i = 0; i < misc_function_count; i++) + { +! if ((j = misc_function_vector[i].address) < 0) +! continue; +! if (pc < j) + return i - 1; + } + return -1; +*************** +*** 325,333 **** +--- 333,610 ---- + } + } + ++ #ifdef ibm032 ++ /* RT frame format: ++ arg 3 these are not really here, but are in regs ++ arg 2 ++ arg 1 ++ arg 0 ++ resvd 20 bytes ++ rn to r15 saved regs ++ floating regs (at first assume 0 bytes, fix later) ++ locals ++ ++ N.B. r13 points 64 bytes below the end of the locals. ++ */ ++ ++ /* ++ * Routine for ibm032 stack trace. Called after a new frame has been set. Do an entire stack ++ * trace, and squirrel away the information. We need to do this since the ibm032 (rt) does ++ * not have enough info in a known place off of the frame ptr (r13) to do anything useful. ++ * Instead, one also requires the pc, and can then perform various operations to find ++ * out how that procedure built its frame, and thus, to decode it. However, since this is ++ * fairly slow, we only do it after a set_current_frame operation has been performed. ++ */ ++ ++ #define rtTTSize 50 ++ static struct rtTTCache { ++ CORE_ADDR lbound; /* lowest address so far known as using this trace table */ ++ CORE_ADDR ttaddr; /* address of the last '0xdf' in the trace table */ ++ char ttype; /* type of the trace table -- 0 == unused */ ++ } ttcache[rtTTSize]; ++ short ttptr = 0; ++ ++ #define rtSize 50 ++ static struct rt_frame rtFrames[rtSize]; ++ static int rtCount; ++ static CORE_ADDR rt_next_frame, rt_next_pc; ++ ++ static struct rtTTCache *ttfind (addr) ++ CORE_ADDR addr; { ++ register int i; ++ register struct rtTTCache *tp; ++ for(i=0,tp=ttcache;i<rtTTSize;i++,tp++) { ++ if (addr >= tp->lbound && addr <= tp->ttaddr) return tp; ++ } ++ return 0; ++ } ++ ++ static ttadd(lowaddr, ttaddr, type) ++ register CORE_ADDR lowaddr, ttaddr; ++ char type; { ++ register struct rtTTCache *tp; ++ if (tp = ttfind(ttaddr)) { ++ /* possibly increase the bound on this cache element */ ++ if (lowaddr < tp->lbound) tp->lbound = lowaddr; ++ } ++ else { ++ /* add a new element */ ++ tp = &ttcache[ttptr++]; ++ tp->lbound = lowaddr; ++ tp->ttaddr = ttaddr; ++ tp->ttype = type; ++ if (ttptr >= rtTTSize) ttptr = 0; /* keep it in bounds */ ++ } ++ } ++ ++ /* this routine scans for a trace table, and returns 4 bytes: 0 0 <n params> <first saved reg> */ ++ rt_num_regs (pc, tf) ++ register struct rt_frame *tf; ++ CORE_ADDR pc; { ++ register state = 0; ++ register long newpc = pc; ++ register int tc; ++ short nparms, firstreg; ++ short ttype; ++ short optx; ++ long offset; ++ char offtype; ++ struct rtTTCache *tp; ++ CORE_ADDR frame; ++ ++ frame = tf->frame; ++ /* first see if it is in our ttcache */ ++ if (tp = ttfind(pc)) { ++ state = 3; ++ ttype = tp->ttype; ++ newpc = tp->ttaddr; ++ } ++ else { ++ /* state machine to look for 'df' 'xx' 'df' */ ++ while (1) { ++ tc = read_memory_integer(newpc, 2); ++ if (state == 0 && (tc&0xff00) == 0xdf00) { ++ state = 1; ++ ttype = tc & 0xff; ++ } ++ else if (state == 1 && (tc & 0xff00) == 0xdf00) { ++ state = 3; ++ break; ++ } ++ else state = 0; ++ if (newpc - pc > 20000) break; ++ newpc += 2; ++ } ++ if (state == 3) ttadd(pc, newpc, ttype); /* add to cache */ ++ } ++ if (state != 3) { ++ printf("No trace table for pc %x, making one up.\n", pc); ++ tf->nParms = 0; ++ tf->firstReg = 12; ++ tf->firstRLoc = frame+64; ++ rt_next_pc = read_memory_integer(frame+64+12, 4); ++ rt_next_frame = read_memory_integer(frame+64+4, 4); ++ return 0; ++ } ++ /* otherwise newpc is pointing at the last 'df' in the trace table */ ++ else if (ttype == 3) { ++ /* funny trace table found by OBSERVATION (not doc) to be in program prolog */ ++ return -1; /* special value checked by recache_frames */ ++ } ++ else if (ttype == 2) { ++ /* assembly: no registers were saved */ ++ tf->nParms = 0; ++ tf->firstReg = 16; ++ tf->firstRLoc = 0; ++ rt_next_pc = read_register(15); /* where we go back to */ ++ rt_next_frame = frame; ++ tf->frame -= 100; /* hack to eliminate duplicate tags */ ++ return 0; ++ } ++ else if (ttype == 0x7f) { ++ /* special machine state frame saved by STACK_DUMMY */ ++ tf->nParms = 0; ++ tf->firstReg = 16; ++ tf->firstRLoc = 0; ++ rt_next_pc = read_memory_integer(frame + 64 - 64, 4); ++ rt_next_frame = read_memory_integer(frame -64 + 13*4, 4); ++ return 0; ++ } ++ else { ++ /* C program, I hope */ ++ nparms = (read_memory_integer(newpc+2, 1) >> 4) & 0x0f; ++ firstreg = ((tc=read_memory_integer(newpc+1, 1)) >> 4) & 0x0f; ++ optx = ((tc&4)? 1 : 0); /* flags says if floating registers described */ ++ offtype = read_memory_integer(newpc+optx+3, 1) & 0xff; ++ if ((offtype & 0xc0) == 0) { ++ /* 6 bits of local offset */ ++ offset = offtype & 0x3f; ++ } ++ else if ((offtype & 0xc0) == 0x40) { ++ /* 14 bits of local offset */ ++ offset = (offtype & 0x3f) << 8; ++ offset += (read_memory_integer(newpc+optx+4, 1) & 0xff); ++ } ++ else if ((offtype & 0xc0) == 0x80) { ++ /* 22 bits of local offset */ ++ offset = (offtype & 0x3f) << 8; ++ offset += (read_memory_integer(newpc+optx+4, 1) & 0xff); ++ offset <<= 8; ++ offset += (read_memory_integer(newpc+optx+5, 1) & 0xff); ++ } ++ else if ((offtype & 0xc0) == 0xc0) { ++ /* 30 bits of local offset */ ++ offset = (offtype & 0x3f) << 8; ++ offset += (read_memory_integer(newpc+optx+4, 1) & 0xff); ++ offset <<= 8; ++ offset += (read_memory_integer(newpc+optx+5, 1) & 0xff); ++ offset <<= 8; ++ offset += (read_memory_integer(newpc+optx+6, 1) & 0xff); ++ } ++ offset <<= 2; ++ tf->nParms = nparms; ++ tf->firstReg = firstreg; ++ tf->firstRLoc = frame /* initial frame location */ ++ + offset /* to top of frame */ ++ - 36 /* pascal static link, incomings args and linkage */ ++ - (4*(16-firstreg)); /* space used by general regs */ ++ rt_next_pc = read_memory_integer(tf->firstRLoc + 4*(15-firstreg), 4); ++ rt_next_frame = read_memory_integer(tf->firstRLoc + 4*(13-firstreg), 4); ++ return 0; ++ } ++ } ++ ++ recache_frames() { ++ register long i, j; ++ long pc; ++ CORE_ADDR curfp; ++ struct rt_frame *tf; ++ ++ pc = read_pc(); ++ curfp = current_frame; ++ rtCount = 0; ++ /* these next special cases can only occur with frame #0; others can't make calls ++ in these intermediate states. ++ */ ++ /* if pc points at br or brx, we're doing a return, so set the pc to the target */ ++ i=read_memory_integer(pc, 2); ++ if ((i & 0xfe00) == 0xe800) { ++ /* we're looking at a br or brx instruction */ ++ pc = read_register(i&0x0f); ++ } ++ /* also, if pc points at d9xx or c111 we're in the middle of a frame push, and should ++ use r15 for the pc. ++ */ ++ if ((i & 0xff00) == 0xd900 || (i & 0xffff) == 0xc111) { ++ pc = read_register(15); ++ } ++ while (1) { ++ if (curfp <= 0x10000000 || curfp >= 0x20000000) break; ++ if (pc > 0x20000000) break; ++ /* otherwise try to add a new frame structure */ ++ if (rtCount >= rtTTSize) break; ++ tf = &rtFrames[rtCount++]; ++ tf->frame = curfp; ++ tf->pc = pc; ++ i = rt_num_regs(pc, tf); ++ if (i<0) { /* exceptional values */ ++ rtCount--; /* last frame was bogus */ ++ break; ++ } ++ /* now setup for next iteration */ ++ pc = rt_next_pc; ++ curfp = rt_next_frame; ++ } ++ } ++ ++ struct rt_frame *get_cached_frame(aframe) ++ CORE_ADDR aframe; { ++ register int i; ++ for(i=0;i<rtCount;i++) { ++ if (rtFrames[i].frame == aframe) return &rtFrames[i]; ++ } ++ return 0; ++ } ++ ++ long rt_prev_frame(frame) ++ register CORE_ADDR frame; { ++ register int i; ++ for(i=0;i<rtCount-1;i++) { ++ if (rtFrames[i].frame == frame) return rtFrames[i+1].frame; ++ } ++ return 0; ++ } ++ ++ long rt_frame_reg(frame, reg) ++ CORE_ADDR frame; ++ register long reg; { ++ register struct rt_frame *tf; ++ tf = get_cached_frame(frame); ++ if (tf == 0) return 0; ++ if (tf->firstReg > reg) return 0; /* didn't save this one! */ ++ return read_memory_integer(tf->firstRLoc + 4 * (reg - tf->firstReg), 4); ++ } ++ ++ long rt_frame_args(frame) ++ CORE_ADDR frame; { ++ register struct rt_frame *tf; ++ tf = get_cached_frame(frame); ++ if (!tf) return 0; ++ return tf->firstRLoc + 20 + 4*(16 - tf->firstReg); ++ } ++ #endif ++ ++ blockinitialize() {initialize();} ++ + static + initialize () + { ++ #ifdef ibm032 ++ #ifdef CAMPHOR ++ add_com ("recache-frames", class_stack, recache_frames, ++ "Tell debugger to recompute PC/RT stack frame cache\n"); ++ #endif ++ #endif + } + + END_FILE +diff -c ../../gnu/gdb/breakpoint.c ./breakpoint.c +*** ../../gnu/gdb/breakpoint.c Sat Apr 4 22:22:44 1987 +--- ./breakpoint.c Sun Apr 26 23:02:20 1987 +*************** +*** 94,99 **** +--- 94,100 ---- + of last breakpoint hit. */ + + struct command_line *breakpoint_commands; ++ char new_breakpoint_commands = 0; /* Zalman Stern, ITC 1/12/1987 */ + + START_FILE + +*************** +*** 203,210 **** + { + execute_command (breakpoint_commands->line, 0); + /* If command was "cont", breakpoint_commands is 0 now. */ +! if (breakpoint_commands) + breakpoint_commands = breakpoint_commands->next; + } + clear_momentary_breakpoints (); + } +--- 204,213 ---- + { + execute_command (breakpoint_commands->line, 0); + /* If command was "cont", breakpoint_commands is 0 now. */ +! if (breakpoint_commands && !new_breakpoint_commands) /* Zalman Stern, ITC 1/12/1987 */ + breakpoint_commands = breakpoint_commands->next; ++ else /* Zalman Stern, ITC 1/12/1987 */ ++ new_breakpoint_commands = 0; /* Zalman Stern, ITC 1/12/1987 */ + } + clear_momentary_breakpoints (); + } +*************** +*** 215,220 **** +--- 218,225 ---- + void + clear_breakpoint_commands () + { ++ if (breakpoint_commands != 0) /* Zalman Stern, ITC 1/12/1987 */ ++ new_breakpoint_commands = 1; /* Zalman Stern, ITC 1/12/1987 */ + breakpoint_commands = 0; + breakpoint_auto_delete (0); + } +*************** +*** 921,926 **** +--- 926,933 ---- + struct cmd_list_element *enablelist; + + extern struct cmd_list_element *cmdlist; ++ ++ breakinitialize() {initialize();} + + static + initialize () +diff -c ../../gnu/gdb/command.c ./command.c +*** ../../gnu/gdb/command.c Sat Apr 4 22:24:07 1987 +--- ./command.c Sat Apr 25 17:18:15 1987 +*************** +*** 94,100 **** + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + +- + #include "command.h" + #include <stdio.h> + +--- 94,99 ---- +*************** +*** 388,394 **** + { + if (nfound > 1 && allow_unknown >= 0) + { +! *p = 0; + ambbuf[0] = 0; + for (c = list; c; c = c->next) + if (!strncmp (*line, c->name, p - *line)) +--- 387,393 ---- + { + if (nfound > 1 && allow_unknown >= 0) + { +! *p = 0; + ambbuf[0] = 0; + for (c = list; c; c = c->next) + if (!strncmp (*line, c->name, p - *line)) +diff -c ../../gnu/gdb/core.c ./core.c +*** ../../gnu/gdb/core.c Sat Apr 4 22:27:23 1987 +--- ./core.c Mon Apr 27 13:20:47 1987 +*************** +*** 163,172 **** + int reg_offset; + + /* 4.2bsd-style core dump */ + val = myread (corechan, &u, sizeof u); + if (val < 0) +! perror_with_name (filename); + data_start = exec_data_start; + data_end = data_start + NBPG * u.u_dsize; + stack_start = stack_end - NBPG * u.u_ssize; + data_offset = NBPG * UPAGES; +--- 163,180 ---- + int reg_offset; + + /* 4.2bsd-style core dump */ ++ #ifdef ibm032 ++ /* on ibm032, uarea is at the far end of the u pages */ ++ lseek(corechan, UPAGES*NBPG - sizeof(u), 0); ++ #endif + val = myread (corechan, &u, sizeof u); + if (val < 0) +! perror_with_name (execfile); +! #ifdef ibm032 +! data_start = 0x10000000; +! #else + data_start = exec_data_start; ++ #endif + data_end = data_start + NBPG * u.u_dsize; + stack_start = stack_end - NBPG * u.u_ssize; + data_offset = NBPG * UPAGES; +*************** +*** 208,214 **** + corefile = concat (dirname, "/", filename); + } + +! set_current_frame (read_register (FP_REGNUM)); + select_frame (get_current_frame (), 0); + validate_files (); + } +--- 216,222 ---- + corefile = concat (dirname, "/", filename); + } + +! set_current_frame (read_register (FP_REGNUM), 1); + select_frame (get_current_frame (), 0); + validate_files (); + } +*************** +*** 523,528 **** +--- 531,539 ---- + + #endif /* not NEW_SUN_CORE */ + ++ ++ coreinitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/dbxread.c ./dbxread.c +*** ../../gnu/gdb/dbxread.c Sat Apr 4 22:29:54 1987 +--- ./dbxread.c Fri May 15 15:52:24 1987 +*************** +*** 28,33 **** +--- 28,36 ---- + #include "initialize.h" + #include "symtab.h" + #include "param.h" ++ #ifdef CAMPHOR ++ #include "value.h" ++ #endif + + static void add_symbol_to_list (); + static void read_dbx_symtab (); +*************** +*** 89,94 **** +--- 92,109 ---- + int prev_line_number; + }; + ++ /* When dealing with dynamically loaded objects, the symbol table in the sym file ++ does not match where we actually load the files. Thus, gdb has to relocate those ++ symbols during dbxread. This is only used by the camphor support code, and ++ probably should be under an ifdef camphor. */ ++ ++ struct dlreloc ++ { ++ long text; ++ long data; ++ long bss; ++ } dlreloc; ++ + static struct subfile *subfiles; + + static struct subfile *current_subfile; +*************** +*** 1015,1020 **** +--- 1030,1037 ---- + register int i, nbl; + register struct blockvector *bv; + register struct block *b; ++ int j; ++ struct symbol *ts1, *ts2; + + for (s = symtab_list; s; s = s->next) + { +*************** +*** 1025,1034 **** +--- 1042,1238 ---- + b = BLOCKVECTOR_BLOCK (bv, i); + qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b), + sizeof (struct symbol *), compare_symbols); ++ /* Register parms have two decls, but the register one is the only one of interest */ ++ /* So, trash the name of the bad one, since binary srch could get either. Yucko. */ ++ /* doing name this way enables symbol freeing code to keep working */ ++ for(j=1;j<BLOCK_NSYMS(b);j++) ++ { ++ ts1 = BLOCK_SYM(b,j-1); ++ ts2 = BLOCK_SYM(b, j); ++ if (SYMBOL_NAMESPACE(ts1) == VAR_NAMESPACE ++ && SYMBOL_NAMESPACE(ts2) == VAR_NAMESPACE ++ && strcmp(SYMBOL_NAME(ts1), SYMBOL_NAME(ts2)) == 0) ++ {if (SYMBOL_CLASS(ts1) == LOC_REGISTER) ++ {SYMBOL_CLASS(ts2) = LOC_REGISTER; ++ SYMBOL_TYPE(ts2) = SYMBOL_TYPE(ts1); ++ SYMBOL_VALUE(ts2) = SYMBOL_VALUE(ts1); ++ } ++ else if (SYMBOL_CLASS(ts2) == LOC_REGISTER ) ++ {SYMBOL_CLASS(ts1) = LOC_REGISTER; ++ SYMBOL_TYPE(ts1) = SYMBOL_TYPE(ts2); ++ SYMBOL_VALUE(ts1) = SYMBOL_VALUE(ts2); ++ } ++ #ifdef notdef ++ else printf("Check out def of symbol %s\n", SYMBOL_NAME(ts1)); ++ #endif ++ } ++ } + } + } + } + ++ ++ #ifdef CAMPHOR ++ set_rel_command(exp) ++ char *exp; ++ { ++ struct expression *expr = (struct expression *) parse_c_expression (exp); ++ register value val; ++ register long temp; ++ register struct cleanup *old_chain ++ = make_cleanup (free_current_contents, &expr); ++ val = evaluate_expression (expr); ++ temp = value_as_long (val); ++ dlreloc.text = dlreloc.data = dlreloc.bss = temp; ++ printf("Relocation for all segs set to %x.\n", temp); ++ do_cleanups (old_chain); ++ } ++ ++ void ++ add_file_command (name) ++ char *name; ++ { ++ register int desc; ++ struct exec hdr; ++ struct nlist *nlist; ++ char *stringtab; ++ long buffer; ++ register int val; ++ extern void close (); ++ struct cleanup *old_chain; ++ int in_this_dir = 1; ++ struct symtab *symtab_temp; ++ ++ dont_repeat (); ++ ++ if (name == 0) ++ error_no_arg ("file to add symbols from"); ++ ++ if (symtab_list && !query ("Add more symbols from \"%s\"? ", name)) ++ error ("Not confirmed."); ++ ++ if (symfile) ++ free (symfile); ++ symfile = 0; ++ ++ desc = open (name, 0); ++ if (desc < 0) ++ { ++ if ((desc = openp (getenv ("BZPATH"), name, 0, 0)) < 0) ++ if ((desc = openp (getenv ("CLASSPATH"), name, 0, 0)) < 0) ++ desc = openp (getenv ("PATH"), name, 0, 0); ++ ++ in_this_dir = 0; ++ } ++ if (desc < 0) ++ perror_with_name (name); ++ ++ old_chain = make_cleanup (close, desc); ++ ++ val = myread (desc, &hdr, sizeof hdr); ++ if (val < 0) ++ perror_with_name (name); ++ ++ if (N_BADMAG (hdr)) ++ error ("File \"%s\" not in executable format.", name); ++ ++ if (hdr.a_syms == 0) ++ { ++ free_all_symtabs (); /* check this */ ++ return; ++ } ++ ++ /* Now read the string table, all at once. */ ++ val = lseek (desc, N_SYMOFF (hdr) + hdr.a_syms, 0); ++ if (val < 0) ++ perror_with_name (name); ++ val = myread (desc, &buffer, sizeof buffer); ++ if (val < 0) ++ perror_with_name (name); ++ stringtab = (char *) alloca (buffer); ++ bcopy (&buffer, stringtab, sizeof buffer); ++ val = myread (desc, stringtab + sizeof buffer, buffer - sizeof buffer); ++ if (val < 0) ++ perror_with_name (name); ++ ++ #ifdef READ_GDB_SYMSEGS ++ /* That puts us at the symsegs. Read them. */ ++ symseg_chain = read_symsegs (desc, name); ++ hash_symsegs (); ++ #else ++ /* Where people are using the 4.2 ld program, must not check for ++ symsegs, because that ld puts randonm garbage at the end of ++ the output file and that would trigger an error message. */ ++ symseg_chain = 0; ++ #endif ++ ++ /* Position to read the symbol table. Do not read it all at once. */ ++ val = lseek (desc, N_SYMOFF (hdr), 0); ++ if (val < 0) ++ perror_with_name (name); ++ ++ printf ("Reading symbol data from %s...", name); ++ fflush (stdout); ++ ++ init_misc_functions (); ++ make_cleanup (discard_misc_bunches, 0); ++ init_header_files (); ++ make_cleanup (free_header_files, 0); ++ ++ /* Remember symtab_list to check if the added file had any dbx info in it. */ ++ symtab_temp = symtab_list; ++ ++ /* Now that the symbol table data of the executable file are all in core, ++ process them and define symbols accordingly. Closes desc. */ ++ ++ read_dbx_symtab (desc, stringtab, hdr.a_syms / sizeof (struct nlist)); ++ ++ if (symtab_list == symtab_temp) { ++ printf("\n%s not compiled with -g, debugging posibilities are limited.\n", name); ++ fflush(stdout); ++ } ++ else { ++ ++ /* Sort symbols alphabetically within each block. */ ++ ++ sort_syms (); ++ ++ /* Go over the misc functions and install them in vector. */ ++ ++ condense_misc_bunches (); ++ ++ /* Make a default for file to list. */ ++ ++ select_source_symtab (symtab_list); ++ } ++ ++ do_cleanups (old_chain); ++ ++ /* Free the symtabs made by read_symsegs, but not their contents, ++ which have been copied into symtabs on symtab_list. */ ++ while (symseg_chain) ++ { ++ register struct symtab *s = symseg_chain->next; ++ free (symseg_chain); ++ symseg_chain = s; ++ } ++ ++ if (in_this_dir && name[0] != '/') ++ { ++ char dirname[MAXPATHLEN]; ++ ++ getwd (dirname); ++ symfile = concat (dirname, "/", ++ savestring (name, strlen (name))); ++ } ++ else ++ symfile = savestring (name, strlen (name)); ++ ++ printf ("done.\n"); ++ fflush (stdout); ++ } ++ #endif ++ + /* This is the symbol-file command. Read the file, analyze its symbols, + and add a struct symtab to symtab_list. */ + +*************** +*** 1047,1052 **** +--- 1251,1263 ---- + + dont_repeat (); + ++ #ifdef CAMPHOR ++ /* this command does not deal with automatically relocated stuff */ ++ dlreloc.text = 0; ++ dlreloc.data = 0; ++ dlreloc.bss = 0; ++ #endif ++ + if (name == 0) + error_no_arg ("file to read symbols from"); + +*************** +*** 1130,1151 **** + + read_dbx_symtab (desc, stringtab, hdr.a_syms / sizeof (struct nlist)); + + /* Sort symbols alphabetically within each block. */ + +! sort_syms (); + + /* Go over the misc functions and install them in vector. */ + +! condense_misc_bunches (); + + /* Don't allow char * to have a typename (else would get caddr_t.) */ + +! TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0; + + /* Make a default for file to list. */ + +! select_source_symtab (symtab_list); + + symfile = savestring (name, strlen (name)); + + do_cleanups (old_chain); +--- 1341,1372 ---- + + read_dbx_symtab (desc, stringtab, hdr.a_syms / sizeof (struct nlist)); + ++ /* Check to make sure file was compiled with -g. */ ++ ++ if (symtab_list == NULL) { ++ printf("\n%s not compiled with -g, debugging posibilities are limited.\n", name); ++ fflush(stdout); ++ } ++ else { ++ + /* Sort symbols alphabetically within each block. */ + +! sort_syms (); + + /* Go over the misc functions and install them in vector. */ + +! condense_misc_bunches (); + + /* Don't allow char * to have a typename (else would get caddr_t.) */ + +! TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0; + + /* Make a default for file to list. */ + +! select_source_symtab (symtab_list); + ++ } ++ + symfile = savestring (name, strlen (name)); + + do_cleanups (old_chain); +*************** +*** 1204,1209 **** +--- 1425,1440 ---- + { + fread (&buf, sizeof buf, 1, stream); + namestring = buf.n_un.n_strx ? buf.n_un.n_strx + stringtab : 0; ++ #ifdef CAMPHOR ++ if ((buf.n_type & N_TYPE) == N_UNDF) { ++ /* don't screw around with undefined symbols */ ++ } ++ else { ++ if ((buf.n_type & N_TYPE) == N_TEXT) buf.n_value += dlreloc.text; ++ else if ((buf.n_type & N_TYPE) == N_DATA) buf.n_value += dlreloc.data; ++ else if ((buf.n_type & N_TYPE) == N_BSS) buf.n_value += dlreloc.bss; ++ } ++ #endif + if (buf.n_type & N_STAB) + process_one_symbol (buf.n_type, buf.n_desc, + buf.n_value, namestring); +*************** +*** 1356,1361 **** +--- 1587,1596 ---- + } + } + ++ #ifdef ibm032 ++ static char hcState; /* two different, incompatible compilers for the RT */ ++ #endif ++ + static void + process_one_symbol (type, desc, value, name) + int type, desc; +*************** +*** 1363,1369 **** + char *name; + { + register struct context_stack *new; +! + /* Something is wrong if we see real data before + seeing a source file name. */ + +--- 1598,1633 ---- + char *name; + { + register struct context_stack *new; +! char tname[256]; +! /* Now, there are two compilers for the RT, and they are seriously incompatible. +! pcc is just like normal c compilers: stabs for a block occur before the LBRAC +! stab for that same block. Thus this code squirrels them away in the context +! and when the RBRAC is hit, restores local_symbols as of the time the LBRAC +! was encountered, and adds these symbosl to the block that just ended. +! +! However, with the HC compiler, those symbols occur *after* the LBRAC symbol +! declaring the block's start. Totally incompatible, of course. One expects no +! less from IBM. For hc compiled programs, we use the symbols in local_symbols +! *before* the RBRAC command pops the context stack. +! +! Amazingly enough, when we complained to IBM/Palo Alto about this incompatibility, +! they claimed that Mark Linton (original author of dbx) liked the new way better, and +! that he didn't even know that pcc used a different order. Sorta explains some things +! about dbx, n'est-ce pas? Furthermore, of course, IBM doesn't want to change +! either pcc or hc. +! +! Anyway, hc and pcc compiled .o files often co-exist in programs. How do we +! tell which is which? Stupid heuristic which doesn't work with programs +! with no top-level locals or parameters: after seeing a function's start, if we see +! an LBRAC before seeing a variable, then we are using hc, otherwise it is pcc. +! Stupid heuristics are better than none, so we use it. +! +! The variable hcState is used to keep track of this crap. +! 0 ==> saw function symbol +! 1 ==> saw lbrac in state 0, this is hc. +! 2 ==> saw symbol in state 0, this is pcc. +! */ +! + /* Something is wrong if we see real data before + seeing a source file name. */ + +*************** +*** 1384,1389 **** +--- 1648,1656 ---- + also the end of the lexical context for the previous function. */ + new = context_stack; + within_function = 1; ++ #ifdef ibm032 ++ hcState = 0; ++ #endif + if (new) + { + /* Make a block for the local symbols within. */ +*************** +*** 1400,1406 **** +--- 1667,1679 ---- + new->locals = 0; + new->old_blocks = pending_blocks; + new->start_addr = value; ++ #ifdef ibm032 ++ strcpy(tname, "."); ++ strcat(tname, name); ++ new->name = define_symbol(value, tname); ++ #else + new->name = define_symbol (value, name); ++ #endif + local_symbols = 0; + break; + +*************** +*** 1407,1412 **** +--- 1680,1688 ---- + case N_LBRAC: + /* This "symbol" just indicates the start of an inner lexical + context within a function. */ ++ #ifdef ibm032 ++ if (hcState == 0) hcState = 1; ++ #endif + new = (struct context_stack *) xmalloc (sizeof (struct context_stack)); + new->depth = desc; + new->next = context_stack; +*************** +*** 1422,1430 **** + /* This "symbol" just indicates the end of an inner lexical + context that was started with N_RBRAC. */ + new = context_stack; + if (new == 0 || desc != new->depth) + error ("Invalid symbol data: N_LBRAC/N_RBRAC symbol mismatch, symtab pos %d.", symnum); +- local_symbols = new->locals; + context_stack = new->next; + /* If this is not the outermost LBRAC...RBRAC pair in the + function, its local symbols preceded it, and are the ones +--- 1698,1711 ---- + /* This "symbol" just indicates the end of an inner lexical + context that was started with N_RBRAC. */ + new = context_stack; ++ #ifdef ibm032 ++ if (hcState == 2) /* pcc */ ++ local_symbols = new->locals; ++ #else ++ local_symbols = new->locals; ++ #endif + if (new == 0 || desc != new->depth) + error ("Invalid symbol data: N_LBRAC/N_RBRAC symbol mismatch, symtab pos %d.", symnum); + context_stack = new->next; + /* If this is not the outermost LBRAC...RBRAC pair in the + function, its local symbols preceded it, and are the ones +*************** +*** 1443,1448 **** +--- 1724,1733 ---- + new->start_addr + last_source_start_addr, + value + last_source_start_addr); + } ++ #ifdef ibm032 ++ if (hcState == 1 && context_stack->next) /* hc */ ++ local_symbols = new->locals; /* now we get them */ ++ #endif + free (new); + break; + +*************** +*** 1493,1498 **** +--- 1778,1786 ---- + break; + + default: ++ #ifdef ibm032 ++ if (hcState == 0) hcState = 2; ++ #endif + if (name) + define_symbol (value, name); + } +*************** +*** 1553,1558 **** +--- 1841,1849 ---- + Dbx data never actually contains 'l'. */ + case 'l': + SYMBOL_CLASS (sym) = LOC_LOCAL; ++ #ifdef ibm032 ++ if (hcState == 1) value += 1000000; /* temporary hack until rel 3 pcc matches hc */ ++ #endif + SYMBOL_VALUE (sym) = value; + SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; + add_symbol_to_list (sym, &local_symbols); +*************** +*** 1572,1577 **** +--- 1863,1875 ---- + add_symbol_to_list (sym, &local_symbols); + break; + ++ case 'R': ++ SYMBOL_CLASS (sym) = LOC_REGISTER; ++ SYMBOL_VALUE (sym) = value; ++ SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; ++ add_symbol_to_list (sym, &local_symbols); ++ break; ++ + case 'S': + /* Static symbol at top level of file */ + SYMBOL_CLASS (sym) = LOC_STATIC; +*************** +*** 1616,1622 **** + break; + + default: +! error ("Invalid symbol data: unknown symbol-type code `%c' at symtab pos %d.", deftype, symnum); + } + return sym; + } +--- 1914,1928 ---- + break; + + default: +! printf ("Unknown symbol-type code '%c' in dbx symbol table, assuming local.\n", deftype); +! SYMBOL_CLASS (sym) = LOC_LOCAL; +! #ifdef ibm032 +! if (hcState == 1) value += 1000000; /* temporary hack until rel 3 pcc matches hc */ +! #endif +! SYMBOL_VALUE (sym) = value; +! SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; +! add_symbol_to_list (sym, &local_symbols); +! break; + } + return sym; + } +*************** +*** 1741,1746 **** +--- 2047,2056 ---- + (*pp) += 5; + else if (!strncmp (*pp, "r(0,1);0;", 9)) + (*pp) += 9; ++ #if 1 ++ else if ((**pp == 'r') && (!strncmp(*pp + 2, ";0;", 3))) ++ (*pp) += 5; ++ #endif + else break; + + TYPE_CODE (type) = TYPE_CODE_ARRAY; +*************** +*** 1980,1986 **** + rather than -128 which is what I would like. + So use n1 != 0 to prevent char from being taken as unsigned. */ + +! else if (n2 == 0 && n1 == 1) + { + /* an unsigned type */ + if (n3 == (1 << (8 * sizeof (int)))) +--- 2290,2296 ---- + rather than -128 which is what I would like. + So use n1 != 0 to prevent char from being taken as unsigned. */ + +! if (n2 == 0) + { + /* an unsigned type */ + if (n3 == (1 << (8 * sizeof (int)))) +*************** +*** 1989,1994 **** +--- 2299,2306 ---- + return builtin_type_unsigned_short; + if (n3 == (1 << (8 * sizeof (char)))) + return builtin_type_unsigned_char; ++ if (n3 == (1 << (8 * sizeof (char) - 1))) ++ return builtin_type_char; + } + else + { +*************** +*** 2002,2007 **** +--- 2314,2321 ---- + if (n3 == (1 << (8 * sizeof (char) - 1))) + return builtin_type_char; + } ++ if (n2 == 0 && n3 == 1) ++ return builtin_type_void; + error ("Invalid symbol data: range type spec %s at symtab pos %d.", + errp - 1, symnum); + } +*************** +*** 2033,2040 **** +--- 2347,2364 ---- + + /* Read the digits, as far as they go. */ + ++ #if 0 /* Yet another "Compiler sucks" fix. */ + while ((c = *p++) >= '0' && c <= '9') ++ #else ++ while (((c = *p++) >= '0' && c <= '9') || ((end != '\n') && (c == '\n'))) ++ #endif + { ++ #if 1 ++ if (c == '\n') { ++ printf("Ignoring bogus newline in stabs entry. Your compiler should be fixed.\n"); ++ continue; ++ } ++ #endif + n *= 10; + n += c - '0'; + } +*************** +*** 2050,2060 **** +--- 2374,2392 ---- + return n * sign; + } + ++ dbxinitialize() {initialize();} ++ + static + initialize () + { + symfile = 0; + ++ #ifdef CAMPHOR ++ add_com ("add-file", class_files, add_file_command, ++ "Add a new symbol table (in dbx format) from file FILE."); ++ add_com("set-rel", class_files, set_rel_command, ++ "Set relocation for add-file command to NUMBER."); ++ #endif + add_com ("symbol-file", class_files, symbol_file_command, + "Load symbol table (in dbx format) from executable file FILE."); + } +diff -c ../../gnu/gdb/environ.c ./environ.c +*** ../../gnu/gdb/environ.c Sat Apr 4 22:31:16 1987 +--- ./environ.c Sun Apr 26 23:48:05 1987 +*************** +*** 129,135 **** + + if (e->allocated < i) + { +! e->allocated = max (i, e->allocated + 10); + e->vector = (char **) xrealloc (e->vector, + (e->allocated + 1) * sizeof (char *)); + } +--- 129,136 ---- + + if (e->allocated < i) + { +! e->allocated = i + 10; + e->vector = (char **) xrealloc (e->vector, + (e->allocated + 1) * sizeof (char *)); + } +diff -c ../../gnu/gdb/eval.c ./eval.c +*** ../../gnu/gdb/eval.c Sat Apr 4 22:32:36 1987 +--- ./eval.c Mon Apr 27 00:01:27 1987 +*************** +*** 546,551 **** +--- 546,553 ---- + } + } + ++ evalinitialize() {initialize();} ++ + static + initialize () + { } +diff -c ../../gnu/gdb/expread.y ./expread.y +*** ../../gnu/gdb/expread.y Sat Apr 4 22:35:27 1987 +--- ./expread.y Sun Apr 26 23:56:51 1987 +*************** +*** 650,655 **** +--- 650,656 ---- + ; + else + { ++ /*N.B. error does a longjmp, so we do not have to worry about storage */ + err_copy = (char *) alloca (olen + 1); + bcopy (lexptr, err_copy, olen); + err_copy[olen] = 0; +*************** +*** 945,953 **** + { + register int len = sizeof (struct expression) + + expr->nelts * sizeof (union exp_element); +! register struct expression *temp +! = (struct expression *) alloca (len); + register int inpos = expr->nelts, outpos = 0; + + /* Copy the original expression into temp. */ + bcopy (expr, temp, len); +--- 946,955 ---- + { + register int len = sizeof (struct expression) + + expr->nelts * sizeof (union exp_element); +! register struct expression *temp; + register int inpos = expr->nelts, outpos = 0; ++ ++ temp = (struct expression *) alloca(len); + + /* Copy the original expression into temp. */ + bcopy (expr, temp, len); +diff -c ../../gnu/gdb/findvar.c ./findvar.c +*** ../../gnu/gdb/findvar.c Sat Apr 4 22:36:38 1987 +--- ./findvar.c Mon Apr 27 00:01:44 1987 +*************** +*** 359,364 **** +--- 359,366 ---- + return value_cast (lookup_pointer_type (SYMBOL_TYPE (var)), + value_from_long (builtin_type_long, addr)); + } ++ ++ findinitialize() {initialize();} + + static + initialize () +diff -c ../../gnu/gdb/firstfile.c ./firstfile.c +*** ../../gnu/gdb/firstfile.c Sat Apr 4 22:37:06 1987 +--- ./firstfile.c Mon Apr 27 00:02:06 1987 +*************** +*** 125,130 **** +--- 125,152 ---- + static initialize_dummy_1 (); + static initialize_dummy_2 (); + ++ initialize_all_files() { ++ blockinitialize(); ++ breakinitialize(); ++ coreinitialize(); ++ dbxinitialize(); ++ evalinitialize(); ++ findinitialize(); ++ infcmdinitialize(); ++ inflowinitialize(); ++ infruninitialize(); ++ symmiscinitialize(); ++ symtabinitialize(); ++ valarithinitialize(); ++ valopsinitialize(); ++ valprintinitialize(); ++ valuesinitialize(); ++ printcmdinitialize(); ++ sourceinitialize(); ++ stackinitialize(); ++ } ++ ++ #if 0 + initialize_all_files () + { + initialize_next_file ((char *) initialize_dummy_2 +*************** +*** 148,153 **** +--- 170,176 ---- + initialize_dummy_2 () + { + } ++ #endif + + /* This makes the function initialize_next_file. */ + +diff -c ../../gnu/gdb/frame.h ./frame.h +*** ../../gnu/gdb/frame.h Sat Apr 4 22:37:22 1987 +--- ./frame.h Mon Apr 27 00:02:14 1987 +*************** +*** 20,25 **** +--- 20,35 ---- + + /* Note that frame.h requires param.h! */ + ++ #ifdef ibm032 ++ struct rt_frame { ++ CORE_ADDR frame; /* frame address */ ++ CORE_ADDR pc; /* pc we called from */ ++ CORE_ADDR firstRLoc; /* loc'n of first saved general reg */ ++ short nParms; /* number of parameters to this frame */ ++ short firstReg; /* the reg stored at 64(fp) */ ++ }; ++ #endif ++ + #define FRAME CORE_ADDR + + struct frame_info +*************** +*** 62,64 **** +--- 72,77 ---- + extern struct block *get_selected_block (); + extern struct symbol *get_frame_function (); + extern struct symbol *get_pc_function (); ++ #ifdef ibm032 ++ extern struct rt_frame *get_cached_frame(); ++ #endif +diff -c ../../gnu/gdb/infcmd.c ./infcmd.c +*** ../../gnu/gdb/infcmd.c Sat Apr 4 22:47:22 1987 +--- ./infcmd.c Mon Apr 27 00:07:53 1987 +*************** +*** 39,45 **** + /* String containing arguments to give to the program, + with a space added at the front. Just a space means no args. */ + +! static char *inferior_args; + + /* Pid of our debugged inferior, or 0 if no inferior now. */ + +--- 39,45 ---- + /* String containing arguments to give to the program, + with a space added at the front. Just a space means no args. */ + +! static char *inferior_args = NULL; + + /* Pid of our debugged inferior, or 0 if no inferior now. */ + +*************** +*** 112,119 **** + set_args_command (args) + char *args; + { +! free (inferior_args); +! if (!args) args = ""; + inferior_args = concat (" ", args, ""); + } + +--- 112,121 ---- + set_args_command (args) + char *args; + { +! if (inferior_args != NULL) +! free (inferior_args); +! if (!args) +! args = ""; + inferior_args = concat (" ", args, ""); + } + +*************** +*** 171,177 **** + signal (SIGINT, SIG_DFL); */ + + ptrace (0); +! execle ("/bin/sh", "sh", "-c", allargs, 0, + environ_vector (inferior_environ)); + + fprintf (stderr, "Cannot exec /bin/sh: %s.\n", +--- 173,180 ---- + signal (SIGINT, SIG_DFL); */ + + ptrace (0); +! +! execle ("/bin/csh", "csh", "-f", "-c", allargs, 0, + environ_vector (inferior_environ)); + + fprintf (stderr, "Cannot exec /bin/sh: %s.\n", +*************** +*** 473,478 **** +--- 476,482 ---- + + retbuf[0] = stop_r0; + retbuf[1] = stop_r1; ++ + val = value_being_returned (value_type, retbuf); + printf ("Value returned is $%d = ", record_latest_value (val)); + value_print (val, stdout); +*************** +*** 705,710 **** +--- 709,716 ---- + printf ("Contents are relative to selected stack frame.\n"); + } + ++ infcmdinitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/inflow.c ./inflow.c +*** ../../gnu/gdb/inflow.c Sat Apr 4 22:56:34 1987 +--- ./inflow.c Mon Apr 27 00:12:10 1987 +*************** +*** 188,194 **** + inferior_pid = 0; + mark_breakpoints_out (); + if (have_core_file_p ()) +! set_current_frame (read_register (FP_REGNUM)); + } + + /* Resume execution of the inferior process. +--- 188,194 ---- + inferior_pid = 0; + mark_breakpoints_out (); + if (have_core_file_p ()) +! set_current_frame (read_register (FP_REGNUM), 1); + } + + /* Resume execution of the inferior process. +*************** +*** 266,271 **** +--- 266,274 ---- + char buf[MAX_REGISTER_RAW_SIZE]; + register int i; + ++ #ifdef ibm032 ++ offset += UPAGES*NBPG - sizeof(u); /* ibm032: ustruct at end of uarea */ ++ #endif + offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR; + for (regno = 0; regno < NUM_REGS; regno++) + { +*************** +*** 291,296 **** +--- 294,303 ---- + register unsigned int regaddr; + char buf[80]; + ++ #ifdef ibm032 ++ offset += UPAGES*NBPG - sizeof(u); /* ibm032: ustruct at end of uarea */ ++ #endif ++ + offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR; + + if (regno >= 0) +*************** +*** 340,347 **** + register int count + = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); + /* Allocate buffer of that many longwords. */ +! register int *buffer = (int *) alloca (count * sizeof (int)); + + /* Read all the longwords */ + for (i = 0; i < count; i++, addr += sizeof (int)) + buffer[i] = ptrace (1, inferior_pid, addr, 0); +--- 347,355 ---- + register int count + = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); + /* Allocate buffer of that many longwords. */ +! register int *buffer; + ++ buffer = (int *) alloca(count * sizeof(int)); + /* Read all the longwords */ + for (i = 0; i < count; i++, addr += sizeof (int)) + buffer[i] = ptrace (1, inferior_pid, addr, 0); +*************** +*** 367,377 **** + register int count + = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); + /* Allocate buffer of that many longwords. */ +! register int *buffer = (int *) alloca (count * sizeof (int)); + extern int errno; + + /* Fill start and end extra bytes of buffer with existing memory data. */ + + buffer[0] = ptrace (1, inferior_pid, addr, 0); + if (count > 1) + buffer[count - 1] +--- 375,386 ---- + register int count + = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); + /* Allocate buffer of that many longwords. */ +! register int *buffer; + extern int errno; + + /* Fill start and end extra bytes of buffer with existing memory data. */ + ++ buffer = (int *) alloca (count * sizeof (int)); + buffer[0] = ptrace (1, inferior_pid, addr, 0); + if (count > 1) + buffer[count - 1] +*************** +*** 388,397 **** + { + errno = 0; + ptrace (4, inferior_pid, addr, buffer[i]); +! if (errno) + return 1; + } +- + return 0; + } + +--- 397,406 ---- + { + errno = 0; + ptrace (4, inferior_pid, addr, buffer[i]); +! if (errno) { + return 1; ++ } + } + return 0; + } + +*************** +*** 421,426 **** +--- 430,437 ---- + } + } + ++ inflowinitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/infrun.c ./infrun.c +*** ../../gnu/gdb/infrun.c Sat Apr 4 22:57:15 1987 +--- ./infrun.c Mon Apr 27 00:17:40 1987 +*************** +*** 257,263 **** + pc_changed = 0; + fetch_inferior_registers (); + stop_pc = read_pc (); +! set_current_frame (read_register (FP_REGNUM)); + stop_frame = get_current_frame (); + stop_sp = read_register (SP_REGNUM); + another_trap = 0; +--- 257,271 ---- + pc_changed = 0; + fetch_inferior_registers (); + stop_pc = read_pc (); +! #ifdef CAMPHOR +! /* if we're not going to stop, don't bother with a stack trace */ +! if (WIFSTOPPED(w) && !signal_stop[WSTOPSIG(w)]) +! set_current_frame(read_register(FP_REGNUM), 0); +! else +! set_current_frame(read_register(FP_REGNUM), 1); +! #else +! set_current_frame (read_register (FP_REGNUM), 1); +! #endif + stop_frame = get_current_frame (); + stop_sp = read_register (SP_REGNUM); + another_trap = 0; +*************** +*** 688,700 **** + + /* Save the function value return registers + We might be about to restore their previous contents. */ +! stop_r0 = read_register (0); +! stop_r1 = read_register (1); + + if (stop_stack_dummy) + { + /* Pop the empty frame that contains the stack dummy. */ + POP_FRAME; + select_frame (read_register (FP_REGNUM), 0); + } + } +--- 696,717 ---- + + /* Save the function value return registers + We might be about to restore their previous contents. */ +! #ifdef ibm032 +! stop_r0 = read_register (2); +! stop_r1 = read_register (3); +! #else +! stop_r0 = read_register (0); +! stop_r1 = read_register (1); +! #endif + + if (stop_stack_dummy) + { + /* Pop the empty frame that contains the stack dummy. */ ++ #ifdef ibm032 ++ POP_DUMMY_FRAME; ++ #else + POP_FRAME; ++ #endif + select_frame (read_register (FP_REGNUM), 0); + } + } +*************** +*** 841,846 **** +--- 858,865 ---- + printf ("\nUse the \"handle\" command to change these tables.\n"); + } + ++ infruninitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/initialize.h ./initialize.h +*** ../../gnu/gdb/initialize.h Sat Apr 4 22:58:27 1987 +--- ./initialize.h Sun May 24 00:19:21 1987 +*************** +*** 103,109 **** +--- 103,120 ---- + of the end of one object file's text to the start of the next + object file's text. */ + ++ /* Changed to use ifdefs on the machine type. David Nichols, 11/28/86 */ ++ #ifdef ibm032 ++ #include "m-ibm032init.h" ++ #endif ++ ++ #ifdef vax + #include "m-vaxinit.h" ++ #endif ++ ++ #ifdef sun ++ #include "m-suninit.h" ++ #endif + + /* This is used to make a file's initialization function. + It calls another function named `initialize', which must +diff -c ../../gnu/gdb/main.c ./main.c +*** ../../gnu/gdb/main.c Sat Apr 4 23:11:59 1987 +--- ./main.c Mon Apr 27 00:27:21 1987 +*************** +*** 236,241 **** +--- 236,243 ---- + if (*p) + { + c = lookup_cmd (&p, cmdlist, "", 0); ++ if (c->function == 0) ++ error ("That is not a command, just a help topic."); + if (c->class == (int) class_user) + { + if (*p) +*************** +*** 457,463 **** + + /* Add an element to the list of commands. */ + +! void + add_com (name, class, fun, doc) + char *name; + int class; +--- 459,465 ---- + + /* Add an element to the list of commands. */ + +! struct cmd_list_element * + add_com (name, class, fun, doc) + char *name; + int class; +*************** +*** 464,470 **** + void (*fun) (); + char *doc; + { +! add_cmd (name, class, fun, doc, &cmdlist); + } + + /* Add an alias or abbreviation command to the list of commands. */ +--- 466,473 ---- + void (*fun) (); + char *doc; + { +! +! return add_cmd (name, class, fun, doc, &cmdlist); + } + + /* Add an alias or abbreviation command to the list of commands. */ +*************** +*** 547,552 **** +--- 550,556 ---- + + if (c && c->class == (int) class_user) + free_command_lines (&c->function); ++ + + add_com (comname, class_user, cmds, + (c && c->class == (int) class_user) +diff -c ../../gnu/gdb/param.h ./param.h +*** ../../gnu/gdb/param.h Sat Apr 4 23:15:44 1987 +--- ./param.h Mon Apr 27 00:28:17 1987 +*************** +*** 1 **** +--- 1,19 ---- ++ /* Changed to use ifdefs so we don't have to edit it all the time. ++ David Nichols ++ 28 November 1986 */ ++ ++ #ifdef vax + #include "m-vax.h" ++ #endif ++ ++ #ifdef ibm032 ++ #include "m-ibm032.h" ++ #endif ++ ++ #ifdef sun ++ #ifdef mc68020 ++ #include "m-sun3.h" ++ #else ++ #include "m-sun2.h" ++ #endif ++ #endif +diff -c ../../gnu/gdb/pinsn.c ./pinsn.c +*** ../../gnu/gdb/pinsn.c Sat Apr 4 23:15:58 1987 +--- ./pinsn.c Mon Apr 27 00:28:36 1987 +*************** +*** 1 **** +--- 1,15 ---- ++ /* Changed to use ifdefs so we don't have to edit this. ++ David Nichols ++ 28 Nov 1986 */ ++ ++ #ifdef ibm032 ++ #include "ibm032-pinsn.c" ++ #endif ++ ++ #ifdef vax + #include "vax-pinsn.c" ++ #endif ++ ++ #ifdef sun ++ #include "m68k-pinsn.c" ++ #endif +diff -c ../../gnu/gdb/printcmd.c ./printcmd.c +*** ../../gnu/gdb/printcmd.c Sat Apr 4 23:17:03 1987 +--- ./printcmd.c Mon Apr 27 00:30:52 1987 +*************** +*** 797,804 **** + CORE_ADDR frame; + FILE *stream; + { +! char *space = (char *) alloca (TYPE_LENGTH (SYMBOL_TYPE (var))); + value val = read_var_value (var, frame); + value_print (val, stream); + } + +--- 797,805 ---- + CORE_ADDR frame; + FILE *stream; + { +! char *space; + value val = read_var_value (var, frame); ++ space = (char *) alloca (TYPE_LENGTH (SYMBOL_TYPE (var))); + value_print (val, stream); + } + +*************** +*** 883,888 **** +--- 884,891 ---- + } + } + ++ printcmdinitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/source.c ./source.c +*** ../../gnu/gdb/source.c Sat Apr 4 23:17:55 1987 +--- ./source.c Mon Apr 27 00:31:25 1987 +*************** +*** 276,282 **** + if (get_exec_file () != 0 && exec_mtime < st.st_mtime) + printf ("Source file is more recent than executable.\n"); + +! data = (char *) alloca (st.st_size); + myread (desc, data, st.st_size, s->filename); + end = data + st.st_size; + p = data; +--- 276,283 ---- + if (get_exec_file () != 0 && exec_mtime < st.st_mtime) + printf ("Source file is more recent than executable.\n"); + +! data = (char *) alloca(st.st_size); +! + myread (desc, data, st.st_size, s->filename); + end = data + st.st_size; + p = data; +*************** +*** 530,535 **** +--- 531,538 ---- + printf ("Line number %d is out of range for \"%s\".\n", + sal.line, sal.symtab->filename); + } ++ ++ sourceinitialize() {initialize();} + + static + initialize () +diff -c ../../gnu/gdb/stack.c ./stack.c +*** ../../gnu/gdb/stack.c Sun Apr 5 00:28:05 1987 +--- ./stack.c Mon Apr 27 00:31:50 1987 +*************** +*** 511,516 **** +--- 511,517 ---- + + print_stack_frame (selected_frame, selected_frame_level, 1); + } ++ + + static void + return_command (retval_exp) +*************** +*** 538,543 **** +--- 539,546 ---- + frame_command ("0", 1); + } + ++ stackinitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/symmisc.c ./symmisc.c +*** ../../gnu/gdb/symmisc.c Sun Apr 5 00:33:16 1987 +--- ./symmisc.c Mon Apr 27 00:37:46 1987 +*************** +*** 504,509 **** +--- 504,511 ---- + return i; + } + ++ symmiscinitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/symtab.c ./symtab.c +*** ../../gnu/gdb/symtab.c Sun Apr 5 00:35:45 1987 +--- ./symtab.c Mon Apr 27 00:38:19 1987 +*************** +*** 71,78 **** + strcpy (copy, name); + strcat (copy, ".c"); + for (s = symtab_list; s; s = s->next) +! if (!strcmp (copy, s->filename)) + return s; + + return 0; + } +--- 71,79 ---- + strcpy (copy, name); + strcat (copy, ".c"); + for (s = symtab_list; s; s = s->next) +! if (!strcmp (copy, s->filename)) { + return s; ++ } + + return 0; + } +*************** +*** 703,709 **** + register struct symbol *sym; + register CORE_ADDR pc; + register int i; +! char *copy; + + /* Defaults have defaults. */ + +--- 704,710 ---- + register struct symbol *sym; + register CORE_ADDR pc; + register int i; +! char *copy, *dotcopy; + + /* Defaults have defaults. */ + +*************** +*** 818,825 **** +--- 819,847 ---- + /* Look up that token as a function. + If file specified, use that file's per-file block to start with. */ + ++ #ifdef ibm032 ++ /* RT has stupid dots in front of function names (_.foo), and worse, has bogus _foo ++ symbol to confuse us, too. ++ */ ++ if (*copy != '.') { ++ dotcopy = (char *) alloca (strlen(copy)+2); /* one for the null and one for the dot */ ++ dotcopy[0] = '.'; ++ strcpy(dotcopy+1, copy); ++ sym = lookup_symbol (dotcopy, s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 1) : 0, ++ VAR_NAMESPACE); ++ } ++ else { ++ sym = 0; ++ dotcopy = 0; ++ } ++ if (!sym || SYMBOL_CLASS(sym) != LOC_BLOCK) { ++ sym = lookup_symbol (copy, s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 1) : 0, ++ VAR_NAMESPACE); ++ } ++ #else + sym = lookup_symbol (copy, s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 1) : 0, + VAR_NAMESPACE); ++ #endif + + if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) + { +*************** +*** 835,840 **** +--- 857,875 ---- + if (sym) + error ("%s is not a function.", copy); + ++ #ifdef ibm032 ++ /* try the dot version first */ ++ if (dotcopy) for (i = 0; i < misc_function_count; i++) ++ if (!strcmp (misc_function_vector[i].name, dotcopy)) ++ { ++ value.symtab = 0; ++ value.line = 0; ++ value.pc = misc_function_vector[i].address + FUNCTION_START_OFFSET; ++ if (funfirstline) ++ SKIP_PROLOGUE (value.pc); ++ return value; ++ } ++ #endif + for (i = 0; i < misc_function_count; i++) + if (!strcmp (misc_function_vector[i].name, copy)) + { +*************** +*** 1027,1032 **** +--- 1062,1069 ---- + + return type; + } ++ ++ symtabinitialize() {initialize();} + + static + initialize () +diff -c ../../gnu/gdb/utils.c ./utils.c +*** ../../gnu/gdb/utils.c Sun Apr 5 00:40:01 1987 +--- ./utils.c Mon Apr 27 00:40:01 1987 +*************** +*** 151,156 **** +--- 151,157 ---- + else + err = "unknown error"; + ++ /* ibm032: no core leak or other problems 'cause we alway call error -> longjmps away */ + combined = (char *) alloca (strlen (err) + strlen (string) + 3); + strcpy (combined, string); + strcat (combined, ": "); +diff -c ../../gnu/gdb/valarith.c ./valarith.c +*** ../../gnu/gdb/valarith.c Sun Apr 5 00:40:44 1987 +--- ./valarith.c Fri May 22 20:18:46 1987 +*************** +*** 239,245 **** + COERCE_ARRAY (arg1); + + len = TYPE_LENGTH (VALUE_TYPE (arg1)); +! p = VALUE_CONTENTS (arg1); + + while (--len >= 0) + { +--- 239,245 ---- + COERCE_ARRAY (arg1); + + len = TYPE_LENGTH (VALUE_TYPE (arg1)); +! p = (char *) VALUE_CONTENTS (arg1); + + while (--len >= 0) + { +*************** +*** 281,288 **** + && ((len = TYPE_LENGTH (VALUE_TYPE (arg1))) + == TYPE_LENGTH (VALUE_TYPE (arg2)))) + { +! p1 = VALUE_CONTENTS (arg1); +! p2 = VALUE_CONTENTS (arg2); + while (--len >= 0) + { + if (*p1++ != *p2++) +--- 281,288 ---- + && ((len = TYPE_LENGTH (VALUE_TYPE (arg1))) + == TYPE_LENGTH (VALUE_TYPE (arg2)))) + { +! p1 = (char *) VALUE_CONTENTS (arg1); +! p2 = (char *) VALUE_CONTENTS (arg2); + while (--len >= 0) + { + if (*p1++ != *p2++) +*************** +*** 348,353 **** +--- 348,355 ---- + return value_from_long (VALUE_TYPE (arg1), ~ value_as_long (arg1)); + } + ++ valarithinitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/valops.c ./valops.c +*** ../../gnu/gdb/valops.c Sun Apr 5 00:41:32 1987 +--- ./valops.c Fri May 22 20:13:02 1987 +*************** +*** 174,180 **** + /* Return a value just like TOVAL except with the contents of FROMVAL. */ + + val = allocate_value (type); +! bcopy (toval, val, VALUE_CONTENTS (val) - (char *) val); + bcopy (VALUE_CONTENTS (fromval), VALUE_CONTENTS (val), TYPE_LENGTH (type)); + + return val; +--- 174,180 ---- + /* Return a value just like TOVAL except with the contents of FROMVAL. */ + + val = allocate_value (type); +! bcopy (toval, val, (char *) VALUE_CONTENTS (val) - (char *) val); + bcopy (VALUE_CONTENTS (fromval), VALUE_CONTENTS (val), TYPE_LENGTH (type)); + + return val; +*************** +*** 413,419 **** +--- 413,427 ---- + } + else if (code == TYPE_CODE_PTR) + { ++ #ifdef ibm032 ++ /* apparently '_a' pseudoprocedure has lval_memory as its lval type */ ++ if (VALUE_LVAL(function) == lval_memory) ++ funaddr = VALUE_ADDRESS(function); ++ else ++ funaddr = value_as_long (function); ++ #else + funaddr = value_as_long (function); ++ #endif + if (TYPE_CODE (TYPE_TARGET_TYPE (ftype)) + == TYPE_CODE_FUNC) + value_type = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (ftype)); +*************** +*** 429,439 **** + else + /* Handle integer used as address of a function. */ + funaddr = value_as_long (function); +- + value_type = builtin_type_int; + } +! else + error ("Invalid data type for function to be called."); + + /* Create a call sequence customized for this function + and the number of arguments for it. */ +--- 437,447 ---- + else + /* Handle integer used as address of a function. */ + funaddr = value_as_long (function); + value_type = builtin_type_int; + } +! else { + error ("Invalid data type for function to be called."); ++ } + + /* Create a call sequence customized for this function + and the number of arguments for it. */ +*************** +*** 590,595 **** +--- 598,605 ---- + return value_field (arg1, i); + } + ++ valopsinitialize() {initialize();} ++ + static + initialize () + { } +diff -c ../../gnu/gdb/valprint.c ./valprint.c +*** ../../gnu/gdb/valprint.c Sun Apr 5 00:42:28 1987 +--- ./valprint.c Mon Apr 27 00:40:56 1987 +*************** +*** 529,534 **** +--- 529,536 ---- + print_max = atoi (arg); + } + ++ valprintinitialize() {initialize();} ++ + static + initialize () + { +diff -c ../../gnu/gdb/value.h ./value.h +*** ../../gnu/gdb/value.h Sun Apr 5 00:43:44 1987 +--- ./value.h Fri May 22 20:03:32 1987 +*************** +*** 37,43 **** + short repeated; + short repetitions; + short regno; +! char contents[1]; + }; + + typedef struct value *value; +--- 37,43 ---- + short repeated; + short repetitions; + short regno; +! long contents[1]; /* Forces alignment... */ + }; + + typedef struct value *value; +diff -c ../../gnu/gdb/values.c ./values.c +*** ../../gnu/gdb/values.c Sun Apr 5 00:45:14 1987 +--- ./values.c Fri May 22 20:12:40 1987 +*************** +*** 338,344 **** + int offset, bitpos, bitsize; + value newval; + { +! register char *addr = VALUE_CONTENTS (var->value) + offset; + if (bitsize) + modify_field (addr, value_as_long (newval), + bitpos, bitsize); +--- 338,344 ---- + int offset, bitpos, bitsize; + value newval; + { +! register char *addr = (char *) VALUE_CONTENTS (var->value) + offset; + if (bitsize) + modify_field (addr, value_as_long (newval), + bitpos, bitsize); +*************** +*** 733,738 **** +--- 733,740 ---- + write_register (1, retbuf[1]); + } + ++ valuesinitialize() {initialize();} ++ + static + initialize () + { + |