[lldb] Correct elision of line zero in mixed disassembly
authorDave Lee <davelee.com@gmail.com>
Thu, 11 May 2023 17:04:55 +0000 (10:04 -0700)
committerDave Lee <davelee.com@gmail.com>
Thu, 11 May 2023 20:24:32 +0000 (13:24 -0700)
When `disassemble --mixed` is run, do not show source for line zero, as intended.

Differential Revision: https://reviews.llvm.org/D150383

lldb/source/Core/Disassembler.cpp
lldb/test/Shell/Commands/command-disassemble-mixed.test [new file with mode: 0644]

index 797d30a..db91dc5 100644 (file)
@@ -243,7 +243,7 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
 
   // 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) {
diff --git a/lldb/test/Shell/Commands/command-disassemble-mixed.test b/lldb/test/Shell/Commands/command-disassemble-mixed.test
new file mode 100644 (file)
index 0000000..d27cdb1
--- /dev/null
@@ -0,0 +1,13 @@
+extern int do_not_show;
+
+int main() {
+  int abc = 30;
+#line 0
+  return abc;
+}
+
+// RUN: %clang_host -g -x c -o a.out %s
+// RUN: %lldb -b -o 'disassemble --mixed -n main' a.out | FileCheck %s
+
+// CHECK: a.out`main:
+// CHECK-NOT: do_not_show