blob: 556b2d65e1a72ab931f608a0dac20c7727788c16 [file] [log] [blame]
Frederic Riss31e081e2014-12-12 17:31:24 +00001//===- tools/dsymutil/dsymutil.h - dsymutil high-level functionality ------===//
2//
Jonas Devlieghere928fea22018-06-27 16:13:40 +00003// The LLVM Compiler Infrastructure
Frederic Riss31e081e2014-12-12 17:31:24 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Eugene Zelenko66f724e2017-11-01 21:16:06 +00009//
Frederic Riss31e081e2014-12-12 17:31:24 +000010/// \file
11///
12/// This file contains the class declaration for the code that parses STABS
13/// debug maps that are embedded in the binaries symbol tables.
Eugene Zelenko66f724e2017-11-01 21:16:06 +000014//
Frederic Riss31e081e2014-12-12 17:31:24 +000015//===----------------------------------------------------------------------===//
Eugene Zelenko66f724e2017-11-01 21:16:06 +000016
Frederic Riss31e081e2014-12-12 17:31:24 +000017#ifndef LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
18#define LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
19
20#include "DebugMap.h"
Jonas Devlieghere928fea22018-06-27 16:13:40 +000021#include "LinkUtils.h"
Eugene Zelenko66f724e2017-11-01 21:16:06 +000022#include "llvm/ADT/ArrayRef.h"
Frederic Riss31e081e2014-12-12 17:31:24 +000023#include "llvm/ADT/StringRef.h"
Eugene Zelenko66f724e2017-11-01 21:16:06 +000024#include "llvm/Support/Compiler.h"
Frederic Riss31e081e2014-12-12 17:31:24 +000025#include "llvm/Support/ErrorOr.h"
26#include <memory>
Eugene Zelenko66f724e2017-11-01 21:16:06 +000027#include <string>
28#include <vector>
Frederic Riss31e081e2014-12-12 17:31:24 +000029
30namespace llvm {
31namespace dsymutil {
Frederic Rissd9a80bd2015-02-28 00:29:07 +000032
Jonas Devlieghere9f33bbfe2018-06-29 16:51:52 +000033class BinaryHolder;
Jonas Devlieghere4d3e6c12018-06-29 16:50:41 +000034
Jonas Devlieghere92a76c52018-02-22 11:43:43 +000035/// Extract the DebugMaps from the given file.
Frederic Riss7a425782015-08-05 18:27:44 +000036/// The file has to be a MachO object file. Multiple debug maps can be
37/// returned when the file is universal (aka fat) binary.
Eugene Zelenko66f724e2017-11-01 21:16:06 +000038ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
Frederic Riss1b709aa2015-08-05 22:33:28 +000039parseDebugMap(StringRef InputFile, ArrayRef<std::string> Archs,
Jonas Devlieghere67eb8fd2018-04-02 10:40:43 +000040 StringRef PrependPath, bool PaperTrailWarnings, bool Verbose,
41 bool InputIsYAML);
Frederic Riss31e081e2014-12-12 17:31:24 +000042
Jonas Devlieghere92a76c52018-02-22 11:43:43 +000043/// Dump the symbol table
Frederic Rissa8a34c52015-08-31 00:29:09 +000044bool dumpStab(StringRef InputFile, ArrayRef<std::string> Archs,
45 StringRef PrependPath = "");
46
Jonas Devlieghere92a76c52018-02-22 11:43:43 +000047/// Link the Dwarf debug info as directed by the passed DebugMap \p DM into a
48/// DwarfFile named \p OutputFilename. \returns false if the link failed.
Jonas Devlieghere9f33bbfe2018-06-29 16:51:52 +000049bool linkDwarf(raw_fd_ostream &OutFile, BinaryHolder &BinHolder,
Jonas Devlieghere4d3e6c12018-06-29 16:50:41 +000050 const DebugMap &DM, const LinkOptions &Options);
Frederic Rissd2fb7bd2015-08-05 18:27:38 +000051
Eugene Zelenko66f724e2017-11-01 21:16:06 +000052} // end namespace dsymutil
53} // end namespace llvm
54
Frederic Riss31e081e2014-12-12 17:31:24 +000055#endif // LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H