fix trie walk

now able to search for symbol with multiple name with same prefix
This commit is contained in:
nganhkhoa 2023-06-02 12:03:27 +07:00
parent 4fd6bd166e
commit 0d13a70896

View File

@ -319,13 +319,12 @@ void *find_in_export_trie(const void *header, void *trie, const char *symbol) {
// terminal node will have data
uint32_t data_count = 0;
decode_uleb128(ptr, &data_count);
if (data_count != 0) {
if (data_count != 0 && *find == 0) {
// printf("reached terminal node\n");
if (*find != 0) {
// it reaches terminal node but symbol is not fully scanned
return 0;
}
break;
} else if (data_count) {
// still need to follow the branch
ptr += data_count;
}
char num_child = ptr[0];
ptr++;