Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/1106/9

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


64-bit fixes.
 [jmk] --rw-rw-r-- M 451989 glenda sys 4377 Nov  6 12:25 sys/src/cmd/db/command.c
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/command.c:150,156 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/command.c:150,156
	  			map = symmap;
	  	}
	  	if (!map) {
	- 		sprint(buf, "no map for %c", pc);
	+ 		snprint(buf, sizeof(buf), "no map for %c", pc);
	  		error(buf);
	  	}
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/command.c:186,192 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/command.c:186,192
	  void
	  cmdsrc(int c, Map *map)
	  {
	- 	long w;
	+ 	ulong w;
	  	long locval, locmsk;
	  	ADDR savdot;
	  	ushort sh;
 [rsc] --rw-rw-r-- M 451989 glenda sys 1700 Nov  6 11:02 sys/src/cmd/db/defs.h
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/defs.h:10,17 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/defs.h:10,17
	  
	  #include <mach.h>
	  
	- typedef long WORD;
	- typedef vlong ADDR;
	+ typedef ulong WORD;
	+ typedef uvlong ADDR;
	  
	  #define	HUGEINT	0x7fffffff	/* enormous WORD */
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/defs.h:57,62 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/defs.h:57,63
	  #define BKPTSKIP 2	/* real, skip over it next time */
	  #define	BKPTTMP	3	/* temporary; clear when it happens */
	  
	+ typedef struct bkpt	BKPT;
	  struct bkpt {
	  	ADDR	loc;
	  	uchar	save[4];
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/defs.h:64,72 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/defs.h:65,72
	  	int	initcnt;
	  	int	flag;
	  	char	comm[MAXCOM];
	- 	struct bkpt *nxtbkpt;
	+ 	BKPT	*nxtbkpt;
	  };
	- typedef struct bkpt	BKPT;
	  
	  #define	BADREG	(-1)
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/defs.h:75,81 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/defs.h:75,81
	   */
	  
	  extern	WORD	adrval;
	- extern	vlong	expv;
	+ extern	uvlong	expv;
	  extern	int	adrflg;
	  extern	WORD	cntval;
	  extern	int	cntflg;
 [rsc] --rw-rw-r-- M 451989 glenda sys 5441 Nov  6 11:02 sys/src/cmd/db/expr.c
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/expr.c:10,16 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/expr.c:10,16
	  static long	round(long, long);
	  
	  extern	ADDR	ditto;
	- vlong	expv;
	+ uvlong	expv;
	  
	  static WORD
	  ascval(void)
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/expr.c:119,131 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/expr.c:119,131
	  
	  term(int a)
	  {	/* item | monadic item | (expr) | */
	- 	WORD e;
	+ 	ADDR e;
	  
	  	switch ((int)readchar()) {
	  
	  	case '*':
	  		term(a|1);
	- 		if (get4(cormap, (ADDR)expv, &e) < 0)
	+ 		if (geta(cormap, expv, &e) < 0)
	  			error("%r");
	  		expv = e;
	  		return(1);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/expr.c:132,138 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/expr.c:132,138
	  
	  	case '@':
	  		term(a|1);
	- 		if (get4(symmap, (ADDR)expv, &e) < 0)
	+ 		if (geta(symmap, expv, &e) < 0)
	  			error("%r");
	  		expv = e;
	  		return(1);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/expr.c:163,169 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/expr.c:163,169
	  {	/* name [ . local ] | number | . | ^  | <register | 'x | | */
	  	char	*base;
	  	char	savc;
	- 	WORD e;
	+ 	uvlong e;
	  	Symbol s;
	  	char gsym[MAXSYM], lsym[MAXSYM];
	  
 [jmk] --rw-rw-r-- M 451989 glenda sys 2014 Nov  6 12:25 sys/src/cmd/db/fns.h
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/fns.h:24,33 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/fns.h:24,29
	  void		execbkpt(BKPT*, int);
	  char*		exform(int, int, char*, Map*, int, int);
	  int		expr(int);
	- /*
	- void		fixregs(Map*);
	- void		adjustreg(char*, ulong, long);
	- */
	  void		flush(void);
	  void		flushbuf(void);
	  char*		getfname(void);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/fns.h:35,41 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/fns.h:31,37
	  int		getnum(int (*)(void));
	  void		grab(void);
	  void		iclose(int, int);
	- ADDR		inkdot(long);
	+ ADDR		inkdot(WORD);
	  int		isfileref(void);
	  int		item(int);
	  void		killpcs(void);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/fns.h:55,61 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/fns.h:51,57
	  void		printpc(void);
	  void		printregs(int);
	  void		prints(char*);
	- void		printsource(long);
	+ void		printsource(ADDR);
	  void		printsym(void);
	  void		printsyscall(void);
	  void		printtrace(int);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/fns.h:68,79 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/fns.h:64,75
	  void		readfname(char *);
	  void		reread(void);
	  char*		regname(int);
	- vlong		rget(Map*, char*);
	+ uvlong		rget(Map*, char*);
	  Reglist*	rname(char*);
	  void		rput(Map*, char*, vlong);
	  int		runpcs(int, int);
	  void		runrun(int);
	- void		runstep(ulong, int);
	+ void		runstep(uvlong, int);
	  BKPT*		scanbkpt(ADDR adr);
	  void		scanform(long, int, char*, Map*, int);
	  void		setbp(void);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/fns.h:88,90 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/fns.h:84,89
	  int		term(int);
	  void		ungrab(void);
	  int		valpr(long, int);
	+ 
	+ #pragma	varargck	argpos	dprint	1
	+ #pragma	varargck	type	"t"	void
 [jmk] --rw-rw-r-- M 451989 glenda sys 6868 Nov  6 12:25 sys/src/cmd/db/format.c
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/format.c:51,59 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/format.c:51,59
	  	 * sets `dotinc' and moves `dot'
	  	 * returns address of next format item
	  	 */
	- 	vlong	v;
	- 	long	w;
	- 	ulong	savdot;
	+ 	uvlong	v;
	+ 	ulong	w;
	+ 	ADDR	savdot;
	  	char	*fp;
	  	char	c, modifier;
	  	int	i;
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/format.c:102,108 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/format.c:102,108
	  			break;
	  
	  		case 'A':
	- 			dprint("%#lux%10t", dot);
	+ 			dprint("%#llux%10t", dot);
	  			dotinc = 0;
	  			break;
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/format.c:294,300 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/format.c:294,300
	  		case 'f':
	  			/* BUG: 'f' and 'F' assume szdouble is sizeof(vlong) in the literal case */
	  			if (literal) {
	- 				v = machdata->swav((ulong)dot);
	+ 				v = machdata->swav(dot);
	  				memmove(buf, &v, mach->szfloat);
	  			}else if (get1(map, dot, (uchar*)buf, mach->szfloat) < 0)
	  				error("%r");
 [jmk] --rw-rw-r-- M 451989 glenda sys 5949 Nov  6 12:25 sys/src/cmd/db/print.c
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:20,26 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:20,26
	   *	callback on stack trace
	   */
	  static void
	- ptrace(Map *map, ulong pc, ulong sp, Symbol *sym)
	+ ptrace(Map *map, uvlong pc, uvlong sp, Symbol *sym)
	  {
	  	char buf[512];
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:41,53 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:41,53
	  void
	  printtrace(int modif)
	  {
	- 	int	i;
	- 	ulong pc, sp, link;
	- 	long v;
	+ 	int i;
	+ 	uvlong pc, sp, link;
	+ 	ulong w;
	  	BKPT *bk;
	  	Symbol s;
	- 	int	stack;
	- 	char	*fname;
	+ 	int stack;
	+ 	char *fname;
	  	char buf[512];
	  
	  	if (cntflg==0)
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:127,135 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:127,140
	  	case 'C':
	  		tracetype = modif;
	  		if (machdata->ctrace) {
	- 			if (adrflg) {	/* trace from jmpbuf for multi-threaded code */
	- 				if (get4(cormap, adrval, (long*)&sp) < 0 ||
	- 					get4(cormap, adrval+4, (long*)&pc) < 0)
	+ 			if (adrflg) {
	+ 				/*
	+ 				 * trace from jmpbuf for multi-threaded code.
	+ 				 * assume sp and pc are in adjacent locations
	+ 				 * and mach->szaddr in size.
	+ 				 */
	+ 				if (geta(cormap, adrval, &sp) < 0 ||
	+ 					geta(cormap, adrval+mach->szaddr, &pc) < 0)
	  						error("%r");
	  			} else {
	  				sp = rget(cormap, mach->sp);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:147,154 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:152,159
	  		/*print externals*/
	  	case 'e':
	  		for (i = 0; globalsym(&s, i); i++) {
	- 			if (get4(cormap, s.value, &v) > 0)
	- 				dprint("%s/%12t%#lux\n", s.name,	v);
	+ 			if (get4(cormap, s.value, &w) > 0)
	+ 				dprint("%s/%12t%#lux\n", s.name, w);
	  		}
	  		break;
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:226,232 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:231,237
	  void
	  redirin(int stack, char *file)
	  {
	- 	char pfile[ARB];
	+ 	char *pfile;
	  
	  	if (file == 0) {
	  		iclose(-1, 0);
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:234,243 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:239,248
	  	}
	  	iclose(stack, 0);
	  	if ((infile = open(file, 0)) < 0) {
	- 		strcpy(pfile, Ipath);
	- 		strcat(pfile, "/");
	- 		strcat(pfile, file);
	- 		if ((infile = open(pfile, 0)) < 0) {
	+ 		pfile = smprint("%s/%s", Ipath, file);
	+ 		infile = open(pfile, 0);
	+ 		free(pfile);
	+ 		if(infile < 0) {
	  			infile = STDIN;
	  			error("cannot open");
	  		}
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:259,266 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:264,272
	  		dprint("%s\n", s);
	  	for (i = 0; i < map->nsegs; i++) {
	  		if (map->seg[i].inuse)
	- 			dprint("%s%8t%-16#lux %-16#lux %-16#lux\n", map->seg[i].name,
	- 				map->seg[i].b, map->seg[i].e, map->seg[i].f);
	+ 			dprint("%s%8t%-16#llux %-16#llux %-16#llux\n",
	+ 				map->seg[i].name, map->seg[i].b,
	+ 				map->seg[i].e, map->seg[i].f);
	  	}
	  }
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:277,287 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:283,293
	  		switch(sp->type) {
	  		case 't':
	  		case 'l':
	- 			dprint("%8#lux t %s\n", sp->value, sp->name);
	+ 			dprint("%16#llux t %s\n", sp->value, sp->name);
	  			break;
	  		case 'T':
	  		case 'L':
	- 			dprint("%8#lux T %s\n", sp->value, sp->name);
	+ 			dprint("%16#llux T %s\n", sp->value, sp->name);
	  			break;
	  		case 'D':
	  		case 'd':
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:290,296 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:296,302
	  		case 'a':
	  		case 'p':
	  		case 'm':
	- 			dprint("%8#lux %c %s\n", sp->value, sp->type, sp->name);
	+ 			dprint("%16#llux %c %s\n", sp->value, sp->type, sp->name);
	  			break;
	  		default:
	  			break;
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:304,310 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:310,316
	   *	print the value of dot as file:line
	   */
	  void
	- printsource(long dot)
	+ printsource(ADDR dot)
	  {
	  	char str[STRINGSZ];
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:317,323 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:323,329
	  {
	  	char buf[512];
	  
	- 	dot = (ulong)rget(cormap, mach->pc);
	+ 	dot = rget(cormap, mach->pc);
	  	if(dot){
	  		printsource((long)dot);
	  		printc(' ');
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:333,339 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:339,345
	  printlocals(Symbol *fn, ADDR fp)
	  {
	  	int i;
	- 	long val;
	+ 	ulong w;
	  	Symbol s;
	  
	  	s = *fn;
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:340,347 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:346,353
	  	for (i = 0; localsym(&s, i); i++) {
	  		if (s.class != CAUTO)
	  			continue;
	- 		if (get4(cormap, fp-s.value, &val) > 0)
	- 			dprint("%8t%s.%s/%10t%#lux\n", fn->name, s.name, val);
	+ 		if (get4(cormap, fp-s.value, &w) > 0)
	+ 			dprint("%8t%s.%s/%10t%#lux\n", fn->name, s.name, w);
	  		else
	  			dprint("%8t%s.%s/%10t?\n", fn->name, s.name);
	  	}
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:352,358 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:358,364
	  {
	  	int i;
	  	Symbol s;
	- 	long v;
	+ 	ulong w;
	  	int first = 0;
	  
	  	fp += mach->szaddr;			/* skip saved pc */
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/print.c:362,368 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/print.c:368,374
	  			continue;
	  		if (first++)
	  			dprint(", ");
	- 		if (get4(cormap, fp+s.value, &v) > 0)
	- 			dprint("%s=%#lux", s.name, v);
	+ 		if (get4(cormap, fp+s.value, &w) > 0)
	+ 			dprint("%s=%#lux", s.name, w);
	  	}
	  }
 [jmk] --rw-rw-r-- M 451989 glenda sys 1998 Nov  6 12:25 sys/src/cmd/db/regs.c
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/regs.c:19,29 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/regs.c:19,30
	  	return 0;
	  }
	  
	- static vlong
	+ static uvlong
	  getreg(Map *map, Reglist *rp)
	  {
	- 	vlong v;
	- 	long w;
	+ 	uvlong v;
	+ 	ulong w;
	+ 	ushort s;
	  	int ret;
	  
	  	v = 0;
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/regs.c:31,42 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/regs.c:32,43
	  	switch (rp->rformat)
	  	{
	  	case 'x':
	- 		ret = get2(map, rp->roffs, (ushort*) &w);
	- 		v = w;
	+ 		ret = get2(map, rp->roffs, &s);
	+ 		v = s;
	  		break;
	  	case 'f':
	  	case 'X':
	- 		ret = get4(map, rp->roffs, (long*) &w);
	+ 		ret = get4(map, rp->roffs, &w);
	  		v = w;
	  		break;
	  	case 'F':
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/regs.c:55,61 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/regs.c:56,62
	  	return v;
	  }
	  
	- vlong
	+ uvlong
	  rget(Map *map, char *name)
	  {
	  	Reglist *rp;
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/regs.c:104,109 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/regs.c:105,111
	  {
	  	Reglist *rp;
	  	int i;
	+ 	uvlong v;
	  
	  	for (i = 1, rp = mach->reglist; rp->rname; rp++, i++) {
	  		if ((rp->rflags & RFLT)) {
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/regs.c:112,121 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/regs.c:114,124
	  			if (rp->rformat == '8' || rp->rformat == '3')
	  				continue;
	  		}
	+ 		v = getreg(cormap, rp);
	  		if(rp->rformat == 'Y')
	- 			dprint("%-8s %-20#llux", rp->rname, getreg(cormap, rp));
	+ 			dprint("%-8s %-20#llux", rp->rname, v);
	  		else
	- 			dprint("%-8s %-12#lux", rp->rname, (ulong)getreg(cormap, rp));
	+ 			dprint("%-8s %-12#lux", rp->rname, (ulong)v);
	  		if ((i % 3) == 0) {
	  			dprint("\n");
	  			i = 0;
 [jmk] --rw-rw-r-- M 451989 glenda sys 4433 Nov  6 12:25 sys/src/cmd/db/trcrun.c
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/trcrun.c:205,214 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/trcrun.c:205,214
	  }
	  
	  void
	- runstep(ulong loc, int keepnote)
	+ runstep(uvlong loc, int keepnote)
	  {
	  	int nfoll;
	- 	ulong foll[3];
	+ 	uvlong foll[3];
	  	BKPT bkpt[3];
	  	int i;
	  
	/n/sourcesdump/2005/1106/plan9/sys/src/cmd/db/trcrun.c:264,270 - 
	/n/sourcesdump/2005/1107/plan9/sys/src/cmd/db/trcrun.c:264,270
	  bkput(BKPT *bp, int install)
	  {
	  	char buf[256];
	- 	ulong loc;
	+ 	ADDR loc;
	  	int ret;
	  
	  	errstr(buf, sizeof buf);
 [jmk] --rw-rw-r-- M 451989 glenda sys 4377 Nov  6 12:25 sys/src/cmd/db/command.c
 [jmk] --rw-rw-r-- M 451989 glenda sys 2014 Nov  6 12:25 sys/src/cmd/db/fns.h
 [jmk] --rw-rw-r-- M 451989 glenda sys 6868 Nov  6 12:25 sys/src/cmd/db/format.c
 [jmk] --rw-rw-r-- M 451989 glenda sys 5949 Nov  6 12:25 sys/src/cmd/db/print.c
 [jmk] --rw-rw-r-- M 451989 glenda sys 1998 Nov  6 12:25 sys/src/cmd/db/regs.c
 [jmk] --rw-rw-r-- M 451989 glenda sys 4433 Nov  6 12:25 sys/src/cmd/db/trcrun.c


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.