* Find a value that is being added to the stack pointer register in \p root. * Find a debug variable with offset equal to this value. */
| 291 | * Find a debug variable with offset equal to this value. |
| 292 | */ |
| 293 | const retdec::common::Object* StackAnalysis::getDebugStackVariable( |
| 294 | llvm::Function* fnc, |
| 295 | SymbolicTree& root) |
| 296 | { |
| 297 | auto baseOffset = getBaseOffset(root); |
| 298 | if (!baseOffset.has_value()) |
| 299 | { |
| 300 | return nullptr; |
| 301 | } |
| 302 | |
| 303 | if (_dbgf == nullptr) |
| 304 | { |
| 305 | return nullptr; |
| 306 | } |
| 307 | |
| 308 | auto* debugFnc = _dbgf->getFunction(_config->getFunctionAddress(fnc)); |
| 309 | if (debugFnc == nullptr) |
| 310 | { |
| 311 | return nullptr; |
| 312 | } |
| 313 | |
| 314 | for (auto& var : debugFnc->locals) |
| 315 | { |
| 316 | if (!var.getStorage().isStack()) |
| 317 | { |
| 318 | continue; |
| 319 | } |
| 320 | if (var.getStorage().getStackOffset() == baseOffset) |
| 321 | { |
| 322 | return &var; |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | return nullptr; |
| 327 | } |
| 328 | |
| 329 | const retdec::common::Object* StackAnalysis::getConfigStackVariable( |
| 330 | llvm::Function* fnc, |
nothing calls this directly
no test coverage detected