libabigail
Loading...
Searching...
No Matches
abg-elf-based-reader.cc
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2// -*- Mode: C++ -*-
3//
4// Copyright (C) 2022-2026 Red Hat, Inc.
5//
6// Author: Dodji Seketeli
7
8/// @file
9///
10/// This file contains the definitions of the entry points of the
11/// generic interface for ELF-based front-ends. The generic interface
12/// for ELF-based front-ends is named @ref elf_based_reader. Examples
13/// of front-ends that implement that interface are @ref
14/// abigail::dwarf_reader::reader and abigail::ctf_raeder::reader.
15
16#include "abg-internal.h"
17
18// <headers defining libabigail's API go under here>
19ABG_BEGIN_EXPORT_DECLARATIONS
20
22
23ABG_END_EXPORT_DECLARATIONS
24// </headers defining libabigail's API>
25namespace abigail
26{
27
28/// The private data of the @ref elf_based_reader type.
29struct elf_based_reader::priv
30{
31
32 void
34 {
35 }
36
37 priv()
38 {
39 initialize();
40 }
41}; // end struct elf_based_reader::priv
42
43/// Constructor of the @erf elf_based_reader type.
44///
45/// @param elf_path the path the ELF file to read.
46///
47/// @param debug_info_root_paths a vector of paths to look into for
48/// split debug info files.
49///
50/// @param env the environment used by the reader.
51elf_based_reader::elf_based_reader(const std::string& elf_path,
52 const vector<string>& debug_info_root_paths,
53 environment& env)
54 : elf::reader(elf_path, debug_info_root_paths, env),
55 priv_(new priv)
56{
57 priv_->initialize();
58}
59
60/// Destructor of the reader.
63
64/// (re)Initialize) the resources used by the current reader.
65///
66/// This frees the resources of the current reader and gets it ready
67/// to read data from another ELF file.
68///
69/// @param elf_path the path to the new ELF file to consider.
70///
71/// @param debug_info_root_paths a vector of paths to look into for
72/// split debug info files.
73void
74elf_based_reader::initialize(const std::string& elf_path,
75 const vector<string>& debug_info_root_paths)
76{
78 priv_->initialize();
79}
80
81/// Read an ABI corpus and add it to a given corpus group.
82///
83/// @param group the corpus group to consider. The new corpus is
84/// added to this group.
85///
86/// @param status output parameter. This is the status of the
87/// creation of the current ABI corpus. It's set by this function iff
88/// a non-nil @ref corpus_sptr is returned.
89///
90/// @return the resulting ABI corpus.
91ir::corpus_sptr
94{
95 ir::corpus_sptr corp = read_corpus(status);
96 group.add_corpus(corp);
97 return corp;
98}
99
100} // end namespace abigail
This file contains the declarations for an elf-based. DWARF and CTF readers can inherit this one.
const vector< string > & debug_info_root_paths() const
Getter of the vector of directory paths to look into for split debug information files.
virtual void initialize(const std::string &elf_path, const vector< string > &debug_info_roots)
Re-initialize the resources used by the current elf::reader type.
virtual ir::corpus_sptr read_corpus(status &status)
Read the ELF information associated to the current ELF file and construct an ABI representation from ...
~elf_based_reader()
Destructor of the reader.
virtual void initialize(const std::string &elf_path, const vector< string > &debug_info_root_paths)
(re)Initialize) the resources used by the current reader.
virtual ir::corpus_sptr read_and_add_corpus_to_group(ir::corpus_group &group, fe_iface::status &status)
Read an ABI corpus and add it to a given corpus group.
status
The status of the fe_iface::read_corpus call.
Abstraction of a group of corpora.
Definition abg-corpus.h:470
void add_corpus(const corpus_sptr &)
Add a new corpus to the current instance of corpus_group.
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
Definition abg-ir.h:216
void initialize()
The initialization function of libxml2 abstraction layer. This function must be called prior to using...
Toplevel namespace for libabigail.