Skip to content

Commit

Permalink
Fix #1220, Moved OS_DEBUG calls outside of rtems_rtl_lock and fixed f…
Browse files Browse the repository at this point in the history
…ormatting
  • Loading branch information
ezpollack committed Mar 7, 2022
1 parent 60e877d commit 7f049e5
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions src/os/rtems/src/os-impl-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,40 +217,42 @@ int32 OS_ModuleUnload_Impl(const OS_object_token_t *token)
*-----------------------------------------------------------------*/
int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *module_prop)
{
rtems_rtl_obj *obj;
OS_impl_module_internal_record_t *impl;
int32 status = OS_ERROR;
rtems_rtl_obj * obj;
OS_impl_module_internal_record_t *impl;
int32 status = OS_ERROR;

impl = OS_OBJECT_TABLE_GET(OS_impl_module_table, *token);

/* Lock RTEMS runtime loader */
if(rtems_rtl_lock() != NULL){

/* Get RTL object from handle */
/* Lock RTEMS runtime loader */
if (rtems_rtl_lock() != NULL)
{
/* Get RTL object from handle and populate section info */
obj = rtems_rtl_check_handle(impl->dl_handle);

if (obj == NULL)
{
OS_DEBUG("Error getting object information from handle\n");
module_prop->addr.valid = false;
}
else
if (obj != NULL)
{
module_prop->addr.valid = true;
module_prop->addr.code_address = obj->text_base;
module_prop->addr.code_size = rtems_rtl_obj_text_size(obj);
module_prop->addr.data_address = obj->data_base;
module_prop->addr.data_size = rtems_rtl_obj_data_size(obj);
module_prop->addr.bss_address = obj->bss_base;
module_prop->addr.bss_size = rtems_rtl_obj_bss_size(obj);
module_prop->addr.code_size = rtems_rtl_obj_text_size(obj);
module_prop->addr.data_address = obj->data_base;
module_prop->addr.data_size = rtems_rtl_obj_data_size(obj);
module_prop->addr.bss_address = obj->bss_base;
module_prop->addr.bss_size = rtems_rtl_obj_bss_size(obj);

status = OS_SUCCESS;
status = OS_SUCCESS;
}

/* Unlock RTEMS runtime loader */
rtems_rtl_unlock();
/* Unlock RTEMS runtime loader, report error if applicable */
rtems_rtl_unlock();

if (obj == NULL)
{
OS_DEBUG("Error getting object information from handle\n");
module_prop->addr.valid = false;
}
}
else{
else
{
OS_DEBUG("Error locking RTEMS runtime loader\n");
module_prop->addr.valid = false;
}
Expand Down

0 comments on commit 7f049e5

Please sign in to comment.