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

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

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 #ifndef DWARF_READER_ELF_SECTION_READER_H_
6 #define DWARF_READER_ELF_SECTION_READER_H_
7
8 #include <map>
9 #include <string>
10
11 #include "common/dwarf/bytereader.h"
12 #include "common/dwarf/dwarf2reader.h"
13
14 #include "elf_reader/elf_reader.h"
15
16 using elf_reader::IElfReader;
17
18 namespace dwarf_reader {
19 /// Maps load addresses to a section names. This refers to the address of the
20 /// section in memory.
21 typedef std::map<std::string, uint64> LoadAddressMap;
22 /// The name and address of a file section. This refers to the address of the
23 /// section in the file text. This is also the keyValue pair of a
24 /// |dwarf2reader::SectionMap|
25 typedef std::pair<const char *, uint64> SectionInfo;
26
27 /// The purpose of this class is to parse a raw ELF binary file and then to
28 /// provide an interface for extracting section and program header information
29 /// from it.
30 /// For documentation on the function, see elf_reader/elf_reader.h
31 class ElfSectionReader : public IElfReader {
32 public:
33 ElfSectionReader();
34
35 ~ElfSectionReader();
36
37 /// @return The SectionMap for the file.
38 const dwarf2reader::SectionMap& sections() const;
39
40 virtual void Init(const char *name,
41 void *data,
42 uint64_t length,
43 uint32_t classSize,
44 bool is_little_endian);
45
46 virtual bool SectionHeadersStart(uint32_t count);
47 virtual void SectionHeadersEnd() { }
48 virtual void AddSectionHeader(const char *name,
49 void *data,
50 uint64_t virt,
51 uint32_t type,
52 uint32_t flags,
53 uint64_t length);
54
55 /// Not thread safe.
56 /// @return A pointer to a ByteReader.
57 dwarf2reader::ByteReader *GetByteReader() const;
58
59 /// Retrieves a descriptor for a section in the ELF binary file.
60 /// @param name The name of the section for which information is required.
61 /// @return SectionInfo for the requested section. If the section is not
62 /// found, this returns a SectionInfo that has empty values (NULL, 0).
63 SectionInfo GetSectionInfo(const char *name) const;
64
65 /// @param name The name of the section for which load info is required.
66 /// @return The load address of the section.
67 uint64 GetSectionLoadAddress(const char *name) const;
68
69 /// @return true iff this object contains no section information.
70 bool IsEmpty() const;
71
72 private:
73 dwarf2reader::SectionMap sections_;
74 LoadAddressMap loadAddresses_;
75 dwarf2reader::ByteReader *byte_reader_;
76 };
77
78 } // namespace dwarf_reader
79
80 #endif // DWARF_READER_ELF_SECTION_READER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698