mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-07-04 00:08:26 +00:00
Breakpad DWARF CFI support: Cleanups requested by Neal
I came across a bunch of comments Neal had made on issue 55011 that I hadn't addressed. This patch takes care of them. A=jimb R=thestig git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@618 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
b80b13fd2f
commit
4f456b8c0d
|
@ -52,18 +52,14 @@ CFISection &CFISection::CIEHeader(u_int64_t code_alignment_factor,
|
||||||
in_fde_ = false;
|
in_fde_ = false;
|
||||||
|
|
||||||
if (dwarf64) {
|
if (dwarf64) {
|
||||||
D32(0xffffffff);
|
D32(kDwarf64InitialLengthMarker);
|
||||||
D64(entry_length_->length);
|
D64(entry_length_->length);
|
||||||
entry_length_->start = Here();
|
entry_length_->start = Here();
|
||||||
// Write the CIE distinguished value. In .debug_frame sections, it's
|
D64(eh_frame_ ? kEHFrame64CIEIdentifier : kDwarf64CIEIdentifier);
|
||||||
// ~0; in .eh_frame sections, it's zero.
|
|
||||||
D64(eh_frame_ ? 0 : ~(u_int64_t)0);
|
|
||||||
} else {
|
} else {
|
||||||
D32(entry_length_->length);
|
D32(entry_length_->length);
|
||||||
entry_length_->start = Here();
|
entry_length_->start = Here();
|
||||||
// Write the CIE distinguished value. In .debug_frame sections, it's
|
D32(eh_frame_ ? kEHFrame32CIEIdentifier : kDwarf32CIEIdentifier);
|
||||||
// ~0; in .eh_frame sections, it's zero.
|
|
||||||
D32(eh_frame_ ? 0 : ~(u_int32_t)0);
|
|
||||||
}
|
}
|
||||||
D8(version);
|
D8(version);
|
||||||
AppendCString(augmentation);
|
AppendCString(augmentation);
|
||||||
|
@ -193,4 +189,10 @@ CFISection &CFISection::EncodedPointer(u_int64_t address,
|
||||||
return *this;
|
return *this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const u_int32_t CFISection::kDwarf64InitialLengthMarker;
|
||||||
|
const u_int32_t CFISection::kDwarf32CIEIdentifier;
|
||||||
|
const u_int64_t CFISection::kDwarf64CIEIdentifier;
|
||||||
|
const u_int32_t CFISection::kEHFrame32CIEIdentifier;
|
||||||
|
const u_int64_t CFISection::kEHFrame64CIEIdentifier;
|
||||||
|
|
||||||
} // namespace google_breakpad
|
} // namespace google_breakpad
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
|
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
|
||||||
|
|
||||||
// cfi-assembler.h: Define CFISection, a class for creating properly
|
// cfi_assembler.h: Define CFISection, a class for creating properly
|
||||||
// (and improperly) formatted DWARF CFI data for unit tests.
|
// (and improperly) formatted DWARF CFI data for unit tests.
|
||||||
|
|
||||||
#ifndef PROCESSOR_CFI_ASSEMBLER_H_
|
#ifndef PROCESSOR_CFI_ASSEMBLER_H_
|
||||||
|
@ -219,6 +219,19 @@ class CFISection: public Section {
|
||||||
Label start;
|
Label start;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Constants used in CFI/.eh_frame data:
|
||||||
|
|
||||||
|
// If the first four bytes of an "initial length" are this constant, then
|
||||||
|
// the data uses the 64-bit DWARF format, and the length itself is the
|
||||||
|
// subsequent eight bytes.
|
||||||
|
static const u_int32_t kDwarf64InitialLengthMarker = 0xffffffffU;
|
||||||
|
|
||||||
|
// The CIE identifier for 32- and 64-bit DWARF CFI and .eh_frame data.
|
||||||
|
static const u_int32_t kDwarf32CIEIdentifier = ~(u_int32_t)0;
|
||||||
|
static const u_int64_t kDwarf64CIEIdentifier = ~(u_int64_t)0;
|
||||||
|
static const u_int32_t kEHFrame32CIEIdentifier = 0;
|
||||||
|
static const u_int64_t kEHFrame64CIEIdentifier = 0;
|
||||||
|
|
||||||
// The size of a machine address for the data in this section.
|
// The size of a machine address for the data in this section.
|
||||||
size_t address_size_;
|
size_t address_size_;
|
||||||
|
|
||||||
|
|
|
@ -239,8 +239,7 @@ static bool LoadDwarf(const string &dwarf_filename,
|
||||||
// success, or false if we don't recognize HEADER's machine
|
// success, or false if we don't recognize HEADER's machine
|
||||||
// architecture.
|
// architecture.
|
||||||
static bool DwarfCFIRegisterNames(const ElfW(Ehdr) *elf_header,
|
static bool DwarfCFIRegisterNames(const ElfW(Ehdr) *elf_header,
|
||||||
vector<string> *register_names)
|
vector<string> *register_names) {
|
||||||
{
|
|
||||||
switch (elf_header->e_machine) {
|
switch (elf_header->e_machine) {
|
||||||
case EM_386:
|
case EM_386:
|
||||||
*register_names = DwarfCFIToModule::RegisterNames::I386();
|
*register_names = DwarfCFIToModule::RegisterNames::I386();
|
||||||
|
|
Loading…
Reference in a new issue