Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: experimental/visual_studio_plugin/src/dwarf_reader/elf_section_reader.cc

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "dwarf_reader/elf_section_reader.h"
6
7 namespace dwarf_reader {
8
9 ElfSectionReader::ElfSectionReader() : byte_reader_(NULL) {}
10
11 ElfSectionReader::~ElfSectionReader() {
12 if (byte_reader_)
13 delete byte_reader_;
14 }
15
16 const dwarf2reader::SectionMap& ElfSectionReader::sections() const {
17 return sections_;
18 }
19
20 void ElfSectionReader::Init(const char *name,
21 void *data,
22 uint64_t length,
23 uint32_t classSize,
24 bool is_little_endian) {
25 if (is_little_endian)
26 byte_reader_ = new dwarf2reader::ByteReader(
27 dwarf2reader::ENDIANNESS_LITTLE);
28 else
29 byte_reader_ = new dwarf2reader::ByteReader(
30 dwarf2reader::ENDIANNESS_BIG);
31 }
32
33 bool ElfSectionReader::SectionHeadersStart(uint32_t count) {
34 return true;
35 }
36
37 void ElfSectionReader::AddSectionHeader(const char *name,
38 void *data,
39 uint64_t virt,
40 uint32_t type,
41 uint32_t flags,
42 uint64_t length) {
43 const char *ptr = reinterpret_cast<const char *>(data);
44 sections_[name] = SectionInfo(ptr, length);
45 loadAddresses_[name] = virt;
46 }
47
48 dwarf2reader::ByteReader *ElfSectionReader::GetByteReader() const {
49 return byte_reader_;
50 }
51
52 SectionInfo ElfSectionReader::GetSectionInfo(const char *name) const {
53 dwarf2reader::SectionMap::const_iterator map_iter =
54 sections_.find(name);
55 if (map_iter != sections_.end())
56 return map_iter->second;
57 else
58 return SectionInfo(NULL, 0);
59 }
60
61 uint64 ElfSectionReader::GetSectionLoadAddress(const char *name) const {
62 LoadAddressMap::const_iterator address_iter =
63 loadAddresses_.find(name);
64 if (address_iter != loadAddresses_.end())
65 return address_iter->second;
66 else
67 return 0;
68 }
69
70 bool ElfSectionReader::IsEmpty() const {
71 return (sections_.empty() || loadAddresses_.empty());
72 }
73
74 } // namespace dwarf_reader
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698