Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Better documentation of weird-DWARF-issue workaround
[simgrid.git] / src / mc / mc_diff.cpp
index d0974ea..b034d1e 100644 (file)
@@ -331,7 +331,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
   const malloc_info* heapinfos2 = snapshot2->read<malloc_info*>(
     (std::uint64_t)heapinfo_address, simgrid::mc::ProcessIndexMissing);
 
-  while (i1 <= state->heaplimit) {
+  while (i1 < state->heaplimit) {
 
     const malloc_info* heapinfo1 = (const malloc_info*) MC_region_read(heap_region1, &heapinfo_temp1, &heapinfos1[i1], sizeof(malloc_info));
     const malloc_info* heapinfo2 = (const malloc_info*) MC_region_read(heap_region2, &heapinfo_temp2, &heapinfos2[i1], sizeof(malloc_info));
@@ -395,7 +395,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
       }
 
-      while (i2 <= state->heaplimit && !equal) {
+      while (i2 < state->heaplimit && !equal) {
 
         addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE +
                        (char *) state->std_heap_copy.heapbase;
@@ -480,7 +480,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
         }
 
-        while (i2 <= state->heaplimit && !equal) {
+        while (i2 < state->heaplimit && !equal) {
 
           const malloc_info* heapinfo2b = (const malloc_info*) MC_region_read(
             heap_region2, &heapinfo_temp2b, &heapinfos2[i2],
@@ -554,7 +554,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
   /* All blocks/fragments are equal to another block/fragment ? */
   size_t i = 1, j = 0;
 
-  for(i = 1; i <= state->heaplimit; i++) {
+  for(i = 1; i < state->heaplimit; i++) {
     const malloc_info* heapinfo1 = (const malloc_info*) MC_region_read(
       heap_region1, &heapinfo_temp1, &heapinfos1[i], sizeof(malloc_info));
     if (heapinfo1->type == MMALLOC_TYPE_UNFRAGMENTED) {
@@ -565,7 +565,6 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
               // TODO, add address
               XBT_DEBUG("Block %zu not found (size used = %zu)", i,
                         heapinfo1->busy_block.busy_size);
-              //mmalloc_backtrace_block_display((void*)heapinfo1, i);
             }
             nb_diff1++;
           }
@@ -583,7 +582,6 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
                     ("Block %zu, Fragment %zu not found (size used = %zd)",
                      i, j,
                      heapinfo1->busy_frag.frag_size[j]);
-                //mmalloc_backtrace_fragment_display((void*)heapinfo1, i, j);
               }
               nb_diff1++;
             }
@@ -596,7 +594,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
   if (i1 == state->heaplimit)
     XBT_DEBUG("Number of blocks/fragments not found in heap1 : %d", nb_diff1);
 
-  for (i=1; i <= state->heaplimit; i++) {
+  for (i=1; i < state->heaplimit; i++) {
     const malloc_info* heapinfo2 = (const malloc_info*) MC_region_read(
       heap_region2, &heapinfo_temp2, &heapinfos2[i], sizeof(malloc_info));
     if (heapinfo2->type == MMALLOC_TYPE_UNFRAGMENTED) {
@@ -607,7 +605,6 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
               // TODO, print address of the block
               XBT_DEBUG("Block %zu not found (size used = %zu)", i,
                         heapinfo2->busy_block.busy_size);
-              //mmalloc_backtrace_block_display((void*)heapinfo2, i);
             }
             nb_diff2++;
           }
@@ -625,7 +622,6 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
                     ("Block %zu, Fragment %zu not found (size used = %zd)",
                      i, j,
                      heapinfo2->busy_frag.frag_size[j]);
-                //mmalloc_backtrace_fragment_display((void*)heapinfo2, i, j);
               }
               nb_diff2++;
             }
@@ -750,8 +746,13 @@ static int compare_heap_area_with_type(struct s_mc_diff *state, int process_inde
                                        int pointer_level)
 {
 top:
-  // HACK: This should not happen but in pratice, there is some
-  // DW_TAG_typedef without DW_AT_type. We should fix this somehow.
+
+  // HACK: This should not happen but in pratice, there are some
+  // DW_TAG_typedef without an associated DW_AT_type:
+  //<1><538832>: Abbrev Number: 111 (DW_TAG_typedef)
+  //    <538833>   DW_AT_name        : (indirect string, offset: 0x2292f3): gregset_t
+  //    <538837>   DW_AT_decl_file   : 98
+  //    <538838>   DW_AT_decl_line   : 37
   if (type == nullptr)
     return 0;