Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Multiple .so support for region snapshots
[simgrid.git] / src / mc / mc_object_info.c
1 #include <stddef.h>
2
3 #include <xbt/dynar.h>
4
5 #include "mc_object_info.h"
6 #include "mc_private.h"
7
8 dw_frame_t MC_file_object_info_find_function(mc_object_info_t info, void *ip)
9 {
10   xbt_dynar_t dynar = info->functions_index;
11   mc_function_index_item_t base =
12       (mc_function_index_item_t) xbt_dynar_get_ptr(dynar, 0);
13   int i = 0;
14   int j = xbt_dynar_length(dynar) - 1;
15   while (j >= i) {
16     int k = i + ((j - i) / 2);
17     if (ip < base[k].low_pc) {
18       j = k - 1;
19     } else if (ip >= base[k].high_pc) {
20       i = k + 1;
21     } else {
22       return base[k].function;
23     }
24   }
25   return NULL;
26 }