2014-12-12 18:31:24 +01:00
|
|
|
//===- tools/dsymutil/dsymutil.h - dsymutil high-level functionality ------===//
|
|
|
|
//
|
2018-06-27 18:13:40 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
2014-12-12 18:31:24 +01:00
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2017-11-01 22:16:06 +01:00
|
|
|
//
|
2014-12-12 18:31:24 +01:00
|
|
|
/// \file
|
|
|
|
///
|
|
|
|
/// This file contains the class declaration for the code that parses STABS
|
|
|
|
/// debug maps that are embedded in the binaries symbol tables.
|
2017-11-01 22:16:06 +01:00
|
|
|
//
|
2014-12-12 18:31:24 +01:00
|
|
|
//===----------------------------------------------------------------------===//
|
2017-11-01 22:16:06 +01:00
|
|
|
|
2014-12-12 18:31:24 +01:00
|
|
|
#ifndef LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
|
|
|
|
#define LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
|
|
|
|
|
|
|
|
#include "DebugMap.h"
|
2018-06-27 18:13:40 +02:00
|
|
|
#include "LinkUtils.h"
|
2017-11-01 22:16:06 +01:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
2014-12-12 18:31:24 +01:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2017-11-01 22:16:06 +01:00
|
|
|
#include "llvm/Support/Compiler.h"
|
2014-12-12 18:31:24 +01:00
|
|
|
#include "llvm/Support/ErrorOr.h"
|
|
|
|
#include <memory>
|
2017-11-01 22:16:06 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2014-12-12 18:31:24 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace dsymutil {
|
2015-02-28 01:29:07 +01:00
|
|
|
|
2018-06-29 18:51:52 +02:00
|
|
|
class BinaryHolder;
|
[dsymutil] Introduce a new CachedBinaryHolder
The original binary holder has an optimization where it caches a static
library (archive) between consecutive calls to GetObjects. However, the
actual memory buffer wasn't cached between calls.
This made sense when dsymutil was processing objects one after each
other, but when processing them in parallel, several binaries have to be
in memory at the same time. For this reason, every link context
contained a binary holder.
Having one binary holder per context is problematic, because the same
static archive was cached for every object file. Luckily, when the file
is mmap'ed, this was only costing us virtual memory.
This patch introduces a new BinaryHolder variant that is fully cached,
for all the object files it load, as well as the static archives. This
way, we don't have to give up on this optimization of bypassing the
file system.
Differential revision: https://reviews.llvm.org/D48501
llvm-svn: 335990
2018-06-29 18:50:41 +02:00
|
|
|
|
2018-02-22 12:43:43 +01:00
|
|
|
/// Extract the DebugMaps from the given file.
|
2015-08-05 20:27:44 +02:00
|
|
|
/// The file has to be a MachO object file. Multiple debug maps can be
|
|
|
|
/// returned when the file is universal (aka fat) binary.
|
2017-11-01 22:16:06 +01:00
|
|
|
ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
|
2015-08-06 00:33:28 +02:00
|
|
|
parseDebugMap(StringRef InputFile, ArrayRef<std::string> Archs,
|
2018-04-02 12:40:43 +02:00
|
|
|
StringRef PrependPath, bool PaperTrailWarnings, bool Verbose,
|
|
|
|
bool InputIsYAML);
|
2014-12-12 18:31:24 +01:00
|
|
|
|
2018-02-22 12:43:43 +01:00
|
|
|
/// Dump the symbol table
|
2015-08-31 02:29:09 +02:00
|
|
|
bool dumpStab(StringRef InputFile, ArrayRef<std::string> Archs,
|
|
|
|
StringRef PrependPath = "");
|
|
|
|
|
2018-02-22 12:43:43 +01:00
|
|
|
/// Link the Dwarf debug info as directed by the passed DebugMap \p DM into a
|
|
|
|
/// DwarfFile named \p OutputFilename. \returns false if the link failed.
|
2018-06-29 18:51:52 +02:00
|
|
|
bool linkDwarf(raw_fd_ostream &OutFile, BinaryHolder &BinHolder,
|
[dsymutil] Introduce a new CachedBinaryHolder
The original binary holder has an optimization where it caches a static
library (archive) between consecutive calls to GetObjects. However, the
actual memory buffer wasn't cached between calls.
This made sense when dsymutil was processing objects one after each
other, but when processing them in parallel, several binaries have to be
in memory at the same time. For this reason, every link context
contained a binary holder.
Having one binary holder per context is problematic, because the same
static archive was cached for every object file. Luckily, when the file
is mmap'ed, this was only costing us virtual memory.
This patch introduces a new BinaryHolder variant that is fully cached,
for all the object files it load, as well as the static archives. This
way, we don't have to give up on this optimization of bypassing the
file system.
Differential revision: https://reviews.llvm.org/D48501
llvm-svn: 335990
2018-06-29 18:50:41 +02:00
|
|
|
const DebugMap &DM, const LinkOptions &Options);
|
2015-08-05 20:27:38 +02:00
|
|
|
|
2017-11-01 22:16:06 +01:00
|
|
|
} // end namespace dsymutil
|
|
|
|
} // end namespace llvm
|
|
|
|
|
2014-12-12 18:31:24 +01:00
|
|
|
#endif // LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
|