2014-12-13 01:31:24 +08:00
|
|
|
//===- tools/dsymutil/dsymutil.h - dsymutil high-level functionality ------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-12-13 01:31:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2017-11-02 05:16:06 +08:00
|
|
|
//
|
2014-12-13 01:31:24 +08: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-02 05:16:06 +08:00
|
|
|
//
|
2014-12-13 01:31:24 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2017-11-02 05:16:06 +08:00
|
|
|
|
2014-12-13 01:31:24 +08:00
|
|
|
#ifndef LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
|
|
|
|
#define LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
|
|
|
|
|
|
|
|
#include "DebugMap.h"
|
2018-06-28 00:13:40 +08:00
|
|
|
#include "LinkUtils.h"
|
2017-11-02 05:16:06 +08:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
2014-12-13 01:31:24 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2017-11-02 05:16:06 +08:00
|
|
|
#include "llvm/Support/Compiler.h"
|
2014-12-13 01:31:24 +08:00
|
|
|
#include "llvm/Support/ErrorOr.h"
|
|
|
|
#include <memory>
|
2017-11-02 05:16:06 +08:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2014-12-13 01:31:24 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace dsymutil {
|
2015-02-28 08:29:07 +08:00
|
|
|
|
2018-06-30 00:51:52 +08: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-30 00:50:41 +08:00
|
|
|
|
2018-02-22 19:43:43 +08:00
|
|
|
/// Extract the DebugMaps from the given file.
|
2015-08-06 02:27:44 +08: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-02 05:16:06 +08:00
|
|
|
ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
|
2015-08-06 06:33:28 +08:00
|
|
|
parseDebugMap(StringRef InputFile, ArrayRef<std::string> Archs,
|
2018-04-02 18:40:43 +08:00
|
|
|
StringRef PrependPath, bool PaperTrailWarnings, bool Verbose,
|
|
|
|
bool InputIsYAML);
|
2014-12-13 01:31:24 +08:00
|
|
|
|
2018-02-22 19:43:43 +08:00
|
|
|
/// Dump the symbol table
|
2015-08-31 08:29:09 +08:00
|
|
|
bool dumpStab(StringRef InputFile, ArrayRef<std::string> Archs,
|
|
|
|
StringRef PrependPath = "");
|
|
|
|
|
2018-02-22 19:43:43 +08: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-30 00:51:52 +08: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-30 00:50:41 +08:00
|
|
|
const DebugMap &DM, const LinkOptions &Options);
|
2015-08-06 02:27:38 +08:00
|
|
|
|
2017-11-02 05:16:06 +08:00
|
|
|
} // end namespace dsymutil
|
|
|
|
} // end namespace llvm
|
|
|
|
|
2014-12-13 01:31:24 +08:00
|
|
|
#endif // LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
|