aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf/dwarf2reader.h
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2020-06-22 16:38:16 -0700
committerSterling Augustine <saugustine@google.com>2020-06-22 23:39:36 +0000
commitfeb2dca989399bc07d2ecf681a19b18af30e81a4 (patch)
tree01ad412d5a6d406959bf9763530f6b9026d1672f /src/common/dwarf/dwarf2reader.h
parentMake symupload exit with an error code when command-line parsing fails. (diff)
downloadbreakpad-feb2dca989399bc07d2ecf681a19b18af30e81a4.tar.xz
Add and handle new dwarf5 string-related forms.
Adding the new forms by type and processing should avoid the problems with 0c0e24f709288a129d665ec27d6f089189318385, where new forms weren't handled in switch statements, breaking the build. Testing this should follow the testing for DW_FORM_GNU_str_index, very closely, but there doesn't appear to be any tests for that, or even DW_FORM_strp. Change-Id: I609d56b1dc879971bfef1070f063f8457fec6017 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2233839 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/common/dwarf/dwarf2reader.h')
-rw-r--r--src/common/dwarf/dwarf2reader.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/common/dwarf/dwarf2reader.h b/src/common/dwarf/dwarf2reader.h
index 0b194c17..51d92285 100644
--- a/src/common/dwarf/dwarf2reader.h
+++ b/src/common/dwarf/dwarf2reader.h
@@ -40,6 +40,7 @@
#ifndef COMMON_DWARF_DWARF2READER_H__
#define COMMON_DWARF_DWARF2READER_H__
+#include <assert.h>
#include <stdint.h>
#include <list>
@@ -475,6 +476,14 @@ class CompilationUnit {
handler_->ProcessAttributeBuffer(offset, attr, form, data, len);
}
+ // Handles the common parts of DW_FORM_GNU_str_index, DW_FORM_strx,
+ // DW_FORM_strx1, DW_FORM_strx2, DW_FORM_strx3, and DW_FORM_strx4.
+ // Retrieves the data and calls through to ProcessAttributeString.
+ void ProcessFormStringIndex(uint64_t offset,
+ enum DwarfAttribute attr,
+ enum DwarfForm form,
+ uint64_t str_index);
+
// Called when we have an attribute with string data to give to
// our handler. The attribute is for the DIE at OFFSET from the
// beginning of compilation unit, has a name of ATTR, a form of
@@ -508,6 +517,20 @@ 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_;
@@ -542,6 +565,10 @@ class CompilationUnit {
const uint8_t *string_buffer_;
uint64_t string_buffer_length_;
+ // Similarly for .debug_line_string.
+ const uint8_t* line_string_buffer_;
+ uint64_t line_string_buffer_length_;
+
// String offsets section buffer and length, if we have a string offsets
// section (.debug_str_offsets or .debug_str_offsets.dwo).
const uint8_t* str_offsets_buffer_;