summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2001-09-29 03:19:00 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2001-09-29 03:19:00 +0000
commit434fe557ee321a13e9998d65e8d7de31caf58ced (patch)
treebfa5f7e85a4819427f75dfaab7fbe0a8bbceb47e
parent3c3c891e41c9df0f186b15bb84119281aa963ce1 (diff)
Change method of determining object type, does better bounds checking,
and fixes a bug on sparc64 "ELF" for type. ok art@.
-rw-r--r--libexec/ld.so/dlfcn.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c
index 7a679f9a399..ce577070d0b 100644
--- a/libexec/ld.so/dlfcn.c
+++ b/libexec/ld.so/dlfcn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dlfcn.c,v 1.9 2001/09/19 10:58:07 mpech Exp $ */
+/* $OpenBSD: dlfcn.c,v 1.10 2001/09/29 03:18:59 drahn Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -274,17 +274,32 @@ void
_dl_show_objects()
{
elf_object_t *object;
- static char *otyp[] = {
- "none", "rtld", "exe ", "rlib", "dlib"
- };
+ char *objtypename;
object = _dl_objects;
_dl_printf("\tStart End Type Ref Name\n");
while (object) {
+ switch (object->obj_type) {
+ case OBJTYPE_LDR:
+ objtypename = "rtld";
+ break;
+ case OBJTYPE_EXE:
+ objtypename = "exe ";
+ break;
+ case OBJTYPE_LIB:
+ objtypename = "rlib";
+ break;
+ case OBJTYPE_DLO:
+ objtypename = "dlib";
+ break;
+ default:
+ objtypename = "????";
+ break;
+ }
_dl_printf("\t%X %X %s %d %s\n", object->load_addr,
- object->load_size, otyp[object->obj_type],
+ object->load_size, objtypename,
object->refcount, object->load_name);
object = object->next;
}