From c5dcedecae63bd8d41e4040ce3832fc76d7b45b4 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 11 Dec 2016 11:08:17 -0500 Subject: [PATCH] Debugger: Fix oversight. DebugReportGenerator: - In the case where the function was already disassembled beforehand, we weren't retrieving the statement, leading to a null pointer dereference. --- src/kits/debugger/controllers/DebugReportGenerator.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/kits/debugger/controllers/DebugReportGenerator.cpp b/src/kits/debugger/controllers/DebugReportGenerator.cpp index 72a459d5aa..e25725e68a 100644 --- a/src/kits/debugger/controllers/DebugReportGenerator.cpp +++ b/src/kits/debugger/controllers/DebugReportGenerator.cpp @@ -701,10 +701,18 @@ DebugReportGenerator::_DumpFunctionDisassembly(BFile& _output, } codeReference.SetTo(code, true); - statement = code->StatementAtAddress(instructionPointer); } else codeReference.SetTo(code); + statement = code->StatementAtAddress(instructionPointer); + if (statement == NULL) { + data.SetToFormat("\t\t\tUnable to retrieve disassembly for IP %#" + B_PRIx64 ": address does not map to a valid instruction.\n", + instructionPointer); + WRITE_AND_CHECK(_output, data); + return B_OK; + } + SourceLocation location = statement->StartSourceLocation(); data = "\t\t\tDisassembly:\n";