mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-01 04:04:32 +01:00
Add and handle new dwarf5 string-related forms.
Adding the new forms by type and processing should avoid
the problems with 0c0e24f709,
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>
This commit is contained in:
parent
2757a2c9c8
commit
feb2dca989
3 changed files with 119 additions and 31 deletions
|
|
@ -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_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue