17 #include "absl/strings/string_view.h"
43 value = dwarf::ReadLEB128<uint64_t>(
data);
72 switch (application) {
79 if (data_base ==
nullptr) {
80 THROW(
"datarel requested but no data_base provided");
82 value +=
sink->TranslateFileToVM(data_base);
87 THROWF(
"Unimplemented eh_frame application value: $0", application);
93 value = ReadFixed<uint64_t>(&location);
95 value = ReadFixed<uint32_t>(&location);
134 bool is_signal_handler =
false;
135 bool has_augmentation_length =
false;
140 std::unordered_map<const void*, CIEInfo> cie_map;
142 while (remaining.
size() > 0) {
146 if (entry.
size() == 0 && remaining.
size() == 0) {
151 uint32_t id = ReadFixed<uint32_t>(&entry);
154 CIEInfo& cie_info = cie_map[full_entry.
data()];
155 cie_info.version = ReadFixed<uint8_t>(&entry);
157 cie_info.code_align = dwarf::ReadLEB128<uint32_t>(&entry);
158 cie_info.data_align = dwarf::ReadLEB128<int32_t>(&entry);
159 switch (cie_info.version) {
161 cie_info.return_address_reg = ReadFixed<uint8_t>(&entry);
164 cie_info.return_address_reg = dwarf::ReadLEB128<uint32_t>(&entry);
167 THROW(
"Unexpected eh_frame CIE version");
169 while (aug_string.
size() > 0) {
170 switch (aug_string[0]) {
173 cie_info.has_augmentation_length =
true;
174 dwarf::ReadLEB128<uint32_t>(&entry);
177 cie_info.lsda_encoding = ReadFixed<uint8_t>(&entry);
180 cie_info.fde_encoding = ReadFixed<uint8_t>(&entry);
183 cie_info.is_signal_handler =
true;
187 cie_info.personality_function =
192 THROW(
"Unexepcted augmentation character");
197 auto iter = cie_map.find(entry.
data() -
id - 4);
198 if (
iter == cie_map.end()) {
199 THROW(
"Couldn't find CIE for FDE");
201 const CIEInfo& cie_info =
iter->second;
223 sink->AddFileRangeForVMAddr(
"dwarf_fde", address, full_entry);
233 uint8_t eh_frame_ptr_enc = ReadFixed<uint8_t>(&
data);
254 sink->AddFileRangeForVMAddr(
"dwarf_fde_table", initial_location,