https://github.com/hapeeeeee created https://github.com/llvm/llvm-project/pull/137515
This PR fixes the issue where the `list` command does not output a prompt when reaching the end of the file. Closes #128507. >From 2d66140f9d62cb9bae44951df0999b595da05e58 Mon Sep 17 00:00:00 2001 From: hapeeeeee <623151...@qq.com> Date: Sun, 27 Apr 2025 18:27:04 +0800 Subject: [PATCH] [lldb] print a notice when `source list` paging reaches the end of the file --- lldb/source/Core/SourceManager.cpp | 7 +++++-- .../Commands/command-list-reach-end-of-file.test | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 lldb/test/Shell/Commands/command-list-reach-end-of-file.test 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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits