blob: e2f73f53ec63e4b28e617b87c8b8b32b2100108f [file] [log] [blame]
Stephen Wilsonf325ba92010-07-13 23:07:23 +00001//===-- ObjectFileELF.h --------------------------------------- -*- C++ -*-===//
Chris Lattner30fdc8d2010-06-08 16:52:24 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_ObjectFileELF_h_
11#define liblldb_ObjectFileELF_h_
12
Eugene Zelenko8157a882015-10-23 16:56:07 +000013// C Includes
Chris Lattner30fdc8d2010-06-08 16:52:24 +000014#include <stdint.h>
Eugene Zelenko8157a882015-10-23 16:56:07 +000015
16// C++ Includes
Ravitheja Addepally15f89c42016-01-19 12:55:21 +000017#include <functional>
Chris Lattner30fdc8d2010-06-08 16:52:24 +000018#include <vector>
19
Eugene Zelenko8157a882015-10-23 16:56:07 +000020// Other libraries and framework includes
21// Project includes
Chris Lattner30fdc8d2010-06-08 16:52:24 +000022#include "lldb/lldb-private.h"
Greg Clayton53239f02011-02-08 05:05:52 +000023#include "lldb/Host/FileSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000024#include "lldb/Symbol/ObjectFile.h"
Michael Sartainc836ae72013-05-23 20:57:03 +000025#include "lldb/Core/UUID.h"
Todd Fialab91de782014-06-27 16:52:49 +000026#include "lldb/Core/ArchSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000027
Stephen Wilsonf325ba92010-07-13 23:07:23 +000028#include "ELFHeader.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000029
Ed Mastec113ff82013-12-02 17:49:13 +000030struct ELFNote
31{
32 elf::elf_word n_namesz;
33 elf::elf_word n_descsz;
34 elf::elf_word n_type;
35
36 std::string n_name;
37
38 ELFNote() : n_namesz(0), n_descsz(0), n_type(0)
39 {
40 }
41
42 /// Parse an ELFNote entry from the given DataExtractor starting at position
43 /// \p offset.
44 ///
45 /// @param[in] data
46 /// The DataExtractor to read from.
47 ///
48 /// @param[in,out] offset
49 /// Pointer to an offset in the data. On return the offset will be
50 /// advanced by the number of bytes read.
51 ///
52 /// @return
53 /// True if the ELFRel entry was successfully read and false otherwise.
54 bool
55 Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
Greg Claytonb704b692015-10-28 18:04:38 +000056
57 size_t
58 GetByteSize() const
59 {
Rafael Espindolaa94ae1e2016-01-18 20:57:54 +000060 return 12 + llvm::alignTo (n_namesz, 4) + llvm::alignTo (n_descsz, 4);
Greg Claytonb704b692015-10-28 18:04:38 +000061 }
Ed Mastec113ff82013-12-02 17:49:13 +000062};
63
Stephen Wilsonf325ba92010-07-13 23:07:23 +000064//------------------------------------------------------------------------------
65/// @class ObjectFileELF
66/// @brief Generic ELF object file reader.
67///
68/// This class provides a generic ELF (32/64 bit) reader plugin implementing the
69/// ObjectFile protocol.
Chris Lattner30fdc8d2010-06-08 16:52:24 +000070class ObjectFileELF :
71 public lldb_private::ObjectFile
72{
73public:
Eugene Zelenko8157a882015-10-23 16:56:07 +000074 ~ObjectFileELF() override;
75
Chris Lattner30fdc8d2010-06-08 16:52:24 +000076 //------------------------------------------------------------------
77 // Static Functions
78 //------------------------------------------------------------------
79 static void
80 Initialize();
81
82 static void
83 Terminate();
84
Greg Clayton57abc5d2013-05-10 21:47:16 +000085 static lldb_private::ConstString
Chris Lattner30fdc8d2010-06-08 16:52:24 +000086 GetPluginNameStatic();
87
88 static const char *
89 GetPluginDescriptionStatic();
90
91 static lldb_private::ObjectFile *
Greg Claytone72dfb32012-02-24 01:59:29 +000092 CreateInstance(const lldb::ModuleSP &module_sp,
Greg Clayton5ce9c562013-02-06 17:22:03 +000093 lldb::DataBufferSP& data_sp,
94 lldb::offset_t data_offset,
Chris Lattner30fdc8d2010-06-08 16:52:24 +000095 const lldb_private::FileSpec* file,
Greg Clayton5ce9c562013-02-06 17:22:03 +000096 lldb::offset_t file_offset,
97 lldb::offset_t length);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000098
Greg Claytonc9660542012-02-05 02:38:54 +000099 static lldb_private::ObjectFile *
Greg Claytone72dfb32012-02-24 01:59:29 +0000100 CreateMemoryInstance (const lldb::ModuleSP &module_sp,
Greg Claytonc9660542012-02-05 02:38:54 +0000101 lldb::DataBufferSP& data_sp,
102 const lldb::ProcessSP &process_sp,
103 lldb::addr_t header_addr);
104
Greg Claytonf4d6de62013-04-24 22:29:28 +0000105 static size_t
106 GetModuleSpecifications (const lldb_private::FileSpec& file,
107 lldb::DataBufferSP& data_sp,
108 lldb::offset_t data_offset,
109 lldb::offset_t file_offset,
110 lldb::offset_t length,
111 lldb_private::ModuleSpecList &specs);
Michael Sartain9f0013d2013-05-17 00:20:21 +0000112
113 static bool
114 MagicBytesMatch (lldb::DataBufferSP& data_sp,
115 lldb::addr_t offset,
116 lldb::addr_t length);
117
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000118 //------------------------------------------------------------------
119 // PluginInterface protocol
120 //------------------------------------------------------------------
Greg Clayton6d06d902015-03-12 00:16:14 +0000121 lldb_private::ConstString
122 GetPluginName() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000123
Greg Clayton6d06d902015-03-12 00:16:14 +0000124 uint32_t
125 GetPluginVersion() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000126
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000127 //------------------------------------------------------------------
128 // ObjectFile Protocol.
129 //------------------------------------------------------------------
Greg Clayton6d06d902015-03-12 00:16:14 +0000130 bool
131 ParseHeader() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000132
Greg Clayton6d06d902015-03-12 00:16:14 +0000133 bool
Greg Clayton751caf62014-02-07 22:54:47 +0000134 SetLoadAddress (lldb_private::Target &target,
135 lldb::addr_t value,
Greg Clayton6d06d902015-03-12 00:16:14 +0000136 bool value_is_offset) override;
Steve Pucci9e02dac2014-02-06 19:02:19 +0000137
Greg Clayton6d06d902015-03-12 00:16:14 +0000138 lldb::ByteOrder
139 GetByteOrder() const override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000140
Greg Clayton6d06d902015-03-12 00:16:14 +0000141 bool
142 IsExecutable () const override;
Jim Ingham5aee1622010-08-09 23:31:02 +0000143
Greg Clayton6d06d902015-03-12 00:16:14 +0000144 uint32_t
145 GetAddressByteSize() const override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000146
Greg Clayton6d06d902015-03-12 00:16:14 +0000147 lldb::AddressClass
148 GetAddressClass (lldb::addr_t file_addr) override;
Todd Fialafbd703a2014-09-15 22:33:39 +0000149
Greg Clayton6d06d902015-03-12 00:16:14 +0000150 lldb_private::Symtab *
151 GetSymtab() override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000152
Greg Clayton6d06d902015-03-12 00:16:14 +0000153 bool
154 IsStripped () override;
Greg Clayton3046e662013-07-10 01:23:25 +0000155
Greg Clayton6d06d902015-03-12 00:16:14 +0000156 void
157 CreateSections (lldb_private::SectionList &unified_section_list) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000158
Greg Clayton6d06d902015-03-12 00:16:14 +0000159 void
160 Dump(lldb_private::Stream *s) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000161
Greg Clayton6d06d902015-03-12 00:16:14 +0000162 bool
163 GetArchitecture (lldb_private::ArchSpec &arch) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000164
Greg Clayton6d06d902015-03-12 00:16:14 +0000165 bool
166 GetUUID(lldb_private::UUID* uuid) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000167
Greg Clayton6d06d902015-03-12 00:16:14 +0000168 lldb_private::FileSpecList
169 GetDebugSymbolFilePaths() override;
Michael Sartaina7499c92013-07-01 19:45:50 +0000170
Greg Clayton6d06d902015-03-12 00:16:14 +0000171 uint32_t
172 GetDependentModules(lldb_private::FileSpecList& files) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000173
Greg Clayton6d06d902015-03-12 00:16:14 +0000174 lldb_private::Address
175 GetImageInfoAddress(lldb_private::Target *target) override;
Jim Ingham672e6f52011-03-07 23:44:08 +0000176
Greg Clayton6d06d902015-03-12 00:16:14 +0000177 lldb_private::Address
178 GetEntryPointAddress () override;
Greg Clayton9e00b6a652011-07-09 00:41:34 +0000179
Greg Clayton6d06d902015-03-12 00:16:14 +0000180 ObjectFile::Type
181 CalculateType() override;
Greg Clayton9e00b6a652011-07-09 00:41:34 +0000182
Greg Clayton6d06d902015-03-12 00:16:14 +0000183 ObjectFile::Strata
184 CalculateStrata() override;
Stephen Wilson2ab0a582011-01-15 00:08:44 +0000185
Ashok Thirumurthi4822d922013-07-11 20:39:00 +0000186 // Returns number of program headers found in the ELF file.
187 size_t
188 GetProgramHeaderCount();
189
190 // Returns the program header with the given index.
191 const elf::ELFProgramHeader *
192 GetProgramHeaderByIndex(lldb::user_id_t id);
193
194 // Returns segment data for the given index.
195 lldb_private::DataExtractor
196 GetSegmentDataByIndex(lldb::user_id_t id);
197
Pavel Labathc6ae7ea2015-03-04 10:25:22 +0000198 std::string
199 StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const override;
200
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000201private:
Greg Claytone72dfb32012-02-24 01:59:29 +0000202 ObjectFileELF(const lldb::ModuleSP &module_sp,
Greg Clayton5ce9c562013-02-06 17:22:03 +0000203 lldb::DataBufferSP& data_sp,
204 lldb::offset_t data_offset,
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000205 const lldb_private::FileSpec* file,
Greg Clayton5ce9c562013-02-06 17:22:03 +0000206 lldb::offset_t offset,
207 lldb::offset_t length);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000208
Andrew MacPherson17220c12014-03-05 10:12:43 +0000209 ObjectFileELF (const lldb::ModuleSP &module_sp,
Tamas Berghammerf2561842015-06-30 10:41:23 +0000210 lldb::DataBufferSP& header_data_sp,
Andrew MacPherson17220c12014-03-05 10:12:43 +0000211 const lldb::ProcessSP &process_sp,
212 lldb::addr_t header_addr);
213
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000214 typedef std::vector<elf::ELFProgramHeader> ProgramHeaderColl;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000215 typedef ProgramHeaderColl::iterator ProgramHeaderCollIter;
216 typedef ProgramHeaderColl::const_iterator ProgramHeaderCollConstIter;
217
Michael Sartaina7499c92013-07-01 19:45:50 +0000218 struct ELFSectionHeaderInfo : public elf::ELFSectionHeader
219 {
220 lldb_private::ConstString section_name;
221 };
Eugene Zelenko8157a882015-10-23 16:56:07 +0000222
Michael Sartaina7499c92013-07-01 19:45:50 +0000223 typedef std::vector<ELFSectionHeaderInfo> SectionHeaderColl;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000224 typedef SectionHeaderColl::iterator SectionHeaderCollIter;
225 typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter;
226
Stephen Wilson499b40e2011-03-30 16:07:05 +0000227 typedef std::vector<elf::ELFDynamic> DynamicSymbolColl;
228 typedef DynamicSymbolColl::iterator DynamicSymbolCollIter;
229 typedef DynamicSymbolColl::const_iterator DynamicSymbolCollConstIter;
230
Tamas Berghammer83544cf2015-04-07 10:43:50 +0000231 typedef std::map<lldb::addr_t, lldb::AddressClass> FileAddressToAddressClassMap;
Ravitheja Addepally15f89c42016-01-19 12:55:21 +0000232 typedef std::function<lldb::offset_t (lldb_private::DataExtractor &, lldb::offset_t, lldb::offset_t)> SetDataFunction;
Tamas Berghammer83544cf2015-04-07 10:43:50 +0000233
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000234 /// Version of this reader common to all plugins based on this class.
235 static const uint32_t m_plugin_version = 1;
Todd Fiala4339f3a2014-03-25 19:29:09 +0000236 static const uint32_t g_core_uuid_magic;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000237
238 /// ELF file header.
239 elf::ELFHeader m_header;
240
Michael Sartaina7499c92013-07-01 19:45:50 +0000241 /// ELF build ID.
Michael Sartainc836ae72013-05-23 20:57:03 +0000242 lldb_private::UUID m_uuid;
243
Michael Sartaina7499c92013-07-01 19:45:50 +0000244 /// ELF .gnu_debuglink file and crc data if available.
245 std::string m_gnu_debuglink_file;
246 uint32_t m_gnu_debuglink_crc;
247
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000248 /// Collection of program headers.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000249 ProgramHeaderColl m_program_headers;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000250
251 /// Collection of section headers.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000252 SectionHeaderColl m_section_headers;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000253
Stephen Wilson499b40e2011-03-30 16:07:05 +0000254 /// Collection of symbols from the dynamic table.
255 DynamicSymbolColl m_dynamic_symbols;
256
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000257 /// List of file specifications corresponding to the modules (shared
258 /// libraries) on which this object file depends.
Greg Clayton7b0992d2013-04-18 22:45:39 +0000259 mutable std::unique_ptr<lldb_private::FileSpecList> m_filespec_ap;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000260
Jim Ingham672e6f52011-03-07 23:44:08 +0000261 /// Cached value of the entry point for this module.
262 lldb_private::Address m_entry_point_address;
Stephen Wilson499b40e2011-03-30 16:07:05 +0000263
Todd Fialab91de782014-06-27 16:52:49 +0000264 /// The architecture detected from parsing elf file contents.
265 lldb_private::ArchSpec m_arch_spec;
266
Tamas Berghammer83544cf2015-04-07 10:43:50 +0000267 /// The address class for each symbol in the elf file
268 FileAddressToAddressClassMap m_address_class_map;
269
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000270 /// Returns a 1 based index of the given section header.
Greg Claytonc7bece562013-01-25 18:06:21 +0000271 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000272 SectionIndex(const SectionHeaderCollIter &I);
273
274 /// Returns a 1 based index of the given section header.
Greg Claytonc7bece562013-01-25 18:06:21 +0000275 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000276 SectionIndex(const SectionHeaderCollConstIter &I) const;
277
Todd Fiala4339f3a2014-03-25 19:29:09 +0000278 // Parses the ELF program headers.
279 static size_t
280 GetProgramHeaderInfo(ProgramHeaderColl &program_headers,
Ravitheja Addepally15f89c42016-01-19 12:55:21 +0000281 const SetDataFunction &set_data,
Todd Fiala4339f3a2014-03-25 19:29:09 +0000282 const elf::ELFHeader &header);
283
284 // Finds PT_NOTE segments and calculates their crc sum.
285 static uint32_t
286 CalculateELFNotesSegmentsCRC32(const ProgramHeaderColl& program_headers,
287 lldb_private::DataExtractor &data);
288
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000289 /// Parses all section headers present in this object file and populates
290 /// m_program_headers. This method will compute the header list only once.
291 /// Returns the number of headers parsed.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000292 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000293 ParseProgramHeaders();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000294
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000295 /// Parses all section headers present in this object file and populates
296 /// m_section_headers. This method will compute the header list only once.
297 /// Returns the number of headers parsed.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000298 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000299 ParseSectionHeaders();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000300
Saleem Abdulrasoold2d15042016-04-23 16:00:15 +0000301 static void
302 ParseARMAttributes(lldb_private::DataExtractor &data, uint64_t length,
303 lldb_private::ArchSpec &arch_spec);
304
Todd Fialab91de782014-06-27 16:52:49 +0000305 /// Parses the elf section headers and returns the uuid, debug link name, crc, archspec.
Michael Sartaina7499c92013-07-01 19:45:50 +0000306 static size_t
307 GetSectionHeaderInfo(SectionHeaderColl &section_headers,
Ravitheja Addepally15f89c42016-01-19 12:55:21 +0000308 const SetDataFunction &set_data,
Michael Sartaina7499c92013-07-01 19:45:50 +0000309 const elf::ELFHeader &header,
310 lldb_private::UUID &uuid,
311 std::string &gnu_debuglink_file,
Todd Fialab91de782014-06-27 16:52:49 +0000312 uint32_t &gnu_debuglink_crc,
313 lldb_private::ArchSpec &arch_spec);
Michael Sartaina7499c92013-07-01 19:45:50 +0000314
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000315 /// Scans the dynamic section and locates all dependent modules (shared
Greg Clayton710dd5a2011-01-08 20:28:42 +0000316 /// libraries) populating m_filespec_ap. This method will compute the
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000317 /// dependent module list only once. Returns the number of dependent
318 /// modules parsed.
319 size_t
320 ParseDependentModules();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000321
Stephen Wilson499b40e2011-03-30 16:07:05 +0000322 /// Parses the dynamic symbol table and populates m_dynamic_symbols. The
323 /// vector retains the order as found in the object file. Returns the
324 /// number of dynamic symbols parsed.
325 size_t
326 ParseDynamicSymbols();
327
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000328 /// Populates m_symtab_ap will all non-dynamic linker symbols. This method
329 /// will parse the symbols only once. Returns the number of symbols parsed.
Stephen Wilson499b40e2011-03-30 16:07:05 +0000330 unsigned
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000331 ParseSymbolTable(lldb_private::Symtab *symbol_table,
Stephen Wilson499b40e2011-03-30 16:07:05 +0000332 lldb::user_id_t start_id,
Greg Clayton3046e662013-07-10 01:23:25 +0000333 lldb_private::Section *symtab);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000334
Michael Sartaina7499c92013-07-01 19:45:50 +0000335 /// Helper routine for ParseSymbolTable().
336 unsigned
337 ParseSymbols(lldb_private::Symtab *symbol_table,
338 lldb::user_id_t start_id,
339 lldb_private::SectionList *section_list,
Greg Clayton3046e662013-07-10 01:23:25 +0000340 const size_t num_symbols,
Michael Sartaina7499c92013-07-01 19:45:50 +0000341 const lldb_private::DataExtractor &symtab_data,
342 const lldb_private::DataExtractor &strtab_data);
343
Stephen Wilson499b40e2011-03-30 16:07:05 +0000344 /// Scans the relocation entries and adds a set of artificial symbols to the
345 /// given symbol table for each PLT slot. Returns the number of symbols
346 /// added.
347 unsigned
348 ParseTrampolineSymbols(lldb_private::Symtab *symbol_table,
349 lldb::user_id_t start_id,
Michael Sartaina7499c92013-07-01 19:45:50 +0000350 const ELFSectionHeaderInfo *rela_hdr,
Stephen Wilson499b40e2011-03-30 16:07:05 +0000351 lldb::user_id_t section_id);
352
Tamas Berghammer6b63b142016-02-18 11:12:18 +0000353 void
354 ParseUnwindSymbols(lldb_private::Symtab *symbol_table,
355 lldb_private::DWARFCallFrameInfo* eh_frame);
356
Andrew MacPherson17220c12014-03-05 10:12:43 +0000357 /// Relocates debug sections
358 unsigned
359 RelocateDebugSections(const elf::ELFSectionHeader *rel_hdr, lldb::user_id_t rel_id);
360
361 unsigned
362 RelocateSection(lldb_private::Symtab* symtab, const elf::ELFHeader *hdr, const elf::ELFSectionHeader *rel_hdr,
363 const elf::ELFSectionHeader *symtab_hdr, const elf::ELFSectionHeader *debug_hdr,
364 lldb_private::DataExtractor &rel_data, lldb_private::DataExtractor &symtab_data,
365 lldb_private::DataExtractor &debug_data, lldb_private::Section* rel_section);
366
367 /// Loads the section name string table into m_shstr_data. Returns the
368 /// number of bytes constituting the table.
369 size_t
370 GetSectionHeaderStringTable();
371
372 /// Utility method for looking up a section given its name. Returns the
373 /// index of the corresponding section or zero if no section with the given
374 /// name can be found (note that section indices are always 1 based, and so
375 /// section index 0 is never valid).
376 lldb::user_id_t
377 GetSectionIndexByName(const char *name);
378
379 // Returns the ID of the first section that has the given type.
380 lldb::user_id_t
381 GetSectionIndexByType(unsigned type);
382
Stephen Wilson499b40e2011-03-30 16:07:05 +0000383 /// Returns the section header with the given id or NULL.
Michael Sartaina7499c92013-07-01 19:45:50 +0000384 const ELFSectionHeaderInfo *
Stephen Wilson499b40e2011-03-30 16:07:05 +0000385 GetSectionHeaderByIndex(lldb::user_id_t id);
386
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000387 /// @name ELF header dump routines
388 //@{
389 static void
390 DumpELFHeader(lldb_private::Stream *s, const elf::ELFHeader& header);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000391
392 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000393 DumpELFHeader_e_ident_EI_DATA(lldb_private::Stream *s,
394 unsigned char ei_data);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000395
396 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000397 DumpELFHeader_e_type(lldb_private::Stream *s, elf::elf_half e_type);
398 //@}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000399
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000400 /// @name ELF program header dump routines
401 //@{
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000402 void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000403 DumpELFProgramHeaders(lldb_private::Stream *s);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000404
405 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000406 DumpELFProgramHeader(lldb_private::Stream *s,
407 const elf::ELFProgramHeader &ph);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000408
409 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000410 DumpELFProgramHeader_p_type(lldb_private::Stream *s, elf::elf_word p_type);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000411
412 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000413 DumpELFProgramHeader_p_flags(lldb_private::Stream *s,
414 elf::elf_word p_flags);
415 //@}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000416
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000417 /// @name ELF section header dump routines
418 //@{
419 void
420 DumpELFSectionHeaders(lldb_private::Stream *s);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000421
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000422 static void
423 DumpELFSectionHeader(lldb_private::Stream *s,
Michael Sartaina7499c92013-07-01 19:45:50 +0000424 const ELFSectionHeaderInfo& sh);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000425
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000426 static void
427 DumpELFSectionHeader_sh_type(lldb_private::Stream *s,
428 elf::elf_word sh_type);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000429
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000430 static void
431 DumpELFSectionHeader_sh_flags(lldb_private::Stream *s,
Greg Claytonc7bece562013-01-25 18:06:21 +0000432 elf::elf_xword sh_flags);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000433 //@}
434
435 /// ELF dependent module dump routine.
436 void
437 DumpDependentModules(lldb_private::Stream *s);
438
Stephen Wilson499b40e2011-03-30 16:07:05 +0000439 const elf::ELFDynamic *
440 FindDynamicSymbol(unsigned tag);
441
Stephen Wilson499b40e2011-03-30 16:07:05 +0000442 unsigned
443 PLTRelocationType();
Todd Fialab91de782014-06-27 16:52:49 +0000444
445 static lldb_private::Error
446 RefineModuleDetailsFromNote (lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch_spec, lldb_private::UUID &uuid);
Ravitheja Addepally15f89c42016-01-19 12:55:21 +0000447
448
449 static lldb::offset_t
450 SetData(const lldb_private::DataExtractor &src, lldb_private::DataExtractor &dst, lldb::offset_t offset, lldb::offset_t length);
451
452 lldb::offset_t
453 SetDataWithReadMemoryFallback(lldb_private::DataExtractor &dst, lldb::offset_t offset, lldb::offset_t length);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000454};
455
Eugene Zelenko8157a882015-10-23 16:56:07 +0000456#endif // liblldb_ObjectFileELF_h_