aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf/dwarf2reader.h
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2020-06-26 11:24:16 -0700
committerSterling Augustine <saugustine@google.com>2020-06-26 18:32:51 +0000
commitb6f36dd7757f5cdb460f7b2ccf4f646099a320af (patch)
tree2044f081ceabc560624471a73ea6eb80d65303e6 /src/common/dwarf/dwarf2reader.h
parentRead dwarf5 compilation unit headers. (diff)
downloadbreakpad-b6f36dd7757f5cdb460f7b2ccf4f646099a320af.tar.xz
Move GetSectionByName out of CompilationUnit.
For the upcoming Dwarf5 LineInfo changes, we will need to get several additional sections by name, but without a the Compilation Unit. This change prepares for that. Change-Id: I566855abb339a856110a2f7d243d3848fe2b3c18 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2268861 Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/common/dwarf/dwarf2reader.h')
-rw-r--r--src/common/dwarf/dwarf2reader.h21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/common/dwarf/dwarf2reader.h b/src/common/dwarf/dwarf2reader.h
index cd91b107..228c867f 100644
--- a/src/common/dwarf/dwarf2reader.h
+++ b/src/common/dwarf/dwarf2reader.h
@@ -65,6 +65,13 @@ class DwpReader;
// This maps from a string naming a section to a pair containing a
// the data for the section, and the size of the section.
typedef std::map<string, std::pair<const uint8_t *, uint64_t> > SectionMap;
+
+// Abstract away the difference between elf and mach-o section names.
+// Elf-names use ".section_name, mach-o uses "__section_name". Pass "name" in
+// the elf form, ".section_name".
+const SectionMap::const_iterator GetSectionByName(const SectionMap&
+ sections, const char *name);
+
typedef std::list<std::pair<enum DwarfAttribute, enum DwarfForm> >
AttributeList;
typedef AttributeList::iterator AttributeIterator;
@@ -544,20 +551,6 @@ class CompilationUnit {
void ReadDebugSectionsFromDwo(ElfReader* elf_reader,
SectionMap* sections);
- // Abstract away the difference between elf, mach-o, and Mac OS section names.
- // Elf-names use ".section_name, others use "__section_name". Pass "name" in
- // the elf form, ".section_name".
- const SectionMap::const_iterator GetSectionByName(const char *name) {
- assert(name[0] == '.');
- auto iter = sections_.find(name);
- if (iter != sections_.end())
- return iter;
- std::string macho_name("__");
- macho_name += name + 1;
- iter = sections_.find(macho_name);
- return iter;
- }
-
// Path of the file containing the debug information.
const string path_;