summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-12-19 20:44:48 +0000
committerbde <bde@FreeBSD.org>1997-12-19 20:44:48 +0000
commit8f84818adad2b776c26d4a15a870a503e5ab0969 (patch)
tree0079301fa9c1c272083711c4c68d83f011acc373
parentd102d16ab7c67b79b30848579f84f59af4e5ccfb (diff)
downloadFreeBSD-src-8f84818adad2b776c26d4a15a870a503e5ab0969.zip
FreeBSD-src-8f84818adad2b776c26d4a15a870a503e5ab0969.tar.gz
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.
-rw-r--r--sys/sys/imgact_aout.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/sys/imgact_aout.h b/sys/sys/imgact_aout.h
index 7db8544..b577da0 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) \
OpenPOWER on IntegriCloud