1 //===- xray-fc-account.cc - XRay Function Call Accounting Tool ------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Implementation of the helper tools dealing with XRay-generated function ids.
12 //===----------------------------------------------------------------------===//
14 #include "func-id-helper.h"
15 #include "llvm/Support/Path.h"
21 std::string FuncIdConversionHelper::SymbolOrNumber(int32_t FuncId) const {
23 auto It = FunctionAddresses.find(FuncId);
24 if (It == FunctionAddresses.end()) {
29 if (auto ResOrErr = Symbolizer.symbolizeCode(BinaryInstrMap, It->second)) {
31 if (DI.FunctionName == "<invalid>")
32 F << "@(" << std::hex << It->second << ")";
36 handleAllErrors(ResOrErr.takeError(), [&](const ErrorInfoBase &) {
37 F << "@(" << std::hex << It->second << ")";
43 std::string FuncIdConversionHelper::FileLineAndColumn(int32_t FuncId) const {
44 auto It = FunctionAddresses.find(FuncId);
45 if (It == FunctionAddresses.end())
49 auto ResOrErr = Symbolizer.symbolizeCode(BinaryInstrMap, It->second);
51 consumeError(ResOrErr.takeError());
56 F << sys::path::filename(DI.FileName).str() << ":" << DI.Line << ":"