llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: None (hapeeeeee)

<details>
<summary>Changes</summary>

This PR fixes the issue where the `list` command does not output a prompt when 
reaching the end of the file.  
Closes #<!-- -->128507.

---
Full diff: https://github.com/llvm/llvm-project/pull/137515.diff


2 Files Affected:

- (modified) lldb/source/Core/SourceManager.cpp (+5-2) 
- (added) lldb/test/Shell/Commands/command-list-reach-end-of-file.test (+16) 


``````````diff
diff --git a/lldb/source/Core/SourceManager.cpp 
b/lldb/source/Core/SourceManager.cpp
index d63d42de14e80..b57d8b3e20316 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -360,8 +360,11 @@ size_t SourceManager::DisplayMoreWithLineNumbers(
     GetDefaultFileAndLine();
 
   if (last_file_sp) {
-    if (m_last_line == UINT32_MAX)
-      return 0;
+    if (m_last_line == UINT32_MAX) {
+      Stream::ByteDelta delta(*s);
+      s->Printf("note: reached the end of current file, no more to page\n");
+      return *delta;
+    }
 
     if (reverse && m_last_line == 1)
       return 0;
diff --git a/lldb/test/Shell/Commands/command-list-reach-end-of-file.test 
b/lldb/test/Shell/Commands/command-list-reach-end-of-file.test
new file mode 100644
index 0000000000000..61237ce4af542
--- /dev/null
+++ b/lldb/test/Shell/Commands/command-list-reach-end-of-file.test
@@ -0,0 +1,16 @@
+# RUN: %clang_host -g -O0 %S/Inputs/sigchld.c -o %t.out
+# RUN: %lldb %t.out -b -s %s | FileCheck %s
+
+b main
+r
+list
+# CHECK: assert (child_pid != -1);
+
+list
+# CHECK: printf("signo = %d\n", SIGCHLD);
+
+list 
+# CHECK: return 0;
+
+list 
+# CHECK: note: reached the end of current file, no more to page

``````````

</details>


https://github.com/llvm/llvm-project/pull/137515
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to