blob: e6ef5dc1c808b0916a513244a40f402780f9e058 [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
Chris Lattner30fdc8d2010-06-08 16:52:24 +000017#include <vector>
18
Eugene Zelenko8157a882015-10-23 16:56:07 +000019// Other libraries and framework includes
20// Project includes
Chris Lattner30fdc8d2010-06-08 16:52:24 +000021#include "lldb/lldb-private.h"
Greg Clayton53239f02011-02-08 05:05:52 +000022#include "lldb/Host/FileSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000023#include "lldb/Symbol/ObjectFile.h"
Michael Sartainc836ae72013-05-23 20:57:03 +000024#include "lldb/Core/UUID.h"
Todd Fialab91de782014-06-27 16:52:49 +000025#include "lldb/Core/ArchSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000026
Stephen Wilsonf325ba92010-07-13 23:07:23 +000027#include "ELFHeader.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000028
Ed Mastec113ff82013-12-02 17:49:13 +000029struct ELFNote
30{
31 elf::elf_word n_namesz;
32 elf::elf_word n_descsz;
33 elf::elf_word n_type;
34
35 std::string n_name;
36
37 ELFNote() : n_namesz(0), n_descsz(0), n_type(0)
38 {
39 }
40
41 /// Parse an ELFNote entry from the given DataExtractor starting at position
42 /// \p offset.
43 ///
44 /// @param[in] data
45 /// The DataExtractor to read from.
46 ///
47 /// @param[in,out] offset
48 /// Pointer to an offset in the data. On return the offset will be
49 /// advanced by the number of bytes read.
50 ///
51 /// @return
52 /// True if the ELFRel entry was successfully read and false otherwise.
53 bool
54 Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
55};
56
Stephen Wilsonf325ba92010-07-13 23:07:23 +000057//------------------------------------------------------------------------------
58/// @class ObjectFileELF
59/// @brief Generic ELF object file reader.
60///
61/// This class provides a generic ELF (32/64 bit) reader plugin implementing the
62/// ObjectFile protocol.
Chris Lattner30fdc8d2010-06-08 16:52:24 +000063class ObjectFileELF :
64 public lldb_private::ObjectFile
65{
66public:
Eugene Zelenko8157a882015-10-23 16:56:07 +000067 ~ObjectFileELF() override;
68
Chris Lattner30fdc8d2010-06-08 16:52:24 +000069 //------------------------------------------------------------------
70 // Static Functions
71 //------------------------------------------------------------------
72 static void
73 Initialize();
74
75 static void
76 Terminate();
77
Greg Clayton57abc5d2013-05-10 21:47:16 +000078 static lldb_private::ConstString
Chris Lattner30fdc8d2010-06-08 16:52:24 +000079 GetPluginNameStatic();
80
81 static const char *
82 GetPluginDescriptionStatic();
83
84 static lldb_private::ObjectFile *
Greg Claytone72dfb32012-02-24 01:59:29 +000085 CreateInstance(const lldb::ModuleSP &module_sp,
Greg Clayton5ce9c562013-02-06 17:22:03 +000086 lldb::DataBufferSP& data_sp,
87 lldb::offset_t data_offset,
Chris Lattner30fdc8d2010-06-08 16:52:24 +000088 const lldb_private::FileSpec* file,
Greg Clayton5ce9c562013-02-06 17:22:03 +000089 lldb::offset_t file_offset,
90 lldb::offset_t length);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000091
Greg Claytonc9660542012-02-05 02:38:54 +000092 static lldb_private::ObjectFile *
Greg Claytone72dfb32012-02-24 01:59:29 +000093 CreateMemoryInstance (const lldb::ModuleSP &module_sp,
Greg Claytonc9660542012-02-05 02:38:54 +000094 lldb::DataBufferSP& data_sp,
95 const lldb::ProcessSP &process_sp,
96 lldb::addr_t header_addr);
97
Greg Claytonf4d6de62013-04-24 22:29:28 +000098 static size_t
99 GetModuleSpecifications (const lldb_private::FileSpec& file,
100 lldb::DataBufferSP& data_sp,
101 lldb::offset_t data_offset,
102 lldb::offset_t file_offset,
103 lldb::offset_t length,
104 lldb_private::ModuleSpecList &specs);
Michael Sartain9f0013d2013-05-17 00:20:21 +0000105
106 static bool
107 MagicBytesMatch (lldb::DataBufferSP& data_sp,
108 lldb::addr_t offset,
109 lldb::addr_t length);
110
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000111 //------------------------------------------------------------------
112 // PluginInterface protocol
113 //------------------------------------------------------------------
Greg Clayton6d06d902015-03-12 00:16:14 +0000114 lldb_private::ConstString
115 GetPluginName() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000116
Greg Clayton6d06d902015-03-12 00:16:14 +0000117 uint32_t
118 GetPluginVersion() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000119
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000120 //------------------------------------------------------------------
121 // ObjectFile Protocol.
122 //------------------------------------------------------------------
Greg Clayton6d06d902015-03-12 00:16:14 +0000123 bool
124 ParseHeader() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000125
Greg Clayton6d06d902015-03-12 00:16:14 +0000126 bool
Greg Clayton751caf62014-02-07 22:54:47 +0000127 SetLoadAddress (lldb_private::Target &target,
128 lldb::addr_t value,
Greg Clayton6d06d902015-03-12 00:16:14 +0000129 bool value_is_offset) override;
Steve Pucci9e02dac2014-02-06 19:02:19 +0000130
Greg Clayton6d06d902015-03-12 00:16:14 +0000131 lldb::ByteOrder
132 GetByteOrder() const override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000133
Greg Clayton6d06d902015-03-12 00:16:14 +0000134 bool
135 IsExecutable () const override;
Jim Ingham5aee1622010-08-09 23:31:02 +0000136
Greg Clayton6d06d902015-03-12 00:16:14 +0000137 uint32_t
138 GetAddressByteSize() const override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000139
Greg Clayton6d06d902015-03-12 00:16:14 +0000140 lldb::AddressClass
141 GetAddressClass (lldb::addr_t file_addr) override;
Todd Fialafbd703a2014-09-15 22:33:39 +0000142
Greg Clayton6d06d902015-03-12 00:16:14 +0000143 lldb_private::Symtab *
144 GetSymtab() override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000145
Greg Clayton6d06d902015-03-12 00:16:14 +0000146 lldb_private::Symbol *
147 ResolveSymbolForAddress(const lldb_private::Address& so_addr, bool verify_unique) override;
Ashok Thirumurthi35729bb2013-09-24 15:34:13 +0000148
Greg Clayton6d06d902015-03-12 00:16:14 +0000149 bool
150 IsStripped () override;
Greg Clayton3046e662013-07-10 01:23:25 +0000151
Greg Clayton6d06d902015-03-12 00:16:14 +0000152 void
153 CreateSections (lldb_private::SectionList &unified_section_list) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000154
Greg Clayton6d06d902015-03-12 00:16:14 +0000155 void
156 Dump(lldb_private::Stream *s) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000157
Greg Clayton6d06d902015-03-12 00:16:14 +0000158 bool
159 GetArchitecture (lldb_private::ArchSpec &arch) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000160
Greg Clayton6d06d902015-03-12 00:16:14 +0000161 bool
162 GetUUID(lldb_private::UUID* uuid) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000163
Greg Clayton6d06d902015-03-12 00:16:14 +0000164 lldb_private::FileSpecList
165 GetDebugSymbolFilePaths() override;
Michael Sartaina7499c92013-07-01 19:45:50 +0000166
Greg Clayton6d06d902015-03-12 00:16:14 +0000167 uint32_t
168 GetDependentModules(lldb_private::FileSpecList& files) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000169
Greg Clayton6d06d902015-03-12 00:16:14 +0000170 lldb_private::Address
171 GetImageInfoAddress(lldb_private::Target *target) override;
Jim Ingham672e6f52011-03-07 23:44:08 +0000172
Greg Clayton6d06d902015-03-12 00:16:14 +0000173 lldb_private::Address
174 GetEntryPointAddress () override;
Greg Clayton9e00b6a652011-07-09 00:41:34 +0000175
Greg Clayton6d06d902015-03-12 00:16:14 +0000176 ObjectFile::Type
177 CalculateType() override;
Greg Clayton9e00b6a652011-07-09 00:41:34 +0000178
Greg Clayton6d06d902015-03-12 00:16:14 +0000179 ObjectFile::Strata
180 CalculateStrata() override;
Stephen Wilson2ab0a582011-01-15 00:08:44 +0000181
Ashok Thirumurthi4822d922013-07-11 20:39:00 +0000182 // Returns number of program headers found in the ELF file.
183 size_t
184 GetProgramHeaderCount();
185
186 // Returns the program header with the given index.
187 const elf::ELFProgramHeader *
188 GetProgramHeaderByIndex(lldb::user_id_t id);
189
190 // Returns segment data for the given index.
191 lldb_private::DataExtractor
192 GetSegmentDataByIndex(lldb::user_id_t id);
193
Pavel Labathc6ae7ea2015-03-04 10:25:22 +0000194 std::string
195 StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const override;
196
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000197private:
Greg Claytone72dfb32012-02-24 01:59:29 +0000198 ObjectFileELF(const lldb::ModuleSP &module_sp,
Greg Clayton5ce9c562013-02-06 17:22:03 +0000199 lldb::DataBufferSP& data_sp,
200 lldb::offset_t data_offset,
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000201 const lldb_private::FileSpec* file,
Greg Clayton5ce9c562013-02-06 17:22:03 +0000202 lldb::offset_t offset,
203 lldb::offset_t length);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000204
Andrew MacPherson17220c12014-03-05 10:12:43 +0000205 ObjectFileELF (const lldb::ModuleSP &module_sp,
Tamas Berghammerf2561842015-06-30 10:41:23 +0000206 lldb::DataBufferSP& header_data_sp,
Andrew MacPherson17220c12014-03-05 10:12:43 +0000207 const lldb::ProcessSP &process_sp,
208 lldb::addr_t header_addr);
209
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000210 typedef std::vector<elf::ELFProgramHeader> ProgramHeaderColl;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000211 typedef ProgramHeaderColl::iterator ProgramHeaderCollIter;
212 typedef ProgramHeaderColl::const_iterator ProgramHeaderCollConstIter;
213
Michael Sartaina7499c92013-07-01 19:45:50 +0000214 struct ELFSectionHeaderInfo : public elf::ELFSectionHeader
215 {
216 lldb_private::ConstString section_name;
217 };
Eugene Zelenko8157a882015-10-23 16:56:07 +0000218
Michael Sartaina7499c92013-07-01 19:45:50 +0000219 typedef std::vector<ELFSectionHeaderInfo> SectionHeaderColl;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000220 typedef SectionHeaderColl::iterator SectionHeaderCollIter;
221 typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter;
222
Stephen Wilson499b40e2011-03-30 16:07:05 +0000223 typedef std::vector<elf::ELFDynamic> DynamicSymbolColl;
224 typedef DynamicSymbolColl::iterator DynamicSymbolCollIter;
225 typedef DynamicSymbolColl::const_iterator DynamicSymbolCollConstIter;
226
Tamas Berghammer83544cf2015-04-07 10:43:50 +0000227 typedef std::map<lldb::addr_t, lldb::AddressClass> FileAddressToAddressClassMap;
228
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000229 /// Version of this reader common to all plugins based on this class.
230 static const uint32_t m_plugin_version = 1;
Todd Fiala4339f3a2014-03-25 19:29:09 +0000231 static const uint32_t g_core_uuid_magic;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000232
233 /// ELF file header.
234 elf::ELFHeader m_header;
235
Michael Sartaina7499c92013-07-01 19:45:50 +0000236 /// ELF build ID.
Michael Sartainc836ae72013-05-23 20:57:03 +0000237 lldb_private::UUID m_uuid;
238
Michael Sartaina7499c92013-07-01 19:45:50 +0000239 /// ELF .gnu_debuglink file and crc data if available.
240 std::string m_gnu_debuglink_file;
241 uint32_t m_gnu_debuglink_crc;
242
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000243 /// Collection of program headers.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000244 ProgramHeaderColl m_program_headers;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000245
246 /// Collection of section headers.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000247 SectionHeaderColl m_section_headers;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000248
Stephen Wilson499b40e2011-03-30 16:07:05 +0000249 /// Collection of symbols from the dynamic table.
250 DynamicSymbolColl m_dynamic_symbols;
251
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000252 /// List of file specifications corresponding to the modules (shared
253 /// libraries) on which this object file depends.
Greg Clayton7b0992d2013-04-18 22:45:39 +0000254 mutable std::unique_ptr<lldb_private::FileSpecList> m_filespec_ap;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000255
Jim Ingham672e6f52011-03-07 23:44:08 +0000256 /// Cached value of the entry point for this module.
257 lldb_private::Address m_entry_point_address;
Stephen Wilson499b40e2011-03-30 16:07:05 +0000258
Todd Fialab91de782014-06-27 16:52:49 +0000259 /// The architecture detected from parsing elf file contents.
260 lldb_private::ArchSpec m_arch_spec;
261
Tamas Berghammer83544cf2015-04-07 10:43:50 +0000262 /// The address class for each symbol in the elf file
263 FileAddressToAddressClassMap m_address_class_map;
264
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000265 /// Returns a 1 based index of the given section header.
Greg Claytonc7bece562013-01-25 18:06:21 +0000266 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000267 SectionIndex(const SectionHeaderCollIter &I);
268
269 /// Returns a 1 based index of the given section header.
Greg Claytonc7bece562013-01-25 18:06:21 +0000270 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000271 SectionIndex(const SectionHeaderCollConstIter &I) const;
272
Todd Fiala4339f3a2014-03-25 19:29:09 +0000273 // Parses the ELF program headers.
274 static size_t
275 GetProgramHeaderInfo(ProgramHeaderColl &program_headers,
276 lldb_private::DataExtractor &data,
277 const elf::ELFHeader &header);
278
279 // Finds PT_NOTE segments and calculates their crc sum.
280 static uint32_t
281 CalculateELFNotesSegmentsCRC32(const ProgramHeaderColl& program_headers,
282 lldb_private::DataExtractor &data);
283
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000284 /// Parses all section headers present in this object file and populates
285 /// m_program_headers. This method will compute the header list only once.
286 /// Returns the number of headers parsed.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000287 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000288 ParseProgramHeaders();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000289
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000290 /// Parses all section headers present in this object file and populates
291 /// m_section_headers. This method will compute the header list only once.
292 /// Returns the number of headers parsed.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000293 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000294 ParseSectionHeaders();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000295
Todd Fialab91de782014-06-27 16:52:49 +0000296 /// Parses the elf section headers and returns the uuid, debug link name, crc, archspec.
Michael Sartaina7499c92013-07-01 19:45:50 +0000297 static size_t
298 GetSectionHeaderInfo(SectionHeaderColl &section_headers,
299 lldb_private::DataExtractor &data,
300 const elf::ELFHeader &header,
301 lldb_private::UUID &uuid,
302 std::string &gnu_debuglink_file,
Todd Fialab91de782014-06-27 16:52:49 +0000303 uint32_t &gnu_debuglink_crc,
304 lldb_private::ArchSpec &arch_spec);
Michael Sartaina7499c92013-07-01 19:45:50 +0000305
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000306 /// Scans the dynamic section and locates all dependent modules (shared
Greg Clayton710dd5a2011-01-08 20:28:42 +0000307 /// libraries) populating m_filespec_ap. This method will compute the
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000308 /// dependent module list only once. Returns the number of dependent
309 /// modules parsed.
310 size_t
311 ParseDependentModules();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000312
Stephen Wilson499b40e2011-03-30 16:07:05 +0000313 /// Parses the dynamic symbol table and populates m_dynamic_symbols. The
314 /// vector retains the order as found in the object file. Returns the
315 /// number of dynamic symbols parsed.
316 size_t
317 ParseDynamicSymbols();
318
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000319 /// Populates m_symtab_ap will all non-dynamic linker symbols. This method
320 /// will parse the symbols only once. Returns the number of symbols parsed.
Stephen Wilson499b40e2011-03-30 16:07:05 +0000321 unsigned
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000322 ParseSymbolTable(lldb_private::Symtab *symbol_table,
Stephen Wilson499b40e2011-03-30 16:07:05 +0000323 lldb::user_id_t start_id,
Greg Clayton3046e662013-07-10 01:23:25 +0000324 lldb_private::Section *symtab);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000325
Michael Sartaina7499c92013-07-01 19:45:50 +0000326 /// Helper routine for ParseSymbolTable().
327 unsigned
328 ParseSymbols(lldb_private::Symtab *symbol_table,
329 lldb::user_id_t start_id,
330 lldb_private::SectionList *section_list,
Greg Clayton3046e662013-07-10 01:23:25 +0000331 const size_t num_symbols,
Michael Sartaina7499c92013-07-01 19:45:50 +0000332 const lldb_private::DataExtractor &symtab_data,
333 const lldb_private::DataExtractor &strtab_data);
334
Stephen Wilson499b40e2011-03-30 16:07:05 +0000335 /// Scans the relocation entries and adds a set of artificial symbols to the
336 /// given symbol table for each PLT slot. Returns the number of symbols
337 /// added.
338 unsigned
339 ParseTrampolineSymbols(lldb_private::Symtab *symbol_table,
340 lldb::user_id_t start_id,
Michael Sartaina7499c92013-07-01 19:45:50 +0000341 const ELFSectionHeaderInfo *rela_hdr,
Stephen Wilson499b40e2011-03-30 16:07:05 +0000342 lldb::user_id_t section_id);
343
Andrew MacPherson17220c12014-03-05 10:12:43 +0000344 /// Relocates debug sections
345 unsigned
346 RelocateDebugSections(const elf::ELFSectionHeader *rel_hdr, lldb::user_id_t rel_id);
347
348 unsigned
349 RelocateSection(lldb_private::Symtab* symtab, const elf::ELFHeader *hdr, const elf::ELFSectionHeader *rel_hdr,
350 const elf::ELFSectionHeader *symtab_hdr, const elf::ELFSectionHeader *debug_hdr,
351 lldb_private::DataExtractor &rel_data, lldb_private::DataExtractor &symtab_data,
352 lldb_private::DataExtractor &debug_data, lldb_private::Section* rel_section);
353
354 /// Loads the section name string table into m_shstr_data. Returns the
355 /// number of bytes constituting the table.
356 size_t
357 GetSectionHeaderStringTable();
358
359 /// Utility method for looking up a section given its name. Returns the
360 /// index of the corresponding section or zero if no section with the given
361 /// name can be found (note that section indices are always 1 based, and so
362 /// section index 0 is never valid).
363 lldb::user_id_t
364 GetSectionIndexByName(const char *name);
365
366 // Returns the ID of the first section that has the given type.
367 lldb::user_id_t
368 GetSectionIndexByType(unsigned type);
369
Stephen Wilson499b40e2011-03-30 16:07:05 +0000370 /// Returns the section header with the given id or NULL.
Michael Sartaina7499c92013-07-01 19:45:50 +0000371 const ELFSectionHeaderInfo *
Stephen Wilson499b40e2011-03-30 16:07:05 +0000372 GetSectionHeaderByIndex(lldb::user_id_t id);
373
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000374 /// @name ELF header dump routines
375 //@{
376 static void
377 DumpELFHeader(lldb_private::Stream *s, const elf::ELFHeader& header);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000378
379 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000380 DumpELFHeader_e_ident_EI_DATA(lldb_private::Stream *s,
381 unsigned char ei_data);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000382
383 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000384 DumpELFHeader_e_type(lldb_private::Stream *s, elf::elf_half e_type);
385 //@}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000386
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000387 /// @name ELF program header dump routines
388 //@{
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000389 void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000390 DumpELFProgramHeaders(lldb_private::Stream *s);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000391
392 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000393 DumpELFProgramHeader(lldb_private::Stream *s,
394 const elf::ELFProgramHeader &ph);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000395
396 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000397 DumpELFProgramHeader_p_type(lldb_private::Stream *s, elf::elf_word p_type);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000398
399 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000400 DumpELFProgramHeader_p_flags(lldb_private::Stream *s,
401 elf::elf_word p_flags);
402 //@}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000403
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000404 /// @name ELF section header dump routines
405 //@{
406 void
407 DumpELFSectionHeaders(lldb_private::Stream *s);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000408
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000409 static void
410 DumpELFSectionHeader(lldb_private::Stream *s,
Michael Sartaina7499c92013-07-01 19:45:50 +0000411 const ELFSectionHeaderInfo& sh);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000412
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000413 static void
414 DumpELFSectionHeader_sh_type(lldb_private::Stream *s,
415 elf::elf_word sh_type);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000416
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000417 static void
418 DumpELFSectionHeader_sh_flags(lldb_private::Stream *s,
Greg Claytonc7bece562013-01-25 18:06:21 +0000419 elf::elf_xword sh_flags);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000420 //@}
421
422 /// ELF dependent module dump routine.
423 void
424 DumpDependentModules(lldb_private::Stream *s);
425
Stephen Wilson499b40e2011-03-30 16:07:05 +0000426 const elf::ELFDynamic *
427 FindDynamicSymbol(unsigned tag);
428
Stephen Wilson499b40e2011-03-30 16:07:05 +0000429 unsigned
430 PLTRelocationType();
Todd Fialab91de782014-06-27 16:52:49 +0000431
432 static lldb_private::Error
433 RefineModuleDetailsFromNote (lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch_spec, lldb_private::UUID &uuid);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000434};
435
Eugene Zelenko8157a882015-10-23 16:56:07 +0000436#endif // liblldb_ObjectFileELF_h_