-/* $OpenBSD: dlfcn.c,v 1.114 2023/07/08 14:09:43 jasper Exp $ */
+/* $OpenBSD: dlfcn.c,v 1.115 2023/08/15 06:26:34 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
#include "archdep.h"
int _dl_errno;
-static int _dl_tracelib;
static int _dl_real_close(void *handle);
static lock_cb *_dl_thread_fnc = NULL;
if ((flags & RTLD_TRACE) == RTLD_TRACE) {
_dl_traceld = 1;
- _dl_tracelib = 1;
}
DL_DEB(("dlopen: loading: %s\n", libname));
/* if opened but grpsym_vec has not been filled in */
if (object->grpsym_vec.len == 0)
_dl_cache_grpsym_list_setup(object);
+ if (_dl_traceld) {
+ _dl_show_objects(object);
+ _dl_unload_shlib(object);
+ _dl_exit(0);
+ }
goto loaded;
}
int err;
DL_DEB(("tail %s\n", object->load_name ));
if (_dl_traceld) {
- _dl_show_objects();
+ _dl_show_objects(object);
_dl_unload_shlib(object);
_dl_exit(0);
}
break;
}
case 0x20:
- _dl_show_objects();
+ _dl_show_objects(NULL);
retval = 0;
break;
case 0x21:
}
void
-_dl_show_objects(void)
+_dl_show_objects(elf_object_t *trace)
{
elf_object_t *object;
char *objtypename;
_dl_dprintf(outputfd, "\tStart %s End %s Type Open Ref GrpRef Name\n",
pad, pad);
- if (_dl_tracelib) {
- for (; object != NULL; object = object->next)
+ if (trace != NULL) {
+ for (; object != NULL; object = object->next) {
+ if (object == trace)
+ break;
if (object->obj_type == OBJTYPE_LDR) {
object = object->next;
break;
}
+ }
}
for (; object != NULL; object = object->next) {
-/* $OpenBSD: loader.c,v 1.213 2023/07/08 14:09:43 jasper Exp $ */
+/* $OpenBSD: loader.c,v 1.214 2023/08/15 06:26:34 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
if (_dl_debug || _dl_traceld) {
if (_dl_traceld)
_dl_pledge("stdio rpath", NULL);
- _dl_show_objects();
+ _dl_show_objects(NULL);
}
DL_DEB(("dynamic loading done, %s.\n",
-/* $OpenBSD: resolve.h,v 1.104 2023/01/29 20:30:56 gnezdo Exp $ */
+/* $OpenBSD: resolve.h,v 1.105 2023/08/15 06:26:34 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
void _dl_trace_object_setup(elf_object_t *);
int _dl_trace_plt(const elf_object_t *, const char *);
+/* dlfcn.c */
+void _dl_show_objects(elf_object_t *_object);
+
/* tib.c */
void _dl_allocate_tls_offsets(void) __boot;
void _dl_allocate_first_tib(void) __boot;
-/* $OpenBSD: util.h,v 1.38 2023/01/29 20:30:21 gnezdo Exp $ */
+/* $OpenBSD: util.h,v 1.39 2023/08/15 06:26:34 guenther Exp $ */
/*
* Copyright (c) 1998 Todd C. Miller <millert@openbsd.org>
void _dl_printf(const char *fmt, ...);
void _dl_vprintf(const char *fmt, va_list ap);
void _dl_dprintf(int, const char *fmt, ...);
-void _dl_show_objects(void);
void _dl_arc4randombuf(void *, size_t);
u_int32_t _dl_arc4random(void);
ssize_t _dl_write(int fd, const char* buf, size_t len);