|
|
|||
File indexing completed on 2026-05-10 08:43:42
0001 //===- DwarfTransformer.h ---------------------------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef LLVM_DEBUGINFO_GSYM_DWARFTRANSFORMER_H 0010 #define LLVM_DEBUGINFO_GSYM_DWARFTRANSFORMER_H 0011 0012 #include "llvm/ADT/StringRef.h" 0013 #include "llvm/DebugInfo/DWARF/DWARFContext.h" 0014 #include "llvm/DebugInfo/GSYM/ExtractRanges.h" 0015 #include "llvm/Support/Error.h" 0016 0017 namespace llvm { 0018 0019 class raw_ostream; 0020 0021 namespace gsym { 0022 0023 struct CUInfo; 0024 struct FunctionInfo; 0025 class GsymCreator; 0026 class OutputAggregator; 0027 0028 /// A class that transforms the DWARF in a DWARFContext into GSYM information 0029 /// by populating the GsymCreator object that it is constructed with. This 0030 /// class supports converting all DW_TAG_subprogram DIEs into 0031 /// gsym::FunctionInfo objects that includes line table information and inline 0032 /// function information. Creating a separate class to transform this data 0033 /// allows this class to be unit tested. 0034 class DwarfTransformer { 0035 public: 0036 /// Create a DWARF transformer. 0037 /// 0038 /// \param D The DWARF to use when converting to GSYM. 0039 /// 0040 /// \param G The GSYM creator to populate with the function information 0041 /// from the debug info. 0042 /// 0043 /// \param LDCS Flag to indicate whether we should load the call site 0044 /// information from DWARF `DW_TAG_call_site` entries 0045 DwarfTransformer(DWARFContext &D, GsymCreator &G, bool LDCS = false) 0046 : DICtx(D), Gsym(G), LoadDwarfCallSites(LDCS) {} 0047 0048 /// Extract the DWARF from the supplied object file and convert it into the 0049 /// Gsym format in the GsymCreator object that is passed in. Returns an 0050 /// error if something fatal is encountered. 0051 /// 0052 /// \param NumThreads The number of threads that the conversion process can 0053 /// use. 0054 /// 0055 /// \param OS The stream to log warnings and non fatal issues to. If NULL 0056 /// then don't log. 0057 /// 0058 /// \returns An error indicating any fatal issues that happen when parsing 0059 /// the DWARF, or Error::success() if all goes well. 0060 llvm::Error convert(uint32_t NumThreads, OutputAggregator &OS); 0061 0062 llvm::Error verify(StringRef GsymPath, OutputAggregator &OS); 0063 0064 private: 0065 0066 /// Parse the DWARF in the object file and convert it into the GsymCreator. 0067 Error parse(); 0068 0069 /// Handle any DIE (debug info entry) from the DWARF. 0070 /// 0071 /// This function will find all DW_TAG_subprogram DIEs that convert them into 0072 /// GSYM FuntionInfo objects and add them to the GsymCreator supplied during 0073 /// construction. The DIE and all its children will be recursively parsed 0074 /// with calls to this function. 0075 /// 0076 /// \param Strm The thread specific log stream for any non fatal errors and 0077 /// warnings. Once a thread has finished parsing an entire compile unit, all 0078 /// information in this temporary stream will be forwarded to the member 0079 /// variable log. This keeps logging thread safe. If the value is NULL, then 0080 /// don't log. 0081 /// 0082 /// \param CUI The compile unit specific information that contains the DWARF 0083 /// line table, cached file list, and other compile unit specific 0084 /// information. 0085 /// 0086 /// \param Die The DWARF debug info entry to parse. 0087 void handleDie(OutputAggregator &Strm, CUInfo &CUI, DWARFDie Die); 0088 0089 /// Parse call site information from DWARF 0090 /// 0091 /// \param CUI The compile unit info for the current CU. 0092 /// \param Die The DWARFDie for the function. 0093 /// \param FI The FunctionInfo for the function being populated. 0094 void parseCallSiteInfoFromDwarf(CUInfo &CUI, DWARFDie Die, FunctionInfo &FI); 0095 0096 DWARFContext &DICtx; 0097 GsymCreator &Gsym; 0098 bool LoadDwarfCallSites; 0099 0100 friend class DwarfTransformerTest; 0101 }; 0102 0103 } // namespace gsym 0104 } // namespace llvm 0105 0106 #endif // LLVM_DEBUGINFO_GSYM_DWARFTRANSFORMER_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|