[PATCH] D96883: Add support for JSON output style to llvm-symbolizer

Alex Orlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 09:49:26 PDT 2021


aorlov marked 7 inline comments as done.
aorlov added inline comments.


================
Comment at: llvm/test/tools/llvm-symbolizer/output-style-json-code.test:6
+
+## Handle symbolize library error - file does not exist.
+# RUN: llvm-symbolizer --output-style=JSON -e %p/no-file.exe 0 | \
----------------
jhenderson wrote:
> 
But note the library name is `symbolize`, not `symbolizer`.


================
Comment at: llvm/test/tools/llvm-symbolizer/output-style-json-code.test:32
+## Resolve valid address, no-inlines.
+# NO-INLINES-NEXT:{"Address":"0x40054d","ModuleName":"{{.*}}/Inputs/addr.exe","Symbol":[{"Column":3,"Discriminator":0,"FileName":"/tmp{{/|\\\\}}x.c","FunctionName":"main","Line":3,"Source":"","StartFileName":"/tmp{{/|\\\\}}x.c","StartLine":2}]}
+
----------------
jhenderson wrote:
> aorlov wrote:
> > jhenderson wrote:
> > > It would be nice to have one or more test cases with a non-zero discriminator value. Also, where the "Source" parameter is non-empty.
> > > 
> > > You can simplify `{{/|\\\\}}` to this: `{{[\\/]}}`. I think it's slightly more readable due to avoiding the quadruple backslash. Same goes elsewhere below.
> > I have added the test for a non-zero discriminator. Note the address is hardcoded. It is more correct to use /Inputs/discrim.inp via stdin, but I just copied the address from discriminator.test.
> > It seems currently we have no binaries in llvm/test/tools/llvm-symbolizer/Inputs with a valid Source info.
> > > You can simplify
> > No, it does not work because JSON has own rules for escaping special symbols in paths.
> > 
> > It seems currently we have no binaries in llvm/test/tools/llvm-symbolizer/Inputs with a valid Source info.
> 
> Consider generating one at test time using assembly or yaml2obj.
> 
> > > You can simplify
> > No, it does not work because JSON has own rules for escaping special symbols in paths.
> 
> Okay - I missed the double backslash.
> 
I have added output-style-json-code-source.c.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96883/new/

https://reviews.llvm.org/D96883



More information about the llvm-commits mailing list