Skip to content

Revert "[symbolizer] Empty string is not an error" #94424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

spavloff
Copy link
Collaborator

@spavloff spavloff commented Jun 5, 2024

Reverts #92660

It needs more discussion.

@llvmbot
Copy link
Member

llvmbot commented Jun 5, 2024

@llvm/pr-subscribers-llvm-binary-utilities

Author: Serge Pavlov (spavloff)

Changes

Reverts llvm/llvm-project#92660

It needs more discussion.


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

2 Files Affected:

  • (modified) llvm/test/tools/llvm-symbolizer/get-input-file.test (+4-2)
  • (modified) llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp (-8)
diff --git a/llvm/test/tools/llvm-symbolizer/get-input-file.test b/llvm/test/tools/llvm-symbolizer/get-input-file.test
index 50eb051968718..8c21816591c81 100644
--- a/llvm/test/tools/llvm-symbolizer/get-input-file.test
+++ b/llvm/test/tools/llvm-symbolizer/get-input-file.test
@@ -1,9 +1,9 @@
 # If binary input file is not specified, llvm-symbolizer assumes it is the first
 # item in the command.
 
-# No input items at all. Report an unknown line, but do not produce any output on stderr.
+# No input items at all, complain about missing input file.
 RUN: echo | llvm-symbolizer 2>%t.1.err | FileCheck %s --check-prefix=NOSOURCE
-RUN: FileCheck --input-file=%t.1.err --implicit-check-not={{.}} --allow-empty %s
+RUN: FileCheck --input-file=%t.1.err --check-prefix=NOFILE %s
 
 # Only one input item, complain about missing addresses.
 RUN: llvm-symbolizer "foo" 2>%t.2.err | FileCheck %s --check-prefix=NOSOURCE
@@ -32,6 +32,8 @@ RUN: FileCheck --input-file=%t.7.err --check-prefix=BAD-QUOTE %s
 NOSOURCE:      ??
 NOSOURCE-NEXT: ??:0:0
 
+NOFILE: error: no input filename has been specified
+
 NOADDR: error: 'foo': no module offset has been specified
 
 NOTFOUND:  error: 'foo': [[MSG]]
diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
index 6d7953f3109a5..b98bdbc388faf 100644
--- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -337,14 +337,6 @@ static void symbolizeInput(const opt::InputArgList &Args,
   object::BuildID BuildID(IncomingBuildID.begin(), IncomingBuildID.end());
   uint64_t Offset = 0;
   StringRef Symbol;
-
-  // An empty input string may be used to check if the process is alive and
-  // responding to input. Do not emit a message on stderr in this case but
-  // respond on stdout.
-  if (InputString.empty()) {
-    printUnknownLineInfo(ModuleName, Printer);
-    return;
-  }
   if (Error E = parseCommand(Args.getLastArgValue(OPT_obj_EQ), IsAddr2Line,
                              StringRef(InputString), Cmd, ModuleName, BuildID,
                              Symbol, Offset)) {

@spavloff spavloff merged commit c0bb16e into main Jun 5, 2024
9 checks passed
@spavloff spavloff deleted the revert-92660-a2l.empty branch June 5, 2024 04:39
spavloff added a commit that referenced this pull request Jul 5, 2024
spavloff added a commit that referenced this pull request Jul 5, 2024
This is recommit of #92660, reverted in
#94424.
Original commit message is below.

After commit
1792852
([symbolizer] Change reaction on invalid input) llvm-symbolizer issues
an error on malformed command instead of echoing it to the standard
output, as in previous versions. It turns out this behavior broke a use
case when echoing was used to check if llvm-symbolizer is working
(1792852#commitcomment-142161925).

With this change an empty line as input is not considered as an error
anymore and does not produce any output on stderr. llvm-symbolizer still
respond on empty line with line not found, this is consistent with GNU
addr2line.
kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
This is recommit of llvm#92660, reverted in
llvm#94424.
Original commit message is below.

After commit
llvm@1792852
([symbolizer] Change reaction on invalid input) llvm-symbolizer issues
an error on malformed command instead of echoing it to the standard
output, as in previous versions. It turns out this behavior broke a use
case when echoing was used to check if llvm-symbolizer is working
(llvm@1792852#commitcomment-142161925).

With this change an empty line as input is not considered as an error
anymore and does not produce any output on stderr. llvm-symbolizer still
respond on empty line with line not found, this is consistent with GNU
addr2line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants