Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Apr 1999 00:48:13 +0900
From:      Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
To:        dfr@nlsystems.com
Cc:        gallatin@cs.duke.edu, freebsd-alpha@freebsd.org, obrien@NUXI.com
Subject:   Re: EGCS and Alpha builds
Message-ID:  <14102.2621.961081.71582J@ett.sat.t.u-tokyo.ac.jp>
In-Reply-To: In your message of "Tue, 13 Apr 1999 20:18:09 %2B0100 (BST)" <Pine.BSF.4.05.9904132016520.51054-100000@herring.nlsystems.com>
References:  <14099.10351.647510.43847V@ett.sat.t.u-tokyo.ac.jp> <Pine.BSF.4.05.9904132016520.51054-100000@herring.nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At Tue, 13 Apr 1999 20:18:09 +0100 (BST),
Doug Rabson <dfr@nlsystems.com> wrote:
> The backtrace code in DDB is somewhat fragile. It has to parse the
> function prologue to figure out where the return address is. I expect egcs
> has changed the prologue.  GDB does something similar; hopefully it will
> be fixed in gdb-4.18.

Thanks for the hint. The prologue has changed. Egcs uses 'subq/addq' to
manipulate stack pointer instead of 'lda'. I made an adhoc fix for
DDB/GDB. Don't you mind my commiting this DDB fix to the tree?
(warning supression included)

Index: db_trace.c
===================================================================
RCS file: /pub/FreeBSD-CVS/src/sys/alpha/alpha/db_trace.c,v
retrieving revision 1.2
diff -u -r1.2 db_trace.c
--- db_trace.c	1998/06/27 15:37:42	1.2
+++ db_trace.c	1999/04/15 06:05:07
@@ -25,12 +25,9 @@
 static void
 parse_proc(db_expr_t addr, struct alpha_proc* frame)
 {
-	db_sym_t sym;
+	c_db_sym_t sym;
 	db_expr_t func;
 	db_expr_t junk, pc, limit;
-	int frame_size;
-	int reg_mask;
-	int got_frame;
 
 	frame->pcreg = -1;
 	frame->reg_mask = 0;
@@ -50,7 +47,13 @@
 		ins.bits = *(u_int32_t*) pc;
 		if (ins.memory_format.opcode == op_lda
 		    && ins.memory_format.ra == 30) {
+			/* gcc 2.7 */
 			frame->frame_size += -ins.memory_format.offset;
+		} else if (ins.operate_lit_format.opcode == op_arit
+		    && ins.operate_lit_format.function == op_subq
+		    && ins.operate_lit_format.rs == 30) {
+		    	/* egcs */
+			frame->frame_size += ins.operate_lit_format.literal;
 		} else if (ins.memory_format.opcode == op_stq
 			   && ins.memory_format.rb == 30
 			   && ins.memory_format.ra != 31) {
@@ -66,7 +69,6 @@
 void
 db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif)
 {
-	struct alpha_proc proc;
 	db_addr_t callpc;
 	db_addr_t frame;
 
@@ -82,10 +84,9 @@
 	}
 
 	while (count--) {
-		u_int64_t *actframe;
-		char *	name;
+		const char *	name;
 		db_expr_t	offset;
-		db_sym_t	sym;
+		c_db_sym_t	sym;
 		struct alpha_proc proc;
 
 		sym = db_search_symbol(callpc, DB_STGY_ANY, &offset);


Here is a gdb fix.

--- alpha-tdep.c.orig	Thu Apr  8 21:24:45 1999
+++ alpha-tdep.c	Fri Apr 16 00:44:29 1999
@@ -502,6 +502,10 @@
 		 epilogue is reached.  */
 	      break;
 	  }
+	else if ((word & 0xfff00fff) == 0x43c0053e)	/* subq $sp,n,$sp */
+	  {
+	      frame_size += word & 0xff;
+	  }
 	else if ((word & 0xfc1f0000) == 0xb41e0000	/* stq reg,n($sp) */
 		 && (word & 0xffff0000) != 0xb7fe0000)	/* reg != $zero */
 	  {


-- 
/\ Hidetoshi Shimokawa
\/  simokawa@sat.t.u-tokyo.ac.jp
PGP public key: finger -l simokawa@sat.t.u-tokyo.ac.jp


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14102.2621.961081.71582J>