Subject: ddb examine should always print address
To: None <tech-kern@sun-lamp.cs.berkeley.edu>
From: Gordon W. Ross <gwr@jericho.mc.com>
List: tech-kern
Date: 06/29/1994 22:13:43
I have found it very inconvenient that ddb does not print the address
for repeated examine commands.  It is especially inconvenient for code
because you can not easily see where nearby branches are going.  For
data it is only less convenient.

Other debuggers of this style (such as adb, kadb) print the address for
every line of a disassembly or data dump.  I think ddb should also.

Would anyone object if I made ddb_examine to always print the address?
Here are the exact changes I propose:

*** sys/ddb/db_examine.c.orig	Sun Dec 19 21:32:36 1993
--- sys/ddb/db_examine.c	Wed Jun 29 00:51:09 1994
***************
*** 103,108 ****
--- 103,109 ----
  			break;
  		    default:
  			if (db_print_position() == 0) {
+ #if 0
  			    /* If we hit a new symbol, print it */
  			    char *	name;
  			    db_expr_t	off;
***************
*** 112,117 ****
--- 113,123 ----
  				db_printf("%s:\t", name);
  			    else
  				db_printf("\t\t");
+ #else
+ 			    /* Always print the address. */
+ 			    db_printsym(addr, DB_STGY_ANY);
+ 			    db_printf(":\t");
+ #endif
  
  			    db_prev = addr;
  			}

*** sys/arch/m68k/m68k/db_disasm.c.orig	Fri Jun 17 06:15:19 1994
--- sys/arch/m68k/m68k/db_disasm.c	Wed Jun 29 22:11:45 1994
***************
*** 184,189 ****
--- 184,191 ----
  	dbuf.dasm[0] = 0;
  	dbuf.info[0] = 0;
  		
+ #if 0
+ 	/* This is now done in db_examine. */
  	diff = INT_MAX;
  	sym = db_search_symbol(loc, DB_STGY_PROC, &diff);
  	db_symbol_values(sym, &symname, 0);
***************
*** 201,206 ****
--- 203,209 ----
  		printu(&dbuf, diff, SIZE_LONG);
  	}
  	addstr(&dbuf, ":  ");
+ #endif
  
  	opc = *dbuf.val;
  	dbuf.used++;
***************
*** 882,887 ****
--- 885,891 ----
  		sz = SIZE_LONG;
  		addchar('l');
  	} else {
+ 		disp = *(char *)(dbuf->val + 1);
  		/*
  		 * XXX gas chokes on this, I am not sure if
  		 * XXX it can even be made to emit it (short of .word)

Oh yeah: that last addition was a bug-fix for "brab xxx" disassembly.

------------------------------------------------------------------------------