From Adrian McCarthy:
"Running ninja check-lldb now has one crash in a Python process, due to deferencing a null pointer in IRExecutionUnit.cpp: candidate_sc.symbol is null, which leads to a call with a null this pointer."
Differential D17860
Fix "ninja check-lldb" crash in IRExecutionUnit.cpp ted on Mar 3 2016, 10:58 AM. Authored by
Details From Adrian McCarthy: "Running ninja check-lldb now has one crash in a Python process, due to deferencing a null pointer in IRExecutionUnit.cpp: candidate_sc.symbol is null, which leads to a call with a null this pointer."
Diff Detail Event TimelineComment Actions Thanks for the fix. Right now I'm trying to figure out why the test framework didn't detect the crash and reported that all the tests passed.
Comment Actions Looks good to me. Thanks for the fix!
Comment Actions I don't think this is right. It is possible to have a sc.symbol be nullptr, but sc.function be valid. So the check for sc.symbol will reject the valid information in the function. Note, the code in the function is also wrong, since it only gets the address from the symbol. Comment Actions Greg suggests adding something to SymbolContext to get the start address of the function that handles this possibility. GetAddressRange sort of does this, but only if the SymbolContext doesn't have a block or line entry. Comment Actions The change is to guard against the case where candidate_sc.symbol is nullptr. candidate_sc.function is only used when load_address != LLDB_INVALID_ADDRESS, but load_address is set on line 802: load_address = candidate_sc.symbol->ResolveCallableAddress(*target); so candidate_sc.symbol must be valid. The purpose of the function is to get the address of a symbol, so I don't think we care about candidate_sc.function when candidate_sc.symbol is nullptr. Comment Actions So you'd like to see this function get the address of a function that it Which should it prioritize when we have both? |
I'm OK with this, but I believe the LLDB style is to reverse the logic and use an early-out (a continue in this case) rather than increasing the depth of the rest of the code.