Fix Moved OS_DEBUG calls outside of rtems_rtl_lock and fixed formatting
@@ -224,17 +224,12 @@ int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *mo
impl = OS_OBJECT_TABLE_GET(OS_impl_module_table, *token);
/* Lock RTEMS runtime loader */
- if(rtems_rtl_lock() != NULL){
-
- /* Get RTL object from handle */
+ 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;
@@ -247,10 +242,17 @@ int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *mo
status = OS_SUCCESS;
}
- /* Unlock RTEMS runtime loader */
+ /* 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;
}
