Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so Add some DEBUG code.
details: https://anonhg.NetBSD.org/src/rev/8d06109081e1
branches: trunk
changeset: 786657:8d06109081e1
user: skrll <skrll%NetBSD.org@localhost>
date: Mon May 06 07:54:04 2013 +0000
description:
Add some DEBUG code.
diffstat:
libexec/ld.elf_so/headers.c | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diffs (117 lines):
diff -r 914127f9e9e1 -r 8d06109081e1 libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c Sun May 05 19:02:22 2013 +0000
+++ b/libexec/ld.elf_so/headers.c Mon May 06 07:54:04 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: headers.c,v 1.48 2013/05/02 21:11:03 matt Exp $ */
+/* $NetBSD: headers.c,v 1.49 2013/05/06 07:54:04 skrll Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.48 2013/05/02 21:11:03 matt Exp $");
+__RCSID("$NetBSD: headers.c,v 1.49 2013/05/06 07:54:04 skrll Exp $");
#endif /* not lint */
#include <err.h>
@@ -75,7 +75,9 @@
Elf_Addr pltrel = 0, pltrelsz = 0;
Elf_Addr init = 0, fini = 0;
+ dbg(("headers: digesting PT_DYNAMIC at %p", obj->dynamic));
for (dynp = obj->dynamic; dynp->d_tag != DT_NULL; ++dynp) {
+ dbg((" d_tag %ld at %p", (long)dynp->d_tag, dynp));
switch (dynp->d_tag) {
case DT_REL:
@@ -231,10 +233,14 @@
case DT_INIT_ARRAY:
obj->init_array =
(fptr_t *)(obj->relocbase + dynp->d_un.d_ptr);
+ dbg(("headers: DT_INIT_ARRAY at %p",
+ obj->init_array));
break;
case DT_INIT_ARRAYSZ:
obj->init_arraysz = dynp->d_un.d_val / sizeof(fptr_t);
+ dbg(("headers: DT_INIT_ARRAYZ %zu",
+ obj->init_arraysz));
break;
#endif
@@ -246,10 +252,14 @@
case DT_FINI_ARRAY:
obj->fini_array =
(fptr_t *)(obj->relocbase + dynp->d_un.d_ptr);
+ dbg(("headers: DT_FINI_ARRAY at %p",
+ obj->fini_array));
break;
case DT_FINI_ARRAYSZ:
obj->fini_arraysz = dynp->d_un.d_val / sizeof(fptr_t);
+ dbg(("headers: DT_FINI_ARRAYZ %zu",
+ obj->fini_arraysz));
break;
#endif
@@ -374,8 +384,8 @@
obj->phdr = (void *)(uintptr_t)ph->p_vaddr;
obj->phsize = ph->p_memsz;
obj->relocbase = (caddr_t)((uintptr_t)phdr - (uintptr_t)ph->p_vaddr);
- dbg(("headers: phdr %p (%p) phsize %zu relocbase %lx",
- obj->phdr, phdr, obj->phsize, (long)obj->relocbase));
+ dbg(("headers: phdr %p (%p) phsize %zu relocbase %p",
+ obj->phdr, phdr, obj->phsize, obj->relocbase));
break;
}
@@ -385,6 +395,9 @@
case PT_INTERP:
obj->interp = (const char *)(uintptr_t)vaddr;
+ dbg(("headers: %s %p phsize %zu",
+ "PT_INTERP", (void *)(uintptr_t)vaddr,
+ ph->p_memsz));
break;
case PT_LOAD:
@@ -399,12 +412,16 @@
obj->vaddrbase;
}
++nsegs;
+ dbg(("headers: %s %p phsize %zu",
+ "PT_LOAD", (void *)(uintptr_t)vaddr,
+ ph->p_memsz));
break;
case PT_DYNAMIC:
obj->dynamic = (Elf_Dyn *)(uintptr_t)vaddr;
- dbg(("headers: PT_DYNAMIC %p phsize %zu",
- obj->dynamic, (size_t)ph->p_memsz));
+ dbg(("headers: %s %p phsize %zu",
+ "PT_DYNAMIC", (void *)(uintptr_t)vaddr,
+ ph->p_memsz));
break;
#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
@@ -414,12 +431,18 @@
obj->tlsalign = ph->p_align;
obj->tlsinitsize = ph->p_filesz;
obj->tlsinit = (void *)(uintptr_t)ph->p_vaddr;
+ dbg(("headers: %s %p phsize %zu",
+ "PT_TLS", (void *)(uintptr_t)vaddr,
+ ph->p_memsz));
break;
#endif
#ifdef __ARM_EABI__
case PT_ARM_EXIDX:
obj->exidx_start = (void *)(uintptr_t)vaddr;
obj->exidx_sz = ph->p_memsz;
+ dbg(("headers: %s %p phsize %zu",
+ "PT_ARM_EXIDX", (void *)(uintptr_t)vaddr,
+ ph->p_memsz));
break;
#endif
}
Home |
Main Index |
Thread Index |
Old Index