[llvm] [symbolizer] Empty string is not an error (PR #92660)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 00:51:06 PDT 2024
jh7370 wrote:
> > A simpler proposal: `ECHO` is only supported when not passing `--obj`, in which case it is unambiguous.
>
> Is there a reason why users, who don't pass `--obj`, do not need this facility?
As I understand it, the functionality is only needed by a tool to detect if llvm-symbolizer has entered interactive mode and is ready to receive input. I believe this is only possible when `--obj` is specified. That being said, this just introduces a special case to avoid a different special case, which seems suboptimal.
> > To be treated as a command, the argument must have at least one additional space after the ECHO
>
> It would be a case of secret symbol, invisible but significant.
I don't think it would be any more than other instances of options that take an empty string as the value. It's certainly not a "secret symbol", given that we'd document such a behaviour.
What do we do about `DATA`, `CODE` etc? They'll have just the same set of ambiguity issues as `ECHO`, right?
> We need to be clear, what problem is being solved. Initially it was something like "llvm-symbolizer needs a method of checking its liveness, compatible with the previous versions". Adding a new command does not solve this problem, - if a user is can adapt their scripts for using the new command, they can adapt them for the reply `??:0`.
To be clear, as I understand it adapting to the `??:0` reply is not the issue: adapting for the stderr printout is the issue - this is more significant than adding a little extra to the input script.
> Now we have solutions for this problem:
>
> * Existing implementation reacts for empty string with `??:0`. It however also produces some output on stderr, which is undesirable.
>
> * The current patch. With it llvm-symbolizer also replies with `??:0` but does not put anything on stderr. It however is not compatible with the previous versions.
Just to be clear, my issue with this particular solution is that it special cases an empty string argument, which I'd prefer to avoid. I'm not strongly opposed to it, but would prefer an alternative approach if we can find one that has consensus.
> * A possible implementation, that echoes the input empty string. It aligns the behavior with the previous versions. The drawback is incompatibility with addr2line and empty line as reply, printing something visible would be better.
>
Incompatibility with addr2line is a non issue: there are several other ways in which llvm-symbolizer consumes input/produces output that is not compatible with addr2line. Specifically printing/echoing an empty string (or more correctly, a blank line, i.e. `'\n'` not `''`) is also not a goal, as I understand @pcc's comments, as long as something is printed.
> I would vote for this patch, - it is not invasive, as the specified behavior of llvm-symbolier does not change. However the the last variant is also reasonable.
I would hope you would vote for your own patch ;)
https://github.com/llvm/llvm-project/pull/92660
More information about the llvm-commits
mailing list