1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_TOOLS_DSYMUTIL_PSEUDOPROBELINKER_H
10#define LLVM_TOOLS_DSYMUTIL_PSEUDOPROBELINKER_H
11
12#include "LinkUtils.h"
13#include "llvm/ADT/StringRef.h"
14#include "llvm/Object/ObjectFile.h"
15#include "llvm/Support/Error.h"
16#include <string>
17
18namespace llvm {
19class Triple;
20namespace dsymutil {
21
22/// The PseudoProbeLinker collects and concatenates pseudo probe sections
23/// __probes and __probe_descs from the debug map objects and writes them as
24/// binary blobs into the .dSYM bundle.
25class PseudoProbeLinker {
26 const LinkOptions &Options;
27 std::string Probes;
28 std::string ProbeDescs;
29
30public:
31 PseudoProbeLinker(const LinkOptions &Options) : Options(Options) {}
32
33 Error collect(const object::ObjectFile &Obj);
34
35 Error emit(const Triple &TheTriple) const;
36
37 bool empty() const { return Probes.empty() && ProbeDescs.empty(); }
38 StringRef getProbes() const { return Probes; }
39 StringRef getProbeDescs() const { return ProbeDescs; }
40};
41
42} // end namespace dsymutil
43} // end namespace llvm
44
45#endif // LLVM_TOOLS_DSYMUTIL_PSEUDOPROBELINKER_H
46