xref: /aosp_15_r20/external/llvm/tools/dsymutil/dsymutil.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===- tools/dsymutil/dsymutil.h - dsymutil high-level functionality ------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                             The LLVM Linker
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker ///
10*9880d681SAndroid Build Coastguard Worker /// \file
11*9880d681SAndroid Build Coastguard Worker ///
12*9880d681SAndroid Build Coastguard Worker /// This file contains the class declaration for the code that parses STABS
13*9880d681SAndroid Build Coastguard Worker /// debug maps that are embedded in the binaries symbol tables.
14*9880d681SAndroid Build Coastguard Worker ///
15*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
16*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
17*9880d681SAndroid Build Coastguard Worker #define LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
18*9880d681SAndroid Build Coastguard Worker 
19*9880d681SAndroid Build Coastguard Worker #include "DebugMap.h"
20*9880d681SAndroid Build Coastguard Worker #include "llvm/ADT/StringRef.h"
21*9880d681SAndroid Build Coastguard Worker #include "llvm/Support/ErrorOr.h"
22*9880d681SAndroid Build Coastguard Worker #include <memory>
23*9880d681SAndroid Build Coastguard Worker 
24*9880d681SAndroid Build Coastguard Worker namespace llvm {
25*9880d681SAndroid Build Coastguard Worker namespace dsymutil {
26*9880d681SAndroid Build Coastguard Worker 
27*9880d681SAndroid Build Coastguard Worker struct LinkOptions {
28*9880d681SAndroid Build Coastguard Worker   bool Verbose;  ///< Verbosity
29*9880d681SAndroid Build Coastguard Worker   bool NoOutput; ///< Skip emitting output
30*9880d681SAndroid Build Coastguard Worker   bool NoODR;    ///< Do not unique types according to ODR
31*9880d681SAndroid Build Coastguard Worker   std::string PrependPath; ///< -oso-prepend-path
32*9880d681SAndroid Build Coastguard Worker 
LinkOptionsLinkOptions33*9880d681SAndroid Build Coastguard Worker   LinkOptions() : Verbose(false), NoOutput(false) {}
34*9880d681SAndroid Build Coastguard Worker };
35*9880d681SAndroid Build Coastguard Worker 
36*9880d681SAndroid Build Coastguard Worker /// \brief Extract the DebugMaps from the given file.
37*9880d681SAndroid Build Coastguard Worker /// The file has to be a MachO object file. Multiple debug maps can be
38*9880d681SAndroid Build Coastguard Worker /// returned when the file is universal (aka fat) binary.
39*9880d681SAndroid Build Coastguard Worker llvm::ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
40*9880d681SAndroid Build Coastguard Worker parseDebugMap(StringRef InputFile, ArrayRef<std::string> Archs,
41*9880d681SAndroid Build Coastguard Worker               StringRef PrependPath, bool Verbose, bool InputIsYAML);
42*9880d681SAndroid Build Coastguard Worker 
43*9880d681SAndroid Build Coastguard Worker /// \brief Dump the symbol table
44*9880d681SAndroid Build Coastguard Worker bool dumpStab(StringRef InputFile, ArrayRef<std::string> Archs,
45*9880d681SAndroid Build Coastguard Worker               StringRef PrependPath = "");
46*9880d681SAndroid Build Coastguard Worker 
47*9880d681SAndroid Build Coastguard Worker /// \brief Link the Dwarf debuginfo as directed by the passed DebugMap
48*9880d681SAndroid Build Coastguard Worker /// \p DM into a DwarfFile named \p OutputFilename.
49*9880d681SAndroid Build Coastguard Worker /// \returns false if the link failed.
50*9880d681SAndroid Build Coastguard Worker bool linkDwarf(StringRef OutputFilename, const DebugMap &DM,
51*9880d681SAndroid Build Coastguard Worker                const LinkOptions &Options);
52*9880d681SAndroid Build Coastguard Worker 
53*9880d681SAndroid Build Coastguard Worker /// \brief Exit the dsymutil process, cleaning up every temporary
54*9880d681SAndroid Build Coastguard Worker /// files that we created.
55*9880d681SAndroid Build Coastguard Worker LLVM_ATTRIBUTE_NORETURN void exitDsymutil(int ExitStatus);
56*9880d681SAndroid Build Coastguard Worker 
57*9880d681SAndroid Build Coastguard Worker void warn(const Twine &Warning, const Twine &Context);
58*9880d681SAndroid Build Coastguard Worker bool error(const Twine &Error, const Twine &Context);
59*9880d681SAndroid Build Coastguard Worker }
60*9880d681SAndroid Build Coastguard Worker }
61*9880d681SAndroid Build Coastguard Worker #endif // LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
62