Index: lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp =================================================================== --- lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -384,6 +384,11 @@ if (zero_fill_size) memset(((char *)buf) + bytes_copied, 0, zero_fill_size); + // No data found in the core file, so the buffer contains + // all zeros. + if (zero_fill_size == size) + return 0; + return bytes_copied + zero_fill_size; } Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py =================================================================== --- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py +++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -155,6 +155,37 @@ self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions, "a.out") + + @skipIf(triple='^mips') + @skipIfLLVMTargetMissing("X86") + @skipIfWindows + @skipIfReproducer + def test_frame_disassemble(self): + """Test that we are able to disassemble all the frames""" + disasmtarget = self.dbg.CreateTarget("linux-x86_64-for-disassemble.out") + disasmprocess = disasmtarget.LoadCore("linux-x86_64-for-disassemble.core") + self.assertTrue(disasmprocess, PROCESS_IS_VALID) + + disasmthread = disasmprocess.GetSelectedThread() + framenum = disasmthread.GetNumFrames() + for i in range(framenum): + frame = disasmthread.GetFrameAtIndex(i) + disassembly = frame.Disassemble() + self.assertNotEqual(disassembly, "") + self.assertNotIn("error", disassembly) + # Make sure we don't have some dummy disassembly. + # Each function should start with: + # pushq %rbp + # ... + # Sometimes it just prints some dummy code as: + # addb %al, (%rax) + # addb %al, (%rax) + # ... + pushrbpinstr = disassembly.splitlines()[1] + self.assertNotIn("addb %al, (%rax)", pushrbpinstr) + + self.dbg.DeleteTarget(disasmtarget) + @skipIf(triple='^mips') @skipIfLLVMTargetMissing("X86") def test_FPR_SSE(self):