kernel/elf: Fix handling of the commpage in UserSymbolLookup.

We now will find its image struct using the standard iteration,
so just check for its address specifically.

Fixes commpage symbols printing in KDL after the recent refactor.
This commit is contained in:
Augustin Cavalier 2025-01-25 15:36:38 -05:00
parent 71c04db60a
commit ab25a42387

View File

@ -1376,20 +1376,19 @@ public:
// get the image for the address
struct image *image;
status_t error = _FindImageAtAddress(address, image);
if (error != B_OK) {
if (error != B_OK)
return error;
if (image->info.basic_info.text == fTeam->commpage_address) {
// commpage requires special treatment since kernel stores symbol
// information
addr_t commPageAddress = (addr_t)fTeam->commpage_address;
if (address >= commPageAddress
&& address < commPageAddress + COMMPAGE_SIZE) {
if (*_imageName)
*_imageName = "commpage";
address -= (addr_t)commPageAddress;
error = elf_debug_lookup_symbol_address(address, _baseAddress,
_symbolName, NULL, _exactMatch);
if (_baseAddress)
*_baseAddress += (addr_t)fTeam->commpage_address;
}
if (*_imageName != NULL)
*_imageName = "commpage";
address -= (addr_t)fTeam->commpage_address;
error = elf_debug_lookup_symbol_address(address, _baseAddress,
_symbolName, NULL, _exactMatch);
if (_baseAddress != NULL)
*_baseAddress += (addr_t)fTeam->commpage_address;
return error;
}