runtime_loader: Optimize a special case of get_nearest_symbol.
If the caller does not want the symbol name/address/etc., we don't need to spend the time finding it, and can just return after finding the image. Change-Id: I138f8bd4071ffc25738dac4d6c0c6d3fe25edf1c Reviewed-on: https://review.haiku-os.org/c/1461 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
44b903f97a
commit
dee722ce4f
@@ -822,6 +822,18 @@ get_nearest_symbol_at_address(void* address, image_id* _imageID,
|
||||
if (image == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (_imageID != NULL)
|
||||
*_imageID = image->id;
|
||||
if (_imagePath != NULL)
|
||||
*_imagePath = image->path;
|
||||
if (_imageName != NULL)
|
||||
*_imageName = image->name;
|
||||
|
||||
// If the caller does not want the actual symbol name, only the image,
|
||||
// we can just return immediately.
|
||||
if (_symbolName == NULL && _type == NULL && _location == NULL)
|
||||
return B_OK;
|
||||
|
||||
bool exactMatch = false;
|
||||
elf_sym* foundSymbol = NULL;
|
||||
addr_t foundLocation = (addr_t)NULL;
|
||||
@@ -845,12 +857,6 @@ get_nearest_symbol_at_address(void* address, image_id* _imageID,
|
||||
}
|
||||
}
|
||||
|
||||
if (_imageID != NULL)
|
||||
*_imageID = image->id;
|
||||
if (_imagePath != NULL)
|
||||
*_imagePath = image->path;
|
||||
if (_imageName != NULL)
|
||||
*_imageName = image->name;
|
||||
if (_exactMatch != NULL)
|
||||
*_exactMatch = exactMatch;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user