ted created this revision. ted requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
"line 0" in a DWARF linetable means something that doesn't have associated source. The code for mixed disassembly has a comment indicating that "line 0" should be skipped, but the wrong value was returned. Fix the return value and add a test to check that we don't incorrectly show source lines from the beginning of the file. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D112931 Files: lldb/source/Core/Disassembler.cpp lldb/test/Shell/Commands/command-disassemble-mixed.c Index: lldb/test/Shell/Commands/command-disassemble-mixed.c =================================================================== --- /dev/null +++ lldb/test/Shell/Commands/command-disassemble-mixed.c @@ -0,0 +1,18 @@ +// invalid mixed disassembly line + +// RUN: %clang -g %s -o %t +// RUN: %lldb %t -o "dis -m -n main" | FileCheck %s + +// CHECK: int main +// CHECK: int i +// CHECK-NOT: invalid mixed disassembly line +// CHECK: return 0; + +int main(int argc, char **argv) +{ + int i; + + for (i=0; i < 10; ++i) ; + + return 0; +} Index: lldb/source/Core/Disassembler.cpp =================================================================== --- lldb/source/Core/Disassembler.cpp +++ lldb/source/Core/Disassembler.cpp @@ -243,7 +243,7 @@ // Skip any line #0 entries - they are implementation details if (line.line == 0) - return false; + return true; ThreadSP thread_sp = exe_ctx.GetThreadSP(); if (thread_sp) {
Index: lldb/test/Shell/Commands/command-disassemble-mixed.c =================================================================== --- /dev/null +++ lldb/test/Shell/Commands/command-disassemble-mixed.c @@ -0,0 +1,18 @@ +// invalid mixed disassembly line + +// RUN: %clang -g %s -o %t +// RUN: %lldb %t -o "dis -m -n main" | FileCheck %s + +// CHECK: int main +// CHECK: int i +// CHECK-NOT: invalid mixed disassembly line +// CHECK: return 0; + +int main(int argc, char **argv) +{ + int i; + + for (i=0; i < 10; ++i) ; + + return 0; +} Index: lldb/source/Core/Disassembler.cpp =================================================================== --- lldb/source/Core/Disassembler.cpp +++ lldb/source/Core/Disassembler.cpp @@ -243,7 +243,7 @@ // Skip any line #0 entries - they are implementation details if (line.line == 0) - return false; + return true; ThreadSP thread_sp = exe_ctx.GetThreadSP(); if (thread_sp) {
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits