-mc_object_info_t MC_ip_find_object_info(void *ip)
-{
- size_t i;
- for (i = 0; i != mc_object_infos_size; ++i) {
- if (ip >= (void *) mc_object_infos[i]->start_exec
- && ip <= (void *) mc_object_infos[i]->end_exec) {
- return mc_object_infos[i];
- }
- }
- return NULL;
-}
-
-static dw_frame_t MC_find_function_by_ip_and_object(void *ip,
- mc_object_info_t info)
-{
- xbt_dynar_t dynar = info->functions_index;
- mc_function_index_item_t base =
- (mc_function_index_item_t) xbt_dynar_get_ptr(dynar, 0);
- int i = 0;
- int j = xbt_dynar_length(dynar) - 1;
- while (j >= i) {
- int k = i + ((j - i) / 2);
- if (ip < base[k].low_pc) {
- j = k - 1;
- } else if (ip >= base[k].high_pc) {
- i = k + 1;
- } else {
- return base[k].function;
- }
- }
- return NULL;
-}
-
-dw_frame_t MC_find_function_by_ip(void *ip)
-{
- mc_object_info_t info = MC_ip_find_object_info(ip);
- if (info == NULL)
- return NULL;
- else
- return MC_find_function_by_ip_and_object(ip, info);
-}
-