libdl/debugger: Fix the broken list delete when unloading an object module.

Closes #3777
This commit is contained in:
Chris Johns
2019-08-05 09:58:07 +10:00
parent 886956afd2
commit 9cb19ded5c
3 changed files with 13 additions and 15 deletions

View File

@@ -64,13 +64,13 @@ _rtld_linkmap_add (rtems_rtl_obj* obj)
if (_rtld_debug.r_map == NULL)
{
_rtld_debug.r_map = l;
return true;
}
for (prev = _rtld_debug.r_map; prev->l_next != NULL; prev = prev->l_next);
l->l_prev = prev;
prev->l_next = l;
else
{
for (prev = _rtld_debug.r_map; prev->l_next != NULL; prev = prev->l_next);
l->l_prev = prev;
prev->l_next = l;
}
return true;
}
@@ -79,20 +79,20 @@ void
_rtld_linkmap_delete (rtems_rtl_obj* obj)
{
struct link_map* l = obj->linkmap;
/*
* link_maps are allocated together if not 1
*/
struct link_map* e = l + obj->obj_num - 1;
while (e && e->l_next) e = e->l_next;
if (l->l_prev == NULL)
{
if ((_rtld_debug.r_map = e->l_next) != NULL)
e->l_next->l_prev = NULL;
return;
_rtld_debug.r_map->l_prev = NULL;
}
else
{
if ((l->l_prev->l_next = e->l_next) != NULL)
e->l_next->l_prev = l->l_prev;
}
if ((l->l_prev->l_next = e->l_next) != NULL)
e->l_next->l_prev = l->l_prev;
}

View File

@@ -1593,8 +1593,6 @@ rtems_rtl_elf_load_linkmap (rtems_rtl_obj* obj)
obj->linkmap->sec_addr[rap_bss] = obj->bss_base;
sd = obj->linkmap->sec_detail;
sections = &obj->sections;
node = rtems_chain_first (sections);
for (m = 0; m < sect_masks; ++m)
{