[lldb] Fix image lookup crash
lldb may crash when performing `image lookup --verbose --address $ADDR`. The ExecutionContext that gets passed into DWARFExpression::Evaluate may be valid but unpopulated. However, in one specific case, we were assuming that it has a valid Target and using it without checking first. We reach this codepath when we attempt to get information about an address that doesn't map to a CompileUnit in the module containing the requested address. lldb then checks to see if it maps to a global variable, so lldb has to evaluate the location of each global variable in the module. If a location expression contains DW_OP_deref_size that uses a FileAddress, we hit this code path. The simplest test case is to take a module that has a global variable with DW_OP_deref_size in its location expression, attempt to read an address that doesn't map to a CompileUnit (e.g. 0x0) and ensure we don't crash. Differential Revision: https://reviews.llvm.org/D143792
Loading
Please sign in to comment