tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Hidden ld-elf.so, shared libs and gdb
Hi all,
attached is a patch to fix the debugging of shared libraries with gdb.
I would like to rename _rtld_debug_state to _dl_debug_state to match the
namespace of dlopen and friends. gdb checks both names, so it wouldn't
matter for it. Comments?
Joerg
Index: rtld.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/libexec/ld.elf_so/rtld.c,v
retrieving revision 1.137
diff -u -p -r1.137 rtld.c
--- rtld.c 24 Dec 2010 12:41:43 -0000 1.137
+++ rtld.c 25 Jan 2011 00:01:15 -0000
@@ -275,7 +275,7 @@ _rtld_init(caddr_t mapbase, caddr_t relo
_rtld_objtail = &_rtld_objlist;
_rtld_objcount = 0;
- _rtld_debug.r_brk = _rtld_debug_state;
+ _rtld_debug.r_brk = _dl_debug_state;
_rtld_debug.r_state = RT_CONSISTENT;
}
@@ -615,7 +615,7 @@ _rtld(Elf_Addr *sp, Elf_Addr relocbase)
* of stack.
*/
- _rtld_debug_state(); /* say hello to gdb! */
+ _dl_debug_state(); /* say hello to gdb! */
((void **) osp)[0] = _rtld_exit;
((void **) osp)[1] = _rtld_objmain;
@@ -810,13 +810,13 @@ dlclose(void *handle)
return -1;
_rtld_debug.r_state = RT_DELETE;
- _rtld_debug_state();
+ _dl_debug_state();
--root->dl_refcount;
_rtld_unload_object(root, true);
_rtld_debug.r_state = RT_CONSISTENT;
- _rtld_debug_state();
+ _dl_debug_state();
return 0;
}
@@ -848,7 +848,7 @@ dlopen(const char *name, int mode)
now = ((mode & RTLD_MODEMASK) == RTLD_NOW) ? true : false;
_rtld_debug.r_state = RT_ADD;
- _rtld_debug_state();
+ _dl_debug_state();
if (name == NULL) {
obj = _rtld_objmain;
@@ -882,7 +882,7 @@ dlopen(const char *name, int mode)
}
}
_rtld_debug.r_state = RT_CONSISTENT;
- _rtld_debug_state();
+ _dl_debug_state();
return obj;
}
@@ -1175,7 +1175,7 @@ _rtld_error(const char *fmt,...)
}
void
-_rtld_debug_state(void)
+_dl_debug_state(void)
{
/* do nothing */
Index: rtld.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/libexec/ld.elf_so/rtld.h,v
retrieving revision 1.99
diff -u -p -r1.99 rtld.h
--- rtld.h 16 Jan 2011 15:56:37 -0000 1.99
+++ rtld.h 25 Jan 2011 00:01:27 -0000
@@ -279,13 +279,13 @@ __dso_public int dladdr(const void *, Dl
__dso_public int dlinfo(void *, int, void *);
__dso_public int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void
*),
void *);
+__dso_public void _dl_debug_state(void);
/* These aren't exported */
void _rtld_error(const char *, ...)
__attribute__((__format__(__printf__,1,2)));
void _rtld_die(void) __attribute__((__noreturn__));
void *_rtld_objmain_sym(const char *);
-void _rtld_debug_state(void);
void _rtld_linkmap_add(Obj_Entry *);
void _rtld_linkmap_delete(Obj_Entry *);
void _rtld_objlist_push_head(Objlist *, Obj_Entry *);
Index: symbol.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/libexec/ld.elf_so/symbol.c,v
retrieving revision 1.54
diff -u -p -r1.54 symbol.c
--- symbol.c 16 Oct 2010 10:27:07 -0000 1.54
+++ symbol.c 25 Jan 2011 00:01:23 -0000
@@ -93,6 +93,7 @@ _rtld_is_exported(const Elf_Sym *def)
(fptr_t)dladdr,
(fptr_t)dlinfo,
(fptr_t)dl_iterate_phdr,
+ (fptr_t)_dl_debug_state,
NULL
};
int i;
Home |
Main Index |
Thread Index |
Old Index