From ea35435137b1b140cdec6896e39334dfba32dd3c Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Fri, 19 Dec 1997 20:44:48 +0000 Subject: [PATCH] Made N_TXTADDR() work for kernels (assume that a ZMAGIC file with an out of bounds a_entry is a kernel and use the usual kludge to find the text address). If gdb had used this, it would have been able to find the kernel text address properly. Unfortunately, it uses its own a.out macros, so this is mainly an example for gdb to copy. --- sys/sys/imgact_aout.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/sys/imgact_aout.h b/sys/sys/imgact_aout.h index 7db8544e697..b577da0024f 100644 --- a/sys/sys/imgact_aout.h +++ b/sys/sys/imgact_aout.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)exec.h 8.1 (Berkeley) 6/11/93 - * $Id$ + * $Id: imgact_aout.h,v 1.7 1997/02/22 09:45:18 peter Exp $ */ #ifndef _IMGACT_AOUT_H_ @@ -73,9 +73,13 @@ /* Address of the bottom of the text segment. */ +/* + * This can not be done right. Abuse a_entry in some cases to handle kernels. + */ #define N_TXTADDR(ex) \ ((N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC || \ - N_GETMAGIC(ex) == ZMAGIC) ? 0 : __LDPGSZ) + N_GETMAGIC(ex) == ZMAGIC) ? \ + ((ex).a_entry < (ex).a_text ? 0 : (ex).a_entry & ~__LDPGSZ) : __LDPGSZ) /* Address of the bottom of the data segment. */ #define N_DATADDR(ex) \