Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
35293 views
1
//===- NativePublicSymbol.cpp - info about public symbols -------*- C++ -*-===//
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
#include "llvm/DebugInfo/PDB/Native/NativePublicSymbol.h"
10
11
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
12
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
13
14
using namespace llvm;
15
using namespace llvm::codeview;
16
using namespace llvm::pdb;
17
18
NativePublicSymbol::NativePublicSymbol(NativeSession &Session, SymIndexId Id,
19
const codeview::PublicSym32 &Sym)
20
: NativeRawSymbol(Session, PDB_SymType::PublicSymbol, Id), Sym(Sym) {}
21
22
NativePublicSymbol::~NativePublicSymbol() = default;
23
24
void NativePublicSymbol::dump(raw_ostream &OS, int Indent,
25
PdbSymbolIdField ShowIdFields,
26
PdbSymbolIdField RecurseIdFields) const {
27
NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
28
dumpSymbolField(OS, "name", getName(), Indent);
29
dumpSymbolField(OS, "offset", getAddressOffset(), Indent);
30
dumpSymbolField(OS, "section", getAddressSection(), Indent);
31
}
32
33
uint32_t NativePublicSymbol::getAddressOffset() const { return Sym.Offset; }
34
35
uint32_t NativePublicSymbol::getAddressSection() const { return Sym.Segment; }
36
37
std::string NativePublicSymbol::getName() const {
38
return std::string(Sym.Name);
39
}
40
41
uint32_t NativePublicSymbol::getRelativeVirtualAddress() const {
42
return Session.getRVAFromSectOffset(Sym.Segment, Sym.Offset);
43
}
44
45
uint64_t NativePublicSymbol::getVirtualAddress() const {
46
return Session.getVAFromSectOffset(Sym.Segment, Sym.Offset);
47
}
48
49