Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : heapinfo adresses refer to saved heap instead of current heap
[simgrid.git] / src / xbt / mmalloc / mm_diff.c
1 /* mm_diff - Memory snapshooting and comparison                             */
2
3 /* Copyright (c) 2008-2012. The SimGrid Team. All rights reserved.          */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #include "xbt/ex_interface.h" /* internals of backtrace setup */
9 #include "xbt/str.h"
10 #include "mc/mc.h"
11
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mm_diff, xbt,
13                                 "Logging specific to mm_diff in mmalloc");
14
15 extern char *xbt_binary_name;
16
17 void mmalloc_backtrace_block_display(xbt_mheap_t heap, size_t block){
18
19   xbt_ex_t e;
20
21   if (heap->heapinfo[block].busy_block.bt_size == 0) {
22     fprintf(stderr,"No backtrace available for that block, sorry.\n");
23     return;
24   }
25
26   memcpy(&e.bt,&(heap->heapinfo[block].busy_block.bt),sizeof(void*)*XBT_BACKTRACE_SIZE);
27   e.used = heap->heapinfo[block].busy_block.bt_size;
28
29   xbt_ex_setup_backtrace(&e);
30   if (e.used == 0) {
31     fprintf(stderr, "(backtrace not set)\n");
32   } else if (e.bt_strings == NULL) {
33     fprintf(stderr, "(backtrace not ready to be computed. %s)\n",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet");
34   } else {
35     int i;
36
37     fprintf(stderr, "Backtrace of where the block %zu was malloced (%d frames):\n", block ,e.used);
38     for (i = 0; i < e.used; i++)       /* no need to display "xbt_backtrace_display" */{
39       fprintf(stderr,"%d",i);fflush(NULL);
40       fprintf(stderr, "---> %s\n", e.bt_strings[i] + 4);
41     }
42   }
43 }
44
45 void mmalloc_backtrace_fragment_display(xbt_mheap_t mdp, size_t block, size_t frag){
46
47   xbt_ex_t e;
48
49   memcpy(&e.bt,&(mdp->heapinfo[block].busy_frag.bt[frag]),sizeof(void*)*XBT_BACKTRACE_SIZE);
50   e.used = XBT_BACKTRACE_SIZE;
51
52   xbt_ex_setup_backtrace(&e);
53   if (e.used == 0) {
54     fprintf(stderr, "(backtrace not set)\n");
55   } else if (e.bt_strings == NULL) {
56     fprintf(stderr, "(backtrace not ready to be computed. %s)\n",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet");
57   } else {
58     int i;
59
60     fprintf(stderr, "Backtrace of where the fragment %zu in block %zu was malloced (%d frames):\n", frag, block ,e.used);
61     for (i = 0; i < e.used; i++)       /* no need to display "xbt_backtrace_display" */{
62       fprintf(stderr,"%d",i);fflush(NULL);
63       fprintf(stderr, "---> %s\n", e.bt_strings[i] + 4);
64     }
65   }
66 }
67
68 int mmalloc_compare_heap(xbt_mheap_t mdp1, xbt_mheap_t mdp2){
69
70   if(mdp1 == NULL && mdp2 == NULL){
71     fprintf(stderr, "Malloc descriptors null\n");
72     return 0;
73   }
74
75   int errors = mmalloc_compare_mdesc(mdp1, mdp2);
76
77   return (errors > 0);
78
79 }
80
81 int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2){
82
83   int errors = 0;
84
85   if(mdp1->heaplimit != mdp2->heaplimit){
86     fprintf(stderr,"Different limit of valid info table indices\n");
87     return 1;
88   }
89
90   void* s_heap = (char *)mmalloc_get_current_heap() - STD_HEAP_SIZE - getpagesize();
91
92   fprintf(stderr, "s_heap->heapbase : %p\n", ((struct mdesc*)s_heap)->heapbase);
93
94   void *heapbase1 = (char *)mdp1 + BLOCKSIZE;
95   void *heapbase2 = (char *)mdp2 + BLOCKSIZE;
96
97   fprintf(stderr, "Heapbase1 : %p, Heapbase2 : %p\n", heapbase1, heapbase2);
98   fprintf(stderr, "Heapinfo : %p\n", mdp1->heapinfo);
99
100   malloc_info* heapinfo1 = (malloc_info *)((char *)mdp1 + ((char *)mdp1->heapinfo - (char *)s_heap));
101   malloc_info* heapinfo2 = (malloc_info *)((char *)mdp2 + ((char *)mdp2->heapinfo - (char *)s_heap));
102
103   fprintf(stderr, "Heapinfo1 : %p, Heapinfo2 : %p\n", heapinfo1, heapinfo2);
104
105   size_t i, j;
106   void *addr_block1 = NULL, *addr_block2 = NULL, *addr_frag1 = NULL, *addr_frag2 = NULL;
107   size_t frag_size;
108
109   i = 1;
110
111   int k = 0;
112   int distance = 0;
113   int total_distance = 0;
114
115   int pointer_align;
116   void *address_pointed1 = NULL, *address_pointed2 = NULL;
117
118   int block_pointed1, block_pointed2, frag_pointed1, frag_pointed2;
119   void *addr_block_pointed1 = NULL, *addr_block_pointed2 = NULL, *addr_frag_pointed1 = NULL, *addr_frag_pointed2 = NULL;
120
121   /* Check busy blocks*/
122
123   while(i < mdp1->heaplimit){
124
125     if(heapinfo1[i].type != heapinfo2[i].type){
126       fprintf(stderr,"Different type of block : %d - %d\n", heapinfo1[i].type, heapinfo2[i].type);
127       errors++;
128     }
129
130     /* Get address of block i in each heap */
131     addr_block1 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase1));
132     addr_block2 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase2));
133
134     if(heapinfo1[i].type == 0){ /* busy large block */
135
136       if(heapinfo1[i].busy_block.size != heapinfo2[i].busy_block.size){
137         fprintf(stderr,"Different size of a large cluster : %zu - %zu\n", heapinfo1[i].busy_block.size, heapinfo2[i].busy_block.size); 
138         fflush(NULL);
139         errors++;
140       }
141
142       if(heapinfo1[i].busy_block.busy_size != heapinfo2[i].busy_block.busy_size){
143         fprintf(stderr,"Different busy_size of a large cluster : %zu - %zu\n", heapinfo1[i].busy_block.busy_size, heapinfo2[i].busy_block.busy_size); 
144         fflush(NULL);
145         errors++;
146       }
147
148       /* Hamming distance on different blocks */
149       distance = 0;
150
151
152       for(k=0;k<heapinfo1[i].busy_block.busy_size;k++){
153
154         if(memcmp(((char *)addr_block1) + k, ((char *)addr_block2) + k, 1) != 0){
155
156           fprintf(stderr, "Different byte (offset=%d) (%p - %p) in block %zu\n", k, (char *)addr_block1 + k, (char *)addr_block2 + k, i); fflush(NULL);
157           
158           /* Check if pointer difference */
159           pointer_align = (k >> sizeof(void*)) * sizeof(void*);
160           address_pointed1 = *((void **)((char *)addr_block1 + pointer_align));
161           address_pointed2 = *((void **)((char *)addr_block2 + pointer_align));
162
163           fprintf(stderr, "Addresses pointed : %p - %p \n", address_pointed1, address_pointed2);
164           
165           /* Get block number */
166           block_pointed1 = ((char*)address_pointed1 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
167           block_pointed2 = ((char*)address_pointed2 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
168           
169           fprintf(stderr, "Blocks pointed : %d - %d\n", block_pointed1, block_pointed2);
170           
171           if((char *) address_pointed1 < (char*)((struct mdesc*)s_heap)->heapbase || block_pointed1 > mdp1->heapsize || block_pointed1 < 1 || (char *) address_pointed2 < (char*)((struct mdesc*)s_heap)->heapbase || block_pointed2 > mdp2->heapsize || block_pointed2 < 1) {
172             fprintf(stderr, "Unknown pointer(s) ! \n");
173             fflush(NULL);
174             distance++;
175             continue;
176           }
177     
178           addr_block_pointed1 = ((void*) (((ADDR2UINT((size_t)block_pointed1)) - 1) * BLOCKSIZE + (char*)heapbase1));
179           addr_block_pointed2 = ((void*) (((ADDR2UINT((size_t)block_pointed2)) - 1) * BLOCKSIZE + (char*)heapbase2));
180
181           fprintf(stderr, "Addr blocks pointed : %p - %p\n", addr_block_pointed1, addr_block_pointed2);
182
183           if(heapinfo1[block_pointed1].type == heapinfo2[block_pointed2].type){
184             
185             if(heapinfo1[block_pointed1].type == 0){ // Large block
186               
187               if(heapinfo1[block_pointed1].busy_block.busy_size == heapinfo2[block_pointed2].busy_block.busy_size){
188                 
189                 if(memcmp(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size) != 0){
190                   distance++;
191                 }else{
192                   fprintf(stderr, "False difference detected\n");
193                 }
194                 
195               }else{
196                 distance++;
197               }
198               
199             }else{ // Fragmented block
200
201               /* Get fragment number */
202               frag_pointed1 = ((uintptr_t) (ADDR2UINT (address_pointed1) % (BLOCKSIZE))) >> ((struct mdesc*)s_heap)->heapinfo[block_pointed1].type;
203               frag_pointed2 = ((uintptr_t) (ADDR2UINT (address_pointed2) % (BLOCKSIZE))) >> ((struct mdesc*)s_heap)->heapinfo[block_pointed2].type;
204               
205               fprintf(stderr, "Fragments pointed : %d - %d\n", frag_pointed1, frag_pointed2);
206               
207               addr_frag_pointed1 = (char*)addr_block_pointed1 + (frag_pointed1 * (int)pow(2, heapinfo1[block_pointed1].type));
208               addr_frag_pointed2 = (char*)addr_block_pointed2 + (frag_pointed2 * (int)pow(2, heapinfo2[block_pointed2].type));
209
210               fprintf(stderr, "Addr frag pointed : %p - %p\n", addr_frag_pointed1, addr_frag_pointed2);
211               
212               fprintf(stderr, "Size used in fragments pointed : %d - %d\n", heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]);  
213               
214               if(heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1] == heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]){
215                 
216                 if(memcmp(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1]) != 0){
217                   distance++;
218                 }else{
219                   fprintf(stderr, "False difference detected\n");
220                 }
221                 
222               }else{
223                 distance ++;
224               }
225             }
226             
227           }else{
228
229             if(((heapinfo1[block_pointed1].type == 0) && (heapinfo2[block_pointed2].type != 0)) || ((heapinfo1[block_pointed1].type != 0) && (heapinfo2[block_pointed2].type == 0))){  
230               fprintf(stderr, "Pointers on blocks with different types \n");
231               distance++;
232             }else{
233              
234               frag_pointed1 = ((uintptr_t) (ADDR2UINT (address_pointed1) % (BLOCKSIZE))) >> ((struct mdesc*)s_heap)->heapinfo[block_pointed1].type;
235               frag_pointed2 = ((uintptr_t) (ADDR2UINT (address_pointed2) % (BLOCKSIZE))) >> ((struct mdesc*)s_heap)->heapinfo[block_pointed2].type;
236               
237               fprintf(stderr, "Fragments pointed : %d - %d\n", frag_pointed1, frag_pointed2);
238               
239               addr_frag_pointed1 = (char*)addr_block_pointed1 + (frag_pointed1 * (int)pow(2, heapinfo1[block_pointed1].type));
240               addr_frag_pointed2 = (char*)addr_block_pointed2 + (frag_pointed2 * (int)pow(2, heapinfo2[block_pointed2].type));
241
242               fprintf(stderr, "Addr frag pointed : %p - %p\n", addr_frag_pointed1, addr_frag_pointed2);
243               
244               fprintf(stderr, "Size used in fragments pointed : %d - %d\n", heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]); 
245               
246               if(heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1] == heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]){
247                                 
248                 if(memcmp(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1]) != 0){
249                   distance++;
250                 }else{
251                   fprintf(stderr, "False difference detected\n");
252                 }
253                 
254               }else{
255                 distance ++;
256               }
257             }
258           }
259         }
260      
261       }
262
263
264       if(distance>0){
265         fprintf(stderr,"\nDifferent data in large block %zu (size = %zu (in blocks), busy_size = %zu (in bytes))\n", i, heapinfo1[i].busy_block.size, heapinfo1[i].busy_block.busy_size);
266         fflush(NULL);
267         fprintf(stderr, "Hamming distance between blocks : %d\n", distance);
268         mmalloc_backtrace_block_display(heapinfo1, i);
269         mmalloc_backtrace_block_display(heapinfo2, i);
270         fprintf(stderr, "\n");
271         errors++;
272         total_distance += distance;
273       }
274
275       i++;
276
277     }else{
278
279       if(heapinfo1[i].type > 0){ /* busy fragmented block */
280
281         if(heapinfo1[i].type != heapinfo2[i].type){
282           fprintf(stderr,"Different size of fragments in fragmented block %zu : %d - %d\n", i, heapinfo1[i].type, heapinfo2[i].type); fflush(NULL);
283           errors++;
284         }
285
286         if(heapinfo1[i].busy_frag.nfree != heapinfo2[i].busy_frag.nfree){
287           fprintf(stderr,"Different free fragments in fragmented block %zu : %zu - %zu\n", i, heapinfo1[i].busy_frag.nfree, heapinfo2[i].busy_frag.nfree); fflush(NULL);
288           errors++;
289         }
290
291         if(heapinfo1[i].busy_frag.first != heapinfo2[i].busy_frag.first){
292           fprintf(stderr,"Different first free fragment in fragmented block %zu : %zu - %zu\n", i, heapinfo1[i].busy_frag.first, heapinfo2[i].busy_frag.first); fflush(NULL);
293           errors++;
294         }
295
296         frag_size = pow(2, heapinfo1[i].type);
297
298         for(j=0; j< (BLOCKSIZE/frag_size); j++){
299
300           if(heapinfo1[i].busy_frag.frag_size[j] != heapinfo2[i].busy_frag.frag_size[j]){
301             fprintf(stderr,"Different busy_size for fragment %zu in block %zu : %hu - %hu\n", j, i, heapinfo1[i].busy_frag.frag_size[j], heapinfo2[i].busy_frag.frag_size[j]); fflush(NULL);
302             errors++;
303           }
304
305           if(heapinfo1[i].busy_frag.frag_size[j] > 0){
306
307             addr_frag1 = (char *)addr_block1 + (j * frag_size);
308             addr_frag2 = (char *)addr_block2 + (j * frag_size);
309
310             /* Hamming distance on different blocks */
311             distance = 0;
312
313             for(k=0;k<heapinfo1[i].busy_frag.frag_size[j];k++){
314
315               if(memcmp(((char *)addr_frag1) + k, ((char *)addr_frag2) + k, 1) != 0){
316
317                 fprintf(stderr, "Different byte (offset=%d) (%p - %p) in fragment %zu in block %zu\n", k, (char *)addr_frag1 + k, (char *)addr_frag2 + k, j, i); fflush(NULL);
318
319                 pointer_align = (k / sizeof(void*)) * sizeof(void*);
320                 address_pointed1 = *((void **)((char *)addr_frag1 + pointer_align));
321                 address_pointed2 = *((void **)((char *)addr_frag2 + pointer_align));
322    
323                 fprintf(stderr, "Addresses pointed : %p - %p \n", address_pointed1, address_pointed2);
324
325
326                 block_pointed1 = ((char*)address_pointed1 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
327                 block_pointed2 = ((char*)address_pointed2 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
328
329                 fprintf(stderr, "Blocks pointed : %d - %d\n", block_pointed1, block_pointed2);
330                 
331                 if((char *) address_pointed1 < (char*)((struct mdesc*)s_heap)->heapbase || block_pointed1 > mdp1->heapsize || block_pointed1 < 1 || (char *) address_pointed2 < (char*)((struct mdesc*)s_heap)->heapbase || block_pointed2 > mdp2->heapsize || block_pointed2 < 1) {
332                   fprintf(stderr, "Unknown pointer(s) ! \n");
333                   fflush(NULL);
334                   distance++;
335                   continue;
336                 }
337
338                 addr_block_pointed1 = ((void*) (((ADDR2UINT((size_t)block_pointed1)) - 1) * BLOCKSIZE + (char*)heapbase1));
339                 addr_block_pointed2 = ((void*) (((ADDR2UINT((size_t)block_pointed2)) - 1) * BLOCKSIZE + (char*)heapbase2));
340
341                 fprintf(stderr, "Addr block pointed : %p - %p\n", addr_block_pointed1, addr_block_pointed2);
342                 
343                 if(heapinfo1[block_pointed1].type == heapinfo2[block_pointed2].type){
344                   
345                   if(heapinfo1[block_pointed1].type == 0){ // Large block
346                     
347                     if(heapinfo1[block_pointed1].busy_block.busy_size == heapinfo2[block_pointed2].busy_block.busy_size){
348                       
349                       if(memcmp(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size) != 0){
350                         distance++;
351                       }else{
352                         fprintf(stderr, "False difference detected\n");
353                       }
354                       
355                     }else{
356                       distance++;
357                     }
358                     
359                   }else{ // Fragmented block
360                     
361                     frag_pointed1 = ((uintptr_t) (ADDR2UINT (address_pointed1) % (BLOCKSIZE))) >> ((struct mdesc*)s_heap)->heapinfo[block_pointed1].type;
362                     frag_pointed2 = ((uintptr_t) (ADDR2UINT (address_pointed2) % (BLOCKSIZE))) >> ((struct mdesc*)s_heap)->heapinfo[block_pointed2].type;
363                             
364                     fprintf(stderr, "Fragments pointed : %d - %d\n", frag_pointed1, frag_pointed2);
365
366                     addr_frag_pointed1 = (char*)addr_block_pointed1 + (frag_pointed1 * (int)pow(2, heapinfo1[block_pointed1].type));
367                     addr_frag_pointed2 = (char*)addr_block_pointed2 + (frag_pointed2 * (int)pow(2, heapinfo2[block_pointed2].type));
368
369                     fprintf(stderr, "Addr frag pointed : %p - %p\n", addr_frag_pointed1, addr_frag_pointed2);
370                     
371                     fprintf(stderr, "Size used in fragments pointed : %d - %d\n", heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]); 
372                                         
373                     if(heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1] == heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]){
374                       
375                       if(memcmp(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1]) != 0){
376                         distance++;
377                       }else{
378                         fprintf(stderr, "False difference detected\n");
379                       }
380                       
381                     }else{
382                       distance ++;
383                     }
384                   }
385
386                 }else{
387
388                   if(((heapinfo1[block_pointed1].type == 0) && (heapinfo2[block_pointed2].type != 0)) || ((heapinfo1[block_pointed1].type != 0) && (heapinfo2[block_pointed2].type == 0))){  
389                     fprintf(stderr, "Pointers on blocks with different types \n");
390                     distance++;
391                   }else{
392
393                     frag_pointed1 = ((uintptr_t) (ADDR2UINT (address_pointed1) % (BLOCKSIZE))) >> ((struct mdesc*)s_heap)->heapinfo[block_pointed1].type;
394                     frag_pointed2 = ((uintptr_t) (ADDR2UINT (address_pointed2) % (BLOCKSIZE))) >> ((struct mdesc*)s_heap)->heapinfo[block_pointed2].type;
395                    
396                     fprintf(stderr, "Fragments pointed : %d - %d\n", frag_pointed1, frag_pointed2);
397
398                     addr_frag_pointed1 = (char*)addr_block_pointed1 + (frag_pointed1 * (int)pow(2, heapinfo1[block_pointed1].type));
399                     addr_frag_pointed2 = (char*)addr_block_pointed2 + (frag_pointed2 * (int)pow(2, heapinfo2[block_pointed2].type));
400
401                     fprintf(stderr, "Addr frag pointed : %p - %p\n", addr_frag_pointed1, addr_frag_pointed2);
402                                         
403                     fprintf(stderr, "Size used in fragments pointed : %d - %d\n", heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]); 
404                                         
405                     if(heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1] == heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]){
406                       
407                       if(memcmp(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1]) != 0){
408                         distance++;
409                       }else{
410                         fprintf(stderr, "False difference detected\n");
411                       }
412                       
413                     }else{
414                       distance ++;
415                     }
416                   }
417                   
418                 }
419               }
420
421             }
422
423             if(distance > 0){
424               fprintf(stderr,"\nDifferent data in fragment %zu (size = %zu, size used = %hu) in block %zu \n", j, frag_size, heapinfo1[i].busy_frag.frag_size[j], i);
425               fprintf(stderr, "Hamming distance between fragments : %d\n", distance);
426               mmalloc_backtrace_fragment_display(heapinfo1, i, j);
427               mmalloc_backtrace_fragment_display(heapinfo2, i, j);
428               fprintf(stderr, "\n");
429               errors++;
430               total_distance += distance;
431
432             }
433
434           }
435         }
436
437         i++;
438
439       }else{ /* free block */
440
441         i++;
442
443       }
444
445     }
446
447   }
448
449
450   fprintf(stderr, "Hamming distance between heap regions : %d\n", total_distance);
451
452   return (errors);
453 }
454
455
456 /* void *get_end_addr_heap(void *heap){ */
457
458 /*   FILE *fp;                     /\* File pointer to process's proc maps file *\/ */
459 /*   char *line = NULL;            /\* Temporal storage for each line that is readed *\/ */
460 /*   ssize_t read;                 /\* Number of bytes readed *\/ */
461 /*   size_t n = 0;                 /\* Amount of bytes to read by getline *\/ */
462
463 /*   fp = fopen("/proc/self/maps", "r"); */
464
465 /*   if(fp == NULL) */
466 /*     perror("fopen failed"); */
467
468
469 /*   xbt_dynar_t lfields = NULL; */
470 /*   xbt_dynar_t start_end  = NULL; */
471 /*   void *start_addr; */
472 /*   void *end_addr; */
473
474 /*   while ((read = getline(&line, &n, fp)) != -1) { */
475
476 /*     xbt_str_trim(line, NULL); */
477 /*     xbt_str_strip_spaces(line); */
478 /*     lfields = xbt_str_split(line,NULL); */
479
480 /*     start_end = xbt_str_split(xbt_dynar_get_as(lfields, 0, char*), "-"); */
481 /*     start_addr = (void *) strtoul(xbt_dynar_get_as(start_end, 0, char*), NULL, 16); */
482 /*     end_addr = (void *) strtoul(xbt_dynar_get_as(start_end, 1, char*), NULL, 16); */
483
484 /*     if(start_addr == heap){ */
485 /*       free(line); */
486 /*       fclose(fp); */
487 /*       xbt_dynar_reset(lfields); */
488 /*       xbt_free(lfields); */
489 /*       xbt_dynar_reset(start_end); */
490 /*       xbt_free(start_end); */
491 /*       return end_addr; */
492 /*     } */
493
494 /*   } */
495
496 /*   xbt_dynar_reset(lfields); */
497 /*   xbt_free(lfields); */
498 /*   xbt_dynar_reset(start_end); */
499 /*   xbt_free(start_end); */
500 /*   free(line); */
501 /*   fclose(fp); */
502 /*   return NULL; */
503
504
505 /* } */
506
507
508