• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- Mode: C++ -*-
3 //
4 // Copyright (C) 2022 Red Hat, Inc.
5 //
6 // Author: Dodji Seketeli
7 
8 /// @file
9 ///
10 /// This file contains the declarations for an elf-based.  DWARF and
11 /// CTF readers can inherit this one.
12 
13 
14 #ifndef __ABG_ELF_BASED_READER_H__
15 #define __ABG_ELF_BASED_READER_H__
16 
17 #include <memory>
18 #include <string>
19 
20 #include "abg-elf-reader.h"
21 #include "abg-corpus.h"
22 
23 namespace abigail
24 {
25 
26 /// The common interface of readers based on ELF.
27 ///
28 /// These are for readers like DWARF and CTF readers that read debug
29 /// information describing binaries in the ELF format.
30 ///
31 /// This interface extends the elf_reader::reader interface and thus
32 /// also provides facilities for reading ELF binaries.
33 class elf_based_reader : public elf::reader
34 {
35   struct priv;
36   priv* priv_;
37 
38   elf_based_reader() = delete;
39 
40 protected:
41 
42   /// Readers that implement this interface must provide a factory
43   /// method to create a reader instance as this constructor is
44   /// protected.
45   elf_based_reader(const std::string& elf_path,
46 		   const vector<char**>& debug_info_root_paths,
47 		   environment& env);
48 public:
49 
50   ~elf_based_reader();
51 
52   virtual void
53   reset(const std::string& elf_path,
54 	const vector<char**>& debug_info_root_paths);
55 
56   virtual ir::corpus_sptr
57   read_and_add_corpus_to_group(ir::corpus_group& group,
58 			       fe_iface::status& status);
59   virtual void
60   initialize(const string&		elf_path,
61 	     const vector<char**>&	debug_info_root_paths,
62 	     bool			load_all_types,
63 	     bool			linux_kernel_mode) = 0;
64 };//end class elf_based_reader
65 
66 typedef std::shared_ptr<elf_based_reader> elf_based_reader_sptr;
67 }// namespace
68 #endif
69