Module Name:    src
Committed By:   thorpej
Date:           Mon Jun 21 02:10:46 UTC 2021

Modified Files:
        src/sys/arch/alpha/alpha: db_disasm.c db_instruction.h

Log Message:
Remove the /I "alternate format" from db_disasm(), which was internally
interpreted as "showregs", whcih would print the values of the registers
at each instruction.  Unfortunately, this was fundamentally broken because
the saved registers accessible to DDB are only valid for the faulting
insn that got us into DDB, and not arbitrary isns that can be examined
from within DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/alpha/db_disasm.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/alpha/db_instruction.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/alpha/db_disasm.c
diff -u src/sys/arch/alpha/alpha/db_disasm.c:1.17 src/sys/arch/alpha/alpha/db_disasm.c:1.18
--- src/sys/arch/alpha/alpha/db_disasm.c:1.17	Mon Jun 21 02:01:13 2021
+++ src/sys/arch/alpha/alpha/db_disasm.c	Mon Jun 21 02:10:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.17 2021/06/21 02:01:13 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -48,7 +48,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.17 2021/06/21 02:01:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -784,13 +784,6 @@ static const char * const name_of_regist
 static const char *
 register_name(struct alpha_print_instruction_context *ctx, int ireg)
 {
-	int	i;
-
-	for (i = 0; i < ctx->regcount; i++)
-		if (ctx->regnum[i] == ireg)
-			break;
-	if (i >= ctx->regcount)
-		ctx->regnum[ctx->regcount++] = ireg;
 	return (name_of_register[ireg]);
 }
 
@@ -824,12 +817,10 @@ int
 alpha_print_instruction(struct alpha_print_instruction_context *ctx)
 {
 	const char	*opcode;
-	int		ireg;
 	long		signed_immediate;
 	bool		fstore;
 	pal_instruction	p;
 
-	ctx->regcount = 0;
 	fstore = false;
 	opcode = op_name[ctx->insn.mem_format.opcode];
 
@@ -1038,16 +1029,6 @@ loadstore_address:
 			insn_printf(ctx, "%s(%s)", tbuf,
 			    register_name(ctx, ctx->insn.mem_format.rb));
 		}
-		/*
-		 * For convenience, do the address computation
-		 */
-		if (ctx->showregs) {
-			if (ctx->insn.mem_format.opcode == op_ldah)
-				signed_immediate <<= 16;
-			insn_printf(ctx, " <0x%lx>", signed_immediate +
-			    db_register_value(DDB_REGS,
-					      ctx->insn.mem_format.rb));
-		}
 		break;
 	case op_br:
 	case op_fbeq:
@@ -1084,21 +1065,6 @@ branch_displacement:
 		insn_printf(ctx, "? 0x%x ?", ctx->insn.bits);
 	}
 
-	/*
-	 *	Print out the registers used in this instruction
-	 */
-	if (ctx->showregs && ctx->regcount > 0) {
-		insn_printf(ctx, "\t<");
-		for (ireg = 0; ireg < ctx->regcount; ireg++) {
-			if (ireg != 0)
-				insn_printf(ctx, ",");
-			insn_printf(ctx, "%s=0x%lx",
-			    name_of_register[ctx->regnum[ireg]],
-			    db_register_value(DDB_REGS, ctx->regnum[ireg]));
-		}
-		insn_printf(ctx, ">");
-	}
-
 	/* If printing into a buffer, skip the newline. */
 	if (ctx->buf == NULL) {
 		insn_printf(ctx, "\n");
@@ -1108,12 +1074,11 @@ branch_displacement:
 }
 
 db_addr_t
-db_disasm(db_addr_t loc, bool altfmt)
+db_disasm(db_addr_t loc, bool altfmt __unused)
 {
 	struct alpha_print_instruction_context ctx = {
 		.insn.bits = db_get_value(loc, 4, 0),
 		.pc = loc,
-		.showregs = altfmt,
 	};
 
 	loc += alpha_print_instruction(&ctx);

Index: src/sys/arch/alpha/alpha/db_instruction.h
diff -u src/sys/arch/alpha/alpha/db_instruction.h:1.11 src/sys/arch/alpha/alpha/db_instruction.h:1.12
--- src/sys/arch/alpha/alpha/db_instruction.h:1.11	Mon Jun 21 02:01:13 2021
+++ src/sys/arch/alpha/alpha/db_instruction.h	Mon Jun 21 02:10:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_instruction.h,v 1.11 2021/06/21 02:01:13 thorpej Exp $ */
+/* $NetBSD: db_instruction.h,v 1.12 2021/06/21 02:10:46 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -748,9 +748,6 @@ struct alpha_print_instruction_context {
 	char	*buf;		/* output buffer (if not DDB) */
 	size_t	bufsize;	/* size of output buffer */
 	size_t	cursor;		/* current next output location */
-	int	regcount;	/* how many rebgs used in this insn */
-	int	regnum[3];	/* which regs are used in this insn */
-	bool	showregs;	/* show registers */
 };
 
 int	alpha_print_instruction(struct alpha_print_instruction_context *);

Reply via email to