Sharing the findings on lldb-dev.
Greg helped me figure out the issue, I need to check if symbol address is lldb.LLDB_INVALID_ADDRESS.
Things work fine now after the added checking.
The remaining issue is to figure out whether symbol.addr.file_addr or symbol.addr.load_addr should be used to get symbol address.
My test shows symbol.addr.file_addr should be used, at least for types defined in exetuables, contrary to what’s documented.