[PATCH] D102316: [symbolizer] Added StartAddress for the resolved function.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 00:57:41 PDT 2021


jhenderson added a comment.

Reminder:

> Don't forget to update the examples (and potentially text) in the docs to match whatever the new output is.



================
Comment at: llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp:110
 
+void LLVMPrinter::printVerbose(StringRef Filename, const DILineInfo &Info) {
+  OS << "  Filename: " << Filename << '\n';
----------------
I feel like it would be a good idea to reduce code duplication of this function. I'd suggest pulling the common bits out into separate static or private functions, that can be called as necessary. Example:
```
void PlainPrinterBase::printVerbose(StringRef Filename,
                                    const DILineInfo &Info) {
  printFileAndFunctionStart(...);
  printLineColumnDiscriminator(...);
}

void LLVMPrinter::printVerbose(StringRef Filename, const DILineInfo &Info) {
  printFileAndFunctionStart(...);
  if (Info.StartAddress) {
    OS << "  Function start address: 0x";
    OS.write_hex(*Info.StartAddress);
    OS << '\n';
  }
  printLineColumnDiscriminator(...);
}
```

Alternatively, put the start address printing in another virtual function, and then just have the `PlainPrinterBase::printVerbose` function callt that function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102316



More information about the llvm-commits mailing list