@@ -3743,7 +3743,7 @@ static bool _upf_get_this_object_cb(
37433743 void *raw_data
37443744) {
37453745 const uintptr_t function_address = (uintptr_t ) _upf_get_this_object_cb;
3746- if (!(start <= function_address && function_address <= end && readable && executable)) return false ;
3746+ if (!(start <= function_address && function_address < end && readable && executable)) return false ;
37473747
37483748 _upf_get_this_object_cb_data *data = (_upf_get_this_object_cb_data *) raw_data;
37493749 *data->path = _upf_copy_string (path);
@@ -3790,7 +3790,7 @@ static const void *_upf_get_memory_region_end(const void *ptr) {
37903790 _UPF_ASSERT (ptr != NULL );
37913791 for (uint32_t i = 0 ; i < _upf_state.addresses .length ; i++) {
37923792 _upf_range range = _upf_state.addresses .data [i];
3793- if ((void *) range.start <= ptr && ptr <= (void *) range.end ) return (void *) range.end ;
3793+ if ((void *) range.start <= ptr && ptr < (void *) range.end ) return (void *) range.end ;
37943794 }
37953795 return NULL ;
37963796}
@@ -3799,7 +3799,7 @@ static bool _upf_is_memory_readable(const uint8_t *ptr, size_t size) {
37993799 _UPF_ASSERT (ptr != NULL );
38003800 if (_upf_get_memory_region_end (ptr) == NULL ) return false ;
38013801 if (size == 0 || size == SIZE_MAX) return true ;
3802- return _upf_get_memory_region_end (ptr + size) != NULL ;
3802+ return _upf_get_memory_region_end (ptr + ( size - 1 ) ) != NULL ;
38033803}
38043804
38053805// ===================== PRINTING =========================
@@ -4342,7 +4342,7 @@ __attribute__((no_sanitize_address)) static void _upf_print_type(
43424342
43434343// ======================== PC ============================
43444344
4345- static bool _upf_is_in_range (uint64_t addr, _upf_range_vec ranges) {
4345+ static bool _upf_is_in_ranges (uint64_t addr, _upf_range_vec ranges) {
43464346 for (uint32_t i = 0 ; i < ranges.length ; i++) {
43474347 if (ranges.data [i].start <= addr && addr < ranges.data [i].end ) return true ;
43484348 }
@@ -4351,14 +4351,14 @@ static bool _upf_is_in_range(uint64_t addr, _upf_range_vec ranges) {
43514351
43524352static _upf_cu *_upf_find_cu (uintptr_t pc) {
43534353 for (uint32_t i = 0 ; i < _upf_state.cus .length ; i++) {
4354- if (_upf_is_in_range (pc, _upf_state.cus .data [i].scope .ranges )) return &_upf_state.cus .data [i];
4354+ if (_upf_is_in_ranges (pc, _upf_state.cus .data [i].scope .ranges )) return &_upf_state.cus .data [i];
43554355 }
43564356 return NULL ;
43574357}
43584358
43594359static void _upf_find_scopes (uintptr_t pc, _upf_scope *scope, _upf_scope_vec *result) {
43604360 for (uint32_t i = 0 ; i < scope->scopes .length ; i++) {
4361- if (!_upf_is_in_range (pc, scope->scopes .data [i]->ranges )) continue ;
4361+ if (!_upf_is_in_ranges (pc, scope->scopes .data [i]->ranges )) continue ;
43624362 _upf_find_scopes (pc, scope->scopes .data [i], result);
43634363 _UPF_VECTOR_PUSH (result, scope->scopes .data [i]);
43644364 break ;
0 commit comments