|
|
1.1 ! root 1: From: zs01#@andrew.cmu.edu (Zalman Stern) ! 2: Date: Sun, 24 May 87 03:20:57 edt ! 3: To: [email protected] ! 4: Subject: RT diffs for gdb version 2.1 ! 5: ! 6: Here are the new files, followed by the diffs to old files. The first file below ! 7: is ITCMODS which is my attempt to document some of our changes. Unfortunately, ! 8: it has not been maintained particularly well and notably does not include info ! 9: about our changes to support the HIGH-C compiler. One big change we put in was ! 10: to use a number of initialize routines instead of the "linked list of object ! 11: modules" that is used on other machines. The RT object file format appears to ! 12: have a variable size header before the code, making it very difficult ! 13: (impossible?) to get the initialization stuff to work. If you have any ! 14: questions, don't hesitate to send me mail. ! 15: ! 16: -Z- ! 17: ! 18: Only in .: ITCMODS ! 19: ! 20: blockframe.c: ! 21: set_current_frame now takes an extra argument. ! 22: RT specific code for interpreting and caching of trace table entries. ! 23: Added initialize routine. ! 24: ! 25: breakpoint.c: ! 26: Added new_breakpoint_commands flag to prevent incorrect interpretation of command lists containing a continue statement. ! 27: Modified do_breakpoint_commands to know about new_breakpoint_commands. ! 28: Modified clear_breakpoint_commands to set new_breakpoint_commands. ! 29: Added initialize routine. ! 30: ! 31: core.c: ! 32: RT specific code to find the uarea. ! 33: RT specific code to indicate the start of the data segment. ! 34: set_current_frame now takes an extra argument. ! 35: Added initialize routine. ! 36: ! 37: dbxread.c: ! 38: Added support for the Camphor dynamic loading system. (All under #ifdef CAMPHOR). ! 39: 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). ! 40: set_rel_command to set relocation offset for camphor loaded files. (Under #ifdef CAMPHOR). ! 41: add_file_command to append a file's symbols to the current symbol table instead of replacing it. (Under #ifdef CAMPHOR). ! 42: RT specific code to deal with function names being _.foo instead of _foo. ! 43: Added initialize routine. ! 44: ! 45: Feb 8, 1987 Zalman Stern. ! 46: Added test in symbol_file_command to see if file was compiled with debugging. If not print an error message instead of dumping core. ! 47: Added same test in add_file_command and made it run through BZPATH, CLASSPATH, and PATH in that order (Under #ifdef CAMPHOR). ! 48: ! 49: environ.c: ! 50: Fixed error in calculating new size of a reallocated environment. ! 51: ! 52: eval.c: ! 53: Added initialize routine. ! 54: ! 55: expread.y: ! 56: Moved alloca call out of variable initializations. ! 57: ! 58: findvar.c: ! 59: Added initialize routine. ! 60: ! 61: firstfile.c: ! 62: Added main initialization driver routine. ! 63: ! 64: frame.h: ! 65: Added RT specific declarations to hold frame information, and to deal with trace table caching. ! 66: ! 67: ibm032-pinsn.c: ! 68: New file, contains RT disassembler. ! 69: ! 70: ibm032-opcode.h: ! 71: New file, contains RT opcode definitions. ! 72: ! 73: infcmd.c ! 74: Changed code to use csh instead of sh to avoid the anoyance of the environment bug. ! 75: Added initialize routine. ! 76: ! 77: inflow.c: ! 78: Added initialize routine. ! 79: ! 80: infrun.c: ! 81: set_current_frame now takes an extra argument. ! 82: Added some code to deal with stopping in the middle of a camphor link. (Under #ifdef CAMPHOR). ! 83: Added RT specific code to get the return values from the right registers. Replaces code that was there for RT. ! 84: 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. ! 85: Added initialize routine. ! 86: ! 87: Feb 9, 1987 Zalman Stern. ! 88: 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. ! 89: ! 90: iniitialize.h: ! 91: Changed file to use #ifdef's for machine type. Allows one to use same sources for different machines. ! 92: ! 93: m-ibm032.h: ! 94: New file, contains RT specific macros and variables. ! 95: ! 96: param.h: ! 97: Changed file to use #ifdef's for machine type. Allows one to use same sources for different machines. ! 98: ! 99: pinsn.c: ! 100: Changed file to use #ifdef's for machine type. Allows one to use same sources for different machines. ! 101: ! 102: printcmd.c: ! 103: Moved alloca calls out of variable initialization. ! 104: Added initialize routine. ! 105: ! 106: source.c: ! 107: Added initialize routine. ! 108: ! 109: stack.c: ! 110: Added initialize routine. ! 111: ! 112: symmisc.c: ! 113: Added initialize routine. ! 114: ! 115: symtab.c: ! 116: RT specific code to deal with function names being _.foo instead of _foo. ! 117: Added initialize routine. ! 118: ! 119: utils.c: ! 120: Added comment. ! 121: ! 122: valarith.c: ! 123: Added initialize routine. ! 124: ! 125: valops.c: ! 126: Added initialize routine. ! 127: ! 128: valprint.c: ! 129: Added initialize routine. ! 130: ! 131: values.c: ! 132: Added initialize routine. ! 133: ! 134: Only in .: ibm032-opcode.h ! 135: ! 136: /* The opcode table consists of a 256 element array containing an ! 137: * instruction mnemonic and an instruction type field. This can be ! 138: * indexed directly by the first eight bits of an RT instruction. ! 139: * The instruction type consists of a type field and some flags. ! 140: * In addition to this, there is an ifdef'd out "instruction" table ! 141: * at the end of the file. This is an alphabetical listing of the instructions ! 142: * containing mnemonic, opcode, and type. This is useful for modification ! 143: * purposes. There is also some code in the ifdef to convert the ! 144: * instruction table into an opcode table. ! 145: */ ! 146: ! 147: /* Various useful bit masks. */ ! 148: #define ibm032_typeMask 0x0f /* Mask to get actual type info out of instruction type. */ ! 149: #define LOW4 0x0f ! 150: #define HIGH4 0xf0 ! 151: #define LOW16 0x0000ffff ! 152: #define HIGH16 0xffff0000 ! 153: #define LOW20 0x000fffff ! 154: #define LOW24 0x00ffffff ! 155: ! 156: /* Instruction types consist of a type id in the low 4 bits and flags above that. */ ! 157: ! 158: /* Flags. */ ! 159: #define ibm032_conditional 0x10 ! 160: #define ibm032_negative 0x20 ! 161: ! 162: /* Format types. */ ! 163: #define ibm032_JI 0x0 /* Jump immediate. */ ! 164: #define ibm032_X 0x1 /* ??? */ ! 165: ! 166: /* These next ones are in a special bit position. Do not change their defines. */ ! 167: #define ibm032_DS0 0x2 /* Data short with no shift for immediate value. */ ! 168: #define ibm032_DS1 0x3 /* Data short with 1 bit shift for immediate value. */ ! 169: #define ibm032_DS2 0x4 /* Data short with 2 bit shift for immediate value */ ! 170: #define ibm032_DSShiftOffset ibm032_DS0 /* Offset to get shift value from ibm032_DS? types. */ ! 171: ! 172: #define ibm032_RR 0x5 /* R format where second argument is a register */ ! 173: #define ibm032_RI 0x6 /* R format where second argument is 4 bit immediate. */ ! 174: #define ibm032_BI 0x7 /* Branch immediate. */ ! 175: #define ibm032_BA 0x8 /* Branch absolute. */ ! 176: #define ibm032_D 0x9 /* Data. */ ! 177: ! 178: /* What an instruction looks like. */ ! 179: struct ibm032_opcode { ! 180: char *mnemonic; /* the name. NULL indicates illegal instruction. */ ! 181: int type; /* See above. */ ! 182: }; ! 183: ! 184: #define MAXOPCODES 256 /* Pretty well hardwired. */ ! 185: ! 186: #ifndef BUILDTABLE ! 187: /* The actual data. */ ! 188: struct ibm032_opcode ibm032_opcodes[] = { ! 189: {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, ! 190: {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, ! 191: {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, ! 192: {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, ! 193: {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, ! 194: {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, ! 195: {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, ! 196: {"j%s", ibm032_JI | ibm032_conditional | ibm032_negative}, ! 197: {"j%s", ibm032_JI | ibm032_conditional}, ! 198: {"j%s", ibm032_JI | ibm032_conditional}, ! 199: {"j%s", ibm032_JI | ibm032_conditional}, ! 200: {"j%s", ibm032_JI | ibm032_conditional}, ! 201: {"j%s", ibm032_JI | ibm032_conditional}, ! 202: {"j%s", ibm032_JI | ibm032_conditional}, ! 203: {"j%s", ibm032_JI | ibm032_conditional}, ! 204: {"j%s", ibm032_JI | ibm032_conditional}, ! 205: {"stcs", ibm032_DS0}, ! 206: {"stcs", ibm032_DS0}, ! 207: {"stcs", ibm032_DS0}, ! 208: {"stcs", ibm032_DS0}, ! 209: {"stcs", ibm032_DS0}, ! 210: {"stcs", ibm032_DS0}, ! 211: {"stcs", ibm032_DS0}, ! 212: {"stcs", ibm032_DS0}, ! 213: {"stcs", ibm032_DS0}, ! 214: {"stcs", ibm032_DS0}, ! 215: {"stcs", ibm032_DS0}, ! 216: {"stcs", ibm032_DS0}, ! 217: {"stcs", ibm032_DS0}, ! 218: {"stcs", ibm032_DS0}, ! 219: {"stcs", ibm032_DS0}, ! 220: {"stcs", ibm032_DS0}, ! 221: {"sths", ibm032_DS1}, ! 222: {"sths", ibm032_DS1}, ! 223: {"sths", ibm032_DS1}, ! 224: {"sths", ibm032_DS1}, ! 225: {"sths", ibm032_DS1}, ! 226: {"sths", ibm032_DS1}, ! 227: {"sths", ibm032_DS1}, ! 228: {"sths", ibm032_DS1}, ! 229: {"sths", ibm032_DS1}, ! 230: {"sths", ibm032_DS1}, ! 231: {"sths", ibm032_DS1}, ! 232: {"sths", ibm032_DS1}, ! 233: {"sths", ibm032_DS1}, ! 234: {"sths", ibm032_DS1}, ! 235: {"sths", ibm032_DS1}, ! 236: {"sths", ibm032_DS1}, ! 237: {"sts", ibm032_DS2}, ! 238: {"sts", ibm032_DS2}, ! 239: {"sts", ibm032_DS2}, ! 240: {"sts", ibm032_DS2}, ! 241: {"sts", ibm032_DS2}, ! 242: {"sts", ibm032_DS2}, ! 243: {"sts", ibm032_DS2}, ! 244: {"sts", ibm032_DS2}, ! 245: {"sts", ibm032_DS2}, ! 246: {"sts", ibm032_DS2}, ! 247: {"sts", ibm032_DS2}, ! 248: {"sts", ibm032_DS2}, ! 249: {"sts", ibm032_DS2}, ! 250: {"sts", ibm032_DS2}, ! 251: {"sts", ibm032_DS2}, ! 252: {"sts", ibm032_DS2}, ! 253: {"lcs", ibm032_DS0}, ! 254: {"lcs", ibm032_DS0}, ! 255: {"lcs", ibm032_DS0}, ! 256: {"lcs", ibm032_DS0}, ! 257: {"lcs", ibm032_DS0}, ! 258: {"lcs", ibm032_DS0}, ! 259: {"lcs", ibm032_DS0}, ! 260: {"lcs", ibm032_DS0}, ! 261: {"lcs", ibm032_DS0}, ! 262: {"lcs", ibm032_DS0}, ! 263: {"lcs", ibm032_DS0}, ! 264: {"lcs", ibm032_DS0}, ! 265: {"lcs", ibm032_DS0}, ! 266: {"lcs", ibm032_DS0}, ! 267: {"lcs", ibm032_DS0}, ! 268: {"lcs", ibm032_DS0}, ! 269: {"lhas", ibm032_DS1}, ! 270: {"lhas", ibm032_DS1}, ! 271: {"lhas", ibm032_DS1}, ! 272: {"lhas", ibm032_DS1}, ! 273: {"lhas", ibm032_DS1}, ! 274: {"lhas", ibm032_DS1}, ! 275: {"lhas", ibm032_DS1}, ! 276: {"lhas", ibm032_DS1}, ! 277: {"lhas", ibm032_DS1}, ! 278: {"lhas", ibm032_DS1}, ! 279: {"lhas", ibm032_DS1}, ! 280: {"lhas", ibm032_DS1}, ! 281: {"lhas", ibm032_DS1}, ! 282: {"lhas", ibm032_DS1}, ! 283: {"lhas", ibm032_DS1}, ! 284: {"lhas", ibm032_DS1}, ! 285: {"cas", ibm032_X}, ! 286: {"cas", ibm032_X}, ! 287: {"cas", ibm032_X}, ! 288: {"cas", ibm032_X}, ! 289: {"cas", ibm032_X}, ! 290: {"cas", ibm032_X}, ! 291: {"cas", ibm032_X}, ! 292: {"cas", ibm032_X}, ! 293: {"cas", ibm032_X}, ! 294: {"cas", ibm032_X}, ! 295: {"cas", ibm032_X}, ! 296: {"cas", ibm032_X}, ! 297: {"cas", ibm032_X}, ! 298: {"cas", ibm032_X}, ! 299: {"cas", ibm032_X}, ! 300: {"cas", ibm032_X}, ! 301: {"ls", ibm032_DS2}, ! 302: {"ls", ibm032_DS2}, ! 303: {"ls", ibm032_DS2}, ! 304: {"ls", ibm032_DS2}, ! 305: {"ls", ibm032_DS2}, ! 306: {"ls", ibm032_DS2}, ! 307: {"ls", ibm032_DS2}, ! 308: {"ls", ibm032_DS2}, ! 309: {"ls", ibm032_DS2}, ! 310: {"ls", ibm032_DS2}, ! 311: {"ls", ibm032_DS2}, ! 312: {"ls", ibm032_DS2}, ! 313: {"ls", ibm032_DS2}, ! 314: {"ls", ibm032_DS2}, ! 315: {"ls", ibm032_DS2}, ! 316: {"ls", ibm032_DS2}, ! 317: {0, 0}, ! 318: {0, 0}, ! 319: {0, 0}, ! 320: {0, 0}, ! 321: {0, 0}, ! 322: {0, 0}, ! 323: {0, 0}, ! 324: {0, 0}, ! 325: {"b%s", ibm032_BI | ibm032_conditional | ibm032_negative}, ! 326: {"b%sx", ibm032_BI | ibm032_conditional | ibm032_negative}, ! 327: {"bala", ibm032_BA}, ! 328: {"balax", ibm032_BA}, ! 329: {"bali", ibm032_BI}, ! 330: {"balix", ibm032_BI}, ! 331: {"b%s", ibm032_BI | ibm032_conditional}, ! 332: {"b%sx", ibm032_BI | ibm032_conditional}, ! 333: {"ais", ibm032_RI}, ! 334: {"inc", ibm032_RI}, ! 335: {"sis", ibm032_RI}, ! 336: {"dec", ibm032_RI}, ! 337: {"cis", ibm032_RI}, ! 338: {"clrsb", ibm032_RI}, ! 339: {"mfs", ibm032_RR}, ! 340: {"setsb", ibm032_RI}, ! 341: {"clrbu", ibm032_RI}, ! 342: {"clrbl", ibm032_RI}, ! 343: {"setbu", ibm032_RI}, ! 344: {"setbl", ibm032_RI}, ! 345: {"mftbiu", ibm032_RI}, ! 346: {"mftbil", ibm032_RI}, ! 347: {"mttbiu", ibm032_RI}, ! 348: {"mttbil", ibm032_RI}, ! 349: {"sari", ibm032_RI}, ! 350: {"sari16", ibm032_RI}, ! 351: {0, 0}, ! 352: {0, 0}, ! 353: {"lis", ibm032_RI}, ! 354: {0, 0}, ! 355: {0, 0}, ! 356: {0, 0}, ! 357: {"sri", ibm032_RI}, ! 358: {"sri16", ibm032_RI}, ! 359: {"sli", ibm032_RI}, ! 360: {"sli16", ibm032_RI}, ! 361: {"srpi", ibm032_RI}, ! 362: {"srpi16", ibm032_RI}, ! 363: {"slpi", ibm032_RI}, ! 364: {"slpi16", ibm032_RI}, ! 365: {"sar", ibm032_RR}, ! 366: {"exts", ibm032_RR}, ! 367: {"sf", ibm032_RR}, ! 368: {"cl", ibm032_RR}, ! 369: {"c", ibm032_RR}, ! 370: {"mts", ibm032_RR}, ! 371: {"d", ibm032_RR}, ! 372: {0, 0}, ! 373: {"sr", ibm032_RR}, ! 374: {"srp", ibm032_RR}, ! 375: {"sl", ibm032_RR}, ! 376: {"slp", ibm032_RR}, ! 377: {"mftb", ibm032_RR}, ! 378: {"tgte", ibm032_RR}, ! 379: {"tlt", ibm032_RR}, ! 380: {"mttb", ibm032_RR}, ! 381: {"svc", ibm032_D}, ! 382: {"ai", ibm032_D}, ! 383: {"cal16", ibm032_D}, ! 384: {"oiu", ibm032_D}, ! 385: {"oil", ibm032_D}, ! 386: {"nilz", ibm032_D}, ! 387: {"nilo", ibm032_D}, ! 388: {"xil", ibm032_D}, ! 389: {"cal", ibm032_D}, ! 390: {"lm", ibm032_D}, ! 391: {"lha", ibm032_D}, ! 392: {"ior", ibm032_D}, ! 393: {"ti", ibm032_D}, ! 394: {"l", ibm032_D}, ! 395: {"lc", ibm032_D}, ! 396: {"tsh", ibm032_D}, ! 397: {"lps", ibm032_D}, ! 398: {"aei", ibm032_D}, ! 399: {"sfi", ibm032_D}, ! 400: {"cli", ibm032_D}, ! 401: {"ci", ibm032_D}, ! 402: {"niuz", ibm032_D}, ! 403: {"niuo", ibm032_D}, ! 404: {"xiu", ibm032_D}, ! 405: {"cau", ibm032_D}, ! 406: {"stm", ibm032_D}, ! 407: {"lh", ibm032_D}, ! 408: {"iow", ibm032_D}, ! 409: {"sth", ibm032_D}, ! 410: {"st", ibm032_D}, ! 411: {"stc", ibm032_D}, ! 412: {0, 0}, ! 413: {"abs", ibm032_RR}, ! 414: {"a", ibm032_RR}, ! 415: {"s", ibm032_RR}, ! 416: {"o", ibm032_RR}, ! 417: {"twoc", ibm032_RR}, ! 418: {"n", ibm032_RR}, ! 419: {"m", ibm032_RR}, ! 420: {"x", ibm032_RR}, ! 421: {"b%sr", ibm032_RR | ibm032_conditional | ibm032_negative}, ! 422: {"b%srx", ibm032_RR | ibm032_conditional | ibm032_negative}, ! 423: {0, 0}, ! 424: {"lhs", ibm032_RR}, ! 425: {"balr", ibm032_RR}, ! 426: {"balrx", ibm032_RR}, ! 427: {"b%sr", ibm032_RR | ibm032_conditional}, ! 428: {"b%srx", ibm032_RR | ibm032_conditional}, ! 429: {"wait", ibm032_RR}, ! 430: {"ae", ibm032_RR}, ! 431: {"se", ibm032_RR}, ! 432: {"ca16", ibm032_RR}, ! 433: {"onec", ibm032_RR}, ! 434: {"clz", ibm032_RR}, ! 435: {0, 0}, ! 436: {0, 0}, ! 437: {0, 0}, ! 438: {"mc03", ibm032_RR}, ! 439: {"mc13", ibm032_RR}, ! 440: {"mc23", ibm032_RR}, ! 441: {"mc33", ibm032_RR}, ! 442: {"mc30", ibm032_RR}, ! 443: {"mc31", ibm032_RR}, ! 444: {"mc32", ibm032_RR}, ! 445: }; ! 446: ! 447: #else ! 448: struct ibm032_opcode ibm032_opcodes[MAXOPCODES]; ! 449: ! 450: struct ibm032_instruction { ! 451: char *mnemonic; /* Mnemonic for this instruction */ ! 452: char opcode; /* Numerical value of opcode. */ ! 453: int type; /* This instructions format. */ ! 454: }; ! 455: ! 456: struct ibm032_instruction ibm032_instructions[] = ! 457: { ! 458: {"a", 0xe1, ibm032_RR}, ! 459: {"abs", 0xe0, ibm032_RR}, ! 460: {"ae", 0xf1, ibm032_RR}, ! 461: {"aei", 0xd1, ibm032_D}, ! 462: {"ai", 0xc1, ibm032_D}, ! 463: {"ais", 0x90, ibm032_RI}, ! 464: {"bala", 0x8a, ibm032_BA}, ! 465: {"balax", 0x8b, ibm032_BA}, ! 466: {"bali", 0x8c, ibm032_BI}, ! 467: {"balix", 0x8d, ibm032_BI}, ! 468: {"balr", 0xec, ibm032_RR}, ! 469: {"balrx", 0xed, ibm032_RR}, ! 470: {"b%s", 0x8e, ibm032_BI | ibm032_conditional}, ! 471: {"b%sr", 0xee, ibm032_RR | ibm032_conditional}, ! 472: {"b%srx", 0xef, ibm032_RR | ibm032_conditional}, ! 473: {"b%sx", 0x8f, ibm032_BI | ibm032_conditional}, ! 474: {"b%s", 0x88, ibm032_BI | ibm032_conditional | ibm032_negative}, ! 475: {"b%sr", 0xe8, ibm032_RR | ibm032_conditional | ibm032_negative}, ! 476: {"b%srx", 0xe9, ibm032_RR | ibm032_conditional | ibm032_negative}, ! 477: {"b%sx", 0x89, ibm032_BI | ibm032_conditional | ibm032_negative}, ! 478: {"c", 0xb4, ibm032_RR}, ! 479: {"cal", 0xc8, ibm032_D}, ! 480: {"cal16", 0xc2, ibm032_D}, ! 481: {"cas", 0x60, ibm032_X}, ! 482: {"cau", 0xd8, ibm032_D}, ! 483: {"ca16", 0xf3, ibm032_RR}, ! 484: {"ci", 0xd4, ibm032_D}, ! 485: {"cis", 0x94, ibm032_RI}, ! 486: {"cl", 0xb3, ibm032_RR}, ! 487: {"cli", 0xd3, ibm032_D}, ! 488: {"clrbl", 0x99, ibm032_RI}, ! 489: {"clrbu", 0x98, ibm032_RI}, ! 490: {"clrsb", 0x95, ibm032_RI}, ! 491: {"clz", 0xf5, ibm032_RR}, ! 492: {"d", 0xb6, ibm032_RR}, ! 493: {"dec", 0x93, ibm032_RI}, ! 494: {"exts", 0xb1, ibm032_RR}, ! 495: {"inc", 0x91, ibm032_RI}, ! 496: {"ior", 0xcb, ibm032_D}, ! 497: {"iow", 0xdb, ibm032_D}, ! 498: ! 499: {"j%s", 0x08, ibm032_JI | ibm032_conditional}, ! 500: {"j%s", 0x00, ibm032_JI | ibm032_conditional | ibm032_negative}, ! 501: ! 502: {"l", 0xcd, ibm032_D}, ! 503: {"lc", 0xce, ibm032_D}, ! 504: {"lcs", 0x40, ibm032_DS0}, ! 505: {"lh", 0xda, ibm032_D}, ! 506: {"lha", 0xca, ibm032_D}, ! 507: {"lhas", 0x50, ibm032_DS1}, ! 508: {"lhs", 0xeb, ibm032_RR}, ! 509: {"lis", 0xa4, ibm032_RI}, ! 510: {"lm", 0xc9, ibm032_D}, ! 511: {"lps", 0xd0, ibm032_D}, ! 512: {"ls", 0x70, ibm032_DS2}, ! 513: {"m", 0xe6, ibm032_RR}, ! 514: {"mc03", 0xf9, ibm032_RR}, ! 515: {"mc13", 0xfa, ibm032_RR}, ! 516: {"mc23", 0xfb, ibm032_RR}, ! 517: {"mc33", 0xfc, ibm032_RR}, ! 518: {"mc30", 0xfd, ibm032_RR}, ! 519: {"mc31", 0xfe, ibm032_RR}, ! 520: {"mc32", 0xff, ibm032_RR}, ! 521: {"mfs", 0x96, ibm032_RR}, ! 522: {"mftb", 0xbc, ibm032_RR}, ! 523: {"mftbil", 0x9d, ibm032_RI}, ! 524: {"mftbiu", 0x9c, ibm032_RI}, ! 525: {"mts", 0xb5, ibm032_RR}, ! 526: {"mttb", 0xbf, ibm032_RR}, ! 527: {"mttbil", 0x9f, ibm032_RI}, ! 528: {"mttbiu", 0x9e, ibm032_RI}, ! 529: {"n", 0xe5, ibm032_RR}, ! 530: ! 531: {"nilo", 0xc6, ibm032_D}, ! 532: {"nilz", 0xc5, ibm032_D}, ! 533: {"niuo", 0xd6, ibm032_D}, ! 534: {"niuz", 0xd5, ibm032_D}, ! 535: {"o", 0xe3, ibm032_RR}, ! 536: {"oil", 0xc4, ibm032_D}, ! 537: {"oiu", 0xc3, ibm032_D}, ! 538: {"onec", 0xf4, ibm032_RR}, ! 539: {"s", 0xe2, ibm032_RR}, ! 540: {"sar", 0xb0, ibm032_RR}, ! 541: {"sari", 0xa0, ibm032_RI}, ! 542: {"sari16", 0xa1, ibm032_RI}, ! 543: {"se", 0xf2, ibm032_RR}, ! 544: {"setbl", 0x9b, ibm032_RI}, ! 545: {"setbu", 0x9a, ibm032_RI}, ! 546: {"setsb", 0x97, ibm032_RI}, ! 547: {"sf", 0xb2, ibm032_RR}, ! 548: ! 549: {"sfi", 0xd2, ibm032_D}, ! 550: ! 551: {"sis", 0x92, ibm032_RI}, ! 552: {"sl", 0xba, ibm032_RR}, ! 553: {"sli", 0xaa, ibm032_RI}, ! 554: {"sli16", 0xab, ibm032_RI}, ! 555: {"slp", 0xbb, ibm032_RR}, ! 556: {"slpi", 0xae, ibm032_RI}, ! 557: {"slpi16", 0xaf, ibm032_RI}, ! 558: {"sr", 0xb8, ibm032_RR}, ! 559: {"sri", 0xa8, ibm032_RI}, ! 560: {"sri16", 0xa9, ibm032_RI}, ! 561: {"srp", 0xb9, ibm032_RR}, ! 562: {"srpi", 0xac, ibm032_RI}, ! 563: {"srpi16", 0xad, ibm032_RI}, ! 564: ! 565: {"st", 0xdd, ibm032_D}, ! 566: ! 567: {"stc", 0xde, ibm032_D}, ! 568: {"stcs", 0x10, ibm032_DS0}, ! 569: {"sth", 0xdc, ibm032_D}, ! 570: {"sths", 0x20, ibm032_DS1}, ! 571: {"stm", 0xd9, ibm032_D}, ! 572: {"sts", 0x30, ibm032_DS2}, ! 573: {"svc", 0xc0, ibm032_D}, ! 574: {"tgte", 0xbd, ibm032_RR}, ! 575: {"ti", 0xcc, ibm032_D}, ! 576: {"tlt", 0xbe, ibm032_RR}, ! 577: {"tsh", 0xcf, ibm032_D}, ! 578: {"twoc", 0xe4, ibm032_RR}, ! 579: {"wait", 0xf0, ibm032_RR}, ! 580: {"x", 0xe7, ibm032_RR}, ! 581: {"xil", 0xc7, ibm032_D}, ! 582: {"xiu", 0xd7, ibm032_D} ! 583: }; ! 584: ! 585: /* Code to generate the packed opcode table from the instructions table. */ ! 586: ! 587: #include <stdio.h> ! 588: ! 589: char *typeNames[] = { ! 590: "ibm032_JI", ! 591: "ibm032_X", ! 592: "ibm032_DS0", ! 593: "ibm032_DS1", ! 594: "ibm032_DS2", ! 595: "ibm032_RR", ! 596: "ibm032_RI", ! 597: "ibm032_BI", ! 598: "ibm032_BA", ! 599: "ibm032_D" ! 600: }; ! 601: ! 602: main() ! 603: { ! 604: ! 605: int i, j, opcode, type; ! 606: ! 607: for (j = (sizeof(ibm032_instructions) / sizeof(struct ibm032_instruction)); j >= 0; j--) { ! 608: opcode = ibm032_instructions[j].opcode; ! 609: switch (ibm032_instructions[j].type & ibm032_typeMask) { ! 610: case ibm032_JI: ! 611: i = 7; ! 612: break; ! 613: case ibm032_X: ! 614: case ibm032_DS0: ! 615: case ibm032_DS1: ! 616: case ibm032_DS2: ! 617: i = 15; ! 618: break; ! 619: case ibm032_RR: ! 620: case ibm032_RI: ! 621: default: ! 622: i = 0; ! 623: break; ! 624: } ! 625: for (;i >= 0; i--) { ! 626: ibm032_opcodes[opcode + i].mnemonic = ibm032_instructions[j].mnemonic; ! 627: ibm032_opcodes[opcode + i].type = ibm032_instructions[j].type; ! 628: } ! 629: } ! 630: ! 631: printf("struct ibm032_opcode ibm032_opcodes[] = {\n"); ! 632: for ( j = 0; j < 256; j++) { ! 633: type = ibm032_opcodes[j].type; ! 634: if (ibm032_opcodes[j].mnemonic != NULL) ! 635: printf(" {\"%s\",\t\t%s%s%s},\n", ibm032_opcodes[j].mnemonic, ! 636: typeNames[type & ibm032_typeMask], ! 637: (type & ibm032_conditional) ? " | ibm032_conditional" : "", ! 638: (type & ibm032_negative) ? " | ibm032_negative" : ""); ! 639: else ! 640: printf(" {0,\t\t\t0},\n"); ! 641: } ! 642: printf("};\n"); ! 643: } ! 644: #endif /* BUILDTABLE */ ! 645: ! 646: Only in .: ibm032-pinsn.c ! 647: ! 648: /* Print ibm032 instructions for GDB, the GNU debugger. ! 649: Copyright (C) 1986 Free Software Foundation, Inc. ! 650: ! 651: GDB is distributed in the hope that it will be useful, but WITHOUT ANY ! 652: WARRANTY. No author or distributor accepts responsibility to anyone ! 653: for the consequences of using it or for whether it serves any ! 654: particular purpose or works at all, unless he says so in writing. ! 655: Refer to the GDB General Public License for full details. ! 656: ! 657: Everyone is granted permission to copy, modify and redistribute GDB, ! 658: but only under the conditions described in the GDB General Public ! 659: License. A copy of this license is supposed to have been given to you ! 660: along with GDB so you can know your rights and responsibilities. It ! 661: should be in a file named COPYING. Among other things, the copyright ! 662: notice and this notice must be preserved on all copies. ! 663: ! 664: In other words, go ahead and share GDB, but don't try to stop ! 665: anyone else from sharing it farther. Help stamp out software hoarding! ! 666: */ ! 667: ! 668: #include <stdio.h> ! 669: ! 670: #include "defs.h" ! 671: #include "param.h" ! 672: #include "symtab.h" ! 673: #include "ibm032-opcode.h" ! 674: ! 675: /* ibm032 instructions are never longer than this many bytes. */ ! 676: #define MAXLEN 4 ! 677: ! 678: extern char *reg_names[]; ! 679: ! 680: static char *mapCondition(); ! 681: ! 682: ! 683: /* Print the ibm032 instruction at address MEMADDR in debugged memory, ! 684: on STREAM. Returns length of the instruction, in bytes. */ ! 685: ! 686: int ! 687: print_insn (memaddr, stream) ! 688: CORE_ADDR memaddr; ! 689: FILE *stream; ! 690: { ! 691: unsigned char buffer[MAXLEN]; ! 692: int opcodeIndex, instructionBits, type; ! 693: char *mnemonic; ! 694: ! 695: read_memory (memaddr, buffer, MAXLEN); ! 696: instructionBits = (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]; /* Get it into an int for easy use. */ ! 697: ! 698: if ((mnemonic = ibm032_opcodes[opcodeIndex = buffer[0]].mnemonic) == NULL) ! 699: { ! 700: fprintf (stream, "0%o", (instructionBits & HIGH16) >> 16); ! 701: return 2; ! 702: } ! 703: type = ibm032_opcodes[opcodeIndex].type; ! 704: if (!(type & ibm032_conditional)) { ! 705: fprintf (stream, "%s", mnemonic); ! 706: ! 707: switch (type) { ! 708: ! 709: int displacement; /* Used for sign extensions. */ ! 710: char *sign; ! 711: ! 712: case ibm032_X: ! 713: 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]); ! 714: return 2; ! 715: case ibm032_DS0: ! 716: case ibm032_DS1: ! 717: case ibm032_DS2: ! 718: 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. */ ! 719: if (buffer[1] & LOW4) ! 720: fprintf(stream, "(%s)", reg_names[buffer[1] & LOW4]); ! 721: return 2; ! 722: case ibm032_RR: ! 723: fprintf(stream, "\t%s, %s", reg_names[(buffer[1] & HIGH4) >> 4], reg_names[buffer[1] & 0x0f]); ! 724: return 2; ! 725: case ibm032_RI: ! 726: fprintf(stream, "\t%s, %x", reg_names[(buffer[1] & HIGH4) >> 4], buffer[1] & LOW4); ! 727: return 2; ! 728: case ibm032_BI: ! 729: fprintf(stream, "\t%s, ", reg_names[(buffer[1] & HIGH4) >> 4]); ! 730: displacement = (instructionBits & LOW20); ! 731: if ((displacement & (1 << 19)) != 0) /* Cover sign extension. */ ! 732: displacement |= 0xfff00000; ! 733: print_address(memaddr + (displacement * 2), stream); /* Need sign extension. */ ! 734: return 4; ! 735: case ibm032_BA: ! 736: print_address((instructionBits & LOW24) & ~1, stream); ! 737: return 4; ! 738: case ibm032_D: ! 739: displacement = (instructionBits & LOW16); ! 740: if ((displacement & (1 << 15)) != 0) { /* Cover sign extension. */ ! 741: displacement = - (displacement | 0xffff0000); ! 742: sign = "-"; ! 743: } ! 744: else ! 745: sign = ""; ! 746: fprintf(stream, "\t%s, %s, %s%x", reg_names[(buffer[1] & HIGH4) >> 4], reg_names[buffer[1] & LOW4], sign, displacement); ! 747: return 4; ! 748: } ! 749: } ! 750: else { /* Conditional branches are hacked. */ ! 751: switch (type & 0x0f) { ! 752: ! 753: int displacement; ! 754: ! 755: case ibm032_JI: ! 756: fprintf(stream, ibm032_opcodes[opcodeIndex].mnemonic, mapCondition(type & ibm032_negative, buffer[0] & LOW4)); ! 757: putc('\t', stream); ! 758: print_address((buffer[1] << 1) + memaddr, stream); ! 759: return 2; ! 760: case ibm032_BI: ! 761: fprintf(stream, ibm032_opcodes[opcodeIndex].mnemonic, mapCondition(type & ibm032_negative, (buffer[1] & HIGH4) >> 4)); ! 762: putc('\t', stream); ! 763: displacement = (instructionBits & LOW20); ! 764: if ((displacement & (1 << 19)) != 0) /* Cover sign extension. */ ! 765: displacement |= 0xfff00000; ! 766: print_address((displacement * 2) + memaddr, stream); ! 767: return 4; ! 768: case ibm032_RR: ! 769: fprintf(stream, ibm032_opcodes[opcodeIndex].mnemonic, mapCondition(type & ibm032_negative, (buffer[1] & HIGH4) >> 4)); ! 770: fprintf(stream, "\t%s", reg_names[buffer[1] & LOW4]); ! 771: return 2; ! 772: } ! 773: } ! 774: } ! 775: ! 776: /* Converts a 4 bit "conditional specifier" into a semi-meaningful name. */ ! 777: static char *mapCondition(negative, conditionBits) ! 778: int conditionBits; ! 779: { ! 780: ! 781: char *condition; ! 782: ! 783: if (negative) ! 784: switch (conditionBits) { ! 785: case 0x8: ! 786: condition = ""; ! 787: break; ! 788: case 0x9: ! 789: condition = "ge"; ! 790: break; ! 791: case 0xa: ! 792: condition = "ne"; ! 793: break; ! 794: case 0xb: ! 795: condition = "le"; ! 796: break; ! 797: case 0xc: ! 798: condition = "nc"; ! 799: break; ! 800: case 0xd: /* Reserved. */ ! 801: condition = "notbogus"; ! 802: break; ! 803: case 0xe: ! 804: condition = "no"; ! 805: break; ! 806: case 0xf: ! 807: condition = "ntb"; ! 808: break; ! 809: default: ! 810: condition = "notbogus"; ! 811: break; ! 812: } ! 813: else ! 814: switch (conditionBits) { ! 815: case 0x8: ! 816: condition = "nop"; ! 817: break; ! 818: case 0x9: ! 819: condition = "lt"; ! 820: break; ! 821: case 0xa: ! 822: condition = "eq"; ! 823: break; ! 824: case 0xb: ! 825: condition = "gt"; ! 826: break; ! 827: case 0xc: ! 828: condition = "c"; ! 829: break; ! 830: case 0xd: /* Reserved. */ ! 831: condition = "bogus"; ! 832: break; ! 833: case 0xe: ! 834: condition = "o"; ! 835: break; ! 836: case 0xf: ! 837: condition = "tb"; ! 838: break; ! 839: default: ! 840: condition = "bogus"; ! 841: break; ! 842: } ! 843: return condition; ! 844: } ! 845: ! 846: Only in .: m-ibm032.h ! 847: ! 848: /* Parameters for execution on an IBM RT, for GDB, the GNU debugger. ! 849: Copyright (C) 1986 Free Software Foundation, Inc. ! 850: ! 851: GDB is distributed in the hope that it will be useful, but WITHOUT ANY ! 852: WARRANTY. No author or distributor accepts responsibility to anyone ! 853: for the consequences of using it or for whether it serves any ! 854: particular purpose or works at all, unless he says so in writing. ! 855: Refer to the GDB General Public License for full details. ! 856: ! 857: Everyone is granted permission to copy, modify and redistribute GDB, ! 858: but only under the conditions described in the GDB General Public ! 859: License. A copy of this license is supposed to have been given to you ! 860: along with GDB so you can know your rights and responsibilities. It ! 861: should be in a file named COPYING. Among other things, the copyright ! 862: notice and this notice must be preserved on all copies. ! 863: ! 864: In other words, go ahead and share GDB, but don't try to stop ! 865: anyone else from sharing it farther. Help stamp out software hoarding! ! 866: */ ! 867: ! 868: /* Define this if the C compiler puts an underscore at the front ! 869: of external names before giving them to the linker. */ ! 870: ! 871: #define NAMES_HAVE_UNDERSCORE ! 872: ! 873: /* Offset from address of function to start of its code. ! 874: Zero on most machines. */ ! 875: ! 876: #define FUNCTION_START_OFFSET 0 ! 877: ! 878: /* Advance PC across any function entry prologue instructions ! 879: to reach some "real" code. */ ! 880: ! 881: #define SKIP_PROLOGUE(pc) \ ! 882: { register int op = read_memory_integer (pc, 1) & 0x00ff; \ ! 883: if (op == 0xd9) { \ ! 884: pc += 4; \ ! 885: op = read_memory_integer (pc, 2); \ ! 886: if ((op & 0xff00) == 0xc100) { /* pcc prolog add r1, number */ \ ! 887: pc += 4; \ ! 888: op = read_memory_integer (pc, 1) & 0x00ff; \ ! 889: if (op == 0x6e) { /* cas r14, 0 */ \ ! 890: pc += 2; \ ! 891: op = read_memory_integer (pc, 2) & 0xffff; \ ! 892: if (op == 0xc8d1) pc += 4; /* cal r13, junk(r1) */ \ ! 893: } \ ! 894: } \ ! 895: else if ((op & 0xffff) == 0x6e00) { /* hc prolog cas r14, 0 */ \ ! 896: pc += 4; \ ! 897: op = read_memory_integer(pc, 1) & 0xff; \ ! 898: if (op == 0x6d) { /* cas r13 junk, probably */ \ ! 899: pc += 2; \ ! 900: op = read_memory_integer(pc, 2) & 0xffff; \ ! 901: if (op == 0xc811) pc += 4; /* cal r1, foo(r1) */ \ ! 902: } \ ! 903: } \ ! 904: } \ ! 905: while (1) { \ ! 906: /* now watch for st, sth, stc, and short versions thereof, cas instructions and exts */ \ ! 907: /* which are all used to store the parameters from r2-r5 onto the stack or into reg vars */ \ ! 908: op = read_memory_integer (pc, 2); \ ! 909: if ((op & 0xff00) == 0x3000 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 2; \ ! 910: else if ((op & 0xff00) == 0x2300 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 2; \ ! 911: else if ((op & 0xff00) == 0x1b00 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 2; \ ! 912: else if ((op & 0xff00) == 0x6c00 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 2; \ ! 913: else if ((op & 0xff00) == 0xb100) pc += 2; /* extend sign */ \ ! 914: else if ((op & 0xff00) == 0xdd00 && (op & 0xf0) >= 0x20 && (op & 0xf0) <= 0x50) pc += 4; \ ! 915: else break; \ ! 916: } \ ! 917: } ! 918: ! 919: /* Immediately after a function call, return the saved pc. ! 920: Can't go through the frames for this because on some machines ! 921: the new frame is not set up until the new function executes ! 922: some instructions. */ ! 923: ! 924: #define SAVED_PC_AFTER_CALL(frame) \ ! 925: read_register (15) ! 926: ! 927: /* This is the amount to subtract from u.u_ar0 ! 928: to get the offset in the core file of the register values. */ ! 929: ! 930: #define KERNEL_U_ADDR (0x20000000 - NBPG * (UPAGES)) ! 931: ! 932: /* Address of end of stack space. */ ! 933: ! 934: /* extra page is for the "red zone" */ ! 935: #define STACK_END_ADDR (0x20000000 - NBPG * (UPAGES+1)) ! 936: ! 937: /* Stack grows downward. */ ! 938: ! 939: #define INNER_THAN < ! 940: ! 941: /* Sequence of bytes for breakpoint instruction. */ ! 942: ! 943: #define BREAKPOINT {0xbd, 0x00} ! 944: ! 945: /* Amount PC must be decremented by after a breakpoint. ! 946: This is often the number of bytes in BREAKPOINT ! 947: but not always. */ ! 948: ! 949: #define DECR_PC_AFTER_BREAK 0 ! 950: ! 951: /* Nonzero if instruction at PC is a return instruction. */ ! 952: ! 953: #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) & 0x00ff == 0xc9) ! 954: ! 955: /* Return 1 if P points to an invalid floating point value. */ ! 956: ! 957: #define INVALID_FLOAT(p) 0 /* Just a first guess; not checked */ ! 958: ! 959: /* Say how long (ordinary) registers are. */ ! 960: ! 961: #define REGISTER_TYPE long ! 962: ! 963: /* Number of machine registers */ ! 964: ! 965: #define NUM_REGS 18 ! 966: ! 967: /* Initializer for an array of names of registers. ! 968: There should be NUM_REGS strings in this initializer. */ ! 969: ! 970: #define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "iar", "mq"} ! 971: ! 972: /* Register numbers of various important registers. ! 973: Note that some of these values are "real" register numbers, ! 974: and correspond to the general registers of the machine, ! 975: and some are "phony" register numbers which are too large ! 976: to be actual register numbers as far as the user is concerned ! 977: but do serve to get the desired values when passed to read_register. */ ! 978: ! 979: #define FP_REGNUM 13 /* Contains address of executing stack frame */ ! 980: #define SP_REGNUM 1 /* Contains address of top of stack */ ! 981: #define PS_REGNUM 17 /* Contains processor status */ ! 982: #define PC_REGNUM 16 /* Contains program counter */ ! 983: ! 984: #define REGISTER_U_ADDR(addr, blockend, regno) \ ! 985: { addr = blockend + regno * 4; } ! 986: ! 987: /* Total amount of space needed to store our copies of the machine's ! 988: register state, the array `registers'. */ ! 989: #define REGISTER_BYTES (NUM_REGS*4) ! 990: ! 991: /* Index within `registers' of the first byte of the space for ! 992: register N. */ ! 993: ! 994: #define REGISTER_BYTE(N) ((N) * 4) ! 995: ! 996: /* Number of bytes of storage in the actual machine representation ! 997: for register N. On the vax, all regs are 4 bytes. */ ! 998: ! 999: #define REGISTER_RAW_SIZE(N) 4 ! 1000: ! 1001: /* Number of bytes of storage in the program's representation ! 1002: for register N. On the vax, all regs are 4 bytes. */ ! 1003: ! 1004: #define REGISTER_VIRTUAL_SIZE(N) 4 ! 1005: ! 1006: /* Largest value REGISTER_RAW_SIZE can have. */ ! 1007: ! 1008: #define MAX_REGISTER_RAW_SIZE 4 ! 1009: ! 1010: /* Largest value REGISTER_VIRTUAL_SIZE can have. */ ! 1011: ! 1012: #define MAX_REGISTER_VIRTUAL_SIZE 4 ! 1013: ! 1014: /* Nonzero if register N requires conversion ! 1015: from raw format to virtual format. */ ! 1016: ! 1017: #define REGISTER_CONVERTIBLE(N) 0 ! 1018: ! 1019: /* Convert data from raw format for register REGNUM ! 1020: to virtual format for register REGNUM. */ ! 1021: ! 1022: #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \ ! 1023: bcopy ((FROM), (TO), 4); ! 1024: ! 1025: /* Convert data from virtual format for register REGNUM ! 1026: to raw format for register REGNUM. */ ! 1027: ! 1028: #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \ ! 1029: bcopy ((FROM), (TO), 4); ! 1030: ! 1031: /* Return the GDB type object for the "standard" data type ! 1032: of data in register N. */ ! 1033: ! 1034: #define REGISTER_VIRTUAL_TYPE(N) builtin_type_int ! 1035: ! 1036: /* Describe the pointer in each stack frame to the previous stack frame ! 1037: (its caller). */ ! 1038: ! 1039: /* FRAME_CHAIN takes a frame's nominal address ! 1040: and produces the frame's chain-pointer. ! 1041: ! 1042: FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address ! 1043: and produces the nominal address of the caller frame. ! 1044: ! 1045: However, if FRAME_CHAIN_VALID returns zero, ! 1046: it means the given frame is the outermost one and has no caller. ! 1047: In that case, FRAME_CHAIN_COMBINE is not used. */ ! 1048: ! 1049: /* In the case of the Sun, the frame's nominal address ! 1050: is the address of a 4-byte word containing the calling frame's address. */ ! 1051: ! 1052: #define FRAME_CHAIN(thisframe) (rt_prev_frame(thisframe)) ! 1053: ! 1054: #define FRAME_CHAIN_VALID(chain, thisframe) \ ! 1055: (chain >= 0x10000000 && chain < 0x20000000) ! 1056: ! 1057: #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain) ! 1058: ! 1059: /* Define other aspects of the stack frame. */ ! 1060: ! 1061: #define FRAME_SAVED_PC(frame) (rt_frame_reg(frame, 15)) ! 1062: ! 1063: #define FRAME_ARGS_ADDRESS(fi) (rt_frame_args(fi.frame)) ! 1064: ! 1065: #define FRAME_LOCALS_ADDRESS(fi) (fi.frame) ! 1066: ! 1067: /* Return number of args passed to a frame. ! 1068: Can return -1, meaning no way to tell. */ ! 1069: ! 1070: #define FRAME_NUM_ARGS(val, fi) \ ! 1071: {register struct rt_frame *tf; \ ! 1072: tf = get_cached_frame(fi.frame); \ ! 1073: val = -1; \ ! 1074: if (tf) val = tf->nParms;\ ! 1075: } ! 1076: ! 1077: /* Return number of bytes at start of arglist that are not really args. */ ! 1078: ! 1079: #define FRAME_ARGS_SKIP 0 ! 1080: ! 1081: /* Put here the code to store, into a struct frame_saved_regs, ! 1082: the addresses of the saved registers of frame described by FRAME_INFO. ! 1083: This includes special registers such as pc and fp saved in special ! 1084: ways in the stack frame. sp is even more special: ! 1085: the address we return for it IS the sp for the next frame. */ ! 1086: ! 1087: #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ ! 1088: { register int regnum; \ ! 1089: register struct rt_frame *tf; \ ! 1090: register CORE_ADDR next_addr; \ ! 1091: bzero (&(frame_saved_regs), sizeof (frame_saved_regs)); \ ! 1092: tf = get_cached_frame((frame_info).frame); \ ! 1093: if (tf) { \ ! 1094: for(regnum = tf->firstReg; regnum < 16; regnum++) { \ ! 1095: (frame_saved_regs).regs[regnum] = tf->firstRLoc+ 4*(regnum - tf->firstReg); \ ! 1096: } \ ! 1097: } \ ! 1098: } ! 1099: ! 1100: ! 1101: /* Things needed for making the inferior call functions. */ ! 1102: ! 1103: /* Push an empty stack frame, to record the current PC, etc. */ ! 1104: ! 1105: #define PUSH_DUMMY_FRAME \ ! 1106: { register CORE_ADDR sp = read_register (SP_REGNUM);\ ! 1107: register int regnum; \ ! 1108: sp = push_word (sp, read_register (PC_REGNUM)); \ ! 1109: for (regnum = 15; regnum >= 0; regnum--) \ ! 1110: sp = push_word (sp, read_register (regnum)); \ ! 1111: write_register (FP_REGNUM, sp+64); \ ! 1112: write_register (SP_REGNUM, sp); } ! 1113: ! 1114: /* discard special frame pushed by PUSH_DUMMY_FRAME */ ! 1115: #define POP_DUMMY_FRAME \ ! 1116: {register CORE_ADDR sp; \ ! 1117: register int regnum; \ ! 1118: sp = read_register(FP_REGNUM)-64; \ ! 1119: for(regnum = 0; regnum < 16;regnum++) { \ ! 1120: write_register(regnum, read_memory_integer(sp, 4)); \ ! 1121: sp += 4; \ ! 1122: } \ ! 1123: /* now get the pc */ \ ! 1124: write_register(PC_REGNUM, read_memory_integer(sp, 4)); \ ! 1125: sp += 4; \ ! 1126: } ! 1127: ! 1128: /* Discard from the stack the innermost frame, restoring all registers. */ ! 1129: /* THIS ROUTINE DOES NOT SET R1 (SP_REGNUM) CORRECTLY */ ! 1130: /* REALLY MUST CONSULT TRACE TBL TO FIND OUT FRAME SIZE */ ! 1131: #define POP_FRAME \ ! 1132: { register CORE_ADDR fp = read_register (FP_REGNUM); \ ! 1133: register int regnum; \ ! 1134: register struct rt_frame *tf; \ ! 1135: tf = (struct rt_frame *) get_cached_frame(fp); \ ! 1136: if (tf) { \ ! 1137: for(regnum = tf->firstReg; regnum < 16; regnum++) { \ ! 1138: write_register(regnum, \ ! 1139: read_memory_integer (tf->firstRLoc + 4*(regnum-tf->firstReg), 4) \ ! 1140: ); \ ! 1141: } \ ! 1142: write_register(PC_REGNUM, read_register(15)); \ ! 1143: write_register(SP_REGNUM, tf->firstRLoc + 4*(16-tf->firstReg) + 36); \ ! 1144: } \ ! 1145: } ! 1146: ! 1147: /* This sequence of words is the instructions ! 1148: ls r2,0(r1) 2 bytes pick up args ! 1149: ls r3,4(r1) 2 bytes pick up args ! 1150: ls r4,8(r1) 2 bytes pick up args ! 1151: ls r5,c(r1) 2 bytes pick up args ! 1152: cal r1,16(r1) 4 bytes fix up ap (==sp) ! 1153: cal16 r15,<low> 4 bytes do call ! 1154: oiu r15,<high>(r15) 4 ! 1155: lr r0,r15 2 ! 1156: ls r15,0(r15) 2 ! 1157: balr r15 2 ! 1158: bpt 2 get back to gdb ! 1159: <4 byte trace table> 4 ! 1160: ! 1161: This is 16 bytes. ! 1162: */ ! 1163: ! 1164: #define CALL_DUMMY {0x70217131, 0x72417351, 0xc8110010, 0xc2f06969, \ ! 1165: 0xc3ff6969, 0x60f070ff, 0xecffbd00, 0xdf7fdf00} ! 1166: ! 1167: #define CALL_DUMMY_LENGTH 32 ! 1168: ! 1169: #define CALL_DUMMY_START_OFFSET 0 ! 1170: ! 1171: /* Insert the specified number of args and function address ! 1172: into a call sequence of the above form stored at DUMMYNAME. */ ! 1173: ! 1174: #define FIX_CALL_DUMMY(dummyname, fun, nargs) \ ! 1175: { *((short *)(((char *)dummyname)+14)) = fun&0xffff; \ ! 1176: *((short *)(((char *)dummyname)+18)) = (fun>>16)&0xffff; \ ! 1177: } ! 1178: ! 1179: /* Interface definitions for kernel debugger KDB. */ ! 1180: ! 1181: /* Map machine fault codes into signal numbers. ! 1182: First subtract 0, divide by 4, then index in a table. ! 1183: Faults for which the entry in this table is 0 ! 1184: are not handled by KDB; the program's own trap handler ! 1185: gets to handle then. */ ! 1186: ! 1187: #define FAULT_CODE_ORIGIN 0 ! 1188: #define FAULT_CODE_UNITS 4 ! 1189: #define FAULT_TABLE \ ! 1190: { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ ! 1191: 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ ! 1192: 0, 0, 0, 0, 0, 0, 0, 0, \ ! 1193: SIGILL } ! 1194: ! 1195: /* Start running with a stack stretching from BEG to END. ! 1196: BEG and END should be symbols meaningful to the assembler. ! 1197: This is used only for kdb, which we do not support. */ ! 1198: ! 1199: #define INIT_STACK(beg, end) \ ! 1200: { } ! 1201: ! 1202: /* Push the frame pointer register on the stack. */ ! 1203: #define PUSH_FRAME_PTR \ ! 1204: { } ! 1205: ! 1206: /* Copy the top-of-stack to the frame pointer register. */ ! 1207: #define POP_FRAME_PTR \ ! 1208: { } ! 1209: ! 1210: /* After KDB is entered by a fault, push all registers ! 1211: that GDB thinks about (all NUM_REGS of them), ! 1212: so that they appear in order of ascending GDB register number. ! 1213: The fault code will be on the stack beyond the last register. */ ! 1214: ! 1215: #define PUSH_REGISTERS \ ! 1216: { } ! 1217: ! 1218: /* Assuming the registers (including processor status) have been ! 1219: pushed on the stack in order of ascending GDB register number, ! 1220: restore them and return to the address in the saved PC register. */ ! 1221: ! 1222: #define POP_REGISTERS \ ! 1223: { } ! 1224: ! 1225: Only in .: m-ibm032init.h ! 1226: ! 1227: /* This is how the size of an individual .o file's text segment ! 1228: is rounded on a sun. */ ! 1229: ! 1230: #define FILEADDR_ROUND(addr) ((addr + 3) & -4) ! 1231: ! 1232: diff -c ../../gnu/gdb/blockframe.c ./blockframe.c ! 1233: *** ../../gnu/gdb/blockframe.c Sat Apr 4 22:06:18 1987 ! 1234: --- ./blockframe.c Mon Apr 27 01:06:06 1987 ! 1235: *************** ! 1236: *** 53,62 **** ! 1237: } ! 1238: ! 1239: void ! 1240: ! set_current_frame (frame) ! 1241: FRAME frame; ! 1242: { ! 1243: current_frame = frame; ! 1244: } ! 1245: ! 1246: /* Return the frame that called FRAME. ! 1247: --- 53,67 ---- ! 1248: } ! 1249: ! 1250: void ! 1251: ! set_current_frame (frame, validp) ! 1252: FRAME frame; ! 1253: + int validp; ! 1254: { ! 1255: current_frame = frame; ! 1256: + #ifdef ibm032 ! 1257: + if (validp) ! 1258: + recache_frames(); ! 1259: + #endif ! 1260: } ! 1261: ! 1262: /* Return the frame that called FRAME. ! 1263: *************** ! 1264: *** 291,301 **** ! 1265: CORE_ADDR pc; ! 1266: { ! 1267: register int i; ! 1268: ! 1269: /* Note that the last thing in the vector is always _etext. */ ! 1270: for (i = 0; i < misc_function_count; i++) ! 1271: { ! 1272: ! if (pc < misc_function_vector[i].address) ! 1273: return i - 1; ! 1274: } ! 1275: return -1; ! 1276: --- 296,309 ---- ! 1277: CORE_ADDR pc; ! 1278: { ! 1279: register int i; ! 1280: + register long j; ! 1281: ! 1282: /* Note that the last thing in the vector is always _etext. */ ! 1283: for (i = 0; i < misc_function_count; i++) ! 1284: { ! 1285: ! if ((j = misc_function_vector[i].address) < 0) ! 1286: ! continue; ! 1287: ! if (pc < j) ! 1288: return i - 1; ! 1289: } ! 1290: return -1; ! 1291: *************** ! 1292: *** 325,333 **** ! 1293: --- 333,610 ---- ! 1294: } ! 1295: } ! 1296: ! 1297: + #ifdef ibm032 ! 1298: + /* RT frame format: ! 1299: + arg 3 these are not really here, but are in regs ! 1300: + arg 2 ! 1301: + arg 1 ! 1302: + arg 0 ! 1303: + resvd 20 bytes ! 1304: + rn to r15 saved regs ! 1305: + floating regs (at first assume 0 bytes, fix later) ! 1306: + locals ! 1307: + ! 1308: + N.B. r13 points 64 bytes below the end of the locals. ! 1309: + */ ! 1310: + ! 1311: + /* ! 1312: + * Routine for ibm032 stack trace. Called after a new frame has been set. Do an entire stack ! 1313: + * trace, and squirrel away the information. We need to do this since the ibm032 (rt) does ! 1314: + * not have enough info in a known place off of the frame ptr (r13) to do anything useful. ! 1315: + * Instead, one also requires the pc, and can then perform various operations to find ! 1316: + * out how that procedure built its frame, and thus, to decode it. However, since this is ! 1317: + * fairly slow, we only do it after a set_current_frame operation has been performed. ! 1318: + */ ! 1319: + ! 1320: + #define rtTTSize 50 ! 1321: + static struct rtTTCache { ! 1322: + CORE_ADDR lbound; /* lowest address so far known as using this trace table */ ! 1323: + CORE_ADDR ttaddr; /* address of the last '0xdf' in the trace table */ ! 1324: + char ttype; /* type of the trace table -- 0 == unused */ ! 1325: + } ttcache[rtTTSize]; ! 1326: + short ttptr = 0; ! 1327: + ! 1328: + #define rtSize 50 ! 1329: + static struct rt_frame rtFrames[rtSize]; ! 1330: + static int rtCount; ! 1331: + static CORE_ADDR rt_next_frame, rt_next_pc; ! 1332: + ! 1333: + static struct rtTTCache *ttfind (addr) ! 1334: + CORE_ADDR addr; { ! 1335: + register int i; ! 1336: + register struct rtTTCache *tp; ! 1337: + for(i=0,tp=ttcache;i<rtTTSize;i++,tp++) { ! 1338: + if (addr >= tp->lbound && addr <= tp->ttaddr) return tp; ! 1339: + } ! 1340: + return 0; ! 1341: + } ! 1342: + ! 1343: + static ttadd(lowaddr, ttaddr, type) ! 1344: + register CORE_ADDR lowaddr, ttaddr; ! 1345: + char type; { ! 1346: + register struct rtTTCache *tp; ! 1347: + if (tp = ttfind(ttaddr)) { ! 1348: + /* possibly increase the bound on this cache element */ ! 1349: + if (lowaddr < tp->lbound) tp->lbound = lowaddr; ! 1350: + } ! 1351: + else { ! 1352: + /* add a new element */ ! 1353: + tp = &ttcache[ttptr++]; ! 1354: + tp->lbound = lowaddr; ! 1355: + tp->ttaddr = ttaddr; ! 1356: + tp->ttype = type; ! 1357: + if (ttptr >= rtTTSize) ttptr = 0; /* keep it in bounds */ ! 1358: + } ! 1359: + } ! 1360: + ! 1361: + /* this routine scans for a trace table, and returns 4 bytes: 0 0 <n params> <first saved reg> */ ! 1362: + rt_num_regs (pc, tf) ! 1363: + register struct rt_frame *tf; ! 1364: + CORE_ADDR pc; { ! 1365: + register state = 0; ! 1366: + register long newpc = pc; ! 1367: + register int tc; ! 1368: + short nparms, firstreg; ! 1369: + short ttype; ! 1370: + short optx; ! 1371: + long offset; ! 1372: + char offtype; ! 1373: + struct rtTTCache *tp; ! 1374: + CORE_ADDR frame; ! 1375: + ! 1376: + frame = tf->frame; ! 1377: + /* first see if it is in our ttcache */ ! 1378: + if (tp = ttfind(pc)) { ! 1379: + state = 3; ! 1380: + ttype = tp->ttype; ! 1381: + newpc = tp->ttaddr; ! 1382: + } ! 1383: + else { ! 1384: + /* state machine to look for 'df' 'xx' 'df' */ ! 1385: + while (1) { ! 1386: + tc = read_memory_integer(newpc, 2); ! 1387: + if (state == 0 && (tc&0xff00) == 0xdf00) { ! 1388: + state = 1; ! 1389: + ttype = tc & 0xff; ! 1390: + } ! 1391: + else if (state == 1 && (tc & 0xff00) == 0xdf00) { ! 1392: + state = 3; ! 1393: + break; ! 1394: + } ! 1395: + else state = 0; ! 1396: + if (newpc - pc > 20000) break; ! 1397: + newpc += 2; ! 1398: + } ! 1399: + if (state == 3) ttadd(pc, newpc, ttype); /* add to cache */ ! 1400: + } ! 1401: + if (state != 3) { ! 1402: + printf("No trace table for pc %x, making one up.\n", pc); ! 1403: + tf->nParms = 0; ! 1404: + tf->firstReg = 12; ! 1405: + tf->firstRLoc = frame+64; ! 1406: + rt_next_pc = read_memory_integer(frame+64+12, 4); ! 1407: + rt_next_frame = read_memory_integer(frame+64+4, 4); ! 1408: + return 0; ! 1409: + } ! 1410: + /* otherwise newpc is pointing at the last 'df' in the trace table */ ! 1411: + else if (ttype == 3) { ! 1412: + /* funny trace table found by OBSERVATION (not doc) to be in program prolog */ ! 1413: + return -1; /* special value checked by recache_frames */ ! 1414: + } ! 1415: + else if (ttype == 2) { ! 1416: + /* assembly: no registers were saved */ ! 1417: + tf->nParms = 0; ! 1418: + tf->firstReg = 16; ! 1419: + tf->firstRLoc = 0; ! 1420: + rt_next_pc = read_register(15); /* where we go back to */ ! 1421: + rt_next_frame = frame; ! 1422: + tf->frame -= 100; /* hack to eliminate duplicate tags */ ! 1423: + return 0; ! 1424: + } ! 1425: + else if (ttype == 0x7f) { ! 1426: + /* special machine state frame saved by STACK_DUMMY */ ! 1427: + tf->nParms = 0; ! 1428: + tf->firstReg = 16; ! 1429: + tf->firstRLoc = 0; ! 1430: + rt_next_pc = read_memory_integer(frame + 64 - 64, 4); ! 1431: + rt_next_frame = read_memory_integer(frame -64 + 13*4, 4); ! 1432: + return 0; ! 1433: + } ! 1434: + else { ! 1435: + /* C program, I hope */ ! 1436: + nparms = (read_memory_integer(newpc+2, 1) >> 4) & 0x0f; ! 1437: + firstreg = ((tc=read_memory_integer(newpc+1, 1)) >> 4) & 0x0f; ! 1438: + optx = ((tc&4)? 1 : 0); /* flags says if floating registers described */ ! 1439: + offtype = read_memory_integer(newpc+optx+3, 1) & 0xff; ! 1440: + if ((offtype & 0xc0) == 0) { ! 1441: + /* 6 bits of local offset */ ! 1442: + offset = offtype & 0x3f; ! 1443: + } ! 1444: + else if ((offtype & 0xc0) == 0x40) { ! 1445: + /* 14 bits of local offset */ ! 1446: + offset = (offtype & 0x3f) << 8; ! 1447: + offset += (read_memory_integer(newpc+optx+4, 1) & 0xff); ! 1448: + } ! 1449: + else if ((offtype & 0xc0) == 0x80) { ! 1450: + /* 22 bits of local offset */ ! 1451: + offset = (offtype & 0x3f) << 8; ! 1452: + offset += (read_memory_integer(newpc+optx+4, 1) & 0xff); ! 1453: + offset <<= 8; ! 1454: + offset += (read_memory_integer(newpc+optx+5, 1) & 0xff); ! 1455: + } ! 1456: + else if ((offtype & 0xc0) == 0xc0) { ! 1457: + /* 30 bits of local offset */ ! 1458: + offset = (offtype & 0x3f) << 8; ! 1459: + offset += (read_memory_integer(newpc+optx+4, 1) & 0xff); ! 1460: + offset <<= 8; ! 1461: + offset += (read_memory_integer(newpc+optx+5, 1) & 0xff); ! 1462: + offset <<= 8; ! 1463: + offset += (read_memory_integer(newpc+optx+6, 1) & 0xff); ! 1464: + } ! 1465: + offset <<= 2; ! 1466: + tf->nParms = nparms; ! 1467: + tf->firstReg = firstreg; ! 1468: + tf->firstRLoc = frame /* initial frame location */ ! 1469: + + offset /* to top of frame */ ! 1470: + - 36 /* pascal static link, incomings args and linkage */ ! 1471: + - (4*(16-firstreg)); /* space used by general regs */ ! 1472: + rt_next_pc = read_memory_integer(tf->firstRLoc + 4*(15-firstreg), 4); ! 1473: + rt_next_frame = read_memory_integer(tf->firstRLoc + 4*(13-firstreg), 4); ! 1474: + return 0; ! 1475: + } ! 1476: + } ! 1477: + ! 1478: + recache_frames() { ! 1479: + register long i, j; ! 1480: + long pc; ! 1481: + CORE_ADDR curfp; ! 1482: + struct rt_frame *tf; ! 1483: + ! 1484: + pc = read_pc(); ! 1485: + curfp = current_frame; ! 1486: + rtCount = 0; ! 1487: + /* these next special cases can only occur with frame #0; others can't make calls ! 1488: + in these intermediate states. ! 1489: + */ ! 1490: + /* if pc points at br or brx, we're doing a return, so set the pc to the target */ ! 1491: + i=read_memory_integer(pc, 2); ! 1492: + if ((i & 0xfe00) == 0xe800) { ! 1493: + /* we're looking at a br or brx instruction */ ! 1494: + pc = read_register(i&0x0f); ! 1495: + } ! 1496: + /* also, if pc points at d9xx or c111 we're in the middle of a frame push, and should ! 1497: + use r15 for the pc. ! 1498: + */ ! 1499: + if ((i & 0xff00) == 0xd900 || (i & 0xffff) == 0xc111) { ! 1500: + pc = read_register(15); ! 1501: + } ! 1502: + while (1) { ! 1503: + if (curfp <= 0x10000000 || curfp >= 0x20000000) break; ! 1504: + if (pc > 0x20000000) break; ! 1505: + /* otherwise try to add a new frame structure */ ! 1506: + if (rtCount >= rtTTSize) break; ! 1507: + tf = &rtFrames[rtCount++]; ! 1508: + tf->frame = curfp; ! 1509: + tf->pc = pc; ! 1510: + i = rt_num_regs(pc, tf); ! 1511: + if (i<0) { /* exceptional values */ ! 1512: + rtCount--; /* last frame was bogus */ ! 1513: + break; ! 1514: + } ! 1515: + /* now setup for next iteration */ ! 1516: + pc = rt_next_pc; ! 1517: + curfp = rt_next_frame; ! 1518: + } ! 1519: + } ! 1520: + ! 1521: + struct rt_frame *get_cached_frame(aframe) ! 1522: + CORE_ADDR aframe; { ! 1523: + register int i; ! 1524: + for(i=0;i<rtCount;i++) { ! 1525: + if (rtFrames[i].frame == aframe) return &rtFrames[i]; ! 1526: + } ! 1527: + return 0; ! 1528: + } ! 1529: + ! 1530: + long rt_prev_frame(frame) ! 1531: + register CORE_ADDR frame; { ! 1532: + register int i; ! 1533: + for(i=0;i<rtCount-1;i++) { ! 1534: + if (rtFrames[i].frame == frame) return rtFrames[i+1].frame; ! 1535: + } ! 1536: + return 0; ! 1537: + } ! 1538: + ! 1539: + long rt_frame_reg(frame, reg) ! 1540: + CORE_ADDR frame; ! 1541: + register long reg; { ! 1542: + register struct rt_frame *tf; ! 1543: + tf = get_cached_frame(frame); ! 1544: + if (tf == 0) return 0; ! 1545: + if (tf->firstReg > reg) return 0; /* didn't save this one! */ ! 1546: + return read_memory_integer(tf->firstRLoc + 4 * (reg - tf->firstReg), 4); ! 1547: + } ! 1548: + ! 1549: + long rt_frame_args(frame) ! 1550: + CORE_ADDR frame; { ! 1551: + register struct rt_frame *tf; ! 1552: + tf = get_cached_frame(frame); ! 1553: + if (!tf) return 0; ! 1554: + return tf->firstRLoc + 20 + 4*(16 - tf->firstReg); ! 1555: + } ! 1556: + #endif ! 1557: + ! 1558: + blockinitialize() {initialize();} ! 1559: + ! 1560: static ! 1561: initialize () ! 1562: { ! 1563: + #ifdef ibm032 ! 1564: + #ifdef CAMPHOR ! 1565: + add_com ("recache-frames", class_stack, recache_frames, ! 1566: + "Tell debugger to recompute PC/RT stack frame cache\n"); ! 1567: + #endif ! 1568: + #endif ! 1569: } ! 1570: ! 1571: END_FILE ! 1572: diff -c ../../gnu/gdb/breakpoint.c ./breakpoint.c ! 1573: *** ../../gnu/gdb/breakpoint.c Sat Apr 4 22:22:44 1987 ! 1574: --- ./breakpoint.c Sun Apr 26 23:02:20 1987 ! 1575: *************** ! 1576: *** 94,99 **** ! 1577: --- 94,100 ---- ! 1578: of last breakpoint hit. */ ! 1579: ! 1580: struct command_line *breakpoint_commands; ! 1581: + char new_breakpoint_commands = 0; /* Zalman Stern, ITC 1/12/1987 */ ! 1582: ! 1583: START_FILE ! 1584: ! 1585: *************** ! 1586: *** 203,210 **** ! 1587: { ! 1588: execute_command (breakpoint_commands->line, 0); ! 1589: /* If command was "cont", breakpoint_commands is 0 now. */ ! 1590: ! if (breakpoint_commands) ! 1591: breakpoint_commands = breakpoint_commands->next; ! 1592: } ! 1593: clear_momentary_breakpoints (); ! 1594: } ! 1595: --- 204,213 ---- ! 1596: { ! 1597: execute_command (breakpoint_commands->line, 0); ! 1598: /* If command was "cont", breakpoint_commands is 0 now. */ ! 1599: ! if (breakpoint_commands && !new_breakpoint_commands) /* Zalman Stern, ITC 1/12/1987 */ ! 1600: breakpoint_commands = breakpoint_commands->next; ! 1601: + else /* Zalman Stern, ITC 1/12/1987 */ ! 1602: + new_breakpoint_commands = 0; /* Zalman Stern, ITC 1/12/1987 */ ! 1603: } ! 1604: clear_momentary_breakpoints (); ! 1605: } ! 1606: *************** ! 1607: *** 215,220 **** ! 1608: --- 218,225 ---- ! 1609: void ! 1610: clear_breakpoint_commands () ! 1611: { ! 1612: + if (breakpoint_commands != 0) /* Zalman Stern, ITC 1/12/1987 */ ! 1613: + new_breakpoint_commands = 1; /* Zalman Stern, ITC 1/12/1987 */ ! 1614: breakpoint_commands = 0; ! 1615: breakpoint_auto_delete (0); ! 1616: } ! 1617: *************** ! 1618: *** 921,926 **** ! 1619: --- 926,933 ---- ! 1620: struct cmd_list_element *enablelist; ! 1621: ! 1622: extern struct cmd_list_element *cmdlist; ! 1623: + ! 1624: + breakinitialize() {initialize();} ! 1625: ! 1626: static ! 1627: initialize () ! 1628: diff -c ../../gnu/gdb/command.c ./command.c ! 1629: *** ../../gnu/gdb/command.c Sat Apr 4 22:24:07 1987 ! 1630: --- ./command.c Sat Apr 25 17:18:15 1987 ! 1631: *************** ! 1632: *** 94,100 **** ! 1633: You are forbidden to forbid anyone else to use, share and improve ! 1634: what you give them. Help stamp out software-hoarding! */ ! 1635: ! 1636: - ! 1637: #include "command.h" ! 1638: #include <stdio.h> ! 1639: ! 1640: --- 94,99 ---- ! 1641: *************** ! 1642: *** 388,394 **** ! 1643: { ! 1644: if (nfound > 1 && allow_unknown >= 0) ! 1645: { ! 1646: ! *p = 0; ! 1647: ambbuf[0] = 0; ! 1648: for (c = list; c; c = c->next) ! 1649: if (!strncmp (*line, c->name, p - *line)) ! 1650: --- 387,393 ---- ! 1651: { ! 1652: if (nfound > 1 && allow_unknown >= 0) ! 1653: { ! 1654: ! *p = 0; ! 1655: ambbuf[0] = 0; ! 1656: for (c = list; c; c = c->next) ! 1657: if (!strncmp (*line, c->name, p - *line)) ! 1658: diff -c ../../gnu/gdb/core.c ./core.c ! 1659: *** ../../gnu/gdb/core.c Sat Apr 4 22:27:23 1987 ! 1660: --- ./core.c Mon Apr 27 13:20:47 1987 ! 1661: *************** ! 1662: *** 163,172 **** ! 1663: int reg_offset; ! 1664: ! 1665: /* 4.2bsd-style core dump */ ! 1666: val = myread (corechan, &u, sizeof u); ! 1667: if (val < 0) ! 1668: ! perror_with_name (filename); ! 1669: data_start = exec_data_start; ! 1670: data_end = data_start + NBPG * u.u_dsize; ! 1671: stack_start = stack_end - NBPG * u.u_ssize; ! 1672: data_offset = NBPG * UPAGES; ! 1673: --- 163,180 ---- ! 1674: int reg_offset; ! 1675: ! 1676: /* 4.2bsd-style core dump */ ! 1677: + #ifdef ibm032 ! 1678: + /* on ibm032, uarea is at the far end of the u pages */ ! 1679: + lseek(corechan, UPAGES*NBPG - sizeof(u), 0); ! 1680: + #endif ! 1681: val = myread (corechan, &u, sizeof u); ! 1682: if (val < 0) ! 1683: ! perror_with_name (execfile); ! 1684: ! #ifdef ibm032 ! 1685: ! data_start = 0x10000000; ! 1686: ! #else ! 1687: data_start = exec_data_start; ! 1688: + #endif ! 1689: data_end = data_start + NBPG * u.u_dsize; ! 1690: stack_start = stack_end - NBPG * u.u_ssize; ! 1691: data_offset = NBPG * UPAGES; ! 1692: *************** ! 1693: *** 208,214 **** ! 1694: corefile = concat (dirname, "/", filename); ! 1695: } ! 1696: ! 1697: ! set_current_frame (read_register (FP_REGNUM)); ! 1698: select_frame (get_current_frame (), 0); ! 1699: validate_files (); ! 1700: } ! 1701: --- 216,222 ---- ! 1702: corefile = concat (dirname, "/", filename); ! 1703: } ! 1704: ! 1705: ! set_current_frame (read_register (FP_REGNUM), 1); ! 1706: select_frame (get_current_frame (), 0); ! 1707: validate_files (); ! 1708: } ! 1709: *************** ! 1710: *** 523,528 **** ! 1711: --- 531,539 ---- ! 1712: ! 1713: #endif /* not NEW_SUN_CORE */ ! 1714: ! 1715: + ! 1716: + coreinitialize() {initialize();} ! 1717: + ! 1718: static ! 1719: initialize () ! 1720: { ! 1721: diff -c ../../gnu/gdb/dbxread.c ./dbxread.c ! 1722: *** ../../gnu/gdb/dbxread.c Sat Apr 4 22:29:54 1987 ! 1723: --- ./dbxread.c Fri May 15 15:52:24 1987 ! 1724: *************** ! 1725: *** 28,33 **** ! 1726: --- 28,36 ---- ! 1727: #include "initialize.h" ! 1728: #include "symtab.h" ! 1729: #include "param.h" ! 1730: + #ifdef CAMPHOR ! 1731: + #include "value.h" ! 1732: + #endif ! 1733: ! 1734: static void add_symbol_to_list (); ! 1735: static void read_dbx_symtab (); ! 1736: *************** ! 1737: *** 89,94 **** ! 1738: --- 92,109 ---- ! 1739: int prev_line_number; ! 1740: }; ! 1741: ! 1742: + /* When dealing with dynamically loaded objects, the symbol table in the sym file ! 1743: + does not match where we actually load the files. Thus, gdb has to relocate those ! 1744: + symbols during dbxread. This is only used by the camphor support code, and ! 1745: + probably should be under an ifdef camphor. */ ! 1746: + ! 1747: + struct dlreloc ! 1748: + { ! 1749: + long text; ! 1750: + long data; ! 1751: + long bss; ! 1752: + } dlreloc; ! 1753: + ! 1754: static struct subfile *subfiles; ! 1755: ! 1756: static struct subfile *current_subfile; ! 1757: *************** ! 1758: *** 1015,1020 **** ! 1759: --- 1030,1037 ---- ! 1760: register int i, nbl; ! 1761: register struct blockvector *bv; ! 1762: register struct block *b; ! 1763: + int j; ! 1764: + struct symbol *ts1, *ts2; ! 1765: ! 1766: for (s = symtab_list; s; s = s->next) ! 1767: { ! 1768: *************** ! 1769: *** 1025,1034 **** ! 1770: --- 1042,1238 ---- ! 1771: b = BLOCKVECTOR_BLOCK (bv, i); ! 1772: qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b), ! 1773: sizeof (struct symbol *), compare_symbols); ! 1774: + /* Register parms have two decls, but the register one is the only one of interest */ ! 1775: + /* So, trash the name of the bad one, since binary srch could get either. Yucko. */ ! 1776: + /* doing name this way enables symbol freeing code to keep working */ ! 1777: + for(j=1;j<BLOCK_NSYMS(b);j++) ! 1778: + { ! 1779: + ts1 = BLOCK_SYM(b,j-1); ! 1780: + ts2 = BLOCK_SYM(b, j); ! 1781: + if (SYMBOL_NAMESPACE(ts1) == VAR_NAMESPACE ! 1782: + && SYMBOL_NAMESPACE(ts2) == VAR_NAMESPACE ! 1783: + && strcmp(SYMBOL_NAME(ts1), SYMBOL_NAME(ts2)) == 0) ! 1784: + {if (SYMBOL_CLASS(ts1) == LOC_REGISTER) ! 1785: + {SYMBOL_CLASS(ts2) = LOC_REGISTER; ! 1786: + SYMBOL_TYPE(ts2) = SYMBOL_TYPE(ts1); ! 1787: + SYMBOL_VALUE(ts2) = SYMBOL_VALUE(ts1); ! 1788: + } ! 1789: + else if (SYMBOL_CLASS(ts2) == LOC_REGISTER ) ! 1790: + {SYMBOL_CLASS(ts1) = LOC_REGISTER; ! 1791: + SYMBOL_TYPE(ts1) = SYMBOL_TYPE(ts2); ! 1792: + SYMBOL_VALUE(ts1) = SYMBOL_VALUE(ts2); ! 1793: + } ! 1794: + #ifdef notdef ! 1795: + else printf("Check out def of symbol %s\n", SYMBOL_NAME(ts1)); ! 1796: + #endif ! 1797: + } ! 1798: + } ! 1799: } ! 1800: } ! 1801: } ! 1802: ! 1803: + ! 1804: + #ifdef CAMPHOR ! 1805: + set_rel_command(exp) ! 1806: + char *exp; ! 1807: + { ! 1808: + struct expression *expr = (struct expression *) parse_c_expression (exp); ! 1809: + register value val; ! 1810: + register long temp; ! 1811: + register struct cleanup *old_chain ! 1812: + = make_cleanup (free_current_contents, &expr); ! 1813: + val = evaluate_expression (expr); ! 1814: + temp = value_as_long (val); ! 1815: + dlreloc.text = dlreloc.data = dlreloc.bss = temp; ! 1816: + printf("Relocation for all segs set to %x.\n", temp); ! 1817: + do_cleanups (old_chain); ! 1818: + } ! 1819: + ! 1820: + void ! 1821: + add_file_command (name) ! 1822: + char *name; ! 1823: + { ! 1824: + register int desc; ! 1825: + struct exec hdr; ! 1826: + struct nlist *nlist; ! 1827: + char *stringtab; ! 1828: + long buffer; ! 1829: + register int val; ! 1830: + extern void close (); ! 1831: + struct cleanup *old_chain; ! 1832: + int in_this_dir = 1; ! 1833: + struct symtab *symtab_temp; ! 1834: + ! 1835: + dont_repeat (); ! 1836: + ! 1837: + if (name == 0) ! 1838: + error_no_arg ("file to add symbols from"); ! 1839: + ! 1840: + if (symtab_list && !query ("Add more symbols from \"%s\"? ", name)) ! 1841: + error ("Not confirmed."); ! 1842: + ! 1843: + if (symfile) ! 1844: + free (symfile); ! 1845: + symfile = 0; ! 1846: + ! 1847: + desc = open (name, 0); ! 1848: + if (desc < 0) ! 1849: + { ! 1850: + if ((desc = openp (getenv ("BZPATH"), name, 0, 0)) < 0) ! 1851: + if ((desc = openp (getenv ("CLASSPATH"), name, 0, 0)) < 0) ! 1852: + desc = openp (getenv ("PATH"), name, 0, 0); ! 1853: + ! 1854: + in_this_dir = 0; ! 1855: + } ! 1856: + if (desc < 0) ! 1857: + perror_with_name (name); ! 1858: + ! 1859: + old_chain = make_cleanup (close, desc); ! 1860: + ! 1861: + val = myread (desc, &hdr, sizeof hdr); ! 1862: + if (val < 0) ! 1863: + perror_with_name (name); ! 1864: + ! 1865: + if (N_BADMAG (hdr)) ! 1866: + error ("File \"%s\" not in executable format.", name); ! 1867: + ! 1868: + if (hdr.a_syms == 0) ! 1869: + { ! 1870: + free_all_symtabs (); /* check this */ ! 1871: + return; ! 1872: + } ! 1873: + ! 1874: + /* Now read the string table, all at once. */ ! 1875: + val = lseek (desc, N_SYMOFF (hdr) + hdr.a_syms, 0); ! 1876: + if (val < 0) ! 1877: + perror_with_name (name); ! 1878: + val = myread (desc, &buffer, sizeof buffer); ! 1879: + if (val < 0) ! 1880: + perror_with_name (name); ! 1881: + stringtab = (char *) alloca (buffer); ! 1882: + bcopy (&buffer, stringtab, sizeof buffer); ! 1883: + val = myread (desc, stringtab + sizeof buffer, buffer - sizeof buffer); ! 1884: + if (val < 0) ! 1885: + perror_with_name (name); ! 1886: + ! 1887: + #ifdef READ_GDB_SYMSEGS ! 1888: + /* That puts us at the symsegs. Read them. */ ! 1889: + symseg_chain = read_symsegs (desc, name); ! 1890: + hash_symsegs (); ! 1891: + #else ! 1892: + /* Where people are using the 4.2 ld program, must not check for ! 1893: + symsegs, because that ld puts randonm garbage at the end of ! 1894: + the output file and that would trigger an error message. */ ! 1895: + symseg_chain = 0; ! 1896: + #endif ! 1897: + ! 1898: + /* Position to read the symbol table. Do not read it all at once. */ ! 1899: + val = lseek (desc, N_SYMOFF (hdr), 0); ! 1900: + if (val < 0) ! 1901: + perror_with_name (name); ! 1902: + ! 1903: + printf ("Reading symbol data from %s...", name); ! 1904: + fflush (stdout); ! 1905: + ! 1906: + init_misc_functions (); ! 1907: + make_cleanup (discard_misc_bunches, 0); ! 1908: + init_header_files (); ! 1909: + make_cleanup (free_header_files, 0); ! 1910: + ! 1911: + /* Remember symtab_list to check if the added file had any dbx info in it. */ ! 1912: + symtab_temp = symtab_list; ! 1913: + ! 1914: + /* Now that the symbol table data of the executable file are all in core, ! 1915: + process them and define symbols accordingly. Closes desc. */ ! 1916: + ! 1917: + read_dbx_symtab (desc, stringtab, hdr.a_syms / sizeof (struct nlist)); ! 1918: + ! 1919: + if (symtab_list == symtab_temp) { ! 1920: + printf("\n%s not compiled with -g, debugging posibilities are limited.\n", name); ! 1921: + fflush(stdout); ! 1922: + } ! 1923: + else { ! 1924: + ! 1925: + /* Sort symbols alphabetically within each block. */ ! 1926: + ! 1927: + sort_syms (); ! 1928: + ! 1929: + /* Go over the misc functions and install them in vector. */ ! 1930: + ! 1931: + condense_misc_bunches (); ! 1932: + ! 1933: + /* Make a default for file to list. */ ! 1934: + ! 1935: + select_source_symtab (symtab_list); ! 1936: + } ! 1937: + ! 1938: + do_cleanups (old_chain); ! 1939: + ! 1940: + /* Free the symtabs made by read_symsegs, but not their contents, ! 1941: + which have been copied into symtabs on symtab_list. */ ! 1942: + while (symseg_chain) ! 1943: + { ! 1944: + register struct symtab *s = symseg_chain->next; ! 1945: + free (symseg_chain); ! 1946: + symseg_chain = s; ! 1947: + } ! 1948: + ! 1949: + if (in_this_dir && name[0] != '/') ! 1950: + { ! 1951: + char dirname[MAXPATHLEN]; ! 1952: + ! 1953: + getwd (dirname); ! 1954: + symfile = concat (dirname, "/", ! 1955: + savestring (name, strlen (name))); ! 1956: + } ! 1957: + else ! 1958: + symfile = savestring (name, strlen (name)); ! 1959: + ! 1960: + printf ("done.\n"); ! 1961: + fflush (stdout); ! 1962: + } ! 1963: + #endif ! 1964: + ! 1965: /* This is the symbol-file command. Read the file, analyze its symbols, ! 1966: and add a struct symtab to symtab_list. */ ! 1967: ! 1968: *************** ! 1969: *** 1047,1052 **** ! 1970: --- 1251,1263 ---- ! 1971: ! 1972: dont_repeat (); ! 1973: ! 1974: + #ifdef CAMPHOR ! 1975: + /* this command does not deal with automatically relocated stuff */ ! 1976: + dlreloc.text = 0; ! 1977: + dlreloc.data = 0; ! 1978: + dlreloc.bss = 0; ! 1979: + #endif ! 1980: + ! 1981: if (name == 0) ! 1982: error_no_arg ("file to read symbols from"); ! 1983: ! 1984: *************** ! 1985: *** 1130,1151 **** ! 1986: ! 1987: read_dbx_symtab (desc, stringtab, hdr.a_syms / sizeof (struct nlist)); ! 1988: ! 1989: /* Sort symbols alphabetically within each block. */ ! 1990: ! 1991: ! sort_syms (); ! 1992: ! 1993: /* Go over the misc functions and install them in vector. */ ! 1994: ! 1995: ! condense_misc_bunches (); ! 1996: ! 1997: /* Don't allow char * to have a typename (else would get caddr_t.) */ ! 1998: ! 1999: ! TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0; ! 2000: ! 2001: /* Make a default for file to list. */ ! 2002: ! 2003: ! select_source_symtab (symtab_list); ! 2004: ! 2005: symfile = savestring (name, strlen (name)); ! 2006: ! 2007: do_cleanups (old_chain); ! 2008: --- 1341,1372 ---- ! 2009: ! 2010: read_dbx_symtab (desc, stringtab, hdr.a_syms / sizeof (struct nlist)); ! 2011: ! 2012: + /* Check to make sure file was compiled with -g. */ ! 2013: + ! 2014: + if (symtab_list == NULL) { ! 2015: + printf("\n%s not compiled with -g, debugging posibilities are limited.\n", name); ! 2016: + fflush(stdout); ! 2017: + } ! 2018: + else { ! 2019: + ! 2020: /* Sort symbols alphabetically within each block. */ ! 2021: ! 2022: ! sort_syms (); ! 2023: ! 2024: /* Go over the misc functions and install them in vector. */ ! 2025: ! 2026: ! condense_misc_bunches (); ! 2027: ! 2028: /* Don't allow char * to have a typename (else would get caddr_t.) */ ! 2029: ! 2030: ! TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0; ! 2031: ! 2032: /* Make a default for file to list. */ ! 2033: ! 2034: ! select_source_symtab (symtab_list); ! 2035: ! 2036: + } ! 2037: + ! 2038: symfile = savestring (name, strlen (name)); ! 2039: ! 2040: do_cleanups (old_chain); ! 2041: *************** ! 2042: *** 1204,1209 **** ! 2043: --- 1425,1440 ---- ! 2044: { ! 2045: fread (&buf, sizeof buf, 1, stream); ! 2046: namestring = buf.n_un.n_strx ? buf.n_un.n_strx + stringtab : 0; ! 2047: + #ifdef CAMPHOR ! 2048: + if ((buf.n_type & N_TYPE) == N_UNDF) { ! 2049: + /* don't screw around with undefined symbols */ ! 2050: + } ! 2051: + else { ! 2052: + if ((buf.n_type & N_TYPE) == N_TEXT) buf.n_value += dlreloc.text; ! 2053: + else if ((buf.n_type & N_TYPE) == N_DATA) buf.n_value += dlreloc.data; ! 2054: + else if ((buf.n_type & N_TYPE) == N_BSS) buf.n_value += dlreloc.bss; ! 2055: + } ! 2056: + #endif ! 2057: if (buf.n_type & N_STAB) ! 2058: process_one_symbol (buf.n_type, buf.n_desc, ! 2059: buf.n_value, namestring); ! 2060: *************** ! 2061: *** 1356,1361 **** ! 2062: --- 1587,1596 ---- ! 2063: } ! 2064: } ! 2065: ! 2066: + #ifdef ibm032 ! 2067: + static char hcState; /* two different, incompatible compilers for the RT */ ! 2068: + #endif ! 2069: + ! 2070: static void ! 2071: process_one_symbol (type, desc, value, name) ! 2072: int type, desc; ! 2073: *************** ! 2074: *** 1363,1369 **** ! 2075: char *name; ! 2076: { ! 2077: register struct context_stack *new; ! 2078: ! ! 2079: /* Something is wrong if we see real data before ! 2080: seeing a source file name. */ ! 2081: ! 2082: --- 1598,1633 ---- ! 2083: char *name; ! 2084: { ! 2085: register struct context_stack *new; ! 2086: ! char tname[256]; ! 2087: ! /* Now, there are two compilers for the RT, and they are seriously incompatible. ! 2088: ! pcc is just like normal c compilers: stabs for a block occur before the LBRAC ! 2089: ! stab for that same block. Thus this code squirrels them away in the context ! 2090: ! and when the RBRAC is hit, restores local_symbols as of the time the LBRAC ! 2091: ! was encountered, and adds these symbosl to the block that just ended. ! 2092: ! ! 2093: ! However, with the HC compiler, those symbols occur *after* the LBRAC symbol ! 2094: ! declaring the block's start. Totally incompatible, of course. One expects no ! 2095: ! less from IBM. For hc compiled programs, we use the symbols in local_symbols ! 2096: ! *before* the RBRAC command pops the context stack. ! 2097: ! ! 2098: ! Amazingly enough, when we complained to IBM/Palo Alto about this incompatibility, ! 2099: ! they claimed that Mark Linton (original author of dbx) liked the new way better, and ! 2100: ! that he didn't even know that pcc used a different order. Sorta explains some things ! 2101: ! about dbx, n'est-ce pas? Furthermore, of course, IBM doesn't want to change ! 2102: ! either pcc or hc. ! 2103: ! ! 2104: ! Anyway, hc and pcc compiled .o files often co-exist in programs. How do we ! 2105: ! tell which is which? Stupid heuristic which doesn't work with programs ! 2106: ! with no top-level locals or parameters: after seeing a function's start, if we see ! 2107: ! an LBRAC before seeing a variable, then we are using hc, otherwise it is pcc. ! 2108: ! Stupid heuristics are better than none, so we use it. ! 2109: ! ! 2110: ! The variable hcState is used to keep track of this crap. ! 2111: ! 0 ==> saw function symbol ! 2112: ! 1 ==> saw lbrac in state 0, this is hc. ! 2113: ! 2 ==> saw symbol in state 0, this is pcc. ! 2114: ! */ ! 2115: ! ! 2116: /* Something is wrong if we see real data before ! 2117: seeing a source file name. */ ! 2118: ! 2119: *************** ! 2120: *** 1384,1389 **** ! 2121: --- 1648,1656 ---- ! 2122: also the end of the lexical context for the previous function. */ ! 2123: new = context_stack; ! 2124: within_function = 1; ! 2125: + #ifdef ibm032 ! 2126: + hcState = 0; ! 2127: + #endif ! 2128: if (new) ! 2129: { ! 2130: /* Make a block for the local symbols within. */ ! 2131: *************** ! 2132: *** 1400,1406 **** ! 2133: --- 1667,1679 ---- ! 2134: new->locals = 0; ! 2135: new->old_blocks = pending_blocks; ! 2136: new->start_addr = value; ! 2137: + #ifdef ibm032 ! 2138: + strcpy(tname, "."); ! 2139: + strcat(tname, name); ! 2140: + new->name = define_symbol(value, tname); ! 2141: + #else ! 2142: new->name = define_symbol (value, name); ! 2143: + #endif ! 2144: local_symbols = 0; ! 2145: break; ! 2146: ! 2147: *************** ! 2148: *** 1407,1412 **** ! 2149: --- 1680,1688 ---- ! 2150: case N_LBRAC: ! 2151: /* This "symbol" just indicates the start of an inner lexical ! 2152: context within a function. */ ! 2153: + #ifdef ibm032 ! 2154: + if (hcState == 0) hcState = 1; ! 2155: + #endif ! 2156: new = (struct context_stack *) xmalloc (sizeof (struct context_stack)); ! 2157: new->depth = desc; ! 2158: new->next = context_stack; ! 2159: *************** ! 2160: *** 1422,1430 **** ! 2161: /* This "symbol" just indicates the end of an inner lexical ! 2162: context that was started with N_RBRAC. */ ! 2163: new = context_stack; ! 2164: if (new == 0 || desc != new->depth) ! 2165: error ("Invalid symbol data: N_LBRAC/N_RBRAC symbol mismatch, symtab pos %d.", symnum); ! 2166: - local_symbols = new->locals; ! 2167: context_stack = new->next; ! 2168: /* If this is not the outermost LBRAC...RBRAC pair in the ! 2169: function, its local symbols preceded it, and are the ones ! 2170: --- 1698,1711 ---- ! 2171: /* This "symbol" just indicates the end of an inner lexical ! 2172: context that was started with N_RBRAC. */ ! 2173: new = context_stack; ! 2174: + #ifdef ibm032 ! 2175: + if (hcState == 2) /* pcc */ ! 2176: + local_symbols = new->locals; ! 2177: + #else ! 2178: + local_symbols = new->locals; ! 2179: + #endif ! 2180: if (new == 0 || desc != new->depth) ! 2181: error ("Invalid symbol data: N_LBRAC/N_RBRAC symbol mismatch, symtab pos %d.", symnum); ! 2182: context_stack = new->next; ! 2183: /* If this is not the outermost LBRAC...RBRAC pair in the ! 2184: function, its local symbols preceded it, and are the ones ! 2185: *************** ! 2186: *** 1443,1448 **** ! 2187: --- 1724,1733 ---- ! 2188: new->start_addr + last_source_start_addr, ! 2189: value + last_source_start_addr); ! 2190: } ! 2191: + #ifdef ibm032 ! 2192: + if (hcState == 1 && context_stack->next) /* hc */ ! 2193: + local_symbols = new->locals; /* now we get them */ ! 2194: + #endif ! 2195: free (new); ! 2196: break; ! 2197: ! 2198: *************** ! 2199: *** 1493,1498 **** ! 2200: --- 1778,1786 ---- ! 2201: break; ! 2202: ! 2203: default: ! 2204: + #ifdef ibm032 ! 2205: + if (hcState == 0) hcState = 2; ! 2206: + #endif ! 2207: if (name) ! 2208: define_symbol (value, name); ! 2209: } ! 2210: *************** ! 2211: *** 1553,1558 **** ! 2212: --- 1841,1849 ---- ! 2213: Dbx data never actually contains 'l'. */ ! 2214: case 'l': ! 2215: SYMBOL_CLASS (sym) = LOC_LOCAL; ! 2216: + #ifdef ibm032 ! 2217: + if (hcState == 1) value += 1000000; /* temporary hack until rel 3 pcc matches hc */ ! 2218: + #endif ! 2219: SYMBOL_VALUE (sym) = value; ! 2220: SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; ! 2221: add_symbol_to_list (sym, &local_symbols); ! 2222: *************** ! 2223: *** 1572,1577 **** ! 2224: --- 1863,1875 ---- ! 2225: add_symbol_to_list (sym, &local_symbols); ! 2226: break; ! 2227: ! 2228: + case 'R': ! 2229: + SYMBOL_CLASS (sym) = LOC_REGISTER; ! 2230: + SYMBOL_VALUE (sym) = value; ! 2231: + SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; ! 2232: + add_symbol_to_list (sym, &local_symbols); ! 2233: + break; ! 2234: + ! 2235: case 'S': ! 2236: /* Static symbol at top level of file */ ! 2237: SYMBOL_CLASS (sym) = LOC_STATIC; ! 2238: *************** ! 2239: *** 1616,1622 **** ! 2240: break; ! 2241: ! 2242: default: ! 2243: ! error ("Invalid symbol data: unknown symbol-type code `%c' at symtab pos %d.", deftype, symnum); ! 2244: } ! 2245: return sym; ! 2246: } ! 2247: --- 1914,1928 ---- ! 2248: break; ! 2249: ! 2250: default: ! 2251: ! printf ("Unknown symbol-type code '%c' in dbx symbol table, assuming local.\n", deftype); ! 2252: ! SYMBOL_CLASS (sym) = LOC_LOCAL; ! 2253: ! #ifdef ibm032 ! 2254: ! if (hcState == 1) value += 1000000; /* temporary hack until rel 3 pcc matches hc */ ! 2255: ! #endif ! 2256: ! SYMBOL_VALUE (sym) = value; ! 2257: ! SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; ! 2258: ! add_symbol_to_list (sym, &local_symbols); ! 2259: ! break; ! 2260: } ! 2261: return sym; ! 2262: } ! 2263: *************** ! 2264: *** 1741,1746 **** ! 2265: --- 2047,2056 ---- ! 2266: (*pp) += 5; ! 2267: else if (!strncmp (*pp, "r(0,1);0;", 9)) ! 2268: (*pp) += 9; ! 2269: + #if 1 ! 2270: + else if ((**pp == 'r') && (!strncmp(*pp + 2, ";0;", 3))) ! 2271: + (*pp) += 5; ! 2272: + #endif ! 2273: else break; ! 2274: ! 2275: TYPE_CODE (type) = TYPE_CODE_ARRAY; ! 2276: *************** ! 2277: *** 1980,1986 **** ! 2278: rather than -128 which is what I would like. ! 2279: So use n1 != 0 to prevent char from being taken as unsigned. */ ! 2280: ! 2281: ! else if (n2 == 0 && n1 == 1) ! 2282: { ! 2283: /* an unsigned type */ ! 2284: if (n3 == (1 << (8 * sizeof (int)))) ! 2285: --- 2290,2296 ---- ! 2286: rather than -128 which is what I would like. ! 2287: So use n1 != 0 to prevent char from being taken as unsigned. */ ! 2288: ! 2289: ! if (n2 == 0) ! 2290: { ! 2291: /* an unsigned type */ ! 2292: if (n3 == (1 << (8 * sizeof (int)))) ! 2293: *************** ! 2294: *** 1989,1994 **** ! 2295: --- 2299,2306 ---- ! 2296: return builtin_type_unsigned_short; ! 2297: if (n3 == (1 << (8 * sizeof (char)))) ! 2298: return builtin_type_unsigned_char; ! 2299: + if (n3 == (1 << (8 * sizeof (char) - 1))) ! 2300: + return builtin_type_char; ! 2301: } ! 2302: else ! 2303: { ! 2304: *************** ! 2305: *** 2002,2007 **** ! 2306: --- 2314,2321 ---- ! 2307: if (n3 == (1 << (8 * sizeof (char) - 1))) ! 2308: return builtin_type_char; ! 2309: } ! 2310: + if (n2 == 0 && n3 == 1) ! 2311: + return builtin_type_void; ! 2312: error ("Invalid symbol data: range type spec %s at symtab pos %d.", ! 2313: errp - 1, symnum); ! 2314: } ! 2315: *************** ! 2316: *** 2033,2040 **** ! 2317: --- 2347,2364 ---- ! 2318: ! 2319: /* Read the digits, as far as they go. */ ! 2320: ! 2321: + #if 0 /* Yet another "Compiler sucks" fix. */ ! 2322: while ((c = *p++) >= '0' && c <= '9') ! 2323: + #else ! 2324: + while (((c = *p++) >= '0' && c <= '9') || ((end != '\n') && (c == '\n'))) ! 2325: + #endif ! 2326: { ! 2327: + #if 1 ! 2328: + if (c == '\n') { ! 2329: + printf("Ignoring bogus newline in stabs entry. Your compiler should be fixed.\n"); ! 2330: + continue; ! 2331: + } ! 2332: + #endif ! 2333: n *= 10; ! 2334: n += c - '0'; ! 2335: } ! 2336: *************** ! 2337: *** 2050,2060 **** ! 2338: --- 2374,2392 ---- ! 2339: return n * sign; ! 2340: } ! 2341: ! 2342: + dbxinitialize() {initialize();} ! 2343: + ! 2344: static ! 2345: initialize () ! 2346: { ! 2347: symfile = 0; ! 2348: ! 2349: + #ifdef CAMPHOR ! 2350: + add_com ("add-file", class_files, add_file_command, ! 2351: + "Add a new symbol table (in dbx format) from file FILE."); ! 2352: + add_com("set-rel", class_files, set_rel_command, ! 2353: + "Set relocation for add-file command to NUMBER."); ! 2354: + #endif ! 2355: add_com ("symbol-file", class_files, symbol_file_command, ! 2356: "Load symbol table (in dbx format) from executable file FILE."); ! 2357: } ! 2358: diff -c ../../gnu/gdb/environ.c ./environ.c ! 2359: *** ../../gnu/gdb/environ.c Sat Apr 4 22:31:16 1987 ! 2360: --- ./environ.c Sun Apr 26 23:48:05 1987 ! 2361: *************** ! 2362: *** 129,135 **** ! 2363: ! 2364: if (e->allocated < i) ! 2365: { ! 2366: ! e->allocated = max (i, e->allocated + 10); ! 2367: e->vector = (char **) xrealloc (e->vector, ! 2368: (e->allocated + 1) * sizeof (char *)); ! 2369: } ! 2370: --- 129,136 ---- ! 2371: ! 2372: if (e->allocated < i) ! 2373: { ! 2374: ! e->allocated = i + 10; ! 2375: e->vector = (char **) xrealloc (e->vector, ! 2376: (e->allocated + 1) * sizeof (char *)); ! 2377: } ! 2378: diff -c ../../gnu/gdb/eval.c ./eval.c ! 2379: *** ../../gnu/gdb/eval.c Sat Apr 4 22:32:36 1987 ! 2380: --- ./eval.c Mon Apr 27 00:01:27 1987 ! 2381: *************** ! 2382: *** 546,551 **** ! 2383: --- 546,553 ---- ! 2384: } ! 2385: } ! 2386: ! 2387: + evalinitialize() {initialize();} ! 2388: + ! 2389: static ! 2390: initialize () ! 2391: { } ! 2392: diff -c ../../gnu/gdb/expread.y ./expread.y ! 2393: *** ../../gnu/gdb/expread.y Sat Apr 4 22:35:27 1987 ! 2394: --- ./expread.y Sun Apr 26 23:56:51 1987 ! 2395: *************** ! 2396: *** 650,655 **** ! 2397: --- 650,656 ---- ! 2398: ; ! 2399: else ! 2400: { ! 2401: + /*N.B. error does a longjmp, so we do not have to worry about storage */ ! 2402: err_copy = (char *) alloca (olen + 1); ! 2403: bcopy (lexptr, err_copy, olen); ! 2404: err_copy[olen] = 0; ! 2405: *************** ! 2406: *** 945,953 **** ! 2407: { ! 2408: register int len = sizeof (struct expression) + ! 2409: expr->nelts * sizeof (union exp_element); ! 2410: ! register struct expression *temp ! 2411: ! = (struct expression *) alloca (len); ! 2412: register int inpos = expr->nelts, outpos = 0; ! 2413: ! 2414: /* Copy the original expression into temp. */ ! 2415: bcopy (expr, temp, len); ! 2416: --- 946,955 ---- ! 2417: { ! 2418: register int len = sizeof (struct expression) + ! 2419: expr->nelts * sizeof (union exp_element); ! 2420: ! register struct expression *temp; ! 2421: register int inpos = expr->nelts, outpos = 0; ! 2422: + ! 2423: + temp = (struct expression *) alloca(len); ! 2424: ! 2425: /* Copy the original expression into temp. */ ! 2426: bcopy (expr, temp, len); ! 2427: diff -c ../../gnu/gdb/findvar.c ./findvar.c ! 2428: *** ../../gnu/gdb/findvar.c Sat Apr 4 22:36:38 1987 ! 2429: --- ./findvar.c Mon Apr 27 00:01:44 1987 ! 2430: *************** ! 2431: *** 359,364 **** ! 2432: --- 359,366 ---- ! 2433: return value_cast (lookup_pointer_type (SYMBOL_TYPE (var)), ! 2434: value_from_long (builtin_type_long, addr)); ! 2435: } ! 2436: + ! 2437: + findinitialize() {initialize();} ! 2438: ! 2439: static ! 2440: initialize () ! 2441: diff -c ../../gnu/gdb/firstfile.c ./firstfile.c ! 2442: *** ../../gnu/gdb/firstfile.c Sat Apr 4 22:37:06 1987 ! 2443: --- ./firstfile.c Mon Apr 27 00:02:06 1987 ! 2444: *************** ! 2445: *** 125,130 **** ! 2446: --- 125,152 ---- ! 2447: static initialize_dummy_1 (); ! 2448: static initialize_dummy_2 (); ! 2449: ! 2450: + initialize_all_files() { ! 2451: + blockinitialize(); ! 2452: + breakinitialize(); ! 2453: + coreinitialize(); ! 2454: + dbxinitialize(); ! 2455: + evalinitialize(); ! 2456: + findinitialize(); ! 2457: + infcmdinitialize(); ! 2458: + inflowinitialize(); ! 2459: + infruninitialize(); ! 2460: + symmiscinitialize(); ! 2461: + symtabinitialize(); ! 2462: + valarithinitialize(); ! 2463: + valopsinitialize(); ! 2464: + valprintinitialize(); ! 2465: + valuesinitialize(); ! 2466: + printcmdinitialize(); ! 2467: + sourceinitialize(); ! 2468: + stackinitialize(); ! 2469: + } ! 2470: + ! 2471: + #if 0 ! 2472: initialize_all_files () ! 2473: { ! 2474: initialize_next_file ((char *) initialize_dummy_2 ! 2475: *************** ! 2476: *** 148,153 **** ! 2477: --- 170,176 ---- ! 2478: initialize_dummy_2 () ! 2479: { ! 2480: } ! 2481: + #endif ! 2482: ! 2483: /* This makes the function initialize_next_file. */ ! 2484: ! 2485: diff -c ../../gnu/gdb/frame.h ./frame.h ! 2486: *** ../../gnu/gdb/frame.h Sat Apr 4 22:37:22 1987 ! 2487: --- ./frame.h Mon Apr 27 00:02:14 1987 ! 2488: *************** ! 2489: *** 20,25 **** ! 2490: --- 20,35 ---- ! 2491: ! 2492: /* Note that frame.h requires param.h! */ ! 2493: ! 2494: + #ifdef ibm032 ! 2495: + struct rt_frame { ! 2496: + CORE_ADDR frame; /* frame address */ ! 2497: + CORE_ADDR pc; /* pc we called from */ ! 2498: + CORE_ADDR firstRLoc; /* loc'n of first saved general reg */ ! 2499: + short nParms; /* number of parameters to this frame */ ! 2500: + short firstReg; /* the reg stored at 64(fp) */ ! 2501: + }; ! 2502: + #endif ! 2503: + ! 2504: #define FRAME CORE_ADDR ! 2505: ! 2506: struct frame_info ! 2507: *************** ! 2508: *** 62,64 **** ! 2509: --- 72,77 ---- ! 2510: extern struct block *get_selected_block (); ! 2511: extern struct symbol *get_frame_function (); ! 2512: extern struct symbol *get_pc_function (); ! 2513: + #ifdef ibm032 ! 2514: + extern struct rt_frame *get_cached_frame(); ! 2515: + #endif ! 2516: diff -c ../../gnu/gdb/infcmd.c ./infcmd.c ! 2517: *** ../../gnu/gdb/infcmd.c Sat Apr 4 22:47:22 1987 ! 2518: --- ./infcmd.c Mon Apr 27 00:07:53 1987 ! 2519: *************** ! 2520: *** 39,45 **** ! 2521: /* String containing arguments to give to the program, ! 2522: with a space added at the front. Just a space means no args. */ ! 2523: ! 2524: ! static char *inferior_args; ! 2525: ! 2526: /* Pid of our debugged inferior, or 0 if no inferior now. */ ! 2527: ! 2528: --- 39,45 ---- ! 2529: /* String containing arguments to give to the program, ! 2530: with a space added at the front. Just a space means no args. */ ! 2531: ! 2532: ! static char *inferior_args = NULL; ! 2533: ! 2534: /* Pid of our debugged inferior, or 0 if no inferior now. */ ! 2535: ! 2536: *************** ! 2537: *** 112,119 **** ! 2538: set_args_command (args) ! 2539: char *args; ! 2540: { ! 2541: ! free (inferior_args); ! 2542: ! if (!args) args = ""; ! 2543: inferior_args = concat (" ", args, ""); ! 2544: } ! 2545: ! 2546: --- 112,121 ---- ! 2547: set_args_command (args) ! 2548: char *args; ! 2549: { ! 2550: ! if (inferior_args != NULL) ! 2551: ! free (inferior_args); ! 2552: ! if (!args) ! 2553: ! args = ""; ! 2554: inferior_args = concat (" ", args, ""); ! 2555: } ! 2556: ! 2557: *************** ! 2558: *** 171,177 **** ! 2559: signal (SIGINT, SIG_DFL); */ ! 2560: ! 2561: ptrace (0); ! 2562: ! execle ("/bin/sh", "sh", "-c", allargs, 0, ! 2563: environ_vector (inferior_environ)); ! 2564: ! 2565: fprintf (stderr, "Cannot exec /bin/sh: %s.\n", ! 2566: --- 173,180 ---- ! 2567: signal (SIGINT, SIG_DFL); */ ! 2568: ! 2569: ptrace (0); ! 2570: ! ! 2571: ! execle ("/bin/csh", "csh", "-f", "-c", allargs, 0, ! 2572: environ_vector (inferior_environ)); ! 2573: ! 2574: fprintf (stderr, "Cannot exec /bin/sh: %s.\n", ! 2575: *************** ! 2576: *** 473,478 **** ! 2577: --- 476,482 ---- ! 2578: ! 2579: retbuf[0] = stop_r0; ! 2580: retbuf[1] = stop_r1; ! 2581: + ! 2582: val = value_being_returned (value_type, retbuf); ! 2583: printf ("Value returned is $%d = ", record_latest_value (val)); ! 2584: value_print (val, stdout); ! 2585: *************** ! 2586: *** 705,710 **** ! 2587: --- 709,716 ---- ! 2588: printf ("Contents are relative to selected stack frame.\n"); ! 2589: } ! 2590: ! 2591: + infcmdinitialize() {initialize();} ! 2592: + ! 2593: static ! 2594: initialize () ! 2595: { ! 2596: diff -c ../../gnu/gdb/inflow.c ./inflow.c ! 2597: *** ../../gnu/gdb/inflow.c Sat Apr 4 22:56:34 1987 ! 2598: --- ./inflow.c Mon Apr 27 00:12:10 1987 ! 2599: *************** ! 2600: *** 188,194 **** ! 2601: inferior_pid = 0; ! 2602: mark_breakpoints_out (); ! 2603: if (have_core_file_p ()) ! 2604: ! set_current_frame (read_register (FP_REGNUM)); ! 2605: } ! 2606: ! 2607: /* Resume execution of the inferior process. ! 2608: --- 188,194 ---- ! 2609: inferior_pid = 0; ! 2610: mark_breakpoints_out (); ! 2611: if (have_core_file_p ()) ! 2612: ! set_current_frame (read_register (FP_REGNUM), 1); ! 2613: } ! 2614: ! 2615: /* Resume execution of the inferior process. ! 2616: *************** ! 2617: *** 266,271 **** ! 2618: --- 266,274 ---- ! 2619: char buf[MAX_REGISTER_RAW_SIZE]; ! 2620: register int i; ! 2621: ! 2622: + #ifdef ibm032 ! 2623: + offset += UPAGES*NBPG - sizeof(u); /* ibm032: ustruct at end of uarea */ ! 2624: + #endif ! 2625: offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR; ! 2626: for (regno = 0; regno < NUM_REGS; regno++) ! 2627: { ! 2628: *************** ! 2629: *** 291,296 **** ! 2630: --- 294,303 ---- ! 2631: register unsigned int regaddr; ! 2632: char buf[80]; ! 2633: ! 2634: + #ifdef ibm032 ! 2635: + offset += UPAGES*NBPG - sizeof(u); /* ibm032: ustruct at end of uarea */ ! 2636: + #endif ! 2637: + ! 2638: offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR; ! 2639: ! 2640: if (regno >= 0) ! 2641: *************** ! 2642: *** 340,347 **** ! 2643: register int count ! 2644: = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); ! 2645: /* Allocate buffer of that many longwords. */ ! 2646: ! register int *buffer = (int *) alloca (count * sizeof (int)); ! 2647: ! 2648: /* Read all the longwords */ ! 2649: for (i = 0; i < count; i++, addr += sizeof (int)) ! 2650: buffer[i] = ptrace (1, inferior_pid, addr, 0); ! 2651: --- 347,355 ---- ! 2652: register int count ! 2653: = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); ! 2654: /* Allocate buffer of that many longwords. */ ! 2655: ! register int *buffer; ! 2656: ! 2657: + buffer = (int *) alloca(count * sizeof(int)); ! 2658: /* Read all the longwords */ ! 2659: for (i = 0; i < count; i++, addr += sizeof (int)) ! 2660: buffer[i] = ptrace (1, inferior_pid, addr, 0); ! 2661: *************** ! 2662: *** 367,377 **** ! 2663: register int count ! 2664: = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); ! 2665: /* Allocate buffer of that many longwords. */ ! 2666: ! register int *buffer = (int *) alloca (count * sizeof (int)); ! 2667: extern int errno; ! 2668: ! 2669: /* Fill start and end extra bytes of buffer with existing memory data. */ ! 2670: ! 2671: buffer[0] = ptrace (1, inferior_pid, addr, 0); ! 2672: if (count > 1) ! 2673: buffer[count - 1] ! 2674: --- 375,386 ---- ! 2675: register int count ! 2676: = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); ! 2677: /* Allocate buffer of that many longwords. */ ! 2678: ! register int *buffer; ! 2679: extern int errno; ! 2680: ! 2681: /* Fill start and end extra bytes of buffer with existing memory data. */ ! 2682: ! 2683: + buffer = (int *) alloca (count * sizeof (int)); ! 2684: buffer[0] = ptrace (1, inferior_pid, addr, 0); ! 2685: if (count > 1) ! 2686: buffer[count - 1] ! 2687: *************** ! 2688: *** 388,397 **** ! 2689: { ! 2690: errno = 0; ! 2691: ptrace (4, inferior_pid, addr, buffer[i]); ! 2692: ! if (errno) ! 2693: return 1; ! 2694: } ! 2695: - ! 2696: return 0; ! 2697: } ! 2698: ! 2699: --- 397,406 ---- ! 2700: { ! 2701: errno = 0; ! 2702: ptrace (4, inferior_pid, addr, buffer[i]); ! 2703: ! if (errno) { ! 2704: return 1; ! 2705: + } ! 2706: } ! 2707: return 0; ! 2708: } ! 2709: ! 2710: *************** ! 2711: *** 421,426 **** ! 2712: --- 430,437 ---- ! 2713: } ! 2714: } ! 2715: ! 2716: + inflowinitialize() {initialize();} ! 2717: + ! 2718: static ! 2719: initialize () ! 2720: { ! 2721: diff -c ../../gnu/gdb/infrun.c ./infrun.c ! 2722: *** ../../gnu/gdb/infrun.c Sat Apr 4 22:57:15 1987 ! 2723: --- ./infrun.c Mon Apr 27 00:17:40 1987 ! 2724: *************** ! 2725: *** 257,263 **** ! 2726: pc_changed = 0; ! 2727: fetch_inferior_registers (); ! 2728: stop_pc = read_pc (); ! 2729: ! set_current_frame (read_register (FP_REGNUM)); ! 2730: stop_frame = get_current_frame (); ! 2731: stop_sp = read_register (SP_REGNUM); ! 2732: another_trap = 0; ! 2733: --- 257,271 ---- ! 2734: pc_changed = 0; ! 2735: fetch_inferior_registers (); ! 2736: stop_pc = read_pc (); ! 2737: ! #ifdef CAMPHOR ! 2738: ! /* if we're not going to stop, don't bother with a stack trace */ ! 2739: ! if (WIFSTOPPED(w) && !signal_stop[WSTOPSIG(w)]) ! 2740: ! set_current_frame(read_register(FP_REGNUM), 0); ! 2741: ! else ! 2742: ! set_current_frame(read_register(FP_REGNUM), 1); ! 2743: ! #else ! 2744: ! set_current_frame (read_register (FP_REGNUM), 1); ! 2745: ! #endif ! 2746: stop_frame = get_current_frame (); ! 2747: stop_sp = read_register (SP_REGNUM); ! 2748: another_trap = 0; ! 2749: *************** ! 2750: *** 688,700 **** ! 2751: ! 2752: /* Save the function value return registers ! 2753: We might be about to restore their previous contents. */ ! 2754: ! stop_r0 = read_register (0); ! 2755: ! stop_r1 = read_register (1); ! 2756: ! 2757: if (stop_stack_dummy) ! 2758: { ! 2759: /* Pop the empty frame that contains the stack dummy. */ ! 2760: POP_FRAME; ! 2761: select_frame (read_register (FP_REGNUM), 0); ! 2762: } ! 2763: } ! 2764: --- 696,717 ---- ! 2765: ! 2766: /* Save the function value return registers ! 2767: We might be about to restore their previous contents. */ ! 2768: ! #ifdef ibm032 ! 2769: ! stop_r0 = read_register (2); ! 2770: ! stop_r1 = read_register (3); ! 2771: ! #else ! 2772: ! stop_r0 = read_register (0); ! 2773: ! stop_r1 = read_register (1); ! 2774: ! #endif ! 2775: ! 2776: if (stop_stack_dummy) ! 2777: { ! 2778: /* Pop the empty frame that contains the stack dummy. */ ! 2779: + #ifdef ibm032 ! 2780: + POP_DUMMY_FRAME; ! 2781: + #else ! 2782: POP_FRAME; ! 2783: + #endif ! 2784: select_frame (read_register (FP_REGNUM), 0); ! 2785: } ! 2786: } ! 2787: *************** ! 2788: *** 841,846 **** ! 2789: --- 858,865 ---- ! 2790: printf ("\nUse the \"handle\" command to change these tables.\n"); ! 2791: } ! 2792: ! 2793: + infruninitialize() {initialize();} ! 2794: + ! 2795: static ! 2796: initialize () ! 2797: { ! 2798: diff -c ../../gnu/gdb/initialize.h ./initialize.h ! 2799: *** ../../gnu/gdb/initialize.h Sat Apr 4 22:58:27 1987 ! 2800: --- ./initialize.h Sun May 24 00:19:21 1987 ! 2801: *************** ! 2802: *** 103,109 **** ! 2803: --- 103,120 ---- ! 2804: of the end of one object file's text to the start of the next ! 2805: object file's text. */ ! 2806: ! 2807: + /* Changed to use ifdefs on the machine type. David Nichols, 11/28/86 */ ! 2808: + #ifdef ibm032 ! 2809: + #include "m-ibm032init.h" ! 2810: + #endif ! 2811: + ! 2812: + #ifdef vax ! 2813: #include "m-vaxinit.h" ! 2814: + #endif ! 2815: + ! 2816: + #ifdef sun ! 2817: + #include "m-suninit.h" ! 2818: + #endif ! 2819: ! 2820: /* This is used to make a file's initialization function. ! 2821: It calls another function named `initialize', which must ! 2822: diff -c ../../gnu/gdb/main.c ./main.c ! 2823: *** ../../gnu/gdb/main.c Sat Apr 4 23:11:59 1987 ! 2824: --- ./main.c Mon Apr 27 00:27:21 1987 ! 2825: *************** ! 2826: *** 236,241 **** ! 2827: --- 236,243 ---- ! 2828: if (*p) ! 2829: { ! 2830: c = lookup_cmd (&p, cmdlist, "", 0); ! 2831: + if (c->function == 0) ! 2832: + error ("That is not a command, just a help topic."); ! 2833: if (c->class == (int) class_user) ! 2834: { ! 2835: if (*p) ! 2836: *************** ! 2837: *** 457,463 **** ! 2838: ! 2839: /* Add an element to the list of commands. */ ! 2840: ! 2841: ! void ! 2842: add_com (name, class, fun, doc) ! 2843: char *name; ! 2844: int class; ! 2845: --- 459,465 ---- ! 2846: ! 2847: /* Add an element to the list of commands. */ ! 2848: ! 2849: ! struct cmd_list_element * ! 2850: add_com (name, class, fun, doc) ! 2851: char *name; ! 2852: int class; ! 2853: *************** ! 2854: *** 464,470 **** ! 2855: void (*fun) (); ! 2856: char *doc; ! 2857: { ! 2858: ! add_cmd (name, class, fun, doc, &cmdlist); ! 2859: } ! 2860: ! 2861: /* Add an alias or abbreviation command to the list of commands. */ ! 2862: --- 466,473 ---- ! 2863: void (*fun) (); ! 2864: char *doc; ! 2865: { ! 2866: ! ! 2867: ! return add_cmd (name, class, fun, doc, &cmdlist); ! 2868: } ! 2869: ! 2870: /* Add an alias or abbreviation command to the list of commands. */ ! 2871: *************** ! 2872: *** 547,552 **** ! 2873: --- 550,556 ---- ! 2874: ! 2875: if (c && c->class == (int) class_user) ! 2876: free_command_lines (&c->function); ! 2877: + ! 2878: ! 2879: add_com (comname, class_user, cmds, ! 2880: (c && c->class == (int) class_user) ! 2881: diff -c ../../gnu/gdb/param.h ./param.h ! 2882: *** ../../gnu/gdb/param.h Sat Apr 4 23:15:44 1987 ! 2883: --- ./param.h Mon Apr 27 00:28:17 1987 ! 2884: *************** ! 2885: *** 1 **** ! 2886: --- 1,19 ---- ! 2887: + /* Changed to use ifdefs so we don't have to edit it all the time. ! 2888: + David Nichols ! 2889: + 28 November 1986 */ ! 2890: + ! 2891: + #ifdef vax ! 2892: #include "m-vax.h" ! 2893: + #endif ! 2894: + ! 2895: + #ifdef ibm032 ! 2896: + #include "m-ibm032.h" ! 2897: + #endif ! 2898: + ! 2899: + #ifdef sun ! 2900: + #ifdef mc68020 ! 2901: + #include "m-sun3.h" ! 2902: + #else ! 2903: + #include "m-sun2.h" ! 2904: + #endif ! 2905: + #endif ! 2906: diff -c ../../gnu/gdb/pinsn.c ./pinsn.c ! 2907: *** ../../gnu/gdb/pinsn.c Sat Apr 4 23:15:58 1987 ! 2908: --- ./pinsn.c Mon Apr 27 00:28:36 1987 ! 2909: *************** ! 2910: *** 1 **** ! 2911: --- 1,15 ---- ! 2912: + /* Changed to use ifdefs so we don't have to edit this. ! 2913: + David Nichols ! 2914: + 28 Nov 1986 */ ! 2915: + ! 2916: + #ifdef ibm032 ! 2917: + #include "ibm032-pinsn.c" ! 2918: + #endif ! 2919: + ! 2920: + #ifdef vax ! 2921: #include "vax-pinsn.c" ! 2922: + #endif ! 2923: + ! 2924: + #ifdef sun ! 2925: + #include "m68k-pinsn.c" ! 2926: + #endif ! 2927: diff -c ../../gnu/gdb/printcmd.c ./printcmd.c ! 2928: *** ../../gnu/gdb/printcmd.c Sat Apr 4 23:17:03 1987 ! 2929: --- ./printcmd.c Mon Apr 27 00:30:52 1987 ! 2930: *************** ! 2931: *** 797,804 **** ! 2932: CORE_ADDR frame; ! 2933: FILE *stream; ! 2934: { ! 2935: ! char *space = (char *) alloca (TYPE_LENGTH (SYMBOL_TYPE (var))); ! 2936: value val = read_var_value (var, frame); ! 2937: value_print (val, stream); ! 2938: } ! 2939: ! 2940: --- 797,805 ---- ! 2941: CORE_ADDR frame; ! 2942: FILE *stream; ! 2943: { ! 2944: ! char *space; ! 2945: value val = read_var_value (var, frame); ! 2946: + space = (char *) alloca (TYPE_LENGTH (SYMBOL_TYPE (var))); ! 2947: value_print (val, stream); ! 2948: } ! 2949: ! 2950: *************** ! 2951: *** 883,888 **** ! 2952: --- 884,891 ---- ! 2953: } ! 2954: } ! 2955: ! 2956: + printcmdinitialize() {initialize();} ! 2957: + ! 2958: static ! 2959: initialize () ! 2960: { ! 2961: diff -c ../../gnu/gdb/source.c ./source.c ! 2962: *** ../../gnu/gdb/source.c Sat Apr 4 23:17:55 1987 ! 2963: --- ./source.c Mon Apr 27 00:31:25 1987 ! 2964: *************** ! 2965: *** 276,282 **** ! 2966: if (get_exec_file () != 0 && exec_mtime < st.st_mtime) ! 2967: printf ("Source file is more recent than executable.\n"); ! 2968: ! 2969: ! data = (char *) alloca (st.st_size); ! 2970: myread (desc, data, st.st_size, s->filename); ! 2971: end = data + st.st_size; ! 2972: p = data; ! 2973: --- 276,283 ---- ! 2974: if (get_exec_file () != 0 && exec_mtime < st.st_mtime) ! 2975: printf ("Source file is more recent than executable.\n"); ! 2976: ! 2977: ! data = (char *) alloca(st.st_size); ! 2978: ! ! 2979: myread (desc, data, st.st_size, s->filename); ! 2980: end = data + st.st_size; ! 2981: p = data; ! 2982: *************** ! 2983: *** 530,535 **** ! 2984: --- 531,538 ---- ! 2985: printf ("Line number %d is out of range for \"%s\".\n", ! 2986: sal.line, sal.symtab->filename); ! 2987: } ! 2988: + ! 2989: + sourceinitialize() {initialize();} ! 2990: ! 2991: static ! 2992: initialize () ! 2993: diff -c ../../gnu/gdb/stack.c ./stack.c ! 2994: *** ../../gnu/gdb/stack.c Sun Apr 5 00:28:05 1987 ! 2995: --- ./stack.c Mon Apr 27 00:31:50 1987 ! 2996: *************** ! 2997: *** 511,516 **** ! 2998: --- 511,517 ---- ! 2999: ! 3000: print_stack_frame (selected_frame, selected_frame_level, 1); ! 3001: } ! 3002: + ! 3003: ! 3004: static void ! 3005: return_command (retval_exp) ! 3006: *************** ! 3007: *** 538,543 **** ! 3008: --- 539,546 ---- ! 3009: frame_command ("0", 1); ! 3010: } ! 3011: ! 3012: + stackinitialize() {initialize();} ! 3013: + ! 3014: static ! 3015: initialize () ! 3016: { ! 3017: diff -c ../../gnu/gdb/symmisc.c ./symmisc.c ! 3018: *** ../../gnu/gdb/symmisc.c Sun Apr 5 00:33:16 1987 ! 3019: --- ./symmisc.c Mon Apr 27 00:37:46 1987 ! 3020: *************** ! 3021: *** 504,509 **** ! 3022: --- 504,511 ---- ! 3023: return i; ! 3024: } ! 3025: ! 3026: + symmiscinitialize() {initialize();} ! 3027: + ! 3028: static ! 3029: initialize () ! 3030: { ! 3031: diff -c ../../gnu/gdb/symtab.c ./symtab.c ! 3032: *** ../../gnu/gdb/symtab.c Sun Apr 5 00:35:45 1987 ! 3033: --- ./symtab.c Mon Apr 27 00:38:19 1987 ! 3034: *************** ! 3035: *** 71,78 **** ! 3036: strcpy (copy, name); ! 3037: strcat (copy, ".c"); ! 3038: for (s = symtab_list; s; s = s->next) ! 3039: ! if (!strcmp (copy, s->filename)) ! 3040: return s; ! 3041: ! 3042: return 0; ! 3043: } ! 3044: --- 71,79 ---- ! 3045: strcpy (copy, name); ! 3046: strcat (copy, ".c"); ! 3047: for (s = symtab_list; s; s = s->next) ! 3048: ! if (!strcmp (copy, s->filename)) { ! 3049: return s; ! 3050: + } ! 3051: ! 3052: return 0; ! 3053: } ! 3054: *************** ! 3055: *** 703,709 **** ! 3056: register struct symbol *sym; ! 3057: register CORE_ADDR pc; ! 3058: register int i; ! 3059: ! char *copy; ! 3060: ! 3061: /* Defaults have defaults. */ ! 3062: ! 3063: --- 704,710 ---- ! 3064: register struct symbol *sym; ! 3065: register CORE_ADDR pc; ! 3066: register int i; ! 3067: ! char *copy, *dotcopy; ! 3068: ! 3069: /* Defaults have defaults. */ ! 3070: ! 3071: *************** ! 3072: *** 818,825 **** ! 3073: --- 819,847 ---- ! 3074: /* Look up that token as a function. ! 3075: If file specified, use that file's per-file block to start with. */ ! 3076: ! 3077: + #ifdef ibm032 ! 3078: + /* RT has stupid dots in front of function names (_.foo), and worse, has bogus _foo ! 3079: + symbol to confuse us, too. ! 3080: + */ ! 3081: + if (*copy != '.') { ! 3082: + dotcopy = (char *) alloca (strlen(copy)+2); /* one for the null and one for the dot */ ! 3083: + dotcopy[0] = '.'; ! 3084: + strcpy(dotcopy+1, copy); ! 3085: + sym = lookup_symbol (dotcopy, s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 1) : 0, ! 3086: + VAR_NAMESPACE); ! 3087: + } ! 3088: + else { ! 3089: + sym = 0; ! 3090: + dotcopy = 0; ! 3091: + } ! 3092: + if (!sym || SYMBOL_CLASS(sym) != LOC_BLOCK) { ! 3093: + sym = lookup_symbol (copy, s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 1) : 0, ! 3094: + VAR_NAMESPACE); ! 3095: + } ! 3096: + #else ! 3097: sym = lookup_symbol (copy, s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), 1) : 0, ! 3098: VAR_NAMESPACE); ! 3099: + #endif ! 3100: ! 3101: if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ! 3102: { ! 3103: *************** ! 3104: *** 835,840 **** ! 3105: --- 857,875 ---- ! 3106: if (sym) ! 3107: error ("%s is not a function.", copy); ! 3108: ! 3109: + #ifdef ibm032 ! 3110: + /* try the dot version first */ ! 3111: + if (dotcopy) for (i = 0; i < misc_function_count; i++) ! 3112: + if (!strcmp (misc_function_vector[i].name, dotcopy)) ! 3113: + { ! 3114: + value.symtab = 0; ! 3115: + value.line = 0; ! 3116: + value.pc = misc_function_vector[i].address + FUNCTION_START_OFFSET; ! 3117: + if (funfirstline) ! 3118: + SKIP_PROLOGUE (value.pc); ! 3119: + return value; ! 3120: + } ! 3121: + #endif ! 3122: for (i = 0; i < misc_function_count; i++) ! 3123: if (!strcmp (misc_function_vector[i].name, copy)) ! 3124: { ! 3125: *************** ! 3126: *** 1027,1032 **** ! 3127: --- 1062,1069 ---- ! 3128: ! 3129: return type; ! 3130: } ! 3131: + ! 3132: + symtabinitialize() {initialize();} ! 3133: ! 3134: static ! 3135: initialize () ! 3136: diff -c ../../gnu/gdb/utils.c ./utils.c ! 3137: *** ../../gnu/gdb/utils.c Sun Apr 5 00:40:01 1987 ! 3138: --- ./utils.c Mon Apr 27 00:40:01 1987 ! 3139: *************** ! 3140: *** 151,156 **** ! 3141: --- 151,157 ---- ! 3142: else ! 3143: err = "unknown error"; ! 3144: ! 3145: + /* ibm032: no core leak or other problems 'cause we alway call error -> longjmps away */ ! 3146: combined = (char *) alloca (strlen (err) + strlen (string) + 3); ! 3147: strcpy (combined, string); ! 3148: strcat (combined, ": "); ! 3149: diff -c ../../gnu/gdb/valarith.c ./valarith.c ! 3150: *** ../../gnu/gdb/valarith.c Sun Apr 5 00:40:44 1987 ! 3151: --- ./valarith.c Fri May 22 20:18:46 1987 ! 3152: *************** ! 3153: *** 239,245 **** ! 3154: COERCE_ARRAY (arg1); ! 3155: ! 3156: len = TYPE_LENGTH (VALUE_TYPE (arg1)); ! 3157: ! p = VALUE_CONTENTS (arg1); ! 3158: ! 3159: while (--len >= 0) ! 3160: { ! 3161: --- 239,245 ---- ! 3162: COERCE_ARRAY (arg1); ! 3163: ! 3164: len = TYPE_LENGTH (VALUE_TYPE (arg1)); ! 3165: ! p = (char *) VALUE_CONTENTS (arg1); ! 3166: ! 3167: while (--len >= 0) ! 3168: { ! 3169: *************** ! 3170: *** 281,288 **** ! 3171: && ((len = TYPE_LENGTH (VALUE_TYPE (arg1))) ! 3172: == TYPE_LENGTH (VALUE_TYPE (arg2)))) ! 3173: { ! 3174: ! p1 = VALUE_CONTENTS (arg1); ! 3175: ! p2 = VALUE_CONTENTS (arg2); ! 3176: while (--len >= 0) ! 3177: { ! 3178: if (*p1++ != *p2++) ! 3179: --- 281,288 ---- ! 3180: && ((len = TYPE_LENGTH (VALUE_TYPE (arg1))) ! 3181: == TYPE_LENGTH (VALUE_TYPE (arg2)))) ! 3182: { ! 3183: ! p1 = (char *) VALUE_CONTENTS (arg1); ! 3184: ! p2 = (char *) VALUE_CONTENTS (arg2); ! 3185: while (--len >= 0) ! 3186: { ! 3187: if (*p1++ != *p2++) ! 3188: *************** ! 3189: *** 348,353 **** ! 3190: --- 348,355 ---- ! 3191: return value_from_long (VALUE_TYPE (arg1), ~ value_as_long (arg1)); ! 3192: } ! 3193: ! 3194: + valarithinitialize() {initialize();} ! 3195: + ! 3196: static ! 3197: initialize () ! 3198: { ! 3199: diff -c ../../gnu/gdb/valops.c ./valops.c ! 3200: *** ../../gnu/gdb/valops.c Sun Apr 5 00:41:32 1987 ! 3201: --- ./valops.c Fri May 22 20:13:02 1987 ! 3202: *************** ! 3203: *** 174,180 **** ! 3204: /* Return a value just like TOVAL except with the contents of FROMVAL. */ ! 3205: ! 3206: val = allocate_value (type); ! 3207: ! bcopy (toval, val, VALUE_CONTENTS (val) - (char *) val); ! 3208: bcopy (VALUE_CONTENTS (fromval), VALUE_CONTENTS (val), TYPE_LENGTH (type)); ! 3209: ! 3210: return val; ! 3211: --- 174,180 ---- ! 3212: /* Return a value just like TOVAL except with the contents of FROMVAL. */ ! 3213: ! 3214: val = allocate_value (type); ! 3215: ! bcopy (toval, val, (char *) VALUE_CONTENTS (val) - (char *) val); ! 3216: bcopy (VALUE_CONTENTS (fromval), VALUE_CONTENTS (val), TYPE_LENGTH (type)); ! 3217: ! 3218: return val; ! 3219: *************** ! 3220: *** 413,419 **** ! 3221: --- 413,427 ---- ! 3222: } ! 3223: else if (code == TYPE_CODE_PTR) ! 3224: { ! 3225: + #ifdef ibm032 ! 3226: + /* apparently '_a' pseudoprocedure has lval_memory as its lval type */ ! 3227: + if (VALUE_LVAL(function) == lval_memory) ! 3228: + funaddr = VALUE_ADDRESS(function); ! 3229: + else ! 3230: + funaddr = value_as_long (function); ! 3231: + #else ! 3232: funaddr = value_as_long (function); ! 3233: + #endif ! 3234: if (TYPE_CODE (TYPE_TARGET_TYPE (ftype)) ! 3235: == TYPE_CODE_FUNC) ! 3236: value_type = TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (ftype)); ! 3237: *************** ! 3238: *** 429,439 **** ! 3239: else ! 3240: /* Handle integer used as address of a function. */ ! 3241: funaddr = value_as_long (function); ! 3242: - ! 3243: value_type = builtin_type_int; ! 3244: } ! 3245: ! else ! 3246: error ("Invalid data type for function to be called."); ! 3247: ! 3248: /* Create a call sequence customized for this function ! 3249: and the number of arguments for it. */ ! 3250: --- 437,447 ---- ! 3251: else ! 3252: /* Handle integer used as address of a function. */ ! 3253: funaddr = value_as_long (function); ! 3254: value_type = builtin_type_int; ! 3255: } ! 3256: ! else { ! 3257: error ("Invalid data type for function to be called."); ! 3258: + } ! 3259: ! 3260: /* Create a call sequence customized for this function ! 3261: and the number of arguments for it. */ ! 3262: *************** ! 3263: *** 590,595 **** ! 3264: --- 598,605 ---- ! 3265: return value_field (arg1, i); ! 3266: } ! 3267: ! 3268: + valopsinitialize() {initialize();} ! 3269: + ! 3270: static ! 3271: initialize () ! 3272: { } ! 3273: diff -c ../../gnu/gdb/valprint.c ./valprint.c ! 3274: *** ../../gnu/gdb/valprint.c Sun Apr 5 00:42:28 1987 ! 3275: --- ./valprint.c Mon Apr 27 00:40:56 1987 ! 3276: *************** ! 3277: *** 529,534 **** ! 3278: --- 529,536 ---- ! 3279: print_max = atoi (arg); ! 3280: } ! 3281: ! 3282: + valprintinitialize() {initialize();} ! 3283: + ! 3284: static ! 3285: initialize () ! 3286: { ! 3287: diff -c ../../gnu/gdb/value.h ./value.h ! 3288: *** ../../gnu/gdb/value.h Sun Apr 5 00:43:44 1987 ! 3289: --- ./value.h Fri May 22 20:03:32 1987 ! 3290: *************** ! 3291: *** 37,43 **** ! 3292: short repeated; ! 3293: short repetitions; ! 3294: short regno; ! 3295: ! char contents[1]; ! 3296: }; ! 3297: ! 3298: typedef struct value *value; ! 3299: --- 37,43 ---- ! 3300: short repeated; ! 3301: short repetitions; ! 3302: short regno; ! 3303: ! long contents[1]; /* Forces alignment... */ ! 3304: }; ! 3305: ! 3306: typedef struct value *value; ! 3307: diff -c ../../gnu/gdb/values.c ./values.c ! 3308: *** ../../gnu/gdb/values.c Sun Apr 5 00:45:14 1987 ! 3309: --- ./values.c Fri May 22 20:12:40 1987 ! 3310: *************** ! 3311: *** 338,344 **** ! 3312: int offset, bitpos, bitsize; ! 3313: value newval; ! 3314: { ! 3315: ! register char *addr = VALUE_CONTENTS (var->value) + offset; ! 3316: if (bitsize) ! 3317: modify_field (addr, value_as_long (newval), ! 3318: bitpos, bitsize); ! 3319: --- 338,344 ---- ! 3320: int offset, bitpos, bitsize; ! 3321: value newval; ! 3322: { ! 3323: ! register char *addr = (char *) VALUE_CONTENTS (var->value) + offset; ! 3324: if (bitsize) ! 3325: modify_field (addr, value_as_long (newval), ! 3326: bitpos, bitsize); ! 3327: *************** ! 3328: *** 733,738 **** ! 3329: --- 733,740 ---- ! 3330: write_register (1, retbuf[1]); ! 3331: } ! 3332: ! 3333: + valuesinitialize() {initialize();} ! 3334: + ! 3335: static ! 3336: initialize () ! 3337: { ! 3338:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.