mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-04 12:52:15 +00:00
Fix a bug that showed up when debugging dynamically linked programs.
References from GDB to "printf" and various other functions would find the versions in the dynamic linker itself, rather than the versions in the program's libc. This fix moves the GDB link map entry for the dynamic linker to the end of the search list, where its symbols will be found only if they are not found anywhere else. It was suggested by Doug Rabson, though I implemented it a little differently. I personally would prefer to leave the dynamic linker's entry out of the GDB search list altogether. But Doug argues that it is handy there for such things as setting breakpoints on dlopen(). So it stays for now, at least. Note, if we ever integrate the dynamic linker with libc (which has several important benefits to recommend it), this whole problem goes away.
This commit is contained in:
parent
0ff27d31ea
commit
29218d94d3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39321
@ -22,7 +22,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: rtld.c,v 1.8 1998/09/05 03:31:00 jdp Exp $
|
||||
* $Id: rtld.c,v 1.9 1998/09/15 21:07:52 jdp Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1240,11 +1240,21 @@ linkmap_add(Obj_Entry *obj)
|
||||
return;
|
||||
}
|
||||
|
||||
for (prev = r_debug.r_map; prev->l_next != NULL; prev = prev->l_next)
|
||||
/*
|
||||
* Scan to the end of the list, but not past the entry for the
|
||||
* dynamic linker, which we want to keep at the very end.
|
||||
*/
|
||||
for (prev = r_debug.r_map;
|
||||
prev->l_next != NULL && prev->l_next != &obj_rtld.linkmap;
|
||||
prev = prev->l_next)
|
||||
;
|
||||
|
||||
/* Link in the new entry. */
|
||||
l->l_prev = prev;
|
||||
l->l_next = prev->l_next;
|
||||
if (l->l_next != NULL)
|
||||
l->l_next->l_prev = l;
|
||||
prev->l_next = l;
|
||||
l->l_next = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user