blob: 4b97f92c6c5c8322e6fbc68e0b009ab37ec98808 [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);
Greg Claytonb704b692015-10-28 18:04:38 +000055
56 size_t
57 GetByteSize() const
58 {
59 return 12 + llvm::RoundUpToAlignment (n_namesz, 4) + llvm::RoundUpToAlignment (n_descsz, 4);
60 }
Ed Mastec113ff82013-12-02 17:49:13 +000061};
62
Stephen Wilsonf325ba92010-07-13 23:07:23 +000063//------------------------------------------------------------------------------
64/// @class ObjectFileELF
65/// @brief Generic ELF object file reader.
66///
67/// This class provides a generic ELF (32/64 bit) reader plugin implementing the
68/// ObjectFile protocol.
Chris Lattner30fdc8d2010-06-08 16:52:24 +000069class ObjectFileELF :
70 public lldb_private::ObjectFile
71{
72public:
Eugene Zelenko8157a882015-10-23 16:56:07 +000073 ~ObjectFileELF() override;
74
Chris Lattner30fdc8d2010-06-08 16:52:24 +000075 //------------------------------------------------------------------
76 // Static Functions
77 //------------------------------------------------------------------
78 static void
79 Initialize();
80
81 static void
82 Terminate();
83
Greg Clayton57abc5d2013-05-10 21:47:16 +000084 static lldb_private::ConstString
Chris Lattner30fdc8d2010-06-08 16:52:24 +000085 GetPluginNameStatic();
86
87 static const char *
88 GetPluginDescriptionStatic();
89
90 static lldb_private::ObjectFile *
Greg Claytone72dfb32012-02-24 01:59:29 +000091 CreateInstance(const lldb::ModuleSP &module_sp,
Greg Clayton5ce9c562013-02-06 17:22:03 +000092 lldb::DataBufferSP& data_sp,
93 lldb::offset_t data_offset,
Chris Lattner30fdc8d2010-06-08 16:52:24 +000094 const lldb_private::FileSpec* file,
Greg Clayton5ce9c562013-02-06 17:22:03 +000095 lldb::offset_t file_offset,
96 lldb::offset_t length);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000097
Greg Claytonc9660542012-02-05 02:38:54 +000098 static lldb_private::ObjectFile *
Greg Claytone72dfb32012-02-24 01:59:29 +000099 CreateMemoryInstance (const lldb::ModuleSP &module_sp,
Greg Claytonc9660542012-02-05 02:38:54 +0000100 lldb::DataBufferSP& data_sp,
101 const lldb::ProcessSP &process_sp,
102 lldb::addr_t header_addr);
103
Greg Claytonf4d6de62013-04-24 22:29:28 +0000104 static size_t
105 GetModuleSpecifications (const lldb_private::FileSpec& file,
106 lldb::DataBufferSP& data_sp,
107 lldb::offset_t data_offset,
108 lldb::offset_t file_offset,
109 lldb::offset_t length,
110 lldb_private::ModuleSpecList &specs);
Michael Sartain9f0013d2013-05-17 00:20:21 +0000111
112 static bool
113 MagicBytesMatch (lldb::DataBufferSP& data_sp,
114 lldb::addr_t offset,
115 lldb::addr_t length);
116
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000117 //------------------------------------------------------------------
118 // PluginInterface protocol
119 //------------------------------------------------------------------
Greg Clayton6d06d902015-03-12 00:16:14 +0000120 lldb_private::ConstString
121 GetPluginName() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000122
Greg Clayton6d06d902015-03-12 00:16:14 +0000123 uint32_t
124 GetPluginVersion() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000125
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000126 //------------------------------------------------------------------
127 // ObjectFile Protocol.
128 //------------------------------------------------------------------
Greg Clayton6d06d902015-03-12 00:16:14 +0000129 bool
130 ParseHeader() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000131
Greg Clayton6d06d902015-03-12 00:16:14 +0000132 bool
Greg Clayton751caf62014-02-07 22:54:47 +0000133 SetLoadAddress (lldb_private::Target &target,
134 lldb::addr_t value,
Greg Clayton6d06d902015-03-12 00:16:14 +0000135 bool value_is_offset) override;
Steve Pucci9e02dac2014-02-06 19:02:19 +0000136
Greg Clayton6d06d902015-03-12 00:16:14 +0000137 lldb::ByteOrder
138 GetByteOrder() const override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000139
Greg Clayton6d06d902015-03-12 00:16:14 +0000140 bool
141 IsExecutable () const override;
Jim Ingham5aee1622010-08-09 23:31:02 +0000142
Greg Clayton6d06d902015-03-12 00:16:14 +0000143 uint32_t
144 GetAddressByteSize() const override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000145
Greg Clayton6d06d902015-03-12 00:16:14 +0000146 lldb::AddressClass
147 GetAddressClass (lldb::addr_t file_addr) override;
Todd Fialafbd703a2014-09-15 22:33:39 +0000148
Greg Clayton6d06d902015-03-12 00:16:14 +0000149 lldb_private::Symtab *
150 GetSymtab() override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000151
Greg Clayton6d06d902015-03-12 00:16:14 +0000152 lldb_private::Symbol *
153 ResolveSymbolForAddress(const lldb_private::Address& so_addr, bool verify_unique) override;
Ashok Thirumurthi35729bb2013-09-24 15:34:13 +0000154
Greg Clayton6d06d902015-03-12 00:16:14 +0000155 bool
156 IsStripped () override;
Greg Clayton3046e662013-07-10 01:23:25 +0000157
Greg Clayton6d06d902015-03-12 00:16:14 +0000158 void
159 CreateSections (lldb_private::SectionList &unified_section_list) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000160
Greg Clayton6d06d902015-03-12 00:16:14 +0000161 void
162 Dump(lldb_private::Stream *s) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000163
Greg Clayton6d06d902015-03-12 00:16:14 +0000164 bool
165 GetArchitecture (lldb_private::ArchSpec &arch) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000166
Greg Clayton6d06d902015-03-12 00:16:14 +0000167 bool
168 GetUUID(lldb_private::UUID* uuid) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000169
Greg Clayton6d06d902015-03-12 00:16:14 +0000170 lldb_private::FileSpecList
171 GetDebugSymbolFilePaths() override;
Michael Sartaina7499c92013-07-01 19:45:50 +0000172
Greg Clayton6d06d902015-03-12 00:16:14 +0000173 uint32_t
174 GetDependentModules(lldb_private::FileSpecList& files) override;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000175
Greg Clayton6d06d902015-03-12 00:16:14 +0000176 lldb_private::Address
177 GetImageInfoAddress(lldb_private::Target *target) override;
Jim Ingham672e6f52011-03-07 23:44:08 +0000178
Greg Clayton6d06d902015-03-12 00:16:14 +0000179 lldb_private::Address
180 GetEntryPointAddress () override;
Greg Clayton9e00b6a652011-07-09 00:41:34 +0000181
Greg Clayton6d06d902015-03-12 00:16:14 +0000182 ObjectFile::Type
183 CalculateType() override;
Greg Clayton9e00b6a652011-07-09 00:41:34 +0000184
Greg Clayton6d06d902015-03-12 00:16:14 +0000185 ObjectFile::Strata
186 CalculateStrata() override;
Stephen Wilson2ab0a582011-01-15 00:08:44 +0000187
Ashok Thirumurthi4822d922013-07-11 20:39:00 +0000188 // Returns number of program headers found in the ELF file.
189 size_t
190 GetProgramHeaderCount();
191
192 // Returns the program header with the given index.
193 const elf::ELFProgramHeader *
194 GetProgramHeaderByIndex(lldb::user_id_t id);
195
196 // Returns segment data for the given index.
197 lldb_private::DataExtractor
198 GetSegmentDataByIndex(lldb::user_id_t id);
199
Pavel Labathc6ae7ea2015-03-04 10:25:22 +0000200 std::string
201 StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const override;
202
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000203private:
Greg Claytone72dfb32012-02-24 01:59:29 +0000204 ObjectFileELF(const lldb::ModuleSP &module_sp,
Greg Clayton5ce9c562013-02-06 17:22:03 +0000205 lldb::DataBufferSP& data_sp,
206 lldb::offset_t data_offset,
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000207 const lldb_private::FileSpec* file,
Greg Clayton5ce9c562013-02-06 17:22:03 +0000208 lldb::offset_t offset,
209 lldb::offset_t length);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000210
Andrew MacPherson17220c12014-03-05 10:12:43 +0000211 ObjectFileELF (const lldb::ModuleSP &module_sp,
Tamas Berghammerf2561842015-06-30 10:41:23 +0000212 lldb::DataBufferSP& header_data_sp,
Andrew MacPherson17220c12014-03-05 10:12:43 +0000213 const lldb::ProcessSP &process_sp,
214 lldb::addr_t header_addr);
215
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000216 typedef std::vector<elf::ELFProgramHeader> ProgramHeaderColl;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000217 typedef ProgramHeaderColl::iterator ProgramHeaderCollIter;
218 typedef ProgramHeaderColl::const_iterator ProgramHeaderCollConstIter;
219
Michael Sartaina7499c92013-07-01 19:45:50 +0000220 struct ELFSectionHeaderInfo : public elf::ELFSectionHeader
221 {
222 lldb_private::ConstString section_name;
223 };
Eugene Zelenko8157a882015-10-23 16:56:07 +0000224
Michael Sartaina7499c92013-07-01 19:45:50 +0000225 typedef std::vector<ELFSectionHeaderInfo> SectionHeaderColl;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000226 typedef SectionHeaderColl::iterator SectionHeaderCollIter;
227 typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter;
228
Stephen Wilson499b40e2011-03-30 16:07:05 +0000229 typedef std::vector<elf::ELFDynamic> DynamicSymbolColl;
230 typedef DynamicSymbolColl::iterator DynamicSymbolCollIter;
231 typedef DynamicSymbolColl::const_iterator DynamicSymbolCollConstIter;
232
Tamas Berghammer83544cf2015-04-07 10:43:50 +0000233 typedef std::map<lldb::addr_t, lldb::AddressClass> FileAddressToAddressClassMap;
234
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000235 /// Version of this reader common to all plugins based on this class.
236 static const uint32_t m_plugin_version = 1;
Todd Fiala4339f3a2014-03-25 19:29:09 +0000237 static const uint32_t g_core_uuid_magic;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000238
239 /// ELF file header.
240 elf::ELFHeader m_header;
241
Michael Sartaina7499c92013-07-01 19:45:50 +0000242 /// ELF build ID.
Michael Sartainc836ae72013-05-23 20:57:03 +0000243 lldb_private::UUID m_uuid;
244
Michael Sartaina7499c92013-07-01 19:45:50 +0000245 /// ELF .gnu_debuglink file and crc data if available.
246 std::string m_gnu_debuglink_file;
247 uint32_t m_gnu_debuglink_crc;
248
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000249 /// Collection of program headers.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000250 ProgramHeaderColl m_program_headers;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000251
252 /// Collection of section headers.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000253 SectionHeaderColl m_section_headers;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000254
Stephen Wilson499b40e2011-03-30 16:07:05 +0000255 /// Collection of symbols from the dynamic table.
256 DynamicSymbolColl m_dynamic_symbols;
257
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000258 /// List of file specifications corresponding to the modules (shared
259 /// libraries) on which this object file depends.
Greg Clayton7b0992d2013-04-18 22:45:39 +0000260 mutable std::unique_ptr<lldb_private::FileSpecList> m_filespec_ap;
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000261
Jim Ingham672e6f52011-03-07 23:44:08 +0000262 /// Cached value of the entry point for this module.
263 lldb_private::Address m_entry_point_address;
Stephen Wilson499b40e2011-03-30 16:07:05 +0000264
Todd Fialab91de782014-06-27 16:52:49 +0000265 /// The architecture detected from parsing elf file contents.
266 lldb_private::ArchSpec m_arch_spec;
267
Tamas Berghammer83544cf2015-04-07 10:43:50 +0000268 /// The address class for each symbol in the elf file
269 FileAddressToAddressClassMap m_address_class_map;
270
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000271 /// Returns a 1 based index of the given section header.
Greg Claytonc7bece562013-01-25 18:06:21 +0000272 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000273 SectionIndex(const SectionHeaderCollIter &I);
274
275 /// Returns a 1 based index of the given section header.
Greg Claytonc7bece562013-01-25 18:06:21 +0000276 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000277 SectionIndex(const SectionHeaderCollConstIter &I) const;
278
Todd Fiala4339f3a2014-03-25 19:29:09 +0000279 // Parses the ELF program headers.
280 static size_t
281 GetProgramHeaderInfo(ProgramHeaderColl &program_headers,
282 lldb_private::DataExtractor &data,
283 const elf::ELFHeader &header);
284
285 // Finds PT_NOTE segments and calculates their crc sum.
286 static uint32_t
287 CalculateELFNotesSegmentsCRC32(const ProgramHeaderColl& program_headers,
288 lldb_private::DataExtractor &data);
289
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000290 /// Parses all section headers present in this object file and populates
291 /// m_program_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 ParseProgramHeaders();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000295
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000296 /// Parses all section headers present in this object file and populates
297 /// m_section_headers. This method will compute the header list only once.
298 /// Returns the number of headers parsed.
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000299 size_t
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000300 ParseSectionHeaders();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000301
Todd Fialab91de782014-06-27 16:52:49 +0000302 /// Parses the elf section headers and returns the uuid, debug link name, crc, archspec.
Michael Sartaina7499c92013-07-01 19:45:50 +0000303 static size_t
304 GetSectionHeaderInfo(SectionHeaderColl &section_headers,
305 lldb_private::DataExtractor &data,
306 const elf::ELFHeader &header,
307 lldb_private::UUID &uuid,
308 std::string &gnu_debuglink_file,
Todd Fialab91de782014-06-27 16:52:49 +0000309 uint32_t &gnu_debuglink_crc,
310 lldb_private::ArchSpec &arch_spec);
Michael Sartaina7499c92013-07-01 19:45:50 +0000311
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000312 /// Scans the dynamic section and locates all dependent modules (shared
Greg Clayton710dd5a2011-01-08 20:28:42 +0000313 /// libraries) populating m_filespec_ap. This method will compute the
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000314 /// dependent module list only once. Returns the number of dependent
315 /// modules parsed.
316 size_t
317 ParseDependentModules();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000318
Stephen Wilson499b40e2011-03-30 16:07:05 +0000319 /// Parses the dynamic symbol table and populates m_dynamic_symbols. The
320 /// vector retains the order as found in the object file. Returns the
321 /// number of dynamic symbols parsed.
322 size_t
323 ParseDynamicSymbols();
324
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000325 /// Populates m_symtab_ap will all non-dynamic linker symbols. This method
326 /// will parse the symbols only once. Returns the number of symbols parsed.
Stephen Wilson499b40e2011-03-30 16:07:05 +0000327 unsigned
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000328 ParseSymbolTable(lldb_private::Symtab *symbol_table,
Stephen Wilson499b40e2011-03-30 16:07:05 +0000329 lldb::user_id_t start_id,
Greg Clayton3046e662013-07-10 01:23:25 +0000330 lldb_private::Section *symtab);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000331
Michael Sartaina7499c92013-07-01 19:45:50 +0000332 /// Helper routine for ParseSymbolTable().
333 unsigned
334 ParseSymbols(lldb_private::Symtab *symbol_table,
335 lldb::user_id_t start_id,
336 lldb_private::SectionList *section_list,
Greg Clayton3046e662013-07-10 01:23:25 +0000337 const size_t num_symbols,
Michael Sartaina7499c92013-07-01 19:45:50 +0000338 const lldb_private::DataExtractor &symtab_data,
339 const lldb_private::DataExtractor &strtab_data);
340
Stephen Wilson499b40e2011-03-30 16:07:05 +0000341 /// Scans the relocation entries and adds a set of artificial symbols to the
342 /// given symbol table for each PLT slot. Returns the number of symbols
343 /// added.
344 unsigned
345 ParseTrampolineSymbols(lldb_private::Symtab *symbol_table,
346 lldb::user_id_t start_id,
Michael Sartaina7499c92013-07-01 19:45:50 +0000347 const ELFSectionHeaderInfo *rela_hdr,
Stephen Wilson499b40e2011-03-30 16:07:05 +0000348 lldb::user_id_t section_id);
349
Andrew MacPherson17220c12014-03-05 10:12:43 +0000350 /// Relocates debug sections
351 unsigned
352 RelocateDebugSections(const elf::ELFSectionHeader *rel_hdr, lldb::user_id_t rel_id);
353
354 unsigned
355 RelocateSection(lldb_private::Symtab* symtab, const elf::ELFHeader *hdr, const elf::ELFSectionHeader *rel_hdr,
356 const elf::ELFSectionHeader *symtab_hdr, const elf::ELFSectionHeader *debug_hdr,
357 lldb_private::DataExtractor &rel_data, lldb_private::DataExtractor &symtab_data,
358 lldb_private::DataExtractor &debug_data, lldb_private::Section* rel_section);
359
360 /// Loads the section name string table into m_shstr_data. Returns the
361 /// number of bytes constituting the table.
362 size_t
363 GetSectionHeaderStringTable();
364
365 /// Utility method for looking up a section given its name. Returns the
366 /// index of the corresponding section or zero if no section with the given
367 /// name can be found (note that section indices are always 1 based, and so
368 /// section index 0 is never valid).
369 lldb::user_id_t
370 GetSectionIndexByName(const char *name);
371
372 // Returns the ID of the first section that has the given type.
373 lldb::user_id_t
374 GetSectionIndexByType(unsigned type);
375
Stephen Wilson499b40e2011-03-30 16:07:05 +0000376 /// Returns the section header with the given id or NULL.
Michael Sartaina7499c92013-07-01 19:45:50 +0000377 const ELFSectionHeaderInfo *
Stephen Wilson499b40e2011-03-30 16:07:05 +0000378 GetSectionHeaderByIndex(lldb::user_id_t id);
379
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000380 /// @name ELF header dump routines
381 //@{
382 static void
383 DumpELFHeader(lldb_private::Stream *s, const elf::ELFHeader& header);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000384
385 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000386 DumpELFHeader_e_ident_EI_DATA(lldb_private::Stream *s,
387 unsigned char ei_data);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000388
389 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000390 DumpELFHeader_e_type(lldb_private::Stream *s, elf::elf_half e_type);
391 //@}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000392
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000393 /// @name ELF program header dump routines
394 //@{
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000395 void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000396 DumpELFProgramHeaders(lldb_private::Stream *s);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000397
398 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000399 DumpELFProgramHeader(lldb_private::Stream *s,
400 const elf::ELFProgramHeader &ph);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000401
402 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000403 DumpELFProgramHeader_p_type(lldb_private::Stream *s, elf::elf_word p_type);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000404
405 static void
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000406 DumpELFProgramHeader_p_flags(lldb_private::Stream *s,
407 elf::elf_word p_flags);
408 //@}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000409
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000410 /// @name ELF section header dump routines
411 //@{
412 void
413 DumpELFSectionHeaders(lldb_private::Stream *s);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000414
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000415 static void
416 DumpELFSectionHeader(lldb_private::Stream *s,
Michael Sartaina7499c92013-07-01 19:45:50 +0000417 const ELFSectionHeaderInfo& sh);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000418
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000419 static void
420 DumpELFSectionHeader_sh_type(lldb_private::Stream *s,
421 elf::elf_word sh_type);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000422
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000423 static void
424 DumpELFSectionHeader_sh_flags(lldb_private::Stream *s,
Greg Claytonc7bece562013-01-25 18:06:21 +0000425 elf::elf_xword sh_flags);
Stephen Wilsonf325ba92010-07-13 23:07:23 +0000426 //@}
427
428 /// ELF dependent module dump routine.
429 void
430 DumpDependentModules(lldb_private::Stream *s);
431
Stephen Wilson499b40e2011-03-30 16:07:05 +0000432 const elf::ELFDynamic *
433 FindDynamicSymbol(unsigned tag);
434
Stephen Wilson499b40e2011-03-30 16:07:05 +0000435 unsigned
436 PLTRelocationType();
Todd Fialab91de782014-06-27 16:52:49 +0000437
438 static lldb_private::Error
439 RefineModuleDetailsFromNote (lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch_spec, lldb_private::UUID &uuid);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000440};
441
Eugene Zelenko8157a882015-10-23 16:56:07 +0000442#endif // liblldb_ObjectFileELF_h_