Thread View: comp.sys.ibm.pc.rt
5 messages
5 total messages
Started by brunner
Fri, 20 Oct 1989 19:41
Fix for dbx, part 1 of 5, IBM/4.3
Author: brunner
Date: Fri, 20 Oct 1989 19:41
Date: Fri, 20 Oct 1989 19:41
660 lines
24983 bytes
24983 bytes
Subject: Fix for dbx (part 1)
Index: /usr/src/ucb/dbx IBM/4.3
Description:
Several problems (too numerous to mention) exist
with the December release of dbx. This is part 1
of a 5 part patch installation kit. The contents
of the kit are:
part 1 shar file containing help.c
part 2 patchs to the following files:
dbx/ibmrt/{coredump.c,decode.c,frame.c,procinfo.c}
part 3 patchs to the following files:
dbx/{object.c,eval.c,commands.y,c.c,tree.c}
part 4 patchs to the following files:
dbx/{runtime.c,symbols.c,execute.c,events.c,mappings.c}
part 5 patches to the following files:
dbx/{stabstring.c,printsym.c,operators.c,process.c,
keywords.c,pascal.c,fortran.c,main.c,Makefile,
examine.c,scanner.c,source.c,library.c}
Fix: Change directories to /usr/src/ucb/dbx and unpack
the attached shar file, e.g.,
sh < this_file
This will create the new help.c file. Proceede to
the next part of the kit.
Inconsistencies between the several compilers (hc,
pp, f77) and the loader exist, stabs in particular.
These will be corrected in a following patch to dbx,
or in corrective releases of the compilers, or both.
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# help.c
#
echo x - help.c
sed 's/^X//' >help.c << 'END-of-help.c'
X/* help.c -- online help for dbx */
X
X#include "defs.h"
X#include "tree.h"
X#include "symbols.h"
X#include "keywords.h"
X#include "process.h"
X#include "runtime.h"
X#include "source.h"
X#include "object.h"
X#include "mappings.h"
X#include "y.tab.h"
X
Xstatic String help_commands[] ={
X "alias", "assign", "call",
X "catch", "clear", "cleari", "cont", "debug", "delete", /*"detach", */
X "down", "dump", "edit", "file", "func", "goto", "gotoi",
X#ifdef MAINTAINER
X "gripe",
X#endif /* MAINTAINER */
X "help", "ignore", "list", "listi", /*"multproc",*/
X "next", "nexti", "print", /*"prompt",*/ "psym", "quit",
X "registers", "rerun", "return", "run", /*"screen",*/ "set", "sh",
X "source", "status", "step", "stepi", "stop", "stopi", "trace",
X "tracei", "unalias", "unset", "up", "use", /*"watch",*/ "whatis", "when",
X "where", "whereis", "which", /*"wins", "wini",*/ 0
X};
X
Xstatic String help_topics[] = {
X "execution", "expressions",
X "files", "printing",
X "usage", "variables",
X 0
X};
X
Xstatic void
Xhelp_help()
X{
X String *p;
X int len, i;
X
X puts("Commands:");
X i = len = 0;
X for ( p = help_commands; *p; p++ ){
X printf(" %s ",*p);
X i = strlen(*p); /* there is a bug in printf!! on the RT */
X while ( i++ < 11 )
X printf(" ");
X len += 11;
X if ( len >= 65 ){
X printf("\n");
X len = 0;
X }
X }
X puts("\nTopics:");
X for ( p = help_topics; *p; p++ ){
X printf(" %s ",*p);
X }
X puts("\n\nType \"help <command>\" or \"help <topic>\" for help on a command or topic.\n");
X}
X
X/*
X * help_topic:
X * See if the user wants help on a given topic
X */
X
Xprivate help_topic(s)
X char *s;
X{
X if ( !strncmp(s,"exe",3) ){
X puts("Execution controlling commands:");
X puts("See: run, rerun, stop, status, catch, ignore, cont");
X puts("step, next, return and call commands.");
X }
X else if ( !strncmp(s,"exp",3) ){
X puts("Expressions are specified with an approximately common");
X puts("subset of C and Pascal syntax. Indirection can be denoted");
X puts("using either a prefix \"*\" or a postfix \"^\" and array");
X puts("expressions are subscripted by brackets (\"[\" \"]\"). The");
X puts("field reference operator (\".\") can be used with pointers");
X puts("as well as structures, unions, and records, making the C");
X puts("operator \"->\" unnecessary (although it is supported).");
X puts("");
X puts("Types of expressions are checked; the type of an expression");
X puts("may be overridden by using \"type-name(expression)\". When");
X puts("there is no corresponding named type the special constructs");
X puts("\"$type-name\" and \"$$tag-name\" can be used to represent a");
X puts("pointer to a named type or C structure tag.");
X }
X else if ( !strncmp(s,"fil",3) ){
X puts("Accessing source files:");
X puts("/<regular-expression>[/]");
X puts("?<regular-expression>[?]");
X puts("\tSearch (respectively) forward or backward in the current");
X puts("\tsource file for the given <regular-expression>.");
X puts("See also:");
X puts("\tedit, file, func, list and use commands.");
X }
X else if ( !strncmp(s,"pri",3) ){
X puts("Address level printing.");
X puts("<address> , <address>/ [<mode>]");
X puts("<address> / [<count>] [<mode>]");
X puts("\tPrint the contents of memory starting at the first");
X puts("\t<address> up to the second <address> or until <count>");
X puts("\titems are printed. If the address is \".\", the address");
X puts("\tfollowing the one most recently printed is used. The mode");
X puts("\tspecifies how memory is to be printed; if it is omitted the");
X puts("\tprevious mode specified is used. The initial mode is \"X\".");
X puts("\tThe following modes are supported:");
X puts("");
X puts("\ti print the machine instruction");
X puts("\td print a short word in decimal");
X puts("\tD print a long word in decimal");
X puts("\to print a short word in octal");
X puts("\tO print a long word in octal");
X puts("\tx print a short word in hexadecimal");
X puts("\tX print a long word in hexadecimal");
X puts("\tb print a byte in octal");
X puts("\tc print a byte as a character");
X puts("\ts print a string (terminated by a null byte)");
X puts("\tf print a single precision real number");
X puts("\tg print a double precision real number");
X puts("");
X puts("Symbolic addresses are specified by preceding the name with");
X puts("an \"&\". Registers are denoted by \"$rN\" where N is the");
X puts("number of the register. Addresses may be expressions made");
X puts("up of other addresses and the operators \"+\", \"-\", and");
X puts("indirection ( unary \"*\").");
X }
X else if ( !strncmp(s,"usa",3) ){
X puts("Basic dbx command usage:\n");
X puts("run - begin execution of the program");
X puts("print <exp> - print the value of the expression");
X puts("where - print currently active procedures");
X puts("stop at <line> - suspend execution at the line");
X puts("stop in <proc> - suspend execution when <proc> is called");
X puts("cont - continue execution");
X puts("step - single step one line");
X puts("next - step to next line (skip over calls)");
X puts("trace <line#> - trace execution of the line");
X puts("trace <proc> - trace calls to the procedure");
X puts("trace <var> - trace changes to the variable");
X puts("trace <exp> at <line#> - print <exp> when <line> is reached");
X puts("status - print trace/stop's in effect");
X puts("delete <number> - remove trace or stop of given number");
X puts("call <proc> - call a procedure in program");
X puts("whatis <name> - print the declaration of the name");
X puts("list <line>, <line> - list source lines");
X puts("registers - display register set");
X puts("quit - exit dbx");
X }
X else if ( !strncmp(s,"var",3) ){
X puts("\tThe following \"set\" variables have special meanings:");
X puts("");
X puts("\t$frame");
X puts("\t\tSetting this variable to an address alters dbx's");
X puts("\t\tidea of the current stack frame.");
X puts("");
X puts("\t$expandunions");
X puts("\t\tCauses dbx to display values of each part of variant");
X puts("\t\trecords or unions.");
X puts("");
X puts("\t$hexchars $hexints $hexstrings");
X puts("\t\tWhen set, dbx prints characters, integers or");
X puts("\t\tcharacter pointers in hexadecimal.");
X puts("");
X puts("\t$listwindow");
X puts("\t\tSpecifies the number of lines to list and listi commands.");
X puts("");
X puts("\t$mapaddrs");
X puts("\t\tControls address mapping, useful for kernel debugging.");
X puts("");
X puts("\t$unsafecall $unsafeassign");
X puts("\t\tTurn off type checking for calls and assignments.");
X }
X else printf("%s is not a known help topic or command\n",s);
X}
X
Xprivate help_command(op,cmd)
X int op;
X char *cmd;
X{
X switch ( op ){
X
X case ALIAS:
X puts("alias");
X puts("alias <name> <name>");
X puts("alias <name> \"<string>\"");
X puts("alias <name> ( <parameters> ) \"<string>\"");
X puts("\tWhen commands are processed, dbx first checks to see if");
X puts("\tthe word is an alias for either a command or a string.");
X puts("\tIf it is an alias, then dbx treats the input as though");
X puts("\tthe corresponding string (with values substituted for ");
X puts("\tany parameters) had been entered.");
X puts("\tAlias with no arguments prints the alias definition list.");
X break;
X
X case ASSIGN:
X puts("assign <variable> = <expression>");
X puts("\tAssign the value of the expression to the variable.");
X break;
X
X case CALL:
X puts("call <procedure> ( <parameters> )");
X puts("\tExecute the object code associated with the named");
X puts("\tprocedure or function");
X break;
X#ifdef 0
X case CASE:
X puts("case");
X puts("case mixed");
X puts("case lower");
X puts("case upper");
X puts("case default");
X puts("\tSet character case sensitivity.");
X puts("\tCase with no arguments prints the current case sensitivity.");
X break;
X#endif
X case CATCH:
X case IGNORE:
X puts("catch <signal-number>");
X puts("catch <signal-name>");
X puts("ignore <signal-number>");
X puts("ignore <signal-name>");
X puts("\tStart or stop trapping a signal before it is sent to");
X puts("\tthe program. This is useful when a program being");
X puts("\tdebugged handles signals such as interrupts. A signal");
X puts("\tmay be specified by number or name.");
X puts("\tSignal names are by default case insensitive and the \"SIG\"");
X puts("\tprefix is optional. By default all signals are trapped");
X puts("\texcept SIGCONT, SIGCHILD, SIGALRM and SIGKILL.");
X break;
X
X case CONT:
X puts("cont");
X puts("cont <signal-number>");
X puts("cont <signal-name>");
X puts("\tContinue execution from where it stopped. If a signal");
X puts("\tis specified, the process continues as though it");
X puts("\treceived the signal. Otherwise, the process is continued");
X puts("\tas though it had not been stopped.");
X break;
X
X case DELETE:
X puts("delete <command-number>");
X puts("delete all");
X puts("\tThe traces or stops corresponding to the given numbers");
X puts("\tare removed. The numbers associated with traces and stops");
X puts("\tare printed with the \"status\" command.");
X break;
X
X case DOWN:
X case UP:
X puts("up");
X puts("down");
X puts("up <count>");
X puts("down <count>");
X puts("\tMove the current function, which is used for resolving");
X puts("\tnames, up or down the stack <count> levels. The default");
X puts("\t<count> is one.");
X break;
X
X case DUMP:
X puts("dump");
X puts("dump .");
X puts("dump <procedure> [ > <filename> ]");
X puts("\tPrint the names and values of variables in the given");
X puts("\tprocedure, or the current one if none is specified. If");
X puts("\tthe procedure given is \'.\', then all active variables");
X puts("\tare dumped.");
X break;
X
X case EDIT:
X puts("edit");
X puts("edit <filename>");
X puts("edit <procedure>");
X puts("\tInvoke an editor on <filename> or the current source file");
X puts("\tif none is specified. If a procedure or function name");
X puts("\tis specified the editor is invoked on the file that");
X puts("\tcontains it. Which editor is invoked by default depends");
X puts("\ton the installation. The default can be overridden by");
X puts("\tsetting the environment variable EDITOR to the name of");
X puts("\tthe desired editor.");
X break;
X
X case FILE:
X puts("file");
X puts("file <filename>");
X puts("\tChange the current source file name to <filename>. If");
X puts("\tnone is specified then the current source file name is");
X puts("\tprinted.");
X break;
X
X case FUNC:
X puts("func");
X puts("func <procedure>");
X puts("\tChange the current function. If none is specified then");
X puts("\tprint the current function. Changing the current function");
X puts("\timplicitly changes the current source file to the");
X puts("\tone that contains the function; it also changes the");
X puts("\tcurrent scope used for name resolution.");
X break;
X
X case CLEAR:
X puts("clear <line-number>");
X puts("\tRemove all breakpoints at a given line number.");
X puts("\tSee also: delete");
X break;
X
X case CLEARI:
X puts("cleari <address>");
X puts("\tRemove all breakpoints at a given address.");
X puts("\tSee also: delete");
X break;
X
X case DEBUG:
X puts("debug <number>");
X puts("\tdbx internal debug switches");
X break;
X
X case GOTOI:
X case GOTO:
X puts("goto <line-number>");
X puts("goto \"<filename>\" : <line-number>");
X puts("gotoi <address>");
X puts("\tChange the program counter to <address> or an address");
X puts("\tnear <line-number>. The variable $unsafegoto must be set");
X puts("\tif a goto out of the current function is desired.");
X break;
X
X case HELP:
X puts("help");
X puts("help <command>");
X puts("help <topic>");
X puts("\tPrint information about command or topic.");
X break;
X
X case LIST:
X puts("list [ <source-line-number> [, <source-line-number> ]]");
X puts("list <procedure>");
X puts("\tList the lines in the current source file from the");
X puts("\tfirst line number to the second inclusive. If no lines");
X puts("\tare specified, the next 10 lines are listed. If the");
X puts("\tname of a procedure or function is given lines n-k to");
X puts("\tn+k are listed where n is the first statement in the");
X puts("\tprocedure or function and k is defined by $listwindow");
X break;
X
X case LISTI:
X puts("listi");
X puts("listi <source-line-number>");
X puts("listi <address>");
X puts("listi <procedure>");
X puts("\tList the instructions from the current program counter");
X puts("\tlocation or given address, line number or procedure.");
X puts("\tThe number of instructions printed is controlled by");
X puts("\tthe dbx internal variable $listwindow.");
X break;
X
X case NEXT:
X puts("next");
X puts("\tExecute up to the next source line. The difference between");
X puts("\tthis and \"step\" is that if the line contains a call");
X puts("\tto a procedure or function the \"step\" command will");
X puts("\tstop at the beginning of that block, while the \"next\"");
X puts("\tcommand will not.");
X break;
X
X case NEXTI:
X puts("nexti");
X puts("\tSingle step as in \"next\", but do a single instruction");
X puts("\trather than source line.");
X break;
X
X case PRINT:
X puts("print <expression> [, <expression>]");
X puts("\tNames are resolved first using the static scope of the");
X puts("\tcurrent function, then using the dynamic scope if the name");
X puts("\tis not defined in the static scope. If static and dynamic");
X puts("\tsearches do not yield a result, an arbitrary symbol is");
X puts("\tchosen and the message \"[using <qualified-name>]\" is");
X puts("\tprinted. The name resolution procedure may be overridden by");
X puts("\tqualifying an identifier with a block name, e.g.,");
X puts("\t\"module.variable\". For C, source files are treated as");
X puts("\tmodules named by the file name without \".c\"");
X puts("");
X break;
X#ifdef 0
X case PROMPT:
X puts("prompt");
X puts("\tDisplays the dbx prompt.");
X break;
X#endif
X case PSYM:
X puts("psym <name>");
X puts("\tPrint the dbx symbol table entry for <name>.");
X break;
X
X case QUIT:
X puts("quit");
X puts("\tExit dbx.");
X break;
X
X case REGISTERS:
X puts("registers");
X puts("\tPrint the contents of all machine registers.");
X break;
X
X case RERUN:
X case RUN:
X puts("run [<arguments>] [< <filename>] [> <filename>] ");
X puts("rerun [<arguments>] [< <filename>] [> <filename>] ");
X puts("\tStart executing the object file, passing arguments as");
X puts("\tcommand line arguments; < or > can be used to redirect");
X puts("\tinput or output in a shell-like manner. When \"rerun\"");
X puts("\tis used without any arguments the previous argument list");
X puts("\tis passed to the program; otherwise it is identical to run.");
X puts("\tIf the object file has been written to since the last time");
X puts("\tthe symbolic information was read in, dbx will read in the");
X puts("\tnew information");
X break;
X
X case RETURN:
X puts("return");
X puts("return <procedure>");
X puts("\tContinue until a return to <procedure> is executed, or");
X puts("\tuntil the current procedure returns if none is specified.");
X break;
X
X case SET:
X puts("set <name>");
X puts("set <name> = <expression>");
X puts("\tThe set command defines values for dbx variables.");
X puts("\tThe names of these variables cannot conflict with names");
X puts("\tin the program being debugged, and are expanded to the");
X puts("\tcorresponding expression within other commands.");
X puts("\tSee also \"help variables\" for definitions of predefined");
X puts("\tset variables.");
X break;
X
X case SH:
X puts("sh <command-line>");
X puts("\tPass the command line to the shell for execution.");
X puts("\tThe SHELL environment variable determines which shell is used.");
X break;
X
X case SOURCE:
X puts("source <filename>");
X puts("\tRead dbx commands from the given file.");
X break;
X
X case STATUS:
X puts("status [> <filename>]");
X puts("\tPrint out the currently active trace and stop commands.");
X break;
X
X case STEP:
X puts("step");
X puts("\tExecute one source line.");
X break;
X
X case STEPI:
X puts("stepi");
X puts("\tExecute a single instruction");
X break;
X
X case STOP:
X puts("stop if <condition>");
X puts("stop at <line-number> [if <condition>]");
X puts("stop in <procedure> [if <condition>]");
X puts("stop <variable> [if <condition>]");
X puts("\tStop execution when the given line is reached,");
X puts("\tprocedure or function entered, variable changed,");
X puts("\tor condition true.");
X break;
X
X case STOPI:
X puts("stopi <address> [if <condition>]");
X puts("stopi at <address> [if <condition>]");
X puts("\t\"stopi at <address>\" stops execution when the given");
X puts("\t<address> is reached.");
X puts("\t\"stopi <address>\" stops execution when the value located");
X puts("\tat the given <address> changes.");
X break;
X
X case UNALIAS:
X puts("unalias <name>");
X puts("\tRemove the alias for <name>.");
X break;
X
X case UNSET:
X puts("unset <name>");
X puts("\tRemove the definition for <name>.");
X break;
X
X case USE:
X puts("use <directory-list>");
X puts("\tSet the list of directories to be searched when looking");
X puts("\tfor source files.");
X break;
X
X case WHATIS:
X puts("whatis <name>");
X puts("\tPrint the declaration of the given name.");
X break;
X
X case WHERE:
X puts("where");
X puts("\tPrint out a stack trace of the currently active procedures");
X puts("\tand functions.");
X break;
X
X case WHEREIS:
X puts("whereis <name>");
X puts("\tPrint the full qualification of all symbols whose name");
X puts("\tmatches <name>.");
X break;
X
X case WHICH:
X puts("which <name>");
X puts("\tPrint the full qualification of the given <name>,");
X puts("\ti.e the outer blocks that the name is associated with.");
X break;
X
X case TRACE:
X puts("trace [in <procedure>] [if <condition>]");
X puts("trace <line-number> [if <condition>]");
X puts("trace <procedure> [in <procedure>] [if <condition>]");
X puts("trace <variable> [in <procedure>] [if <condition>]");
X puts("trace <expression> at <line-number> [if <condition>]");
X puts("\tHave tracing information printed when the program is");
X puts("\texecuted. A number is associated with the command so");
X puts("\tthat tracing can be turned off with the delete command.");
X break;
X
X case TRACEI:
X puts("tracei [<address>] [if <condition>]");
X puts("tracei [<variable>] [at <address>] [if <condition>]");
X puts("\tTurn on tracing using a machine instruction address.");
X puts("See trace command.");
X break;
X
X case WHEN:
X puts("when in <procedure> { <actions> }");
X puts("when at <line-number> { <actions> }");
X puts("when at <address> { <actions> }");
X puts("when <expression> { <actions> }");
X puts("\tWhen <expression> is true, execute <actions>.");
X puts("\tWhere <actions> is a list of dbx commands.");
X break;
X#ifdef 0
X case SCREEN:
X puts("screen");
X puts("\tSwitch dbx to another virtual terminal.");
X break;
X
X case WATCH:
X puts("watch <expression> [if <condition>]");
X puts("watch <expression> [in <procedure>] [if <condition>]");
X puts("watch <expression> [at <line-number>] [if <condition>]");
X puts("\tSee trace command.");
X break;
X
X case MULTPROC:
X case DETACH:
X case WINS:
X case WINI:
X printf("%s is currently undocumented\n",cmd);
X break;
X#endif
X default:
X printf("no help available for %s\n",cmd);
X }
X puts("");
X}
X
X/*
X * Give the user some help.
X */
X
Xpublic help(n)
X Node n;
X{
X Node name;
X int op;
X
X name = n->value.arg[0];
X
X if ( name == nil ){
X help_help();
X return;
X }
X /* resolve aliasing first ...???
X
X if ( findalias(name->value.name,&s1,&s2) ){
X expand(p,str);
X }
X
X */
X
X op = findkeyword(name->value.name,0);
X
X if ( op )
X help_command(op,ident(name->value.name));
X else
X help_topic(ident(name->value.name));
X}
END-of-help.c
exit
Eric Brunner, IBM AWD Palo Alto
inet: brunner@monet.berkeley.edu or brunner%ibmsupt@uunet.uu.net
uucp: uunet!ibmsupt!brunner (415) 855-4486
Fix for dbx, part 2 of 5, IBM/4.3
Author: brunner
Date: Fri, 20 Oct 1989 19:43
Date: Fri, 20 Oct 1989 19:43
649 lines
16678 bytes
16678 bytes
Subject: Fix for dbx (part 2)
Index: /usr/src/ucb/dbx IBM/4.3
Description:
Several problems (too numerous to mention) exist
with the December release of dbx. This is part 1
of a 5 part patch installation kit. The contents
of the kit are:
part 1 shar file containing help.c
part 2 patchs to the following files:
dbx/ibmrt/{coredump.c,decode.c,frame.c,procinfo.c}
part 3 patchs to the following files:
dbx/{object.c,eval.c,commands.y,c.c,tree.c}
part 4 patchs to the following files:
dbx/{runtime.c,symbols.c,execute.c,events.c,mappings.c}
part 5 patches to the following files:
dbx/{stabstring.c,printsym.c,operators.c,process.c,
keywords.c,pascal.c,fortran.c,main.c,Makefile,
examine.c,scanner.c,source.c,library.c}
Fix: Change directories to /usr/src/ucb/dbx/ibmrt and
apply this patch file, e.g.,
patch < this_file
Proceede to the next part of the kit.
Inconsistencies between the several compilers (hc,
pp, f77) and the loader exist, stabs in particular.
These will be corrected in a following patch to dbx,
or in corrective releases of the compilers, or both.
*** /usr/src/ucb/dbx/ibmrt/coredump.c Fri Dec 9 11:56:20 1988
--- coredump.c Thu Oct 12 14:27:38 1989
***************
*** 1,9 ****
! /* $Header:coredump.c 12.0$ */
! /* $ACIS:coredump.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/ibmrt/RCS/coredump.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:coredump.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: coredump.c,v 12.1 89/10/12 17:27:35 brunner Locked $ */
! /* $Source: /fish/dbx/ibmrt/RCS/coredump.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: coredump.c,v 12.1 89/10/12 17:27:35 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 26,32 ****
#include <machine/reg.h>
#include <machine/vmparam.h>
#include <a.out.h>
!
#ifndef public
#include "machine.h"
--- 25,31 ----
#include <machine/reg.h>
#include <machine/vmparam.h>
#include <a.out.h>
! #include <sys/stat.h>
#ifndef public
#include "machine.h"
***************
*** 124,134 ****
register struct user *up;
char uarea[ctob(UPAGES)];
objfile = fopen(objname, "r");
if (objfile == nil) {
fatal("can't read \"%s\"", objname);
}
! get(objfile, hdr);
if (vaddrs) {
datamap.begin = 0;
datamap.end = 0xffffffff;
--- 123,152 ----
register struct user *up;
char uarea[ctob(UPAGES)];
+ struct stat c_stat, o_stat;
+
+ /* stat core & object, if older core, error */
+
+ stat(objname,&o_stat);
+ stat(corefile,&c_stat);
+ if ( o_stat.st_mtime > c_stat.st_mtime ){
+ badcore = true;
+ coredump_close();
+ return;
+ }
+
+
objfile = fopen(objname, "r");
if (objfile == nil) {
fatal("can't read \"%s\"", objname);
}
!
! if ( !get(objfile, hdr) ){
! badcore = true;
! coredump_close();
! return;
! }
!
if (vaddrs) {
datamap.begin = 0;
datamap.end = 0xffffffff;
***************
*** 137,142 ****
--- 155,166 ----
} else {
fread(uarea, ctob(UPAGES), 1, corefile);
up = (struct user *) (&uarea[(int)uoffset]);
+ if(strncmp(up->u_comm,objname,strlen(objname))){
+ badcore = true;
+ coredump_close();
+ return;
+ }
+
/* u_exdata is not part of 4.3 uarea
if (up->u_exdata.ux_tsize != hdr.a_text ||
up->u_exdata.ux_dsize != hdr.a_data ||
***************
*** 153,166 ****
stkmap.seekaddr = datamap.seekaddr + ctob(up->u_dsize);
switch (hdr.a_magic) {
case OMAGIC:
! datamap.begin = CODESTART;
datamap.end = CODESTART + ctob(up->u_tsize) + ctob(up->u_dsize);
break;
case NMAGIC:
case ZMAGIC:
! datamap.begin = (Address)
! ptob(btop(ctob(up->u_tsize) - 1) + 1) + CODESTART;
datamap.end = datamap.begin + ctob(up->u_dsize);
break;
--- 177,191 ----
stkmap.seekaddr = datamap.seekaddr + ctob(up->u_dsize);
switch (hdr.a_magic) {
case OMAGIC:
! datamap.begin = CODESTART ; /* this may be wrong too??? */
datamap.end = CODESTART + ctob(up->u_tsize) + ctob(up->u_dsize);
break;
case NMAGIC:
case ZMAGIC:
! datamap.begin = (Address) 0x10000000;
! /* ptob(btop(ctob(up->u_tsize) - 1) + 1) + CODESTART;*/
! /* the data segment on the RT starts at 0x10000000 */
datamap.end = datamap.begin + ctob(up->u_dsize);
break;
***************
*** 172,178 ****
public coredump_close ()
{
! fclose(objfile);
}
public coredump_readtext (buff, addr, nbytes)
--- 197,205 ----
public coredump_close ()
{
! coredump = false;
! if ( corefile ) fclose(corefile);
! if ( objfile ) fclose(objfile);
}
public coredump_readtext (buff, addr, nbytes)
***************
*** 331,336 ****
--- 358,364 ----
integer nbytes;
{
integer fileaddr;
+
if (a < stkmap.begin) {
fileaddr = datamap.seekaddr + a - datamap.begin;
*** /usr/src/ucb/dbx/ibmrt/decode.c Fri Dec 9 11:56:22 1988
--- decode.c Thu Oct 12 14:27:42 1989
***************
*** 1,9 ****
! /* $Header:decode.c 12.0$ */
! /* $ACIS:decode.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/ibmrt/RCS/decode.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:decode.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: decode.c,v 12.1 89/10/12 17:27:38 brunner Locked $ */
! /* $Source: /fish/dbx/ibmrt/RCS/decode.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: decode.c,v 12.1 89/10/12 17:27:38 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 106,112 ****
info = ltab[ ifmt = tp->fmt];
newaddr = addr + info; /* add length of instruction to address */
! printf("%08x ",addr);
cp = tp->opc;
bp = buf+1;
while( *buf++ = *cp++);
--- 105,114 ----
info = ltab[ ifmt = tp->fmt];
newaddr = addr + info; /* add length of instruction to address */
! /* Print the instruction address */
! addrprint(stdout, addr, true);
!
! /* printf("%08x ",addr);*/
cp = tp->opc;
bp = buf+1;
while( *buf++ = *cp++);
***************
*** 385,390 ****
--- 387,401 ----
return addr;
}
+ private boolean skipfunc (f)
+ Symbol f;
+ {
+ boolean b;
+
+ b = (boolean) (!inst_tracing && nlhdr.nlines && f && nosource(f));
+ return b;
+ }
+
public Address nextaddr (startaddr, isnext)
Address startaddr;
Boolean isnext;
***************
*** 394,399 ****
--- 405,411 ----
YOpCode inst;
int info;
int opcode, extend;
+ Symbol s;
addr = usignal(process);
if (addr != 0 && addr != 1) {
***************
*** 422,427 ****
--- 434,448 ----
}
} else {
addr = dojump(startaddr, info, true);
+ s = whatblock(addr);
+
+ if (skipfunc(s))
+ {
+ /* get the return address and continue to it */
+ addr = reg(15);
+ contto(addr);
+ bpact();
+ }
}
break;
case 0xe: /* extended branch - calls? */
***************
*** 435,440 ****
--- 456,470 ----
}
} else {
addr = dojump(startaddr, info, true);
+ s = whatblock(addr);
+
+ if (skipfunc(s))
+ {
+ /* get the return address and continue to it */
+ addr = reg(15);
+ contto(addr);
+ bpact();
+ }
}
break;
/*
***************
*** 454,491 ****
#define CALLSIZE 4 /* size of call instruction */
! public beginproc (p, argc)
! Symbol p;
! int argc;
{
! Word dest;
! Word save, callinst;
! Address addr;
! Name n;
! Symbol data;
! char buf[100];
! sprintf(buf, ".%s", symname(p));
! n = identname(buf, false);
! data = lookup(n);
! if (data == nil || data->class != VAR) {
! error("no data area for %s\n", symname(p));
! }
! addr = 4;
! iread(&save, addr, CALLSIZE);
! pc = 6;
! dest = codeloc(p);
! callinst = 0xdb00ecff;
! iwrite(&callinst, addr, CALLSIZE);
! setreg(15, dest);
! setreg(PROGCTR, pc);
! setreg(0, data->symvalue.offset);
! pstep(process, DEFSIG);
! iwrite(&save, addr, CALLSIZE);
! pc = reg(PROGCTR);
! if (not isbperr()) {
! printstatus();
! }
}
/*
--- 484,506 ----
#define CALLSIZE 4 /* size of call instruction */
! public beginproc (p)
! Symbol p;
{
! if ( !dataloc(p) )
! error("no data area for %s\n", symname(p));
!
! /* alter PC, set r0 to dataloc, set r15 to current PC for return addr */
! pc = reg(PROGCTR);
! setreg(PROGCTR,codeloc(p));
! setreg(0,dataloc(p));
! setreg(15,pc);
! pc = codeloc(p);
!
! if ( !isbperr() ) {
! printstatus();
! }
}
/*
***************
*** 539,541 ****
--- 554,597 ----
}
sp += n;
}
+
+ /*
+ * Print out the address of an instruction or a destination. Nicely.
+ */
+
+ public addrprint(f, addr, pad)
+ File f;
+ Address addr;
+ Boolean pad;
+ {
+ static Address funcaddr = 0;
+ static Symbol lastfunc = nil;
+ static char *funcname = nil;
+ Symbol newfunc;
+ int offset, l;
+
+ if((newfunc = whatblock(addr)) && symname(newfunc)) {
+ /* Find the containing function */
+ fprintf(f, "%08x ",addr);
+ /* newfunc = whatblock(addr);*/
+ if (newfunc != lastfunc) {
+ funcaddr = codeloc(newfunc);
+ funcname = symname(newfunc);
+ lastfunc = newfunc;
+ }
+ offset = addr - funcaddr;
+
+ if (offset)
+ l = fprintf(f,"(%s+0x%x) ",funcname, offset);
+ else
+ l = fprintf(f,"(%s) ",funcname);
+ if ( pad )
+ while ( l++ < 16 )
+ fputc(' ',f);
+ }
+ else {
+ fprintf(f,"%08x ",addr);
+ }
+ }
+
+
*** /usr/src/ucb/dbx/ibmrt/frame.c Fri Dec 9 11:56:25 1988
--- frame.c Thu Oct 12 14:27:47 1989
***************
*** 1,9 ****
! /* $Header:frame.c 12.0$ */
! /* $ACIS:frame.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/ibmrt/RCS/frame.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:frame.c 12.0$";
#endif
--- 1,8 ----
! /* $Header: frame.c,v 12.1 89/10/12 17:27:43 brunner Locked $ */
! /* $Source: /fish/dbx/ibmrt/RCS/frame.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: frame.c,v 12.1 89/10/12 17:27:43 brunner Locked $";
#endif
***************
*** 173,178 ****
--- 172,179 ----
register Address a;
char buf[4];
+ addr = tracetable_addr(addr);
+
for (a = addr; ; a++) {
if (!ValidText(a)) {
break;
***************
*** 330,335 ****
--- 331,337 ----
frp->reg[i] = reg(i);
}
}
+ else { error("getcurframe: findframe failed for addr 0x%x\n",a); }
}
/*
***************
*** 355,363 ****
return nil;
}
if (frp->prolog) {
! callpc = frp->reg[15];
} else {
dread(&callpc, frp->ap - LINKSIZE - 4, sizeof(callpc));
}
if (inSignalHandler(callpc)) {
sc = (struct sigcontext *) (frp->reg[1] + 3*sizeof(Word));
--- 357,366 ----
return nil;
}
if (frp->prolog) {
! callpc = frp->reg[15]-4;
} else {
dread(&callpc, frp->ap - LINKSIZE - 4, sizeof(callpc));
+ callpc -= 4;
}
if (inSignalHandler(callpc)) {
sc = (struct sigcontext *) (frp->reg[1] + 3*sizeof(Word));
***************
*** 696,757 ****
* Push the value associated with the current function.
*/
! public pushretval (len, isindirect)
! integer len;
! boolean isindirect;
{
! Word r0;
! r0 = reg(2);
! if (isindirect) {
! rpush((Address) r0, len);
! } else {
! switch (len) {
! case sizeof(char):
! push(char, r0);
! break;
! case sizeof(short):
! push(short, r0);
! break;
! default:
! if (len == sizeof(Word)) {
! push(Word, r0);
! } else if (len == 2*sizeof(Word)) {
! push(Word, r0);
! push(Word, reg(3));
! } else {
! error("[internal error: bad size %d in pushretval]", len);
! }
! break;
! }
}
! }
! /*
! * Flush the debuggee's standard output.
! *
! * This is VERY dependent on the use of stdio.
! */
! public flushoutput ()
! {
! Symbol p, iob;
!
! p = lookup(identname("fflush", true));
! while (p != nil and not isblock(p)) {
! p = p->next_sym;
! }
! if (p != nil) {
! iob = lookup(identname("_iob", true));
! if (iob != nil) {
! pushenv();
! pc = codeloc(p) - FUNCOFFSET;
! setreg(2, address(iob, nil) + sizeof(*stdout));
! beginproc(p, 1);
! stepto(return_addr());
! popenv();
}
}
}
--- 699,763 ----
* Push the value associated with the current function.
*/
! #define isdouble(t) ( t->class == RANGE && \
! (t->symvalue.rangev.upper == 0 && t->symvalue.rangev.lower == 8) )
!
! #define isfloat(t) ( t->class == RANGE && \
! (t->symvalue.rangev.upper == 0 && t->symvalue.rangev.lower == 4) )
!
! public pushretval (s)
! Symbol s;
{
! int len;
! boolean indirect;
! Symbol t;
! Word reg2;
! union {
! double d;
! float f;
! long l[2];
! } u;
! len = size(s);
! t = rtype(s);
! indirect = (t->class == RECORD || t->class == VARNT );
! reg2 = reg(2); /* funky RT function return in r2 */
! if ( indirect ){
! rpush((Address) reg2, len);
! }
! else if ( isfloat(t) ){ /* in case they use float regs someday.. */
! u.l[0] = reg2;
! push(float, u.f);
}
! else if ( isdouble(t) ){
! u.l[0] = reg2;
! u.l[1] = reg(3);
! push(double, u.d )
! }
! else {
! switch ( len ){
! case sizeof(char):
! push(char, reg2);
! break;
! case sizeof(short):
! push(short, reg2);
! break;
! default:
! if ( len == sizeof(Word) ){
! push(Word, reg2);
! }
! else if ( len == 2*sizeof(Word) ){
! push(Word, reg2);
! push(Word, reg(3));
! }
! else {
! error("[internal error: bad size %d in pushretval]", len);
! }
! break;
}
}
}
*** /usr/src/ucb/dbx/ibmrt/procinfo.c Fri Dec 9 11:56:28 1988
--- procinfo.c Thu Oct 12 14:30:51 1989
***************
*** 1,9 ****
! /* $Header:procinfo.c 12.0$ */
! /* $ACIS:procinfo.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/ibmrt/RCS/procinfo.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:procinfo.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: procinfo.c,v 12.1 89/10/12 17:30:50 brunner Locked $ */
! /* $Source: /fish/dbx/ibmrt/RCS/procinfo.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: procinfo.c,v 12.1 89/10/12 17:30:50 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 104,110 ****
}
for (i = 0; i < NFLREG; i++) {
sprintf(buf, "$fr%d", i);
! defregname(identname(buf, false), i + NREG);
}
defregname(identname("$ap", true), ARGP);
defregname(identname("$fp", true), FRP);
--- 103,110 ----
}
for (i = 0; i < NFLREG; i++) {
sprintf(buf, "$fr%d", i);
! /* defregname(identname(buf, false), i + NREG);*/
! deffregname(identname(buf, false), i + NREG,8);
}
defregname(identname("$ap", true), ARGP);
defregname(identname("$fp", true), FRP);
Eric Brunner, IBM AWD Palo Alto
inet: brunner@monet.berkeley.edu or brunner%ibmsupt@uunet.uu.net
uucp: uunet!ibmsupt!brunner (415) 855-4486
Fix for dbx, part 3 of 5, IBM/4.3
Author: brunner
Date: Fri, 20 Oct 1989 19:44
Date: Fri, 20 Oct 1989 19:44
2037 lines
47302 bytes
47302 bytes
Subject: Fix for dbx (part 3)
Index: /usr/src/ucb/dbx IBM/4.3
Description:
Several problems (too numerous to mention) exist
with the December release of dbx. This is part 1
of a 5 part patch installation kit. The contents
of the kit are:
part 1 shar file containing help.c
part 2 patchs to the following files:
dbx/ibmrt/{coredump.c,decode.c,frame.c,procinfo.c}
part 3 patchs to the following files:
dbx/{object.c,eval.c,commands.y,c.c,tree.c}
part 4 patchs to the following files:
dbx/{runtime.c,symbols.c,execute.c,events.c,mappings.c}
part 5 patches to the following files:
dbx/{stabstring.c,printsym.c,operators.c,process.c,
keywords.c,pascal.c,fortran.c,main.c,Makefile,
examine.c,scanner.c,source.c,library.c}
Fix: Change directories to /usr/src/ucb/dbx and
apply this patch file, e.g.,
patch < this_file
Proceede to the next part of the kit.
Inconsistencies between the several compilers (hc,
pp, f77) and the loader exist, stabs in particular.
These will be corrected in a following patch to dbx,
or in corrective releases of the compilers, or both.
*** /usr/src/ucb/dbx/object.c Fri Dec 9 11:57:21 1988
--- object.c Thu Oct 12 14:37:18 1989
***************
*** 1,9 ****
! /* $Header:object.c 12.0$ */
! /* $ACIS:object.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/object.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:object.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: object.c,v 12.1 89/10/12 17:37:17 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/object.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: object.c,v 12.1 89/10/12 17:37:17 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 100,109 ****
}
blkstack[curlevel] = curblock;
++curlevel;
- curblock = b;
if (traceblocks) {
! printf("entering block %s\n", symname(b));
}
}
/*
--- 99,109 ----
}
blkstack[curlevel] = curblock;
++curlevel;
if (traceblocks) {
! printf("current = %s entering block %s\n",
! symname(curblock), symname(b));
}
+ curblock = b;
}
/*
***************
*** 139,145 ****
}
--curlevel;
if (traceblocks) {
! printf("exiting block %s\n", symname(curblock));
}
curblock = blkstack[curlevel];
}
--- 139,146 ----
}
--curlevel;
if (traceblocks) {
! printf("exiting block %s to block %s\n",
! symname(curblock),symname(blkstack[curlevel]));
}
curblock = blkstack[curlevel];
}
***************
*** 249,260 ****
private foundglobals ()
{
! if (curblock->class != PROG) {
exitblock();
! if (curblock->class != PROG) {
! exitblock();
! }
! }
enterline(0, (linep-1)->addr + 1);
}
--- 250,258 ----
private foundglobals ()
{
! while ( curblock->class != PROG )
exitblock();
!
enterline(0, (linep-1)->addr + 1);
}
***************
*** 262,272 ****
* Read in symbols from object file.
*/
/* Has to be larger than maximum string table entry */
#define STRBUFSIZ (BUFSIZ * 4)
private char strbuf[STRBUFSIZ];
! private readsyms (f, fstr)
Fileid f, fstr;
{
register File fp;
--- 260,284 ----
* Read in symbols from object file.
*/
+ pr_np(name,np)
+ char *name;
+ struct nlist *np;
+ {
+ printf("entry: ");
+ if (name != nil) {
+ printf("name %s,", name);
+ }
+ else printf("<unnamed>");
+
+ printf("ntype %2x, desc %x, value %x'\n",
+ np->n_type, np->n_desc, np->n_value);
+ }
+
/* Has to be larger than maximum string table entry */
#define STRBUFSIZ (BUFSIZ * 4)
private char strbuf[STRBUFSIZ];
! /*private*/ readsyms (f, fstr)
Fileid f, fstr;
{
register File fp;
***************
*** 281,290 ****
--- 293,304 ----
foundstab = false;
np = &nl;
symcounter = nlhdr.nsyms;
+
if((symtabfp = fp = fdopen(f, "r")) == 0)
panic("fdopen1");
if((fpstr = fdopen(fstr, "r")) == 0)
panic("fdopen2");
+
while (symcounter--) {
fread(np, sizeof(*np), 1, fp);
i = np->n_un.n_strx;
***************
*** 306,311 ****
--- 320,328 ----
name = nil;
}
+ if ( tracesyms )
+ pr_np(name,np);
+
/*
* Assumptions:
* not an N_STAB ==> name != nil
***************
*** 328,334 ****
if (curcomm) {
curcomm->symvalue.common.chain = commchain;
}
! n = identname(name, true);
curcomm = lookup(n);
if (curcomm == nil) {
curcomm = insert(n);
--- 345,351 ----
if (curcomm) {
curcomm->symvalue.common.chain = commchain;
}
! n = identname(name, false);
curcomm = lookup(n);
if (curcomm == nil) {
curcomm = insert(n);
***************
*** 374,380 ****
* Source files.
*/
case N_SO:
! n = identname(name, true);
enterSourceModule(n, (Address) np->n_value);
break;
--- 391,397 ----
* Source files.
*/
case N_SO:
! n = identname(name, false);
enterSourceModule(n, (Address) np->n_value);
break;
***************
*** 382,388 ****
* Textually included files.
*/
case N_SOL:
! enterfile(name, (Address) np->n_value);
break;
/*
--- 399,406 ----
* Textually included files.
*/
case N_SOL:
! n = identname(name,false);
! enterfile(ident(n), (Address) np->n_value);
break;
/*
***************
*** 420,430 ****
default:
printf("warning: stab entry unrecognized: ");
! if (name != nil) {
! printf("name %s,", name);
! }
! printf("ntype %2x, desc %x, value %x'\n",
! np->n_type, np->n_desc, np->n_value);
break;
}
} else if (afterlg) {
--- 438,444 ----
default:
printf("warning: stab entry unrecognized: ");
! pr_np(name,np);
break;
}
} else if (afterlg) {
***************
*** 443,452 ****
--- 457,473 ----
} else if (name[0] == '_') {
check_local(&name[1], np);
}
+ else if((np->n_type&N_BSS)==N_BSS)
+ {
+ }
+ else
+ printf("readsym: ignored symbol: %s\n",name);
}
+
if (!foundstab) {
warning("no source compiled with -g");
}
+
fclose(fp);
fclose(fpstr);
}
***************
*** 478,495 ****
private initsyms ()
{
- curblock = nil;
curlevel = 0;
nesting = 0;
! program = insert(identname("", true));
program->class = PROG;
program->language = primlang;
! program->symvalue.funcv.beginaddr = CODESTART;
program->symvalue.funcv.inline = false;
newfunc(program, codeloc(program));
! findbeginning(program);
! enterblock(program);
curmodule = program;
}
/*
--- 499,515 ----
private initsyms ()
{
curlevel = 0;
nesting = 0;
! program = insert(identname("", false));
program->class = PROG;
program->language = primlang;
! codeloc(program) = CODESTART;
program->symvalue.funcv.inline = false;
newfunc(program, codeloc(program));
! curblock = program;
curmodule = program;
+ enterblock(program);
}
/*
***************
*** 520,526 ****
*var_isextref = false;
find(s, n) where
(
! s->level == program->level and (
s->class == EXTREF or s->class == VAR or
s->class == PROC or s->class == FUNC
)
--- 540,546 ----
*var_isextref = false;
find(s, n) where
(
! /*s->level == program->level and */(
s->class == EXTREF or s->class == VAR or
s->class == PROC or s->class == FUNC
)
***************
*** 550,556 ****
r->class = FUNC;
r->symvalue.funcv.src = false;
r->symvalue.funcv.inline = false;
! fdata(r->name, r->symvalue.offset);
}
return r;
}
--- 570,576 ----
r->class = FUNC;
r->symvalue.funcv.src = false;
r->symvalue.funcv.inline = false;
! dataloc(r) = r->symvalue.offset;
}
return r;
}
***************
*** 612,625 ****
char *name;
Address addr;
{
if (s->class == VAR) {
s->symvalue.offset = addr;
} else {
! s->symvalue.funcv.beginaddr = addr;
! if (name[0] == '_') {
newfunc(s, codeloc(s));
findbeginning(s);
}
}
}
--- 632,651 ----
char *name;
Address addr;
{
+
if (s->class == VAR) {
s->symvalue.offset = addr;
} else {
! if (name[0] == '_' && name[1] == '.') {
! codeloc(s) = addr;
newfunc(s, codeloc(s));
findbeginning(s);
}
+ /*****
+ else { /* assume dataloc
+ dataloc(s) = addr;
+ }
+ *****/
}
}
***************
*** 666,678 ****
isfunc = false;
if (name[0] == '_') {
if (name[1] == '.') {
! n = identname(&name[2], true);
isfunc = true;
} else {
! n = identname(&name[1], true);
}
} else {
! n = identname(name, true);
if (lookup(n) != nil) {
sprintf(buf, "$%s", name);
n = identname(buf, false);
--- 692,704 ----
isfunc = false;
if (name[0] == '_') {
if (name[1] == '.') {
! n = identname(&name[2], false);
isfunc = true;
} else {
! n = identname(&name[1], false);
}
} else {
! n = identname(name, false);
if (lookup(n) != nil) {
sprintf(buf, "$%s", name);
n = identname(buf, false);
***************
*** 703,709 ****
if (tracesyms) {
printdecl(t);
}
! } else if (t->class == FUNC) {
if (isfunc) {
updateTextSym(t, name, np->n_value);
}
--- 729,735 ----
if (tracesyms) {
printdecl(t);
}
! } else if (t->class == FUNC || t->class == PROC) {
if (isfunc) {
updateTextSym(t, name, np->n_value);
}
***************
*** 776,782 ****
return;
case PROC:
case FUNC:
! fdata(n, np->n_value);
return;
default:
warning("global %s ignored", ident(n));
--- 802,808 ----
return;
case PROC:
case FUNC:
! dataloc(t) = np->n_value;
return;
default:
warning("global %s ignored", ident(n));
***************
*** 794,818 ****
}
/*
- * Handle a data symbol with the same name as a known function.
- * These contain the address of function data areas.
- */
-
- private fdata (n, addr)
- Name n;
- Address addr;
- {
- char *str, *newstr;
- Symbol v;
-
- str = ident(n);
- newstr = mymalloc(strlen(str) + 2);
- sprintf(newstr, ".%s", str);
- v = defvar(identname(newstr, true), program, program->level);
- v->symvalue.offset = addr;
- }
-
- /*
* Check to see if a local _name is known in the current scope.
* If not then enter it.
*/
--- 820,825 ----
***************
*** 821,846 ****
String name;
register struct nlist *np;
{
! register Name n;
! register Symbol s, t;
if (name[0] == '.') {
! n = identname(&name[1], true);
} else {
! n = identname(name, true);
}
s = lookup(n);
! if ((np->n_type&N_TYPE) == N_TEXT) {
for (t = s; t != nil; t = t->next_sym) {
! if (t->name == n && t->block == curmodule) {
! return;
! }
}
! t = deffunc(n, curmodule, curmodule->level);
! t->symvalue.funcv.beginaddr = np->n_value;
! newfunc(t, codeloc(t));
! findbeginning(t);
! } else {
for (t = s; t != nil; t = t->next_sym) {
if (t->name == n && t->block == curblock) {
t->symvalue.offset = np->n_value;
--- 828,874 ----
String name;
register struct nlist *np;
{
! Name n;
! Symbol s, t;
! boolean is_code_addr, defined = false;
if (name[0] == '.') {
! n = identname(&name[1], false);
! is_code_addr = true;
} else {
! n = identname(name, false);
! is_code_addr = false;
}
s = lookup(n);
!
! /*
! * On the rt we have symbols that start with "_."
! * these are the only symbols which contain the TEXT address of a
! * function, the associated stab & plain "_" symbols contain a data
! * address which also contains the text address of the function.
! */
!
! if ((np->n_type&N_TYPE) == N_TEXT|| (np->n_type == N_DATA)){
for (t = s; t != nil; t = t->next_sym) {
! if (t->name == n && t->block == curmodule) {
! defined = true;
! break;
! }
}
! if ( !defined )
! t = deffunc(n, curmodule, curmodule->level);
!
! t->class = FUNC;
! if ( is_code_addr ){
! codeloc(t) = np->n_value;
! newfunc(t, codeloc(t));
! findbeginning(t);
! }
! else dataloc(t) = np->n_value;
! }
! else {
! /* update address if sym predefined in this block */
!
for (t = s; t != nil; t = t->next_sym) {
if (t->name == n && t->block == curblock) {
t->symvalue.offset = np->n_value;
***************
*** 847,855 ****
return;
}
}
for (t = s; t != nil; t = t->next_sym) {
if (t->name == n && t->block == curmodule && t->class == FUNC) {
! fdata(n, np->n_value);
return;
}
}
--- 875,886 ----
return;
}
}
+
+ /* set dataloc for func predefined in this module */
+
for (t = s; t != nil; t = t->next_sym) {
if (t->name == n && t->block == curmodule && t->class == FUNC) {
! dataloc(t) = np->n_value;
return;
}
}
***************
*** 879,885 ****
while (mname[i] != '/' and i >= 0) {
--i;
}
! n = identname(&mname[i+1], true);
find(s, n) where s->block == program and s->class == MODULE endfind(s);
if (s == nil) {
s = insert(n);
--- 910,916 ----
while (mname[i] != '/' and i >= 0) {
--i;
}
! n = identname(&mname[i+1], false);
find(s, n) where s->block == program and s->class == MODULE endfind(s);
if (s == nil) {
s = insert(n);
***************
*** 887,903 ****
s->class = MODULE;
s->level = program->level;
s->symvalue.funcv.beginaddr = 0;
! findbeginning(s);
! if (tracesyms) {
printdecl(s);
- }
}
! if (curblock->class != PROG) {
exitblock();
- if (curblock->class != PROG) {
- exitblock();
- }
- }
enterblock(s);
curmodule = s;
}
--- 918,929 ----
s->class = MODULE;
s->level = program->level;
s->symvalue.funcv.beginaddr = 0;
!
! if (tracesyms)
printdecl(s);
}
! while (curblock->class != PROG)
exitblock();
enterblock(s);
curmodule = s;
}
***************
*** 967,984 ****
*suffix = '\0';
}
if (!(*language_op(curlang, L_HASMODULES))()) {
! if (curblock->class != PROG) {
exitblock();
! if (curblock->class != PROG) {
! exitblock();
! }
! }
! nn = identname(mname, true);
if (curmodule == nil or curmodule->name != nn) {
s = insert(nn);
s->class = MODULE;
s->symvalue.funcv.beginaddr = 0;
- findbeginning(s);
} else {
s = curmodule;
}
--- 993,1006 ----
*suffix = '\0';
}
if (!(*language_op(curlang, L_HASMODULES))()) {
! while ( curblock->class != PROG )
exitblock();
!
! nn = identname(mname, false);
if (curmodule == nil or curmodule->name != nn) {
s = insert(nn);
s->class = MODULE;
s->symvalue.funcv.beginaddr = 0;
} else {
s = curmodule;
}
*** /usr/src/ucb/dbx/eval.c Fri Dec 9 11:56:47 1988
--- eval.c Thu Oct 12 14:36:58 1989
***************
*** 1,9 ****
! /* $Header:eval.c 12.0$ */
! /* $ACIS:eval.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/eval.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:eval.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: eval.c,v 12.1 89/10/12 17:36:56 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/eval.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: eval.c,v 12.1 89/10/12 17:36:56 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 31,36 ****
--- 30,36 ----
#include <math.h>
#include <ieee.h>
+ extern Node findvar();
#ifndef public
#include "machine.h"
***************
*** 144,155 ****
if (s == retaddrsym) {
push(long, return_addr());
} else if (isvariable(s)) {
- if (s != program && !isactive(container(s))) {
- error("\"%s\" is not active", symname(s));
- }
addr = address(s, nil);
if (isvarparam(s) && !isopenarray(s)) {
! if (s->storage == INREG || preg(s, nil) != -1) {
pushregvalue(s, addr, nil, sizeof(Address));
} else {
rpush(addr, sizeof(Address));
--- 144,152 ----
if (s == retaddrsym) {
push(long, return_addr());
} else if (isvariable(s)) {
addr = address(s, nil);
if (isvarparam(s) && !isopenarray(s)) {
! if (s->storage == INREG) {
pushregvalue(s, addr, nil, sizeof(Address));
} else {
rpush(addr, sizeof(Address));
***************
*** 215,222 ****
case O_INDIR:
case O_RVAL:
- addr = pop(long);
s = p->nodetype;
len = size(s);
if (s->class != REF &&
(s->storage == INREG || (s->param && preg(s, nil) != -1))
--- 212,223 ----
case O_INDIR:
case O_RVAL:
s = p->nodetype;
+
+ if ( s->language == primlang && s->storage != INREG )
+ break;
+
+ addr = ( sp > &stack[0] ) ? pop(long) : 0;
len = size(s);
if (s->class != REF &&
(s->storage == INREG || (s->param && preg(s, nil) != -1))
***************
*** 369,374 ****
--- 370,379 ----
printnews();
break;
+ case O_LISTI:
+ listi(p);
+ break;
+
case O_LIST:
list(p);
break;
***************
*** 422,437 ****
break;
case O_STEP:
! b = inst_tracing;
! inst_tracing = (Boolean) (!p->value.step.source);
! if (p->value.step.skipcalls) {
! next();
! } else {
! stepc();
}
- inst_tracing = b;
- useInstLoc = (Boolean) (!p->value.step.source);
- printnews();
break;
case O_WHATIS:
--- 427,447 ----
break;
case O_STEP:
! {
! int i;
! b = inst_tracing;
! inst_tracing = (Boolean) (!p->value.step.source);
!
! for(i = p->value.step.count; i ; i--)
! {
! if (p->value.step.skipcalls) next();
! else stepc();
! }
!
! inst_tracing = b;
! useInstLoc = (Boolean) (!p->value.step.source);
! printnews();
}
break;
case O_WHATIS:
***************
*** 508,513 ****
--- 518,531 ----
}
break;
+ case O_CLEAR:
+ clearbps(p);
+ break;
+
+ case O_CLEARI:
+ clearbps_i(p);
+ break;
+
case O_EDIT:
edit(p->value.scon);
break;
***************
*** 535,546 ****
}
break;
! case O_GRIPE:
! gripe();
break;
case O_HELP:
! help();
break;
case O_IGNORE:
--- 553,564 ----
}
break;
! case O_GOTO:
! changepc(p);
break;
case O_HELP:
! help(p);
break;
case O_IGNORE:
***************
*** 560,565 ****
--- 578,587 ----
}
break;
+ case O_REGS:
+ registers();
+ break;
+
case O_RUN:
run();
break;
***************
*** 620,625 ****
--- 642,651 ----
}
break;
+ case O_DELALL:
+ deleteall();
+ break;
+
case O_ENDX:
endprogram();
break;
***************
*** 639,647 ****
break;
case O_PRINTIFCHANGED:
! printifchanged(p->value.arg[0]);
break;
case O_PRINTRTN:
printrtn(p->value.sym);
break;
--- 665,677 ----
break;
case O_PRINTIFCHANGED:
! printifchanged(p->value.arg[0],true);
break;
+ case O_PRINTIIFCHANGED:
+ printifchanged(p->value.arg[0],false);
+ break;
+
case O_PRINTRTN:
printrtn(p->value.sym);
break;
***************
*** 654,664 ****
printlines(nil, curline, curline);
} else if (p->value.arg[0]->op == O_QLINE) {
if (p->value.arg[0]->value.arg[1]->value.lcon == 0) {
- printf("tracei: ");
printinst(pc, pc);
} else {
if (canReadSource()) {
- printf("trace: ");
printlines(nil, curline, curline);
}
}
--- 684,692 ----
***************
*** 678,686 ****
break;
case O_STOPIFCHANGED:
! stopifchanged(p->value.arg[0]);
break;
case O_STOPX:
isstopped = true;
break;
--- 706,718 ----
break;
case O_STOPIFCHANGED:
! stopifchanged(p->value.arg[0],true);
break;
+ case O_STOPIIFCHANGED:
+ stopifchanged(p->value.arg[0],false);
+ break;
+
case O_STOPX:
isstopped = true;
break;
***************
*** 1095,1101 ****
* Set up breakpoint for tracing data.
*/
! private tracedata (op, exp, place, cond)
Operator op;
Node exp;
Node place;
--- 1127,1133 ----
* Set up breakpoint for tracing data.
*/
! private tracedata(op, exp, place, cond)
Operator op;
Node exp;
Node place;
***************
*** 1112,1118 ****
if (p == nil) {
p = program;
}
! action = build(O_PRINTIFCHANGED, exp);
if (cond != nil) {
action = build(O_IF, cond, buildcmdlist(action));
}
--- 1144,1151 ----
if (p == nil) {
p = program;
}
! if(op == O_TRACE) action = build(O_PRINTIFCHANGED, exp);
! else action = build(O_PRINTIIFCHANGED, exp);
if (cond != nil) {
action = build(O_IF, cond, buildcmdlist(action));
}
***************
*** 1128,1134 ****
* Setting and unsetting of stops.
*/
! public stop (p)
Node p;
{
Node exp, place, cond, t;
--- 1161,1167 ----
* Setting and unsetting of stops.
*/
! public stop(p)
Node p;
{
Node exp, place, cond, t;
***************
*** 1183,1188 ****
--- 1216,1223 ----
event = build(O_EQ, build(O_SYM, linesym), place);
} else {
event = build(O_EQ, build(O_SYM, pcsym), place);
+ if(place->op == O_LCON && (int) place->value.lcon >= 0x10000000)
+ warning("instruction breakpoint set at data address");
}
e = addevent(event, buildcmdlist(action));
if (isstdin()) {
***************
*** 1195,1201 ****
* the variable list.
*/
! private stopvar (op, exp, place, cond)
Operator op;
Node exp;
Node place;
--- 1230,1236 ----
* the variable list.
*/
! private stopvar(op, exp, place, cond)
Operator op;
Node exp;
Node place;
***************
*** 1220,1226 ****
} else {
p = place->value.sym;
}
! action = build(O_STOPIFCHANGED, exp);
if (cond != nil) {
action = build(O_IF, cond, buildcmdlist(action));
}
--- 1255,1262 ----
} else {
p = place->value.sym;
}
! if(op == O_STOP) action = build(O_STOPIFCHANGED, exp);
! else action = build(O_STOPIIFCHANGED, exp);
if (cond != nil) {
action = build(O_IF, cond, buildcmdlist(action));
}
***************
*** 1498,1528 ****
# endif
}
/*
! * Give the user some help.
*/
! public help ()
{
! puts("run - begin execution of the program");
! puts("print <exp> - print the value of the expression");
! puts("where - print currently active procedures");
! puts("stop at <line> - suspend execution at the line");
! puts("stop in <proc> - suspend execution when <proc> is called");
! puts("cont - continue execution");
! puts("step - single step one line");
! puts("next - step to next line (skip over calls)");
! puts("trace <line#> - trace execution of the line");
! puts("trace <proc> - trace calls to the procedure");
! puts("trace <var> - trace changes to the variable");
! puts("trace <exp> at <line#> - print <exp> when <line> is reached");
! puts("status - print trace/stop's in effect");
! puts("delete <number> - remove trace or stop of given number");
! puts("call <proc> - call a procedure in program");
! puts("whatis <name> - print the declaration of the name");
! puts("list <line>, <line> - list source lines");
! puts("gripe - send mail to the person in charge of dbx");
! puts("quit - exit dbx");
}
/*
--- 1534,1574 ----
# endif
}
+
/*
! * Set the program counter to be at a particular place in the code.
*/
! public changepc (p)
! Node p;
{
! Address goaddr;
! String fn;
! long ln;
! Symbol oldfunc;
!
! /* if (noexec)
! error("program is not executable");*/
! oldfunc = curfunc;
! if (p->value.arg[0]->op == O_QLINE) {
! fn = p->value.arg[0]->value.arg[0]->value.scon;
! ln = p->value.arg[0]->value.arg[1]->value.lcon;
! goaddr = objaddr(ln, fn);
! } else {
! eval(p->value.arg[0]);
! goaddr = pop(long);
! }
! if (goaddr != NOADDR) {
! setcurfunc(whatblock(goaddr));
! if ((curfunc != oldfunc) && (!(varIsSet("$unsafegoto")))) {
! curfunc = oldfunc;
! error("Goto address is not within current function. (set $unsafegoto to override)");
! } else {
! setreg(PROGCTR, pc = goaddr);
! getsrcpos();
! printstatus();
! }
! }
}
/*
***************
*** 1659,1662 ****
--- 1705,1865 ----
" mapped to %.17g\n",
xw[0],xw[1],xw[2], dsign?"-":"", g1, n, *(double *)t);
return ;
+ }
+ /*
+ * Execute a listi command.
+ */
+
+ private listi (p)
+ Node p;
+ {
+ static Address old_pc;
+ Address addr1, addr2;
+ long t1, t2;
+ Symbol f;
+ Node wnode;
+ int wsize;
+
+ wnode = findvar(identname("$listwindow",true));
+ if ( !wnode )
+ wsize = inst_windowsize;
+ else {
+ eval(wnode);
+ wsize = pop(integer);
+ }
+
+ if (p->value.arg[0]->op == O_SYM)
+ {
+ f = p->value.arg[0]->value.sym;
+ addr1 = firstline(f);
+ if (addr1 == NOADDR) {
+ error("no source lines for \"%s\"", symname(f));
+ }
+ printninst(wsize,addr1);
+ }
+ else
+ {
+ eval(p->value.arg[0]);
+ t1 = pop(long);
+ addr1 = (Address) t1;
+ eval(p->value.arg[1]);
+ t2 = pop(long);
+ addr2 = (Address) t2;
+ if ((t1 < 0) || (t2 < 0))
+ {
+ beginerrmsg();
+ fprintf(stderr, "Addresses must be positive\n");
+ return;
+ }
+ if (addr2 == 0)
+ {
+ if (addr1 == 0) /* No line numbers specified */
+ {
+ if (prtaddr && (old_pc == pc))
+ printninst(wsize,prtaddr);
+ else
+ printninst(wsize,pc);
+ }
+ else /* Only 1st line specified */
+ {
+ printninst(wsize,addr1);
+ }
+ } /* end if no ending line specified */
+ else
+ {
+ if (addr1 == 0) /* print assembly code given source line # */
+ {
+ addr1 = objaddr(addr2,cursource);
+ if (addr1 == NOADDR) {
+ error("No assembly code for that source line number");
+ }
+ printninst(wsize,addr1);
+ }
+ else if (addr2 < addr1)
+ {
+ beginerrmsg();
+ fprintf(stderr, "second number must be greater than first\n");
+ return;
+ }
+ else /* Both lines specified */
+ {
+ if ((addr2 - addr1) < wsize)
+ printninst(wsize,addr1);
+ else
+ printinst(addr1,addr2, false);
+ }
+ }
+ }
+ old_pc = pc;
+ }
+
+ /*
+ * Execute a registers command to print out the registers in readable form.
+ */
+ #define NGREG 16
+ /* Register mnemonics */
+ char *regnames[] = {
+ "r0", /* register 00 */
+ "r1", /* register 01 */
+ "r2", /* register 02 */
+ "r3", /* register 03 */
+ "r4", /* register 04 */
+ "r5", /* register 05 */
+ "r6", /* register 06 */
+ "r7", /* register 07 */
+ "r8", /* register 08 */
+ "r9", /* register 09 */
+ "r10", /* register 0A */
+ "r11", /* register 0B */
+ "r12", /* register 0C */
+ "sp", /* register 0D */
+ "r14", /* register 0E */
+ "r15", /* register 0F */
+ };
+
+ registers () {
+ int p, i;
+
+ for (p = 0; p < (NREG-1) / 4; ++p)
+ {
+ for (i = 0; i < NREG-1; i += 4)
+ {
+ printf("%5s: ", regnames[p + i]);
+ printf("%08x ", reg(p + i));
+ }
+ printf("\n");
+ }
+ printf("%5s: ","pc");
+ printf("%08X ", reg(PROGCTR));
+ printf("\n");
+
+ printf("\n");
+ if (varIsSet("$flregs"))
+ {
+ prflregs();
+ printf("\n");
+ }
+
+ }
+
+ /*
+ * Print out the values of the floating point registers.
+ */
+ prflregs()
+ {
+ int i;
+ union {
+ double d;
+ float f[2];
+ long l[2];
+ } u;
+
+
+ printf("\n");
+ for (i = 0; i < NFLREG; i ++)
+ {
+ printf(" dr%d: %08.8x ", i,reg(i+NREG));
+ prtreal(true, (double) reg(i+NREG));
+ printf("\n");
+ }
}
*** /usr/src/ucb/dbx/commands.y Fri Dec 9 11:56:39 1988
--- commands.y Thu Oct 12 14:37:33 1989
***************
*** 1,6 ****
! /* $Header:commands.y 12.0$ */
! /* $ACIS:commands.y 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/commands.y,v $ */
%{
/* Copyright (c) 1982 Regents of the University of California */
--- 1,5 ----
! /* $Header: commands.y,v 12.1 89/10/12 17:37:32 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/commands.y,v $ */
%{
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 21,33 ****
#include "lists.h"
private String curformat = "X";
%}
%term
! ALIAS AND ASSIGN AT CALL CATCH CONT DEBUG DELETE DIV DOWN DUMP
! EDIT FILE FUNC GRIPE HELP IF IGNORE IN LIST MOD NEXT NEXTI NIL NOT OR
! PRINT PSYM QUIT RERUN RETURN RUN SET SH SKIP SOURCE STATUS STEP STEPI
STOP STOPI TRACE TRACEI UNALIAS UNSET UP USE
WHATIS WHEN WHERE WHEREIS WHICH
--- 20,34 ----
#include "lists.h"
private String curformat = "X";
+ boolean instlevel = false;
%}
%term
! ALIAS ALL AND ASSIGN AT CALL CATCH CLEAR CLEARI CONT DEBUG DELETE DIV DOWN DUMP
! EDIT FILE FUNC GOTO GOTOI HELP IF IGNORE IN LIST LISTI MOD NEXT NEXTI NIL NOT OR
! PRINT PSYM QUIT REGISTERS RERUN RETURN RUN SET SH SKIP SOURCE
! STATUS STEP STEPI
STOP STOPI TRACE TRACEI UNALIAS UNSET UP USE
WHATIS WHEN WHERE WHEREIS WHICH
***************
*** 64,75 ****
%type <y_char> CHAR
%type <y_real> REAL
%type <y_string> STRING redirectout filename opt_filename mode
! %type <y_name> ALIAS AND ASSIGN AT CALL CATCH CONT
%type <y_name> DEBUG DELETE DIV DOWN DUMP
! %type <y_name> EDIT FILE FUNC GRIPE HELP IF IGNORE IN LIST MOD
%type <y_name> NEXT NEXTI NIL NOT OR
! %type <y_name> PRINT PSYM QUIT RERUN RETURN RUN SET SH SKIP SOURCE STATUS
! %type <y_name> STEP STEPI STOP STOPI TRACE TRACEI
%type <y_name> UNALIAS UNSET UP USE WHATIS WHEN WHERE WHEREIS WHICH
%type <y_name> name NAME keyword
%type <y_node> opt_qual_symbol symbol
--- 65,76 ----
%type <y_char> CHAR
%type <y_real> REAL
%type <y_string> STRING redirectout filename opt_filename mode
! %type <y_name> ALIAS ALL AND ASSIGN AT CALL CATCH CLEAR CLEARI CONT
%type <y_name> DEBUG DELETE DIV DOWN DUMP
! %type <y_name> EDIT FILE FUNC GOTO GOTOI HELP IF IGNORE IN LIST LISTI MOD
%type <y_name> NEXT NEXTI NIL NOT OR
! %type <y_name> PRINT PSYM QUIT REGISTERS RERUN RETURN RUN SET SH SKIP
! %type <y_name> SOURCE STATUS STEP STEPI STOP STOPI TRACE TRACEI
%type <y_name> UNALIAS UNSET UP USE WHATIS WHEN WHERE WHEREIS WHICH
%type <y_name> name NAME keyword
%type <y_node> opt_qual_symbol symbol
***************
*** 76,83 ****
%type <y_node> command rcommand cmd step what where examine
%type <y_node> event opt_exp_list opt_cond
%type <y_node> exp_list exp term boolean_exp constant address
! %type <y_node> integer_list alias_command list_command line_number
! %type <y_cmdlist> actions
%type <y_list> sourcepath name_list
%%
--- 77,85 ----
%type <y_node> command rcommand cmd step what where examine
%type <y_node> event opt_exp_list opt_cond
%type <y_node> exp_list exp term boolean_exp constant address
! %type <y_node> integer_list alias_command listi_command list_command
! %type <y_node> line_number
! %type <y_cmdlist> actions actionlist
%type <y_list> sourcepath name_list
%%
***************
*** 155,160 ****
--- 157,177 ----
$$ = build(O_CATCH, 0);
}
|
+ CLEAR line_number
+ {
+ $$ = build(O_CLEAR, build(O_SCON, strdup(cursource)), $2);
+ }
+ |
+ CLEARI address
+ {
+ $$ = build(O_CLEARI, $2);
+ }
+ |
+ CLEAR STRING ':' line_number
+ {
+ $$ = build(O_CLEAR, build(O_SCON, $2), $4);
+ }
+ |
CONT
{
$$ = build(O_CONT, (long) DEFSIG);
***************
*** 170,175 ****
--- 187,197 ----
$$ = build(O_DELETE, $2);
}
|
+ DELETE ALL
+ {
+ $$ = build(O_DELALL);
+ }
+ |
DOWN
{
$$ = build(O_DOWN, build(O_LCON, (long) 1));
***************
*** 200,213 ****
$$ = build(O_FUNC, $2);
}
|
! GRIPE
{
! $$ = build(O_GRIPE);
}
|
HELP
{
! $$ = build(O_HELP);
}
|
IGNORE signal
--- 222,253 ----
$$ = build(O_FUNC, $2);
}
|
! GOTO line_number
{
! if (!instlevel)
! $$ = build(O_GOTO, build(O_QLINE, build(O_SCON, strdup(cursource)), $2));
! else
! $$ = build(O_GOTO, unrval($2));
}
|
+ GOTO STRING ':' line_number
+ {
+ $$ = build(O_GOTO, build(O_QLINE, build(O_SCON, $2), $4));
+ }
+ |
+ GOTOI address
+ {
+ $$ = build(O_GOTO, $2);
+ }
+ |
+ HELP name
+ {
+ $$ = build(O_HELP,build(O_NAME,$2));
+ }
+ |
HELP
{
! $$ = build(O_HELP, 0);
}
|
IGNORE signal
***************
*** 220,225 ****
--- 260,270 ----
$$ = build(O_IGNORE, 0);
}
|
+ listi_command
+ {
+ $$ = $1;
+ }
+ |
list_command
{
$$ = $1;
***************
*** 291,296 ****
--- 336,346 ----
$$ = build($1, nil, $2, $3);
}
|
+ stop what where opt_cond
+ {
+ $$ = build($1, $2, $3, $4);
+ }
+ |
stop what opt_cond
{
$$ = build($1, $2, nil, $3);
***************
*** 364,372 ****
$$ = build(O_WHATIS, $2);
}
|
! WHEN event '{' actions '}'
{
! $$ = build(O_ADDEVENT, $2, $4);
}
|
WHEREIS name
--- 414,422 ----
$$ = build(O_WHATIS, $2);
}
|
! WHEN event actions
{
! $$ = build(O_ADDEVENT, $2, $3);
}
|
WHEREIS name
***************
*** 456,478 ****
step:
STEP
{
! $$ = build(O_STEP, true, false);
}
|
STEPI
{
! $$ = build(O_STEP, false, false);
}
|
NEXT
{
! $$ = build(O_STEP, true, true);
}
|
NEXTI
{
! $$ = build(O_STEP, false, true);
}
;
shellmode:
/* empty */
--- 506,548 ----
step:
STEP
{
! $$ = build(O_STEP, true, false, 1);
}
|
STEPI
{
! $$ = build(O_STEP, false, false, 1);
}
|
NEXT
{
! $$ = build(O_STEP, true, true, 1);
}
|
NEXTI
{
! $$ = build(O_STEP, false, true, 1);
}
+ |
+ STEP INT
+ {
+ $$ = build(O_STEP, true, false, $2);
+ }
+ |
+ STEPI INT
+ {
+ $$ = build(O_STEP, false, false, $2);
+ }
+ |
+ NEXT INT
+ {
+ $$ = build(O_STEP, true, true, $2);
+ }
+ |
+ NEXTI INT
+ {
+ $$ = build(O_STEP, false, true, $2);
+ }
;
shellmode:
/* empty */
***************
*** 498,515 ****
exp
;
actions:
! actions cmd ';'
{
! $$ = $1;
! cmdlist_append($2, $$);
}
|
! cmd ';'
{
! $$ = list_alloc();
! cmdlist_append($1, $$);
}
;
cmd:
command
|
--- 568,594 ----
exp
;
actions:
! '{' actionlist '}'
{
! $$ = $2;
}
|
! '{' actionlist ';' '}'
{
! $$ = $2;
}
;
+ actionlist:
+ cmd
+ {
+ $$ = buildcmdlist($1);
+ }
+ |
+ actionlist ';' cmd
+ {
+ cmdlist_append($3, $$);
+ }
+ ;
cmd:
command
|
***************
*** 565,570 ****
--- 644,654 ----
$$ = build(O_DUMP, build(O_SYM, curfunc));
}
|
+ REGISTERS
+ {
+ $$ = build(O_REGS, nil);
+ }
+ |
STATUS
{
$$ = build(O_STATUS);
***************
*** 615,625 ****
--- 699,711 ----
trace:
TRACE
{
+ instlevel = false;
$$ = O_TRACE;
}
|
TRACEI
{
+ instlevel = true;
$$ = O_TRACEI;
}
;
***************
*** 626,636 ****
--- 712,724 ----
stop:
STOP
{
+ instlevel = false;
$$ = O_STOP;
}
|
STOPI
{
+ instlevel = true;
$$ = O_STOPI;
}
;
***************
*** 651,660 ****
$$ = unrval($2);
}
|
! AT line_number
{
$$ = build(O_QLINE, build(O_SCON, strdup(cursource)), $2);
}
|
AT STRING ':' line_number
{
--- 739,756 ----
$$ = unrval($2);
}
|
! /* AT line_number
{
$$ = build(O_QLINE, build(O_SCON, strdup(cursource)), $2);
}
+ */
+ AT address
+ {
+ if (!instlevel)
+ $$ = build(O_QLINE, build(O_SCON, strdup(cursource)), $2);
+ else
+ $$ = unrval($2);
+ }
|
AT STRING ':' line_number
{
***************
*** 689,694 ****
--- 785,816 ----
$$ = nil;
}
;
+ listi_command:
+ LISTI
+ {
+ $$ = build(O_LISTI, build(O_LCON, (long) 0), build(O_LCON, (long) 0));
+ }
+ |
+ LISTI address
+ {
+ $$ = build(O_LISTI, $2, build(O_LCON, (long) 0));
+ }
+ |
+ LISTI address ',' address
+ {
+ $$ = build(O_LISTI, $2, $4);
+ }
+ |
+ LISTI opt_qual_symbol
+ {
+ $$ = build(O_LISTI, $2);
+ }
+ |
+ LISTI AT line_number
+ {
+ $$ = build(O_LISTI, build(O_LCON, (long) 0), $3);
+ }
+ ;
list_command:
LIST
{
***************
*** 764,770 ****
$$ = build(O_LCON, (long) prtaddr);
}
|
! '&' term
{
$$ = amper($2);
}
--- 886,893 ----
$$ = build(O_LCON, (long) prtaddr);
}
|
! /* '&' term*/
! '&' exp %prec NOT
{
$$ = amper($2);
}
***************
*** 1080,1089 ****
$$ = $1;
}
keyword:
! ALIAS | AND | ASSIGN | AT | CALL | CATCH | CONT | DEBUG | DELETE | DIV |
! DOWN | DUMP | EDIT | FILE | FUNC | GRIPE | HELP | IGNORE | IN | LIST |
! MOD | NEXT | NEXTI | NIL | NOT | OR | PRINT | PSYM | QUIT |
! RERUN | RETURN | RUN | SET | SH | SKIP | SOURCE | STATUS | STEP | STEPI |
STOP | STOPI | TRACE | TRACEI | UNALIAS | UNSET | UP | USE |
WHATIS | WHEN | WHERE | WHEREIS | WHICH
;
--- 1203,1213 ----
$$ = $1;
}
keyword:
! ALIAS | ALL | AND | ASSIGN | AT | CALL | CATCH | CLEAR | CLEARI | CONT | DEBUG | DELETE | DIV |
! DOWN | DUMP | EDIT | FILE | FUNC | GOTO | GOTOI | HELP | IGNORE | IN | LIST |
! LISTI | MOD | NEXT | NEXTI | NIL | NOT | OR | PRINT | PSYM | QUIT |
! REGISTERS | RERUN | RETURN | RUN | SET | SH | SKIP | SOURCE |
! STATUS | STEP | STEPI |
STOP | STOPI | TRACE | TRACEI | UNALIAS | UNSET | UP | USE |
WHATIS | WHEN | WHERE | WHEREIS | WHICH
;
*** /usr/src/ucb/dbx/c.c Fri Dec 9 11:56:33 1988
--- c.c Thu Oct 12 14:36:53 1989
***************
*** 1,9 ****
! /* $Header:c.c 12.0$ */
! /* $ACIS:c.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/c.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:c.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: c.c,v 12.1 89/10/12 17:36:52 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/c.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: c.c,v 12.1 89/10/12 17:36:52 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 35,40 ****
--- 34,40 ----
#define isrange(t, name) (t->class == RANGE && istypename(t->type, name))
+ extern Boolean expandunions;
private Language langC;
private Language langCplpl;
***************
*** 450,458 ****
public c_printval (s)
Symbol s;
{
! register Symbol t;
! register Address a;
! integer i, len;
switch (s->class) {
case CONST:
--- 450,458 ----
public c_printval (s)
Symbol s;
{
! Symbol t;
! Address a;
! int i, len;
switch (s->class) {
case CONST:
***************
*** 464,469 ****
--- 464,476 ----
c_printval(s->type);
break;
+ case VARNT:
+ if ( expandunions )
+ printunion(s);
+ else
+ goto DEFAULT;
+ break;
+
case FIELD:
if (isbitfield(s)) {
i = extractField(s);
***************
*** 560,565 ****
--- 567,573 ----
break;
default:
+ DEFAULT:
if (ord(s->class) > ord(TYPEREF)) {
panic("printval: bad class %d", ord(s->class));
}
***************
*** 584,590 ****
savesp = sp;
printf("(");
f = s->chain;
! for (;;) {
off = f->symvalue.field.offset;
len = f->symvalue.field.length;
n = (off + len + BITSPERBYTE - 1) div BITSPERBYTE;
--- 592,598 ----
savesp = sp;
printf("(");
f = s->chain;
! for (;f;) {
off = f->symvalue.field.offset;
len = f->symvalue.field.length;
n = (off + len + BITSPERBYTE - 1) div BITSPERBYTE;
***************
*** 597,602 ****
--- 605,645 ----
printf(", ");
}
printf(")");
+ }
+
+ printunion(s)
+ Symbol s;
+ {
+ Symbol t;
+ long i;
+ Stack *sp_top, *sp_base;
+
+ sp_top = sp;
+ sp_base = sp - size(s);
+
+ printf( "union: (");
+ for ( s = s->chain; s; s = s->chain ){
+ printf( "%s = ", symname(s));
+
+ sp = sp_base + size(s);
+ if ( isbitfield(s) ){
+ i = extractField(s);
+ t = rtype(s->type);
+ if ( t->class == SCAL )
+ printEnum(i, t);
+ else
+ printRangeVal(i, t);
+ }
+ else
+ c_printval(s->type);
+ sp = sp_top;
+
+ if ( s->chain ){
+ printf( ", ");
+ }
+ }
+ sp = sp_base;
+ printf( ")");
}
/*
*** /usr/src/ucb/dbx/tree.c Fri Dec 9 11:57:50 1988
--- tree.c Thu Oct 12 14:37:31 1989
***************
*** 1,9 ****
! /* $Header:tree.c 12.0$ */
! /* $ACIS:tree.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/tree.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:tree.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: tree.c,v 12.1 89/10/12 17:37:30 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/tree.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: tree.c,v 12.1 89/10/12 17:37:30 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 39,44 ****
--- 38,44 ----
#include "events.h"
#define MAXNARGS 5
+ extern boolean hexaddr;
struct Node {
Operator op;
***************
*** 62,67 ****
--- 62,68 ----
struct {
Boolean source;
Boolean skipcalls;
+ int count;
} step;
struct {
String mode;
***************
*** 178,183 ****
--- 179,185 ----
case O_STEP:
p->value.step.source = va_arg(ap, Boolean);
p->value.step.skipcalls = va_arg(ap, Boolean);
+ p->value.step.count = va_arg(ap, int);
break;
case O_EXAMINE:
***************
*** 281,287 ****
case O_SYM:
s = p->value.sym;
if (isblock(s)) {
! r = build(O_LCON, codeloc(s));
} else {
notregsym(s);
r = build(O_LCON, address(s, nil));
--- 283,291 ----
case O_SYM:
s = p->value.sym;
if (isblock(s)) {
! if ( s->class == PROC || s->class == FUNC && !isinline(s) )
! r = build(O_LCON, dataloc(s));
! else r = build(O_LCON, codeloc(s));
} else {
notregsym(s);
r = build(O_LCON, address(s, nil));
***************
*** 348,355 ****
--- 352,361 ----
switch (cmd->op) {
case O_PRINTIFCHANGED:
+ case O_PRINTIIFCHANGED:
case O_PRINTSRCPOS:
case O_STOPIFCHANGED:
+ case O_STOPIIFCHANGED:
case O_TRACEON:
break;
***************
*** 470,476 ****
prtree(f, ifcmd->value.event.cond);
done = true;
}
! } else if (ifcmd->op == O_STOPIFCHANGED) {
fprintf(f, "stop");
fprintI(f, cmd->value.trace.inst);
fprintf(f, " ");
--- 476,482 ----
prtree(f, ifcmd->value.event.cond);
done = true;
}
! } else if (ifcmd->op == O_STOPIFCHANGED || ifcmd->op == O_STOPIIFCHANGED){
fprintf(f, "stop");
fprintI(f, cmd->value.trace.inst);
fprintf(f, " ");
***************
*** 521,527 ****
break;
case O_LCON:
! fprintf(f, "%d", p->value.lcon);
break;
case O_CCON:
--- 527,538 ----
break;
case O_LCON:
! if (hexaddr) {
! fprintf(f, "0x");
! if( (int) p->value.lcon < 0x10000000 ) addrprint(f,p->value.lcon,false);
! else fprintf(f,"%x" ,p->value.lcon);
! } else
! fprintf(f, "%d", p->value.lcon);
break;
case O_CCON:
Eric Brunner, IBM AWD Palo Alto
inet: brunner@monet.berkeley.edu or brunner%ibmsupt@uunet.uu.net
uucp: uunet!ibmsupt!brunner (415) 855-4486
Fix for dbx, part 4 of 5, IBM/4.3
Author: brunner
Date: Fri, 20 Oct 1989 19:46
Date: Fri, 20 Oct 1989 19:46
2070 lines
47967 bytes
47967 bytes
Subject: Fix for dbx (part 4)
Index: /usr/src/ucb/dbx IBM/4.3
Description:
Several problems (too numerous to mention) exist
with the December release of dbx. This is part 1
of a 5 part patch installation kit. The contents
of the kit are:
part 1 shar file containing help.c
part 2 patchs to the following files:
dbx/ibmrt/{coredump.c,decode.c,frame.c,procinfo.c}
part 3 patchs to the following files:
dbx/{object.c,eval.c,commands.y,c.c,tree.c}
part 4 patchs to the following files:
dbx/{runtime.c,symbols.c,execute.c,events.c,mappings.c}
part 5 patches to the following files:
dbx/{stabstring.c,printsym.c,operators.c,process.c,
keywords.c,pascal.c,fortran.c,main.c,Makefile,
examine.c,scanner.c,source.c,library.c}
Fix: Change directories to /usr/src/ucb/dbx and
apply this patch file, e.g.,
patch < this_file
Proceede to the next part of the kit.
Inconsistencies between the several compilers (hc,
pp, f77) and the loader exist, stabs in particular.
These will be corrected in a following patch to dbx,
or in corrective releases of the compilers, or both.
*** /usr/src/ucb/dbx/runtime.c Fri Dec 9 11:57:34 1988
--- runtime.c Thu Oct 12 14:37:24 1989
***************
*** 1,9 ****
! /* $Header:runtime.c 12.0$ */
! /* $ACIS:runtime.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/runtime.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:runtime.c 12.0$";
#endif
--- 1,8 ----
! /* $Header: runtime.c,v 12.1 89/10/12 17:37:23 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/runtime.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: runtime.c,v 12.1 89/10/12 17:37:23 brunner Locked $";
#endif
***************
*** 49,55 ****
* associated function in the given value-result parameter.
*/
! private getcurfunc (frp, fp)
Frame frp;
Symbol *fp;
{
--- 48,54 ----
* associated function in the given value-result parameter.
*/
! getcurfunc (frp, fp)
Frame frp;
Symbol *fp;
{
***************
*** 94,101 ****
*
* Static allocation for the frame.
*/
!
! public Frame findframe (f)
Symbol f;
{
register Frame frp;
--- 93,99 ----
*
* Static allocation for the frame.
*/
! public Frame findframe(f)
Symbol f;
{
register Frame frp;
***************
*** 102,130 ****
static struct Frame frame;
Symbol p;
frp = &frame;
! getcurframe(frp);
! if (f != nil) {
! if (f == curfunc and curframe != nil) {
! *frp = *curframe;
! } else {
! p = whatblock(savepc(frp));
! for (;;) {
! if (p == f) {
! break;
! } else if (p == program) {
! frp = nil;
! break;
! } else {
! frp = nextfunc(frp, &p);
! if (frp == nil) {
! break;
! }
! }
! }
! }
}
! return frp;
}
/*
--- 100,130 ----
static struct Frame frame;
Symbol p;
+ if ( !f )
+ return nil;
+
frp = &frame;
! if ( getcurfunc(frp,&p) < 0 ){
! return nil;
}
! if (f == curfunc && curframe ){
! *frp = *curframe;
! return frp;
! }
! if ( p == f )
! return frp;
!
! for (;;) {
!
! frp = nextfunc(frp, &p);
!
! if ( p == program )
! frp = nil;
!
! if ( p == f || !frp )
! return frp;
! }
! /*NOTREACHED*/
}
/*
***************
*** 137,142 ****
--- 137,149 ----
Address addr;
struct Frame frame;
+ /*
+ * curblock = whatblock(pc) -- get current block
+ * if in prologue, use reg 15, it contains the return address.
+ * else get the return address out of the current frame save area
+ * for reg 15.
+ */
+
frp = &frame;
getcurframe(frp);
frp = nextframe(frp);
***************
*** 478,492 ****
{
Boolean b;
! if (isfinished(process)) {
b = false;
! } else {
! if (walkingstack or f == program or f == nil or
! (ismodule(f) and isactive(container(f)))) {
b = true;
! } else {
b = (Boolean) (findframe(f) != nil);
- }
}
return b;
}
--- 485,499 ----
{
Boolean b;
! if (isfinished(process) || notstarted(process) ) {
b = false;
! }
! else {
! if (walkingstack || f == program || f == nil ||
! ((isinline(f) || ismodule(f)) && isactive(container(f))))
b = true;
! else
b = (Boolean) (findframe(f) != nil);
}
return b;
}
***************
*** 501,510 ****
{
Node procnode, arglist;
Symbol proc;
! integer argc;
procnode = exprnode->value.arg[0];
arglist = exprnode->value.arg[1];
if (procnode->op != O_SYM) {
beginerrmsg();
fprintf(stderr, "can't call \"");
--- 508,518 ----
{
Node procnode, arglist;
Symbol proc;
! Word call_pc, call_sp;
procnode = exprnode->value.arg[0];
arglist = exprnode->value.arg[1];
+
if (procnode->op != O_SYM) {
beginerrmsg();
fprintf(stderr, "can't call \"");
***************
*** 521,545 ****
endproc.callnode = exprnode;
endproc.cmdnode = topnode;
pushenv();
pc = codeloc(proc);
! argc = pushargs(proc, arglist);
! beginproc(proc, argc);
! event_once(
! build(O_EQ, build(O_SYM, pcsym), build(O_SYM, retaddrsym)),
! buildcmdlist(build(O_PROCRTN, proc))
);
isstopped = false;
if (not bpact()) {
isstopped = true;
cont(0);
}
- /*
- * bpact() won't return true, it will call printstatus() and go back
- * to command input if a breakpoint is found.
- */
- /* NOTREACHED */
}
/*
* Check to see if an expression is correct for a given parameter.
* If the given parameter is false, don't worry about type inconsistencies.
--- 529,619 ----
endproc.callnode = exprnode;
endproc.cmdnode = topnode;
pushenv();
+
+ call_pc = reg(PROGCTR);
pc = codeloc(proc);
! pushargs(proc, arglist);
! call_sp = reg(1);
! beginproc(proc);
!
! push(Word,call_pc);
! push(Word,call_sp);
!
! event_alloc(true,
! build(O_EQ,
! build(O_SYM, pcsym),
! build(O_LCON,call_pc)
! ),
! buildcmdlist(build(O_PROCRTN, proc))
);
+
isstopped = false;
if (not bpact()) {
isstopped = true;
cont(0);
}
}
+ public procreturn (f)
+ Symbol f;
+ {
+ int r;
+ Node tmp;
+ char *copy;
+ Word call_sp, call_pc;
+
+ /* if SP < call_sp we are in a recursive call, continue */
+
+ call_sp = pop(Word);
+ call_pc = pop(Word);
+
+ if ( reg(1) < call_sp ){
+ push(Word,call_pc);
+ push(Word,call_sp);
+ event_alloc(true,
+ build(O_EQ,
+ build(O_SYM, pcsym),
+ build(O_LCON,call_pc)
+ ),
+ buildcmdlist(build(O_PROCRTN, f)));
+ return;
+ }
+
+ /* grab the endproc struct early */
+
+ endproc = pop(CallEnv);
+ push(CallEnv,endproc);
+ flushoutput();
+
+ if ( endproc.isfunc ){
+
+ pushretval(f->type);
+
+ r = size(f->type);
+ if ( r > sizeof(long) ){
+ copy = newarr(char, r);
+ popn(r,copy);
+ tmp = build(O_SCON, copy);
+ }
+ else
+ tmp = build(O_LCON, (long) popsmall(f->type));
+
+ tmp->nodetype = f->type;
+
+ /**** tfree(endproc.callnode); ***/
+
+ *(endproc.callnode) = *tmp;
+ dispose(tmp);
+ eval(endproc.cmdnode);
+ }
+ else {
+ printf("%s returns successfully\n", symname(f));
+ }
+ popenv();
+ getsrcpos();
+ erecover(); /* blast out, kills pending events */
+ }
+
/*
* Check to see if an expression is correct for a given parameter.
* If the given parameter is false, don't worry about type inconsistencies.
***************
*** 653,692 ****
return count;
}
- public procreturn (f)
- Symbol f;
- {
- int r;
- Node n;
- char *data;
-
- popenv();
- if (endproc.isfunc) {
- r = size(f->type);
- if (r > sizeof(long)) {
- pushretval(r, true);
- data = newarr(char, r);
- popn(r, data);
- n = build(O_SCON, data);
- } else {
- pushretval(r, false);
- n = build(O_LCON, (long) popsmall(f->type));
- }
- flushoutput();
- n->nodetype = f->type;
- tfree(endproc.callnode);
- *endproc.callnode = *n;
- dispose(n);
- eval(endproc.cmdnode);
- } else {
- flushoutput();
- putchar('\n');
- printname(stdout, f);
- printf(" returns successfully\n", symname(f));
- }
- erecover();
- }
-
/*
* Push the current environment.
*/
--- 727,732 ----
***************
*** 693,698 ****
--- 733,769 ----
public pushenv ()
{
+ Word framebase[4];
+
+ push(Word,reg(0));
+ push(Word,reg(1));
+ push(Word,reg(2));
+ push(Word,reg(3));
+ push(Word,reg(4));
+ push(Word,reg(5));
+ push(Word,reg(6));
+ push(Word,reg(7));
+ push(Word,reg(8));
+ push(Word,reg(9));
+ push(Word,reg(10));
+ push(Word,reg(11));
+ push(Word,reg(12));
+ push(Word,reg(13));
+ push(Word,reg(14));
+ push(Word,reg(15));
+
+ dread(framebase,reg(1),sizeof(framebase));
+ push(Word,framebase[0]);
+ push(Word,framebase[1]);
+ push(Word,framebase[2]);
+ push(Word,framebase[3]);
+
+ push(Word,reg(1));
+ push(Word, reg(PROGCTR));
+ push(int, (int) isstopped);
+ push(CallEnv, endproc);
+
+ /*****
push(Address, pc);
push(Lineno, curline);
push(String, cursource);
***************
*** 704,709 ****
--- 775,781 ----
push(Word, reg(PROGCTR));
push(Word, reg(STKP));
push(Word, reg(FRP));
+ *****/
}
/*
***************
*** 712,717 ****
--- 784,821 ----
public popenv ()
{
+ Word framebase[4];
+
+ endproc = pop(CallEnv);
+ isstopped = (Boolean) pop(int);
+
+ setreg(PROGCTR, pop(Word));
+ setreg(1,pop(Word));
+
+ framebase[3] = pop(Word);
+ framebase[2] = pop(Word);
+ framebase[1] = pop(Word);
+ framebase[0] = pop(Word);
+ dwrite(framebase,reg(1),sizeof(framebase));
+
+ setreg(15,pop(Word));
+ setreg(14,pop(Word));
+ setreg(13,pop(Word));
+ setreg(12,pop(Word));
+ setreg(11,pop(Word));
+ setreg(10,pop(Word));
+ setreg(9,pop(Word));
+ setreg(8,pop(Word));
+ setreg(7,pop(Word));
+ setreg(6,pop(Word));
+ setreg(5,pop(Word));
+ setreg(4,pop(Word));
+ setreg(3,pop(Word));
+ setreg(2,pop(Word));
+ setreg(1,pop(Word));
+ setreg(0,pop(Word));
+
+ /****
String filename;
setreg(FRP, pop(Word));
***************
*** 726,729 ****
--- 830,868 ----
curline = pop(Lineno);
pc = pop(Address);
setsource(filename);
+ ****/
}
+ /*
+ * Flush the debuggee's standard output.
+ *
+ * This is VERY dependent on the use of stdio.
+ */
+
+ public flushoutput()
+ {
+ Address addr;
+ Symbol p, iob;
+
+ p = lookup(identname("fflush", true));
+ while (p != nil and not isblock(p)) {
+ p = p->next_sym;
+ }
+ if (p != nil) {
+ iob = lookup(identname("_iob", true));
+ if (iob != nil) {
+ pushenv();
+ pc = codeloc(p);
+ setreg(2, address(iob, nil) + sizeof(*stdout));
+ beginproc(p);
+ stepto(reg(15));
+ /*
+ addr = reg(15);
+ setbp(addr);
+ resume(-1, addr);
+ unsetbp(addr);
+ */
+ popenv();
+ }
+ }
+ }
+
*** /usr/src/ucb/dbx/symbols.c Fri Dec 9 11:57:47 1988
--- symbols.c Thu Oct 12 14:37:30 1989
***************
*** 1,9 ****
! /* $Header:symbols.c 12.0$ */
! /* $ACIS:symbols.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/symbols.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:symbols.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: symbols.c,v 12.1 89/10/12 17:37:28 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/symbols.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: symbols.c,v 12.1 89/10/12 17:37:28 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 35,40 ****
--- 34,40 ----
#include "languages.h"
#include "tree.h"
+
/*
* Symbol classes
*/
***************
*** 90,95 ****
--- 90,96 ----
Boolean intern : 1; /* internal calling sequence */
int unused : 13;
Address beginaddr; /* address of function code */
+ Address dataaddr; /* function data address */
} funcv;
struct { /* variant record info */
int size;
***************
*** 121,126 ****
--- 122,128 ----
#define symname(s) ident(s->name)
#define codeloc(f) ((f)->symvalue.funcv.beginaddr)
+ #define dataloc(f) ((f)->symvalue.funcv.dataaddr)
#define isblock(s) (Boolean) ( \
s->class == FUNC || s->class == PROC || \
s->class == MODULE || s->class == PROG \
***************
*** 563,568 ****
--- 565,571 ----
* locals - take offset from locals base
* arguments - take offset from argument base
* register - offset is register number
+ * functions/procedures - return the DATA address
*/
public Address address (s, frame)
***************
*** 576,617 ****
checkref(s);
addr = s->symvalue.offset;
! if (!isactive(s->block)) {
error("\"%s\" is not currently defined", symname(s));
! } else if (s->storage != EXT) {
! frp = frame;
! if (frp == nil) {
! cur = s->block;
! while (cur != nil && cur->class == MODULE) {
! cur = cur->block;
! }
! if (cur == nil) {
! frp = nil;
! } else {
! frp = findframe(cur);
! if (frp == nil) {
! error("[internal error: unexpected nil frame for \"%s\"]",
! symname(s)
! );
! }
! }
! }
! if (s->param) {
! r = preg(s, frp);
! if (r != -1) {
! addr = r;
! } else if (s->storage == STK) {
! addr += args_base(frp);
! if (multiword(s->block)) {
! addr += sizeof(Word);
! }
! }
! } else if (s->storage == STK) {
! addr += locals_base(frp);
! } else if (s->storage != INREG) {
! panic("address: bad symbol \"%s\"", symname(s));
! }
}
return addr;
}
--- 579,625 ----
checkref(s);
addr = s->symvalue.offset;
!
! if ( s->class == FUNC || s->class == PROC && !isinline(s) )
! return dataloc(s);
!
! if ( s->storage == EXT )
! return addr;
!
! if ( s->block == nil && s->storage == INREG )
! return addr;
!
! if ( !isactive(s->block) ){
error("\"%s\" is not currently defined", symname(s));
! }
!
! frp = frame;
! if ( !frp ){
! for ( cur = s->block; ( cur && (ismodule(cur) || isinline(cur)) );
! cur = cur->block )
! ;
! frp = ( cur ) ? findframe(cur) : nil;
}
+ if ( !frp ){
+ error("[internal error: unexpected nil frame for \"%s\"]",
+ symname(s));
+ }
+
+ if ( isparam(s) ){
+ r = preg(s, frp);
+ if ( r != NOADDR )
+ addr = r;
+ else if ( s->storage == STK )
+ addr += args_base(frp);
+ else {
+ panic("address: invalid symbol \"%s\"", symname(s));
+ }
+ }
+ else if ( s->storage == STK )
+ addr += locals_base(frp);
+ else if ( s->storage != INREG )
+ panic("address: invalid symbol \"%s\"", symname(s));
+
return addr;
}
***************
*** 649,660 ****
s->language = t_addr->language;
s->class = VAR;
s->storage = INREG;
! s->level = 3;
s->type = t_addr;
s->symvalue.offset = r;
}
/*
* Resolve an "abstract" type reference.
*
* It is possible in C to define a pointer to a type, but never define
--- 657,693 ----
s->language = t_addr->language;
s->class = VAR;
s->storage = INREG;
! s->block = nil;
! s->level = 1;
s->type = t_addr;
s->symvalue.offset = r;
}
+
/*
+ * Define a symbol used to access floating point register values.
+ */
+
+ public deffregname (n, regno, rsize)
+ Name n;
+ int regno, rsize;
+ {
+ Symbol s;
+
+ s = insert(n);
+ s->language = t_real->language;
+ s->class = VAR;
+ s->storage = INREG;
+ s->level = 1;
+ s->block = nil;
+ if ( rsize == 4 )
+ s->type = t_real;
+ else
+ s->type = t_real;
+ s->symvalue.offset = regno;
+ }
+
+ /*
* Resolve an "abstract" type reference.
*
* It is possible in C to define a pointer to a type, but never define
***************
*** 759,764 ****
--- 792,800 ----
if (t->class == TYPEREF) {
resolveRef(t);
}
+
+ r = 0;
+
switch (t->class) {
case RANGE:
lower = t->symvalue.rangev.lower;
***************
*** 826,832 ****
findtype(t);
}
# endif
! r = size(t->type);
break;
case FIELD:
--- 862,871 ----
findtype(t);
}
# endif
! if( t->type == t)
! r = 0;
! else
! r = size(t->type);
break;
case FIELD:
***************
*** 1221,1227 ****
p1 = p->value.arg[0];
p->nodetype = p1->nodetype;
if (p1->op == O_SYM) {
! if (p1->nodetype->class == PROC || p->nodetype->class == FUNC) {
p->op = p1->op;
p->value.sym = p1->value.sym;
p->nodetype = p1->nodetype;
--- 1260,1268 ----
p1 = p->value.arg[0];
p->nodetype = p1->nodetype;
if (p1->op == O_SYM) {
! if (p1->nodetype->class == PROC ||
! p1->nodetype->class == FUNC ||
! p1->nodetype->class == MODULE) {
p->op = p1->op;
p->value.sym = p1->value.sym;
p->nodetype = p1->nodetype;
***************
*** 1522,1527 ****
--- 1563,1569 ----
dispose(s->chain);
}
+ #ifdef 0
/*
* Figure out the "current" variable or function being referred to
* by the name n.
***************
*** 1631,1637 ****
}
return b;
}
!
/*
* Find the symbol that has the same name and scope as the
* given symbol but is of the given field. Return nil if there is none.
--- 1673,1679 ----
}
return b;
}
! #endif
/*
* Find the symbol that has the same name and scope as the
* given symbol but is of the given field. Return nil if there is none.
***************
*** 1683,1686 ****
--- 1725,1902 ----
}
dread(valp, addr, sizeof(long));
return true;
+ }
+
+
+ boolean Search_block(var_s,f)
+ Symbol *var_s, f;
+ {
+ Name n;
+ Symbol s;
+
+ s = *var_s;
+ n = s->name;
+
+ for ( ; s; s = s->next_sym ){
+ if ( s->name == n ){
+ if ( s->class == FIELD || s->class == TAG )
+ continue;
+ if ( f == s->block || f == s ){
+ *var_s = s;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ boolean Search_active_blocks(var_s)
+ Symbol *var_s;
+ {
+ Symbol f; /* iteration variable for active functions */
+ Frame frp; /* frame associated with stack walk */
+ struct Frame frame;
+
+ frp = &frame;
+ if ( getcurfunc(frp,&f) < 0 )
+ return false;
+
+ for ( ; frp; frp = nextfunc(frp,&f) ){
+ if ( f == program )
+ break;
+ if ( Search_block(var_s,f) )
+ return true;
+ }
+ return false;
+ }
+
+
+ boolean Search_globals(var_s)
+ Symbol *var_s;
+ {
+ Name n;
+ Symbol s;
+ boolean found;
+
+ n = (*var_s)->name;
+ found = false;
+
+ for ( s = *var_s; s; s = s->next_sym ){
+ if ( s->name == n &&
+ (s->block == nil ||
+ (ismodule(s->block) || s->block->class == PROG)) ){
+ if ( !found ){
+ *var_s = s;
+ found = true;
+ }
+ else if ( priority(s) > priority(*var_s) )
+ *var_s = s;
+ }
+ }
+ return found;
+ }
+
+ /*
+ * Return the priority associated with a symbol class
+ */
+
+ priority(s)
+ Symbol s;
+ {
+
+ switch (s->class)
+ {
+ case PROC:
+ case FUNC:
+ return(7);
+
+ case VAR:
+ case ARRAY:
+ case OPENARRAY:
+ case DYNARRAY:
+ case SUBARRAY:
+ return(6);
+
+ case COMMON:
+ return(5);
+
+ case PROG:
+ case MODULE:
+ return(4);
+
+ case CONST:
+ case PTRFILE:
+ case FILET:
+ case SET:
+ case LABEL:
+ case WITHPTR:
+ case SCAL:
+ case STR:
+ case EXTREF:
+ case TYPE:
+ case TYPEREF:
+ return(3);
+
+ case RECORD:
+ case FIELD:
+ case FVAR:
+ case REF:
+ case PTR:
+ case RANGE:
+ case VARNT:
+ case FPROC:
+ case FFUNC:
+ case TAG:
+ return(2);
+
+ case IMPROPER:
+ case BADUSE:
+ default:
+ return(1);
+ }
+ }
+
+ /*
+ * Figure out the "current" variable or function being referred to
+ * by the name n.
+ */
+
+ public Symbol which (n)
+ Name n;
+ {
+ Symbol s;
+
+ s = lookup(n);
+ if (s == nil) {
+ error("\"%s\" is not defined", ident(n));
+ }
+
+ if (!isactive(program) || !Search_block(&s,curfunc) ) {
+ if(isactive(program) && Search_active_blocks(&s) )
+ {
+ if(isambiguous(s))
+ {
+ printf("[using ");
+ printwhich(stdout, s);
+ printf("]\n");
+ }
+ }
+ else if( Search_globals(&s) )
+ {
+ if(isambiguous(s))
+ {
+ printf("[using ");
+ printwhich(stdout, s);
+ printf("]\n");
+ }
+ }
+ else
+ {
+ printf("[inactive ");
+ printwhich(stdout, s);
+ printf("]\n");
+ }
+ }
+
+ return s;
}
*** /usr/src/ucb/dbx/execute.c Fri Dec 9 11:56:54 1988
--- execute.c Thu Oct 12 14:37:02 1989
***************
*** 1,9 ****
! /* $Header:execute.c 12.0$ */
! /* $ACIS:execute.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/execute.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:execute.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: execute.c,v 12.1 89/10/12 17:37:01 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/execute.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: execute.c,v 12.1 89/10/12 17:37:01 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 26,31 ****
--- 25,31 ----
#include "mappings.h"
#include "coredump.h"
#include "runtime.h"
+ #include "frame.h"
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
***************
*** 32,40 ****
#include <sys/stat.h>
#ifndef public
-
#define DEFSIG -1
-
#endif
#define MAXNCMDARGS 1000 /* maximum number of arguments to RUN */
--- 32,38 ----
***************
*** 60,70 ****
String pargv[4];
Node cond;
! if (coredump) {
! coredump = false;
! fclose(corefile);
coredump_close();
! }
if (argv == nil) {
argv = pargv;
pargv[0] = objname;
--- 58,66 ----
String pargv[4];
Node cond;
! if (coredump)
coredump_close();
!
if (argv == nil) {
argv = pargv;
pargv[0] = objname;
***************
*** 205,214 ****
printnews();
} else {
setallbps();
! resume(s);
unsetallbps();
s = DEFSIG;
! if (not isbperr() or not bpact()) {
printstatus();
}
}
--- 201,210 ----
printnews();
} else {
setallbps();
! resume(s, 0);
unsetallbps();
s = DEFSIG;
! if ( !isbperr() || !bpact()) {
printstatus();
}
}
***************
*** 222,235 ****
* but actually in the debugger. Could happen, for example, while
* processing breakpoints.
*
! * We basically just want to keep going; the assumption is
! * that when the process resumes it will get the interrupt,
! * which will then be handled.
*/
private intr ()
{
! signal(SIGINT, intr);
}
public fixintr ()
--- 218,229 ----
* but actually in the debugger. Could happen, for example, while
* processing breakpoints.
*
! * To avoid HANGING, just stop.
*/
private intr ()
{
! isstopped = true;
}
public fixintr ()
***************
*** 241,263 ****
* Resume execution.
*/
! public resume (signo)
int signo;
{
register Process p;
p = process;
pcont(p, signo);
pc = reg(PROGCTR);
! if (p->status != STOPPED) {
! if (p->signo != 0) {
error("program terminated by signal %d", p->signo);
! } else if (not runfirst) {
! if (p->exitval == 0) {
error("program exited");
! } else {
error("program exited with code %d", p->exitval);
- }
}
}
}
--- 235,274 ----
* Resume execution.
*/
! public resume (signo, last_bp)
int signo;
+ Address last_bp;
{
register Process p;
p = process;
pcont(p, signo);
+
pc = reg(PROGCTR);
!
! if (p->status != STOPPED)
! {
! /*
! * Must unset all the breakpoints here since we won't be going
! * back to continue from here. First we set status to STOPPED
! * so that we can unset all the breakpoints, once we return we
! * set it back so that we represent our true condition.
! */
! p->status = STOPPED;
! if (last_bp > 0)
! unsetbp(last_bp);
! else
! unsetallbps();
! p->status = FINISHED;
!
! if (p->signo != 0)
error("program terminated by signal %d", p->signo);
! else if ( !runfirst)
! {
! if (p->exitval == 0)
error("program exited");
! else
error("program exited with code %d", p->exitval);
}
}
}
***************
*** 295,337 ****
isstopped = true;
}
/*
! * Continue execution until the current function returns, or,
! * if the given argument is non-nil, until execution returns to
! * somewhere within the given function.
! */
!
! public rtnfunc (f)
! Symbol f;
{
! Address addr;
! Symbol t;
! if (not isstopped) {
! error("can't continue execution");
! } else if (f != nil and not isactive(f)) {
! error("%s is not active", symname(f));
! } else {
! addr = return_addr();
! if (addr == nil) {
! error("no place to return to");
! } else {
! isstopped = false;
! contto(addr);
! if (f != nil) {
! for (;;) {
! t = whatblock(pc);
! addr = return_addr();
! if (t == f or addr == nil) break;
! contto(addr);
! }
! }
! if (not bpact()) {
! isstopped = true;
! printstatus();
! }
! }
! }
}
/*
--- 306,424 ----
isstopped = true;
}
+ rtnfunc(f)
/*
! This routine returns from the current function if f == NULL
! or to the function named by f, provided it is on the
! stack. If there is source info, it steps ahead to stop
! at the next source line in the same manner as dostep.
! Note: in routines with no source, this code will give
! incorrect results in the prolog and in the epilog because
! the current frame hasn't been set up or the registers have
! be changed, respectively. Fixup for entry point done though.
! */
! Symbol f;
{
! Address of, nf, addr;
! int line;
! Symbol s, g;
! struct Frame frame;
! Frame frp = &frame;
! if (!isstopped) error("can't continue execution");
!
! isstopped = false;
!
! of = reg(1);
! nf = reg(1);
!
! if(!f)
! {
! /* if at entry point, do something special */
! if(isprolog(reg(PROGCTR)))
! {
! of = reg(1);
! addr = reg(15);
! }
! else
! {
! getcurfunc(frp,&g);
! of = frp->reg[1];
! addr = frp->reg[15];
!
! /* find the function to return to, if there */
! for(; g && g != program && isinline(g) ; )
! {
! frp = nextfunc(frp,&g);
! of = frp->reg[1];
! addr = frp->reg[15];
! }
! }
! }
! else
! {
! /* if at entry point, do something special */
! if(isprolog(reg(PROGCTR)))
! {
! addr = reg(15);
! of = reg(1);
! g = whatblock(addr);
! if(f == g) goto foundit;
! else getcurfunc(frp,&g);
! }
! else
! {
! /* get the current function info */
! getcurfunc(frp,&g);
! addr = frp->reg[15];
! of = frp->reg[1];
! }
!
! /* find the function to return to, if there */
! for(; g && g != program && g != f; )
! {
! frp = nextfunc(frp,&g);
! of = frp->reg[1];
! addr = frp->reg[15];
! }
! }
!
! /* C doesn't have a break from an if so we need a goto to here */
! foundit:
!
! if(f && f != g || !of)
! {
! error("can't return to function");
! isstopped = true;
! return;
! }
!
! /* crank until we get to the right stack level */
! do
! {
! /* continue to that address */
! xto(addr,true);
!
! pc = reg(PROGCTR);
! nf = reg(1);
! }
! while ( nf < of && nf != 0 );
!
! /* did we stop at a line with line info ? */
! line = linelookup(addr);
!
! /* crank ahead until we find an addr with a line or no source info */
! while (line == 0 && (s = whatblock(addr)) && (isinline(s) || !nosource(s)))
! {
! addr = nextaddr(addr, false);
! line = linelookup(addr);
! xto(addr,false);
! }
!
! isstopped = true;
!
! if(s = whatblock(addr)) useInstLoc = (Boolean) nosource(s);
! printnews();
}
/*
***************
*** 374,380 ****
xto(addr, false);
}
! private contto (addr)
Address addr;
{
xto(addr, true);
--- 461,467 ----
xto(addr, false);
}
! public contto (addr)
Address addr;
{
xto(addr, true);
***************
*** 398,409 ****
setallbps();
}
setbp(addr);
! resume(DEFSIG);
unsetbp(addr);
if (catchbps) {
unsetallbps();
}
! if (not isbperr()) {
printstatus();
}
}
--- 485,496 ----
setallbps();
}
setbp(addr);
! resume(DEFSIG, addr);
unsetbp(addr);
if (catchbps) {
unsetallbps();
}
! if ( !isbperr() ) {
printstatus();
}
}
***************
*** 565,571 ****
if (coredump) {
coredump_readtext(buff, addr, nbytes);
} else {
! pio(process, PREAD, TEXTSEG, buff, addr, nbytes);
}
onsyserr(EIO, f);
}
--- 652,658 ----
if (coredump) {
coredump_readtext(buff, addr, nbytes);
} else {
! pio(process, PREAD, buff, addr, nbytes);
}
onsyserr(EIO, f);
}
***************
*** 587,593 ****
}
f = onsyserr(EIO, write_err);
badaddr = addr;
! pio(process, PWRITE, TEXTSEG, buff, addr, nbytes);
onsyserr(EIO, f);
}
--- 674,680 ----
}
f = onsyserr(EIO, write_err);
badaddr = addr;
! pio(process, PWRITE, buff, addr, nbytes);
onsyserr(EIO, f);
}
***************
*** 609,615 ****
onsyserr(EFAULT, f);
} else {
f = onsyserr(EIO, read_err);
! pio(process, PREAD, DATASEG, buff, addr, nbytes);
onsyserr(EIO, f);
}
}
--- 696,702 ----
onsyserr(EFAULT, f);
} else {
f = onsyserr(EIO, read_err);
! pio(process, PREAD, buff, addr, nbytes);
onsyserr(EIO, f);
}
}
***************
*** 630,636 ****
}
f = onsyserr(EIO, write_err);
badaddr = addr;
! pio(process, PWRITE, DATASEG, buff, addr, nbytes);
onsyserr(EIO, f);
}
--- 717,723 ----
}
f = onsyserr(EIO, write_err);
badaddr = addr;
! pio(process, PWRITE, buff, addr, nbytes);
onsyserr(EIO, f);
}
*** /usr/src/ucb/dbx/events.c Fri Dec 9 11:56:50 1988
--- events.c Thu Oct 12 14:36:59 1989
***************
*** 1,9 ****
! /* $Header:events.c 12.0$ */
! /* $ACIS:events.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/events.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:events.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: events.c,v 12.1 89/10/12 17:36:58 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/events.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: events.c,v 12.1 89/10/12 17:36:58 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 48,53 ****
--- 47,53 ----
public boolean inst_tracing;
public boolean single_stepping;
public boolean isstopped;
+ public boolean hexaddr = false;
public Symbol linesym;
public Symbol procsym;
***************
*** 229,235 ****
--- 229,263 ----
line = pop(long);
addr = objaddr(line, cursource);
}
+
+ /*
+ * Scan ahead, see if there is a decent line
+ * around.
+ */
+
+ if ( addr == NOADDR )
+ {
+ addr = nearobjaddr(line, cursource);
+ if ( addr != NOADDR )
+ {
+ fprintf(stderr, "no executable code at line ");
+ prtree(stderr, place);
+ line = srcline(addr);
+ fprintf(stderr,"; using line %d instead.\n",line);
+ if ( place->op == O_QLINE )
+ {
+ (place->value.arg[1])->value.lcon = line;
+ (place->value.arg[1])->op = O_LCON;
+ }
+ }
+ }
+
+ /*
+ * Nope, delete the event
+ */
+
if (addr == NOADDR) {
+
if (not delevent(e->id)) {
printf("!! dbx.translate: can't undo event %d?\n",
e->id);
***************
*** 371,376 ****
--- 399,464 ----
endfor
}
+ /*
+ * Delete all of the breakpoints.
+ */
+
+ public deleteall()
+ {
+ Event e;
+
+ foreach (Event, e, eventlist)
+ if (not e->temporary) {
+ delevent(e->id);
+ }
+ endfor
+ }
+
+
+ /*
+ * Delete all of the breakpoints at a given line.
+ */
+
+ public clearbps (place)
+ Node place;
+ {
+ Breakpoint bp;
+ Lineno line;
+ Address addr;
+
+ line = place->value.arg[1]->value.lcon;
+ addr = objaddr(line, place->value.arg[0]->value.scon);
+ if ( addr == NOADDR )
+ return;
+
+ foreach (Breakpoint, bp, bplist)
+ if ( !bp->temporary ){
+ if ( bp->bpaddr == addr )
+ delevent(bp->event->id);
+ }
+ endfor
+ }
+
+ /*
+ * Delete all of the breakpoints at a given address.
+ */
+
+ public clearbps_i (place)
+ Node place;
+ {
+ Breakpoint bp;
+ Address addr;
+
+ eval(place->value.arg[0]);
+ addr = pop(long);
+ foreach (Breakpoint, bp, bplist)
+ if (not bp->temporary) {
+ if (bp->bpaddr == addr)
+ delevent(bp->event->id);
+ }
+ endfor
+ }
+
public printevent (e)
Event e;
{
***************
*** 430,436 ****
--- 518,526 ----
prtree(stdout, place);
} else if (s == pcsym or s == retaddrsym) {
printf("i at ");
+ hexaddr = true;
prtree(stdout, place);
+ hexaddr = false;
} else {
printf(" when ");
prtree(stdout, cond);
***************
*** 645,651 ****
--- 735,746 ----
public printnews ()
{
register Trcmd t;
+ Symbol s;
+ /* skip over initialization and exit code */
+ s = whatblock(reg(PROGCTR));
+ if(!s || !strcmp(symname(s),"") || !strcmp(symname(s),"_exit")) return;
+
foreach (Trcmd, t, eachline)
evalcmdlist(t->cmdlist);
endfor
***************
*** 749,756 ****
* last time we checked.
*/
! public printifchanged (p)
Node p;
{
register Trinfo tp;
register int n;
--- 844,852 ----
* last time we checked.
*/
! public printifchanged (p, trace)
Node p;
+ Boolean trace;
{
register Trinfo tp;
register int n;
***************
*** 758,763 ****
--- 854,860 ----
Filename curfile;
static Lineno prevline;
static Filename prevfile;
+ static Address prevaddr;
tp = findtrinfo(p);
n = size(p->nodetype);
***************
*** 767,773 ****
if (tp->trvalue == nil) {
tp->trvalue = newarr(char, n);
mov(v, tp->trvalue, n);
! printf("initially (at line %d in \"%s\"):\t", curline, curfile);
prtree(stdout, p);
printf(" = ");
printval(p->nodetype);
--- 864,872 ----
if (tp->trvalue == nil) {
tp->trvalue = newarr(char, n);
mov(v, tp->trvalue, n);
! if(!trace || nosource(whatblock(reg(PROGCTR))))
! printf("initially (at address 0x%x in \"%s\"):\t", reg(PROGCTR), curfile);
! else printf("initially (at line %d in \"%s\"):\t", srcline(reg(PROGCTR)), curfile);
prtree(stdout, p);
printf(" = ");
printval(p->nodetype);
***************
*** 774,786 ****
putchar('\n');
} else if (cmp(tp->trvalue, v, n) != 0) {
mov(v, tp->trvalue, n);
! printf("after line %d in \"%s\":\t", prevline, prevfile);
prtree(stdout, p);
printf(" = ");
printval(p->nodetype);
putchar('\n');
}
! prevline = curline;
prevfile = curfile;
}
--- 873,889 ----
putchar('\n');
} else if (cmp(tp->trvalue, v, n) != 0) {
mov(v, tp->trvalue, n);
! if(!trace || !prevline)
! printf("after address 0x%x in \"%s\":\t", prevaddr, prevfile);
! else printf("after line %d in \"%s\":\t", prevline, prevfile);
prtree(stdout, p);
printf(" = ");
printval(p->nodetype);
putchar('\n');
}
! prevaddr = reg(PROGCTR);
! if(nosource(whatblock(reg(PROGCTR)))) prevline = 0;
! else prevline = srcline(reg(PROGCTR));
prevfile = curfile;
}
***************
*** 788,800 ****
* Stop if the value of the given expression has changed.
*/
! public stopifchanged (p)
Node p;
{
register Trinfo tp;
register int n;
char *v;
static Lineno prevline;
tp = findtrinfo(p);
n = size(p->nodetype);
--- 891,905 ----
* Stop if the value of the given expression has changed.
*/
! public stopifchanged (p, stop)
Node p;
+ Boolean stop;
{
register Trinfo tp;
register int n;
char *v;
static Lineno prevline;
+ static Address prevaddr;
tp = findtrinfo(p);
n = size(p->nodetype);
***************
*** 803,819 ****
if (tp->trvalue == nil) {
tp->trvalue = newarr(char, n);
mov(v, tp->trvalue, n);
! sp = v;
} else if (cmp(tp->trvalue, v, n) != 0) {
mov(v, tp->trvalue, n);
! printf("after line %d:\t", prevline);
prtree(stdout, p);
printf(" = ");
printval(p->nodetype);
putchar('\n');
isstopped = true;
}
! prevline = curline;
}
/*
--- 908,936 ----
if (tp->trvalue == nil) {
tp->trvalue = newarr(char, n);
mov(v, tp->trvalue, n);
! printf("initially:\t");
! prtree(stdout, p);
! printf(" = ");
! printval(p->nodetype);
! putchar('\n');
! if(!stop || nosource(whatblock(reg(PROGCTR)))) useInstLoc = true;
! else useInstLoc = false;
! isstopped = true;
} else if (cmp(tp->trvalue, v, n) != 0) {
mov(v, tp->trvalue, n);
! if(!stop || !prevline) printf("after address 0x%x:\t", prevaddr);
! else printf("after line %d:\t", prevline);
prtree(stdout, p);
printf(" = ");
printval(p->nodetype);
putchar('\n');
+ if(!stop || nosource(whatblock(reg(PROGCTR)))) useInstLoc = true;
+ else useInstLoc = false;
isstopped = true;
}
! prevaddr = reg(PROGCTR);
! if(nosource(whatblock(reg(PROGCTR)))) prevline = 0;
! else prevline = srcline(reg(PROGCTR));
}
/*
*** /usr/src/ucb/dbx/mappings.c Fri Dec 9 11:57:11 1988
--- mappings.c Thu Oct 12 14:37:13 1989
***************
*** 1,9 ****
! /* $Header:mappings.c 12.0$ */
! /* $ACIS:mappings.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/mappings.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:mappings.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: mappings.c,v 12.1 89/10/12 17:37:12 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/mappings.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: mappings.c,v 12.1 89/10/12 17:37:12 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 38,47 ****
--- 37,56 ----
Filetab *filetab;
Linetab *linetab;
+ #define nearobjaddr(l,f) findobjaddr(l,f,false)
+ #define objaddr(l,f) findobjaddr(l,f,true)
#define NOADDR ((Address) -1) /* no address for line or procedure */
+ /* if <values.h> exists, then these are not needed */
+ #ifndef _h_VALUES
+ #define BITSPERBYTE 8
+ #define BITS(type) (BITSPERBYTE * (int)sizeof(type))
+ #define HIBITI (1 << (BITS(int) - 1))
+ #define MAXINT (~HIBITI)
#endif
+ #endif
+
/*
* Get the source file name associated with a given address.
*/
***************
*** 213,218 ****
--- 222,305 ----
* more than once in the file table (caused by includes).
*/
+ public Address findobjaddr(line, name, exact)
+ Lineno line;
+ String name;
+ boolean exact;
+ {
+ register Filetab *ftp;
+ register Lineno i, j;
+ Boolean foundfile;
+ int current, prev, follow, follow_i, prev_i;
+
+
+ if ( nlhdr.nlines == 0 || line <= 0 )
+ return NOADDR;
+
+ if ( !name )
+ name = cursource;
+
+ foundfile = false;
+ prev = 0;
+ follow = MAXINT;
+
+ /*
+ * try for an exact match first, but remember closest prev and
+ * closest follow in case exact fails.
+ */
+
+ for ( ftp = filetab; ftp <= &filetab[nlhdr.nfiles]; ftp++ ){
+ if ( !streq(ftp->filename, name) )
+ continue;
+
+ foundfile = true;
+ i = ftp->lineindex;
+ j = ( ftp == &filetab[nlhdr.nfiles-1] )
+ ? nlhdr.nlines
+ : (ftp + 1)->lineindex;
+
+ for ( ; i < j; i++ ){
+
+ if ( linetab[i].line == line )
+ return linetab[i].addr;
+
+ if ( !exact ){
+ current = linetab[i].line;
+
+ if ( current < line && current > 0 && prev < current ){
+ prev = current;
+ prev_i = i;
+ }
+
+ if ( current > line && current > 0 && current < follow ){
+ follow = current;
+ follow_i = i;
+ }
+ }
+ }
+ }
+
+ if ( !foundfile ){
+ error("source file \"%s\" not compiled with -g", name);
+ return NOADDR;
+ }
+
+ /*
+ * Check for nearest line, if non-exact search requested.
+ */
+
+ if ( !exact ){
+ if ( follow != MAXINT ){
+ return linetab[follow_i].addr;
+ }
+ else if ( prev ){
+ return linetab[prev_i].addr;
+ }
+ }
+ return NOADDR;
+ }
+
+ #ifdef TEST
public Address objaddr(line, name)
Lineno line;
String name;
***************
*** 250,256 ****
}
return NOADDR;
}
!
/*
* Table for going from object addresses to the functions in which they belong.
*/
--- 337,343 ----
}
return NOADDR;
}
! #endif
/*
* Table for going from object addresses to the functions in which they belong.
*/
***************
*** 277,282 ****
--- 364,370 ----
register AddrOfFunc *af;
AddrOfFunc *newfunctab;
+
if (nfuncs >= functablesize) {
if (functablesize == 0) {
functab = newarr(AddrOfFunc, NFUNCS);
***************
*** 296,305 ****
}
/*
! * Return the function that begins at the given address.
*/
! public Symbol whatblock(addr)
Address addr;
{
register int i, j, k;
--- 384,393 ----
}
/*
! * func_index: return the index of a function in the function table.
*/
! private int func_index(addr)
Address addr;
{
register int i, j, k;
***************
*** 307,324 ****
i = 0;
j = nfuncs - 1;
! if (addr < functab[i].addr) {
! return program;
! } else if (addr == functab[i].addr) {
! return functab[i].func;
} else if (addr >= functab[j].addr) {
! return functab[j].func;
}
while (i <= j) {
k = (i + j) / 2;
a = functab[k].addr;
if (a == addr) {
! return functab[k].func;
} else if (addr > a) {
i = k+1;
} else {
--- 395,410 ----
i = 0;
j = nfuncs - 1;
! if (addr <= functab[i].addr) {
! return i;
} else if (addr >= functab[j].addr) {
! return j;
}
while (i <= j) {
k = (i + j) / 2;
a = functab[k].addr;
if (a == addr) {
! return k;
} else if (addr > a) {
i = k+1;
} else {
***************
*** 325,336 ****
j = k-1;
}
}
! if (addr > functab[i].addr) {
! return functab[i].func;
! } else {
! return functab[i-1].func;
! }
! /* NOTREACHED */
}
/*
--- 411,465 ----
j = k-1;
}
}
! if (addr > functab[i].addr)
! return i;
! else
! return i-1;
! }
!
! /*
! * Return the function that begins at the given address.
! */
!
! public Symbol whatblock(addr)
! Address addr;
! {
! int i, j;
!
! j = nfuncs - 1;
! if (addr < functab[0].addr)
! return program;
! else if (addr == functab[0].addr)
! return functab[0].func;
! else if (addr >= functab[j].addr)
! return functab[j].func;
!
! i = func_index(addr);
! return functab[i].func;
! }
!
! /*
! * tracetable_addr:
! * Return the start of the trace table for some function.
! * The trace table immediately follows the code in the function,
! * so for all functions but the last we can get the start address
! * of the next function in the table and back off by 10 bytes or so.
! * --This would have worked except the raving morons also allow random
! * data to be inserted anywhere in text, so we have to forget the whole idea.
! */
!
! public Address tracetable_addr(addr)
! Address addr;
! {
! register int i, j, k;
! Address a;
!
! i = func_index(addr);
! return functab[i].addr;
! #ifdef LOSE
! a = ( i >= nfuncs - 1 ) ? functab[i].addr : functab[i+1].addr - 16;
! return a;
! #endif
}
/*
Eric Brunner, IBM AWD Palo Alto
inet: brunner@monet.berkeley.edu or brunner%ibmsupt@uunet.uu.net
uucp: uunet!ibmsupt!brunner (415) 855-4486
Fix for dbx, part 5 of 5, IBM/4.3
Author: brunner
Date: Fri, 20 Oct 1989 19:47
Date: Fri, 20 Oct 1989 19:47
2172 lines
54816 bytes
54816 bytes
Subject: Fix for dbx (part 5)
Index: /usr/src/ucb/dbx IBM/4.3
Description:
Several problems (too numerous to mention) exist
with the December release of dbx. This is part 1
of a 5 part patch installation kit. The contents
of the kit are:
part 1 shar file containing help.c
part 2 patchs to the following files:
dbx/ibmrt/{coredump.c,decode.c,frame.c,procinfo.c}
part 3 patchs to the following files:
dbx/{object.c,eval.c,commands.y,c.c,tree.c}
part 4 patchs to the following files:
dbx/{runtime.c,symbols.c,execute.c,events.c,mappings.c}
part 5 patches to the following files:
dbx/{stabstring.c,printsym.c,operators.c,process.c,
keywords.c,pascal.c,fortran.c,main.c,Makefile,
examine.c,scanner.c,source.c,library.c}
Fix: Change directories to /usr/src/ucb/dbx and
apply this patch file, e.g.,
patch < this_file
Proceede to the next part of the kit.
Inconsistencies between the several compilers (hc,
pp, f77) and the loader exist, stabs in particular.
These will be corrected in a following patch to dbx,
or in corrective releases of the compilers, or both.
*** /usr/src/ucb/dbx/stabstring.c Fri Dec 9 11:57:42 1988
--- stabstring.c Thu Oct 12 14:37:28 1989
***************
*** 1,16 ****
! /* $Header:stabstring.c 12.0$ */
! /* $ACIS:stabstring.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/stabstring.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:stabstring.c 12.0$";
#endif
/*
! * String information interpretation
! *
! * The string part of a stab entry is broken up into name and type information.
! */
#include "defs.h"
#include "stabstring.h"
--- 1,15 ----
! /* $Header: stabstring.c,v 12.1 89/10/12 17:37:27 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/stabstring.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: stabstring.c,v 12.1 89/10/12 17:37:27 brunner Locked $";
#endif
/*
! * String information interpretation
! *
! * The string part of a stab entry is broken up into name and type information.
! */
#include "defs.h"
#include "stabstring.h"
***************
*** 27,34 ****
#endif
/*
! * Special characters in symbol table information.
! */
#define CONSTNAME 'c'
#define TYPENAME 't'
--- 26,33 ----
#endif
/*
! * Special characters in symbol table information.
! */
#define CONSTNAME 'c'
#define TYPENAME 't'
***************
*** 53,60 ****
#define LOCALVAR /* default */
/*
! * Type information special characters.
! */
#define T_SUBRANGE 'r'
#define T_ARRAY 'a'
--- 52,59 ----
#define LOCALVAR /* default */
/*
! * Type information special characters.
! */
#define T_SUBRANGE 'r'
#define T_ARRAY 'a'
***************
*** 74,81 ****
#define T_FILE 'd'
/*
! * Table of types indexed by per-file unique identification number.
! */
#define NTYPES 6000
--- 73,80 ----
#define T_FILE 'd'
/*
! * Table of types indexed by per-file unique identification number.
! */
#define NTYPES 6000
***************
*** 83,98 ****
public initTypeTable ()
{
! bzero(typetable, sizeof(typetable));
! (*language_op(curlang, L_MODINIT))(typetable);
}
/*
! * Put an nlist entry into the symbol table.
! * If it's already there just add the associated information.
! *
! * Type information is encoded in the name following a ":".
! */
private Symbol constype();
private Char *curchar;
--- 82,97 ----
public initTypeTable ()
{
! bzero(typetable, sizeof(typetable));
! (*language_op(curlang, L_MODINIT))(typetable);
}
/*
! * Put an nlist entry into the symbol table.
! * If it's already there just add the associated information.
! *
! * Type information is encoded in the name following a ":".
! */
private Symbol constype();
private Char *curchar;
***************
*** 99,159 ****
#define skipchar(ptr, ch) \
{ \
! if (*ptr != ch) { \
! panic("expected char '%c', found '%s'", ch, ptr); \
! } \
! ++ptr; \
}
#define optchar(ptr, ch) \
{ \
! if (*ptr == ch) { \
! ++ptr; \
! } \
}
#ifdef sun
# define chkcont(ptr) \
{ \
! if (*ptr == '\\' or *ptr == '?') { \
! ptr = getcont(); \
! } \
}
#else if notsun
# define chkcont(ptr) \
{ \
! if (*ptr == '?') { \
! ptr = getcont(); \
! } \
}
#endif
#define newSym(s, n) \
{ \
! s = insert(n); \
! s->level = curblock->level + 1; \
! s->language = curlang; \
! s->block = curblock; \
}
! #define makeVariable(s, n, off) \
! { \
! newSym(s, n); \
! s->class = VAR; \
! s->symvalue.offset = off; \
! getType(s); \
}
#define makeParameter(s, n, st, cl, off) \
{ \
! newSym(s, n); \
! s->storage = st; \
! s->param = true; \
! s->class = cl; \
! s->symvalue.offset = off; \
! curparam->chain = s; \
! curparam = s; \
! getType(s); \
}
public entersym (name, np)
--- 98,174 ----
#define skipchar(ptr, ch) \
{ \
! if (*ptr != ch) { \
! panic("expected char '%c', found '%s'", ch, ptr); \
! } \
! ++ptr; \
}
#define optchar(ptr, ch) \
{ \
! if (*ptr == ch) { \
! ++ptr; \
! } \
}
#ifdef sun
# define chkcont(ptr) \
{ \
! if (*ptr == '\\' or *ptr == '?') { \
! ptr = getcont(); \
! } \
}
#else if notsun
# define chkcont(ptr) \
{ \
! if (*ptr == '?') { \
! ptr = getcont(); \
! } \
}
#endif
#define newSym(s, n) \
{ \
! s = insert(n); \
! s->level = curblock->level + 1; \
! s->language = curlang; \
! s->block = curblock; \
}
! #define makeVariable(s,n,off) dcl_var(&s,n,off)
!
! static void dcl_var(sym_p,n,off)
! Symbol *sym_p;
! Name n;
! Address off;
! {
! Symbol s;
!
! find(s, n) where
! s->block == curblock && s->class == VAR
! endfind(s);
!
! if ( !s )
! s = insert(n);
!
! s->language = curlang;
! s->block = curblock;
! s->class = VAR;
! s->symvalue.offset = off;
! getType(s);
! *sym_p = s;
}
#define makeParameter(s, n, st, cl, off) \
{ \
! newSym(s, n); \
! s->storage = st; \
! s->param = true; \
! s->class = cl; \
! s->symvalue.offset = off; \
! curparam->chain = s; \
! curparam = s; \
! getType(s); \
}
public entersym (name, np)
***************
*** 160,454 ****
String name;
struct nlist *np;
{
! Symbol s;
! register char *p;
! register Name n;
! char c;
! p = index(name, ':');
! *p = '\0';
! c = *(p+1);
! if (autostrip && *name == '_' && strncmp(name, "_auto_", 6) == 0) {
! n = identname(&name[6], true);
! } else {
! n = identname(name, true);
! }
! chkUnnamedBlock();
! curchar = p + 2;
! switch (c) {
! case CONSTNAME:
! newSym(s, n);
! constName(s);
! break;
! case TYPENAME:
! newSym(s, n);
! typeName(s);
! break;
! case TAGNAME:
! s = symbol_alloc();
! s->name = n;
! s->level = curblock->level + 1;
! s->language = curlang;
! s->block = curblock;
! tagName(s);
! break;
! case MODULEBEGIN:
! publicRoutine(&s, n, MODULE, np->n_value, false);
! curmodule = s;
! break;
! case EXTPROCEDURE:
! publicRoutine(&s, n, PROC, np->n_value, false);
! break;
! case PRIVPROCEDURE:
! privateRoutine(&s, n, PROC, np->n_value);
! break;
! case INTPROCEDURE:
! publicRoutine(&s, n, PROC, np->n_value, true);
! break;
! case EXTFUNCTION:
! publicRoutine(&s, n, FUNC, np->n_value, false);
! break;
! case PRIVFUNCTION:
! privateRoutine(&s, n, FUNC, np->n_value);
! break;
! case INTFUNCTION:
! publicRoutine(&s, n, FUNC, np->n_value, true);
! break;
! case EXTVAR:
! extVar(&s, n, np->n_value);
! break;
! case MODULEVAR:
! if (curblock->class != MODULE) {
! exitblock();
! }
! makeVariable(s, n, np->n_value);
! s->storage = EXT;
! s->level = program->level;
! s->block = curmodule;
! getExtRef(s);
! break;
! case OWNVAR:
! makeVariable(s, n, np->n_value);
! ownVariable(s, np->n_value);
! getExtRef(s);
! break;
! case REGVAR:
! makeVariable(s, n, np->n_value);
! s->storage = INREG;
! break;
! case FREGVAR:
! makeVariable(s, n, NREG + np->n_value);
! s->storage = INREG;
! break;
! case VALUEPARAM:
! makeParameter(s, n, STK, VAR, np->n_value);
# ifdef IRIS
! /*
! * Bug in SGI C compiler -- generates stab offset
! * for parameters with size added in.
! */
! if (curlang == findlanguage(".c")) {
! s->symvalue.offset -= size(s);
! }
# endif
! break;
! case VARIABLEPARAM:
! makeParameter(s, n, STK, REF, np->n_value);
! break;
! case REGPARAM:
! makeParameter(s, n, INREG, VAR, np->n_value);
! break;
! case FREGPARAM:
! makeParameter(s, n, INREG, VAR, NREG + np->n_value);
! break;
! case REGVARPARAM:
! makeParameter(s, n, INREG, REF, np->n_value);
! break;
! default: /* local variable */
! --curchar;
! makeVariable(s, n, np->n_value);
! s->storage = STK;
! break;
! }
! if (tracesyms) {
! printdecl(s);
! fflush(stdout);
! }
}
/*
! * Enter a named constant.
! */
private constName (s)
Symbol s;
{
! double d;
! char *p, buf[1000];
! s->class = CONST;
! skipchar(curchar, '=');
! p = curchar;
! ++curchar;
! switch (*p) {
! case 'b':
! s->type = t_boolean;
! s->symvalue.constval = build(O_LCON, getint());
! break;
! case 'c':
! s->type = t_char;
! s->symvalue.constval = build(O_LCON, getint());
! break;
! case 'i':
! s->type = t_int;
! s->symvalue.constval = build(O_LCON, getint());
! break;
! case 'r':
! sscanf(curchar, "%lf", &d);
! while (*curchar != '\0' and *curchar != ';') {
! ++curchar;
! }
! --curchar;
! s->type = t_real;
! s->symvalue.constval = build(O_FCON, d);
! break;
! case 's':
! p = &buf[0];
! skipchar(curchar, '\'');
! while (*curchar != '\'') {
! *p = *curchar;
! ++p;
! ++curchar;
! }
! *p = '\0';
! s->symvalue.constval = build(O_SCON, strdup(buf));
! s->type = s->symvalue.constval->nodetype;
! break;
! case 'e':
! getType(s);
! skipchar(curchar, ',');
! s->symvalue.constval = build(O_LCON, getint());
! break;
! case 'S':
! getType(s);
! skipchar(curchar, ',');
! getint(); /* set size */
! skipchar(curchar, ',');
! getint(); /* number of bits in constant */
! s->symvalue.constval = build(O_LCON, 0);
! break;
! default:
! s->type = t_int;
! s->symvalue.constval = build(O_LCON, 0);
! printf("[internal error: unknown constant type '%c']", *p);
! break;
! }
! s->symvalue.constval->nodetype = s->type;
}
/*
! * Enter a type name.
! */
private typeName (s)
Symbol s;
{
! register integer i;
! s->class = TYPE;
! s->language = curlang;
! s->block = curblock;
! s->level = curblock->level + 1;
! i = getint();
! if (i == 0) {
! panic("bad input on type \"%s\" at \"%s\"", symname(s), curchar);
! } else if (i >= NTYPES) {
! panic("too many types in file \"%s\"", curfilename());
! }
! /*
! * A hack for C typedefs that don't create new types,
! * e.g. typedef unsigned int Hashvalue;
! * or typedef struct blah BLAH;
! */
! if (*curchar != '=') {
! s->type = typetable[i];
! if (s->type == nil) {
! s->type = symbol_alloc();
! typetable[i] = s->type;
! }
! } else {
! if (typetable[i] != nil) {
! typetable[i]->language = curlang;
! typetable[i]->class = TYPE;
! typetable[i]->type = s;
! } else {
! typetable[i] = s;
! }
! skipchar(curchar, '=');
! getType(s);
! }
}
/*
! * Enter a tag name.
! */
private tagName (s)
Symbol s;
{
! register integer i;
! s->class = TAG;
! i = getint();
! if (i == 0) {
! panic("bad input on tag \"%s\" at \"%s\"", symname(s), curchar);
! } else if (i >= NTYPES) {
! panic("too many types in file \"%s\"", curfilename());
! }
! if (typetable[i] != nil) {
! typetable[i]->language = curlang;
! typetable[i]->class = TYPE;
! typetable[i]->type = s;
! } else {
! typetable[i] = s;
! }
! skipchar(curchar, '=');
! getType(s);
}
/*
! * Setup a symbol entry for a public procedure or function.
! *
! * If it contains nested procedures, then it may already be defined
! * in the current block as a MODULE.
! */
private publicRoutine (s, n, class, addr, isinternal)
Symbol *s;
--- 175,469 ----
String name;
struct nlist *np;
{
! Symbol s;
! register char *p;
! register Name n;
! char c;
! p = index(name, ':');
! *p = '\0';
! c = *(p+1);
! if (autostrip && *name == '_' && strncmp(name, "_auto_", 6) == 0) {
! n = identname(&name[6], false);
! } else {
! n = identname(name, false);
! }
! chkUnnamedBlock();
! curchar = p + 2;
! switch (c) {
! case CONSTNAME:
! newSym(s, n);
! constName(s);
! break;
! case TYPENAME:
! newSym(s, n);
! typeName(s);
! break;
! case TAGNAME:
! s = symbol_alloc();
! s->name = n;
! s->level = curblock->level + 1;
! s->language = curlang;
! s->block = curblock;
! tagName(s);
! break;
! case MODULEBEGIN:
! publicRoutine(&s, n, MODULE, np->n_value, false);
! curmodule = s;
! break;
! case EXTPROCEDURE:
! publicRoutine(&s, n, PROC, np->n_value, false);
! break;
! case PRIVPROCEDURE:
! privateRoutine(&s, n, PROC, np->n_value);
! break;
! case INTPROCEDURE:
! publicRoutine(&s, n, PROC, np->n_value, true);
! break;
! case EXTFUNCTION:
! publicRoutine(&s, n, FUNC, np->n_value, false);
! break;
! case PRIVFUNCTION:
! privateRoutine(&s, n, FUNC, np->n_value);
! break;
! case INTFUNCTION:
! publicRoutine(&s, n, FUNC, np->n_value, true);
! break;
! case EXTVAR:
! extVar(&s, n, np->n_value);
! break;
! case MODULEVAR:
! if (curblock->class != MODULE) {
! exitblock();
! }
! makeVariable(s, n, np->n_value);
! s->storage = EXT;
! s->level = program->level;
! s->block = curmodule;
! getExtRef(s);
! break;
! case OWNVAR:
! makeVariable(s, n, np->n_value);
! ownVariable(s, np->n_value);
! getExtRef(s);
! break;
! case REGVAR:
! makeVariable(s, n, np->n_value);
! s->storage = INREG;
! break;
! case FREGVAR:
! makeVariable(s, n, NREG + np->n_value);
! s->storage = INREG;
! break;
! case VALUEPARAM:
! makeParameter(s, n, STK, VAR, np->n_value);
# ifdef IRIS
! /*
! * Bug in SGI C compiler -- generates stab offset
! * for parameters with size added in.
! */
! if (curlang == findlanguage(".c")) {
! s->symvalue.offset -= size(s);
! }
# endif
! break;
! case VARIABLEPARAM:
! makeParameter(s, n, STK, REF, np->n_value);
! break;
! case REGPARAM:
! makeParameter(s, n, INREG, VAR, np->n_value);
! break;
! case FREGPARAM:
! makeParameter(s, n, INREG, VAR, NREG + np->n_value);
! break;
! case REGVARPARAM:
! makeParameter(s, n, INREG, REF, np->n_value);
! break;
! default: /* local variable */
! --curchar;
! makeVariable(s, n, np->n_value);
! s->storage = STK;
! break;
}
+ if (tracesyms) {
+ printdecl(s);
+ fflush(stdout);
+ }
+ }
/*
! * Enter a named constant.
! */
private constName (s)
Symbol s;
{
! double d;
! char *p, buf[1000];
! s->class = CONST;
! skipchar(curchar, '=');
! p = curchar;
! ++curchar;
! switch (*p) {
! case 'b':
! s->type = t_boolean;
! s->symvalue.constval = build(O_LCON, getint());
! break;
! case 'c':
! s->type = t_char;
! s->symvalue.constval = build(O_LCON, getint());
! break;
! case 'i':
! s->type = t_int;
! s->symvalue.constval = build(O_LCON, getint());
! break;
! case 'r':
! sscanf(curchar, "%lf", &d);
! while (*curchar != '\0' and *curchar != ';') {
! ++curchar;
! }
! --curchar;
! s->type = t_real;
! s->symvalue.constval = build(O_FCON, d);
! break;
! case 's':
! p = &buf[0];
! skipchar(curchar, '\'');
! while (*curchar != '\'') {
! *p = *curchar;
! ++p;
! ++curchar;
! }
! *p = '\0';
! s->symvalue.constval = build(O_SCON, strdup(buf));
! s->type = s->symvalue.constval->nodetype;
! break;
! case 'e':
! getType(s);
! skipchar(curchar, ',');
! s->symvalue.constval = build(O_LCON, getint());
! break;
! case 'S':
! getType(s);
! skipchar(curchar, ',');
! getint(); /* set size */
! skipchar(curchar, ',');
! getint(); /* number of bits in constant */
! s->symvalue.constval = build(O_LCON, 0);
! break;
! default:
! s->type = t_int;
! s->symvalue.constval = build(O_LCON, 0);
! printf("[internal error: unknown constant type '%c']", *p);
! break;
}
+ s->symvalue.constval->nodetype = s->type;
+ }
/*
! * Enter a type name.
! */
private typeName (s)
Symbol s;
{
! register integer i;
! s->class = TYPE;
! s->language = curlang;
! s->block = curblock;
! s->level = curblock->level + 1;
! i = getint();
! if (i == 0) {
! panic("bad input on type \"%s\" at \"%s\"", symname(s), curchar);
! } else if (i >= NTYPES) {
! panic("too many types in file \"%s\"", curfilename());
}
+ /*
+ * A hack for C typedefs that don't create new types,
+ * e.g. typedef unsigned int Hashvalue;
+ * or typedef struct blah BLAH;
+ */
+ if (*curchar != '=') {
+ s->type = typetable[i];
+ if (s->type == nil) {
+ s->type = symbol_alloc();
+ typetable[i] = s->type;
+ }
+ } else {
+ if (typetable[i] != nil) {
+ typetable[i]->language = curlang;
+ typetable[i]->class = TYPE;
+ typetable[i]->type = s;
+ } else {
+ typetable[i] = s;
+ }
+ skipchar(curchar, '=');
+ getType(s);
+ }
+ }
/*
! * Enter a tag name.
! */
private tagName (s)
Symbol s;
{
! register integer i;
! s->class = TAG;
! i = getint();
! if (i == 0) {
! panic("bad input on tag \"%s\" at \"%s\"", symname(s), curchar);
! } else if (i >= NTYPES) {
! panic("too many types in file \"%s\"", curfilename());
}
+ if (typetable[i] != nil) {
+ typetable[i]->language = curlang;
+ typetable[i]->class = TYPE;
+ typetable[i]->type = s;
+ } else {
+ typetable[i] = s;
+ }
+ skipchar(curchar, '=');
+ getType(s);
+ }
/*
! * Setup a symbol entry for a public procedure or function.
! *
! * If it contains nested procedures, then it may already be defined
! * in the current block as a MODULE.
! */
private publicRoutine (s, n, class, addr, isinternal)
Symbol *s;
***************
*** 457,475 ****
Address addr;
boolean isinternal;
{
! Symbol nt, t;
! newSym(nt, n);
! if (isinternal) {
! markInternal(nt);
! }
! enterRoutine(nt, class);
! find(t, n) where
! t != nt and t->class == MODULE and t->block == nt->block
! endfind(t);
! if (t == nil) {
! t = nt;
! } else {
t->language = nt->language;
t->class = nt->class;
t->type = nt->type;
--- 472,490 ----
Address addr;
boolean isinternal;
{
! Symbol nt, t;
! newSym(nt, n);
! if (isinternal) {
! markInternal(nt);
! }
! enterRoutine(nt, class);
! find(t, n) where
! t != nt and t->class == MODULE and t->block == nt->block
! endfind(t);
! if (t == nil) {
! t = nt;
! } else {
t->language = nt->language;
t->class = nt->class;
t->type = nt->type;
***************
*** 507,513 ****
boolean isnew;
find(t, n) where
! t->level == curmodule->level and t->class == class
endfind(t);
if (t == nil) {
isnew = true;
--- 522,528 ----
boolean isnew;
find(t, n) where
! t->block == curmodule and t->class == class
endfind(t);
if (t == nil) {
isnew = true;
***************
*** 517,528 ****
}
t->language = curlang;
enterRoutine(t, class);
if (isnew) {
t->symvalue.funcv.src = false;
t->symvalue.funcv.inline = false;
- t->symvalue.funcv.beginaddr = addr;
- newfunc(t, codeloc(t));
- findbeginning(t);
}
*s = t;
}
--- 532,541 ----
}
t->language = curlang;
enterRoutine(t, class);
+ dataloc(t) = addr;
if (isnew) {
t->symvalue.funcv.src = false;
t->symvalue.funcv.inline = false;
}
*s = t;
}
***************
*** 614,620 ****
n = identname(curchar + 1, false);
curchar = p + 1;
} else {
! n = identname(curchar + 1, true);
}
t = insert(n);
t->language = s->language;
--- 627,633 ----
n = identname(curchar + 1, false);
curchar = p + 1;
} else {
! n = identname(curchar + 1, false);
}
t = insert(n);
t->language = s->language;
***************
*** 637,643 ****
Name n;
Symbol s;
! n = identname(id, true);
find(s, n) where s->block == m and isblock(s) endfind(s);
if (s == nil) {
s = insert(n);
--- 650,656 ----
Name n;
Symbol s;
! n = identname(id, false);
find(s, n) where s->block == m and isblock(s) endfind(s);
if (s == nil) {
s = insert(n);
***************
*** 964,978 ****
if (autostrip && *cur == '_') {
for (tagname = cur + 1; ; tagname++) {
if (*tagname == '_') {
! name = identname(tagname + 1, true);
break;
} else if (*tagname == '\0') {
! name = identname(cur, true);
break;
}
}
} else {
! name = identname(cur, true);
}
u->chain = newSymbol(name, d, FIELD, nil, nil);
cur = p + 1;
--- 977,991 ----
if (autostrip && *cur == '_') {
for (tagname = cur + 1; ; tagname++) {
if (*tagname == '_') {
! name = identname(tagname + 1, false);
break;
} else if (*tagname == '\0') {
! name = identname(cur, false);
break;
}
}
} else {
! name = identname(cur, false);
}
u->chain = newSymbol(name, d, FIELD, nil, nil);
cur = p + 1;
***************
*** 1012,1018 ****
p = index(curchar, ':');
assert(p != nil);
*p = '\0';
! u->chain = insert(identname(curchar, true));
curchar = p + 1;
u = u->chain;
u->language = curlang;
--- 1025,1031 ----
p = index(curchar, ':');
assert(p != nil);
*p = '\0';
! u->chain = insert(identname(curchar, false));
curchar = p + 1;
u = u->chain;
u->language = curlang;
***************
*** 1109,1115 ****
}
def = (Boolean) (*p == ',');
*p = '\0';
! n = identname(curchar, true);
find(s, n) where s->class == TYPEREF endfind(s);
if (s == nil) {
s = insert(n);
--- 1122,1128 ----
}
def = (Boolean) (*p == ',');
*p = '\0';
! n = identname(curchar, false);
find(s, n) where s->class == TYPEREF endfind(s);
if (s == nil) {
s = insert(n);
*** /usr/src/ucb/dbx/printsym.c Fri Dec 9 11:57:29 1988
--- printsym.c Thu Oct 12 14:37:21 1989
***************
*** 1,9 ****
! /* $Header:printsym.c 12.0$ */
! /* $ACIS:printsym.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/printsym.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:printsym.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: printsym.c,v 12.1 89/10/12 17:37:20 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/printsym.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: printsym.c,v 12.1 89/10/12 17:37:20 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 27,34 ****
#include "main.h"
#include <ctype.h>
! #ifndef public
! #endif
/*
* Maximum number of arguments to a function.
--- 26,34 ----
#include "main.h"
#include <ctype.h>
! public boolean hexints = false;
! public boolean octints = false;
! public boolean expandunions = false;
/*
* Maximum number of arguments to a function.
***************
*** 115,131 ****
public printrtn (s)
Symbol s;
{
! register Symbol t;
! register int len;
! Boolean isindirect;
printf("returning ");
if (s->class == FUNC && (!istypename(s->type,"void"))) {
len = size(s->type);
if (canpush(len)) {
! t = rtype(s->type);
! isindirect = (Boolean) (t->class == RECORD or t->class == VARNT);
! pushretval(len, isindirect);
printval(s->type);
putchar(' ');
} else {
--- 115,127 ----
public printrtn (s)
Symbol s;
{
! int len;
printf("returning ");
if (s->class == FUNC && (!istypename(s->type,"void"))) {
len = size(s->type);
if (canpush(len)) {
! pushretval(s->type);
printval(s->type);
putchar(' ');
} else {
***************
*** 377,391 ****
checkref(s);
n = s->name;
! t = lookup(n);
! printwhich(f, t);
! t = t->next_sym;
! while (t != nil) {
if (t->name == n) {
putc(' ', f);
- printwhich(f, t);
}
- t = t->next_sym;
}
putc('\n', f);
}
--- 373,383 ----
checkref(s);
n = s->name;
! for ( t = lookup(n); t; t = t->next_sym ){
if (t->name == n) {
+ printwhich(f,t);
putc(' ', f);
}
}
putc('\n', f);
}
***************
*** 481,487 ****
case PROG:
case PROC:
case FUNC:
! printf("address\t0x%x\n", s->symvalue.funcv.beginaddr);
if (isinline(s)) {
printf("inline procedure\n");
}
--- 473,480 ----
case PROG:
case PROC:
case FUNC:
! printf("code address\t0x%x\n", codeloc(s));
! printf("data address\t0x%x\n", dataloc(s));
if (isinline(s)) {
printf("inline procedure\n");
}
***************
*** 636,642 ****
if (sp - elsize != newsp) {
fputs(sep, stdout);
}
! printval(eltype);
}
sp = newsp;
if (streq(sep, "\n")) {
--- 629,640 ----
if (sp - elsize != newsp) {
fputs(sep, stdout);
}
! if (expandunions && (a->type->type->class == VARNT))
! {
! printunion(a->type->type);
! }
! else
! printval(eltype);
}
sp = newsp;
if (streq(sep, "\n")) {
***************
*** 726,731 ****
--- 724,731 ----
}
} else if (varIsSet("$hexints")) {
printf("0x%lx", val);
+ } else if (octints) {
+ printf("0%lo", val);
} else if (t->symvalue.rangev.lower >= 0) {
printf("%lu", val);
} else {
***************
*** 749,755 ****
e = e->chain;
}
if (e != nil) {
! printf("%s", symname(e));
} else {
printf("%d", i);
}
--- 749,755 ----
e = e->chain;
}
if (e != nil) {
! printf("%s:%d", symname(e),i);
} else {
printf("%d", i);
}
*** /usr/src/ucb/dbx/operators.c Fri Dec 9 11:57:23 1988
--- operators.c Thu Oct 12 14:37:19 1989
***************
*** 1,9 ****
! /* $Header:operators.c 12.0$ */
! /* $ACIS:operators.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/operators.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:operators.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: operators.c,v 12.1 89/10/12 17:37:18 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/operators.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: operators.c,v 12.1 89/10/12 17:37:18 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 41,58 ****
O_CALL, /* call a procedure in the program */
O_CATCH, /* catch a signal before program does */
O_CHFILE, /* change (or print) the current source file */
O_CONT, /* continue execution */
O_DEBUG, /* invoke a dbx internal debugging routine */
O_DELETE, /* remove a trace/stop */
O_DUMP, /* dump out variables */
O_EDIT, /* edit a file (or function) */
O_FUNC, /* set the current function */
! O_GRIPE, /* send mail to debugger support person */
O_HELP, /* print a synopsis of debugger commands */
O_IGNORE, /* let program catch signal */
O_LIST, /* list source lines */
O_PRINT, /* print the values of a list of expressions */
O_PSYM, /* print symbol information */
O_RUN, /* start up program */
O_SKIP, /* skip the current line */
O_SOURCE, /* read commands from a file */
--- 40,62 ----
O_CALL, /* call a procedure in the program */
O_CATCH, /* catch a signal before program does */
O_CHFILE, /* change (or print) the current source file */
+ O_CLEAR,
+ O_CLEARI,
O_CONT, /* continue execution */
O_DEBUG, /* invoke a dbx internal debugging routine */
+ O_DELALL,
O_DELETE, /* remove a trace/stop */
O_DUMP, /* dump out variables */
O_EDIT, /* edit a file (or function) */
O_FUNC, /* set the current function */
! O_GOTO,
O_HELP, /* print a synopsis of debugger commands */
O_IGNORE, /* let program catch signal */
O_LIST, /* list source lines */
+ O_LISTI, /* list assembly code */
O_PRINT, /* print the values of a list of expressions */
O_PSYM, /* print symbol information */
+ O_REGS, /* print register information */
O_RUN, /* start up program */
O_SKIP, /* skip the current line */
O_SOURCE, /* read commands from a file */
***************
*** 74,84 ****
--- 78,90 ----
O_ONCE, /* add a "one-time" event, delete when first reached */
O_PRINTCALL, /* print out the current procedure and its arguments */
O_PRINTIFCHANGED, /* print the value of the argument if it has changed */
+ O_PRINTIIFCHANGED, /* print the value of the argument if it has changed */
O_PRINTRTN, /* print out the routine and value that just returned */
O_PRINTSRCPOS, /* print out the current source position */
O_PROCRTN, /* call completed */
O_QLINE, /* filename, line number */
O_STOPIFCHANGED, /* stop if the value of the argument has changed */
+ O_STOPIIFCHANGED, /* stop if the value of the argument has changed */
O_STOPX, /* stop execution */
O_TRACEON, /* begin tracing source line, variable, or all lines */
O_TRACEOFF, /* end tracing source line, variable, or all lines */
***************
*** 128,139 ****
public Opinfo opinfo[] ={
/* O_NOP */ 0, null, 0,
! /* O_NAME */ -1, LEAF, 0,
! /* O_SYM */ -1, LEAF, 0,
! /* O_LCON */ -1, LEAF, 0,
! /* O_CCON */ -1, LEAF, 0,
! /* O_FCON */ -1, LEAF, 0,
! /* O_SCON */ -1, LEAF, 0,
/* O_RVAL */ 1, UNARY, 0,
/* O_INDEX */ 2, null, 0,
/* O_INDIR */ 1, UNARY, "^",
--- 134,145 ----
public Opinfo opinfo[] ={
/* O_NOP */ 0, null, 0,
! /* O_NAME */ 0, LEAF, 0,
! /* O_SYM */ 0, LEAF, 0,
! /* O_LCON */ 0, LEAF, 0,
! /* O_CCON */ 0, LEAF, 0,
! /* O_FCON */ 0, LEAF, 0,
! /* O_SCON */ 0, LEAF, 0,
/* O_RVAL */ 1, UNARY, 0,
/* O_INDEX */ 2, null, 0,
/* O_INDIR */ 1, UNARY, "^",
***************
*** 171,188 ****
/* O_CALL */ 2, null, "call",
/* O_CATCH */ 0, null, "catch",
/* O_CHFILE */ 0, null, "file",
/* O_CONT */ 0, null, "cont",
/* O_DEBUG */ 0, null, "debug",
/* O_DELETE */ 1, null, "delete",
/* O_DUMP */ 1, null, "dump",
/* O_EDIT */ 0, null, "edit",
/* O_FUNC */ 1, null, "func",
! /* O_GRIPE */ 0, null, "gripe",
! /* O_HELP */ 0, null, "help",
/* O_IGNORE */ 0, null, "ignore",
/* O_LIST */ 2, null, "list",
/* O_PRINT */ 1, null, "print",
/* O_PSYM */ 1, null, "psym",
/* O_RUN */ 0, null, "run",
/* O_SKIP */ 0, null, "skip",
/* O_SOURCE */ 0, null, "source",
--- 177,199 ----
/* O_CALL */ 2, null, "call",
/* O_CATCH */ 0, null, "catch",
/* O_CHFILE */ 0, null, "file",
+ /* O_CLEAR */ 2, null, "clear",
+ /* O_CLEARI */ 1, null, "cleari",
/* O_CONT */ 0, null, "cont",
/* O_DEBUG */ 0, null, "debug",
+ /* O_DELALL */ 0, null, "delete all",
/* O_DELETE */ 1, null, "delete",
/* O_DUMP */ 1, null, "dump",
/* O_EDIT */ 0, null, "edit",
/* O_FUNC */ 1, null, "func",
! /* O_GOTO */ 1, null, "goto",
! /* O_HELP */ 1, null, "help",
/* O_IGNORE */ 0, null, "ignore",
+ /* O_LISTI */ 2, null, "listi",
/* O_LIST */ 2, null, "list",
/* O_PRINT */ 1, null, "print",
/* O_PSYM */ 1, null, "psym",
+ /* O_REGS */ 0, null, "registers",
/* O_RUN */ 0, null, "run",
/* O_SKIP */ 0, null, "skip",
/* O_SOURCE */ 0, null, "source",
***************
*** 204,214 ****
--- 215,227 ----
/* O_ONCE */ 0, null, "once",
/* O_PRINTCALL */ 1, null, "printcall",
/* O_PRINTIFCHANGED */ 1, null, "printifchanged",
+ /* O_PRINTIIFCHANGED */ 1, null, "printiifchanged",
/* O_PRINTRTN */ 1, null, "printrtn",
/* O_PRINTSRCPOS */ 1, null, "printsrcpos",
/* O_PROCRTN */ 1, null, "procrtn",
/* O_QLINE */ 2, null, nil,
/* O_STOPIFCHANGED */ 1, null, "stopifchanged",
+ /* O_STOPIIFCHANGED */ 1, null, "stopiifchanged",
/* O_STOPX */ 0, null, "stop",
/* O_TRACEON */ 1, null, "traceon",
/* O_TRACEOFF */ 1, null, "traceoff",
*** /usr/src/ucb/dbx/process.c Fri Dec 9 11:57:31 1988
--- process.c Thu Oct 12 14:37:22 1989
***************
*** 1,9 ****
! /* $Header:process.c 12.0$ */
! /* $ACIS:process.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/process.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:process.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: process.c,v 12.1 89/10/12 17:37:22 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/process.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: process.c,v 12.1 89/10/12 17:37:22 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 47,52 ****
--- 46,53 ----
* These definitions are for the arguments to "pio".
*/
+ #define DATASTART 0x10000000 /* data segment start on the RT */
+
typedef enum { PREAD, PWRITE } PioOp;
typedef enum { TEXTSEG, DATASEG } PioSeg;
***************
*** 468,482 ****
private Word fetch();
private store();
! public pio (p, op, seg, buff, addr, nbytes)
Process p;
PioOp op;
- PioSeg seg;
char *buff;
Address addr;
int nbytes;
{
register int i;
register Address newaddr;
register char *cp;
char *bufend;
--- 469,483 ----
private Word fetch();
private store();
! public pio (p, op, buff, addr, nbytes)
Process p;
PioOp op;
char *buff;
Address addr;
int nbytes;
{
register int i;
+ PioSeg seg;
register Address newaddr;
register char *cp;
char *bufend;
***************
*** 484,489 ****
--- 485,492 ----
Address wordaddr;
int byteoff;
+ seg = ( addr < DATASTART ) ? TEXTSEG : DATASEG;
+
if (p->status != STOPPED) {
error("program is not active");
}
***************
*** 558,563 ****
--- 561,568 ----
register CacheWord *wp;
register Word w;
+ w = errno = 0;
+
switch (seg) {
case TEXTSEG:
++nfetchs;
***************
*** 580,585 ****
--- 585,595 ----
panic("fetch: bad seg %d", seg);
/* NOTREACHED */
}
+ if ( w == -1 && errno != 0 && errno != ESRCH )
+ error("read of process %s segment, address 0x%x failed. errno = %d\n",
+ ( (seg == DATASEG)?"data":"text"),addr,errno);
+
+
return w;
}
***************
*** 595,601 ****
--- 605,614 ----
Word data;
{
register CacheWord *wp;
+ int ret;
+ ret = errno = 0;
+
switch (seg) {
case TEXTSEG:
++nwrites;
***************
*** 602,612 ****
wp = &p->word[cachehash(addr)];
wp->addr = addr;
wp->val = data;
! ptrace(PT_WRITE_I, p->pid, addr, data);
break;
case DATASEG:
! ptrace(PT_WRITE_D, p->pid, addr, data);
break;
default:
--- 615,625 ----
wp = &p->word[cachehash(addr)];
wp->addr = addr;
wp->val = data;
! ret = ptrace(PT_WRITE_I, p->pid, addr, data);
break;
case DATASEG:
! ret = ptrace(PT_WRITE_D, p->pid, addr, data);
break;
default:
***************
*** 613,618 ****
--- 626,634 ----
panic("store: bad seg %d", seg);
/* NOTREACHED */
}
+ if ( ret == -1 && errno != 0 && errno != ESRCH )
+ printf("write to process %s segment, address = 0x%x failed. errno = %d\n",
+ ( (seg == TEXTSEG )?"text":"data"),addr,errno);
}
/*
*** /usr/src/ucb/dbx/keywords.c Fri Dec 9 11:56:59 1988
--- keywords.c Thu Oct 12 14:37:07 1989
***************
*** 1,9 ****
! /* $Header:keywords.c 12.0$ */
! /* $ACIS:keywords.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/keywords.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:keywords.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: keywords.c,v 12.1 89/10/12 17:37:06 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/keywords.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: keywords.c,v 12.1 89/10/12 17:37:06 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 21,26 ****
--- 20,26 ----
#include "lists.h"
#include "main.h"
#include "y.tab.h"
+ #include "printsym.h"
#ifndef public
***************
*** 30,40 ****
#endif
private String reserved[] ={
! "alias", "and", "assign", "at", "call", "catch", "cont",
"debug", "delete", "div", "down", "dump", "edit", "file", "func",
! "gripe", "help", "if", "ignore", "in",
! "list", "mod", "next", "nexti", "nil", "not", "or",
! "print", "psym", "quit", "rerun", "return", "run",
"set", "sh", "skip", "source", "status", "step", "stepi",
"stop", "stopi", "trace", "tracei", "unalias", "unset", "up", "use",
"whatis", "when", "where", "whereis", "which",
--- 30,40 ----
#endif
private String reserved[] ={
! "alias", "all", "and", "assign", "at", "call", "catch", "clear", "cleari", "cont",
"debug", "delete", "div", "down", "dump", "edit", "file", "func",
! "goto", "gotoi", "help", "if", "ignore", "in",
! "list", "listi","mod", "next", "nexti", "nil", "not", "or",
! "print", "psym", "quit", "registers", "rerun", "return", "run",
"set", "sh", "skip", "source", "status", "step", "stepi",
"stop", "stopi", "trace", "tracei", "unalias", "unset", "up", "use",
"whatis", "when", "where", "whereis", "which",
***************
*** 103,111 ****
--- 103,113 ----
defalias("st", "stop");
defalias("j", "status");
defalias("t", "where");
+ defalias("x", "registers");
if (vaddrs) {
defvar(identname("$mapaddrs", true), nil);
}
+ defvar(identname("$listwindow", true), build(O_LCON, (long) 10));
}
/*
***************
*** 412,417 ****
--- 414,436 ----
if (n == identname("$mapaddrs", true)) {
vaddrs = true;
}
+ if (n == identname("$expandunions", true)) {
+ expandunions = true;
+ }
+ else if (n == identname("$hexints", true)) {
+ hexints = true;
+ if (octints) {
+ undefvar(identname("$octints",true));
+ octints = false;
+ }
+ }
+ else if (n == identname("$octints", true)) {
+ octints = true;
+ if (hexints) {
+ undefvar(identname("$hexints",true));
+ hexints = false;
+ }
+ }
}
}
***************
*** 456,461 ****
--- 475,486 ----
}
if (n == identname("$mapaddrs", true)) {
vaddrs = false;
+ } else if (n == identname("$hexints", true)) {
+ hexints = false;
+ } else if (n == identname("$octints", true)) {
+ octints = false;
+ } else if (n == identname("$expandunions", true)) {
+ expandunions = false;
}
}
*** /usr/src/ucb/dbx/pascal.c Fri Dec 9 11:57:26 1988
--- pascal.c Thu Oct 12 14:37:20 1989
***************
*** 1,9 ****
! /* $Header:pascal.c 12.0$ */
! /* $ACIS:pascal.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/pascal.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:pascal.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: pascal.c,v 12.1 89/10/12 17:37:19 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/pascal.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: pascal.c,v 12.1 89/10/12 17:37:19 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 22,31 ****
#include "process.h"
#include "runtime.h"
#include "machine.h"
- #ifndef public
- #endif
-
private Language pasc;
private boolean initialized;
--- 21,28 ----
#include "process.h"
#include "runtime.h"
#include "machine.h"
+ #include "printsym.h"
private Language pasc;
private boolean initialized;
***************
*** 82,88 ****
boolean b;
register Symbol rt1, rt2;
! if (t1->class == RANGE and t2->class == RANGE) {
rt1 = rtype(t1->type);
rt2 = rtype(t2->type);
b = (boolean) (rt1->type == rt2->type);
--- 79,88 ----
boolean b;
register Symbol rt1, rt2;
! if (streq(t1->type->name->identifier,"short") &&
! streq(t2->type->name->identifier,"$integer"))
! b = true;
! else if (t1->class == RANGE and t2->class == RANGE) {
rt1 = rtype(t1->type);
rt2 = rtype(t2->type);
b = (boolean) (rt1->type == rt2->type);
***************
*** 558,564 ****
break;
case VARNT:
! printf("[variant]");
break;
case RANGE:
--- 558,567 ----
break;
case VARNT:
! if (expandunions)
! printunion(s);
! else
! printf("[variant]");
break;
case RANGE:
***************
*** 801,807 ****
t = rtype(s);
s = rtype(t->chain);
findbounds(s, &lb, &ub);
! if (i < lb or i > ub) {
error("subscript %d out of range [%d..%d]", i, lb, ub);
}
push(long, base + (i - lb) * size(t->type));
--- 804,810 ----
t = rtype(s);
s = rtype(t->chain);
findbounds(s, &lb, &ub);
! if ((i < lb or i > ub) && varIsSet("$unsafebounds")) {
error("subscript %d out of range [%d..%d]", i, lb, ub);
}
push(long, base + (i - lb) * size(t->type));
*** /usr/src/ucb/dbx/fortran.c Fri Dec 9 11:56:57 1988
--- fortran.c Thu Oct 12 14:37:05 1989
***************
*** 1,9 ****
! /* $Header:fortran.c 12.0$ */
! /* $ACIS:fortran.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/fortran.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:fortran.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: fortran.c,v 12.1 89/10/12 17:37:04 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/fortran.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: fortran.c,v 12.1 89/10/12 17:37:04 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 115,121 ****
return(buf);
}
! private Symbol mksubs (pbuf,st)
Symbol st;
char **pbuf;
{
--- 114,120 ----
return(buf);
}
! private void mksubs (pbuf,st)
Symbol st;
char **pbuf;
{
***************
*** 362,370 ****
if (t->type == t_int or istypename(t->type, "integer") or
istypename(t->type,"integer*2")
) {
! printf("%ld", i);
} else if (istypename(t->type, "addr")) {
printf("0x%lx", i);
} else {
error("unknown type in fortran printint");
}
--- 361,381 ----
if (t->type == t_int or istypename(t->type, "integer") or
istypename(t->type,"integer*2")
) {
! if (hexints)
! printf("0x%lx", i);
! else if (octints)
! printf("0%lo", i);
! else
! printf("%ld", i);
! } else if (istypename(t->type, "short")) {
! printf("%d", i);
} else if (istypename(t->type, "addr")) {
printf("0x%lx", i);
+ } else if (istypename(t->type, "char")) {
+ if (varIsSet("$hexchars"))
+ printf("0x%lx", i);
+ else
+ printf("%c", i);
} else {
error("unknown type in fortran printint");
}
***************
*** 499,505 ****
ub = r->symvalue.rangev.upper;
}
! if (i < lb or i > ub) {
error("subscript out of range");
}
push(long, base + (i - lb) * size(t->type));
--- 510,516 ----
ub = r->symvalue.rangev.upper;
}
! if ( (i < lb or i > ub) && varIsSet("$unsafebounds") ){
error("subscript out of range");
}
push(long, base + (i - lb) * size(t->type));
*** /usr/src/ucb/dbx/main.c Fri Dec 9 11:57:07 1988
--- main.c Thu Oct 12 14:37:11 1989
***************
*** 1,9 ****
! /* $Header:main.c 12.0$ */
! /* $ACIS:main.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/main.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:main.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: main.c,v 12.1 89/10/12 17:37:10 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/main.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: main.c,v 12.1 89/10/12 17:37:10 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 164,181 ****
readobj(objname);
printf("\n");
fflush(stdout);
! if (coredump) {
! printf("[using memory image in %s]\n", corename);
! if (vaddrs) {
! coredump_getkerinfo();
! } else if (badcore) {
! warning("%s does not match %s", corename, objname);
}
! getsrcpos();
! setcurfunc(whatblock(pc));
! } else {
! setcurfunc(program);
! }
bpinit();
f = fopen(initfile, "r");
if (f != nil) {
--- 163,183 ----
readobj(objname);
printf("\n");
fflush(stdout);
!
! if ( badcore ){
! coredump = false;
! fprintf(stderr,"%s does not match %s\n",corename,objname);
}
!
! if (coredump) {
! printf("[using memory image in %s]\n", corename);
! if (vaddrs)
! coredump_getkerinfo();
! getsrcpos();
! setcurfunc(whatblock(pc));
! }
! else setcurfunc(program);
!
bpinit();
f = fopen(initfile, "r");
if (f != nil) {
***************
*** 264,269 ****
--- 266,272 ----
public erecover()
{
+ isstopped = true;
if (initdone) {
gobble();
longjmp(env, 1);
*** /usr/src/ucb/dbx/Makefile Fri Dec 9 11:56:31 1988
--- Makefile Thu Oct 12 14:37:37 1989
***************
*** 3,11 ****
# All rights reserved. The Berkeley Software License Agreement
# specifies the terms and conditions for redistribution.
#
! #$Header:Makefile 12.1$
! #$ACIS:Makefile 12.1$
! #$Source: /ibm/acis/usr/src/ucb/dbx/RCS/Makefile,v $
#
# make file for debugger "dbx"
#
--- 3,10 ----
# All rights reserved. The Berkeley Software License Agreement
# specifies the terms and conditions for redistribution.
#
! #$Header: Makefile,v 12.1 89/10/12 17:37:36 brunner Locked $
! #$Source: /fish/dbx/RCS/Makefile,v $
#
# make file for debugger "dbx"
#
***************
*** 18,33 ****
AOUT = tdbx
DEST = ${DESTDIR}/usr/ucb/dbx
! CC = cc
AS = as
#
# if you want gripes
# CFLAGS = '-DMAINTAINER="linton@shasta"'
#
- CFLAGS =
! LD = cc
LDFLAGS =
LIBRARIES = -lm # -lPW for IRIS (System V)
--- 17,32 ----
AOUT = tdbx
DEST = ${DESTDIR}/usr/ucb/dbx
! CC = /bin/cc
AS = as
#
# if you want gripes
# CFLAGS = '-DMAINTAINER="linton@shasta"'
#
!
! LD = $(CC)
LDFLAGS =
LIBRARIES = -lm # -lPW for IRIS (System V)
***************
*** 81,86 ****
--- 80,86 ----
stabstring.o \
symbols.o \
tree.o \
+ help.o \
version.o
HDR = \
*** /usr/src/ucb/dbx/examine.c Fri Dec 9 11:56:52 1988
--- examine.c Thu Oct 12 14:37:00 1989
***************
*** 1,9 ****
! /* $Header:examine.c 12.0$ */
! /* $ACIS:examine.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/examine.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:examine.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: examine.c,v 12.1 89/10/12 17:37:00 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/examine.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: examine.c,v 12.1 89/10/12 17:37:00 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 382,392 ****
register Address addr;
register Lineno line;
String filename;
addr = nextaddr(pc, isnext);
if (not inst_tracing and nlhdr.nlines != 0) {
line = linelookup(addr);
! while (line == 0) {
addr = nextaddr(addr, isnext);
line = linelookup(addr);
}
--- 381,392 ----
register Address addr;
register Lineno line;
String filename;
+ Symbol s;
addr = nextaddr(pc, isnext);
if (not inst_tracing and nlhdr.nlines != 0) {
line = linelookup(addr);
! while (line == 0 && (s = whatblock(addr)) && !nosource(s)) {
addr = nextaddr(addr, isnext);
line = linelookup(addr);
}
*** /usr/src/ucb/dbx/scanner.c Fri Dec 9 11:57:36 1988
--- scanner.c Thu Oct 12 14:37:25 1989
***************
*** 1,9 ****
! /* $Header:scanner.c 12.0$ */
! /* $ACIS:scanner.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/scanner.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:scanner.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: scanner.c,v 12.1 89/10/12 17:37:24 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/scanner.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: scanner.c,v 12.1 89/10/12 17:37:24 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 152,159 ****
++curchar;
switch (c) {
case '\'':
! t = INT;
! yylval.y_int = charcon(curchar);
curchar += 2;
break;
case '\n':
--- 151,158 ----
++curchar;
switch (c) {
case '\'':
! t = CHAR;
! yylval.y_char = charcon(curchar);
curchar += 2;
break;
case '\n':
*** /usr/src/ucb/dbx/source.c Fri Dec 9 11:57:39 1988
--- source.c Thu Oct 12 14:37:26 1989
***************
*** 1,9 ****
! /* $Header:source.c 12.0$ */
! /* $ACIS:source.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/source.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:source.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: source.c,v 12.1 89/10/12 17:37:26 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/source.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: source.c,v 12.1 89/10/12 17:37:26 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 49,54 ****
--- 48,54 ----
extern char *re_comp();
private Lineno lastlinenum;
+ public int inst_windowsize = 10;
private String prevsource = nil;
/*
*** /usr/src/ucb/dbx/library.c Fri Dec 9 11:57:03 1988
--- library.c Thu Oct 12 14:37:09 1989
***************
*** 1,9 ****
! /* $Header:library.c 12.0$ */
! /* $ACIS:library.c 12.0$ */
! /* $Source: /ibm/acis/usr/src/ucb/dbx/RCS/library.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:library.c 12.0$";
#endif
/* Copyright (c) 1982 Regents of the University of California */
--- 1,8 ----
! /* $Header: library.c,v 12.1 89/10/12 17:37:08 brunner Locked $ */
! /* $Source: /fish/dbx/RCS/library.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: library.c,v 12.1 89/10/12 17:37:08 brunner Locked $";
#endif
/* Copyright (c) 1982 Regents of the University of California */
***************
*** 750,755 ****
--- 749,755 ----
sprintf(buf, "malloc failed: no space: file %s, line %d", f,l);
panic(buf);
}
+ bzero(cp,n);
return(cp);
}
Eric Brunner, IBM AWD Palo Alto
inet: brunner@monet.berkeley.edu or brunner%ibmsupt@uunet.uu.net
uucp: uunet!ibmsupt!brunner (415) 855-4486
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads