Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Remove HTML in a comment (this is ugly)
[simgrid.git] / src / mc / mc_object_info.cpp
index 46c4630..3d3703c 100644 (file)
@@ -84,15 +84,15 @@ ObjectInformation::ObjectInformation()
  *
  *  An offset is applied to address found in DWARF:
  *
- *  <ul>
- *    <li>for an executable obejct, addresses are virtual address
- *        (there is no offset) i.e. \f$\text{virtual address} = \{dwarf address}\f$;</li>
- *    <li>for a shared object, the addreses are offset from the begining
- *        of the shared object (the base address of the mapped shared
- *        object must be used as offset
- *        i.e. \f$\text{virtual address} = \text{shared object base address}
- *             + \text{dwarf address}\f$.</li>
+ *  * for an executable obejct, addresses are virtual address
+ *    (there is no offset) i.e.
+ *    \f$\text{virtual address} = \{dwarf address}\f$;
  *
+ *  * for a shared object, the addreses are offset from the begining
+ *    of the shared object (the base address of the mapped shared
+ *    object must be used as offset
+ *    i.e. \f$\text{virtual address} = \text{shared object base address}
+ *             + \text{dwarf address}\f$.
  */
 void *ObjectInformation::base_address() const
 {
@@ -128,10 +128,18 @@ simgrid::mc::Frame* ObjectInformation::find_function(const void *ip) const
   int j = this->functions_index.size() - 1;
   while (j >= i) {
     int k = i + ((j - i) / 2);
+
+    /* In most of the search, we do not dereference the base[k].function.
+     * This way the memory accesses are located in the base[k] array. */
     if (ip < base[k].low_pc)
       j = k - 1;
     else if (k < j && ip >= base[k + 1].low_pc)
       i = k + 1;
+
+    /* At this point, the search is over.
+     * Either we have found the correct function or we do not know
+     * any function corresponding to this instruction address.
+     * Only at the point do we derefernce the function pointer. */
     else if (ip < base[k].function->high_pc)
       return base[k].function;
     else