libabigail
Loading...
Searching...
No Matches
abg-fe-iface.h
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 declarations for the @ref fe_iface a.k.a
11/// "Front End Interface".
12
13#ifndef __ABG_FE_IFACE_H__
14#define __ABG_FE_IFACE_H__
15
16#include "abg-ir.h"
17#include "abg-suppression.h"
18
19namespace abigail
20{
21
22/// The base class of all libabigail front-ends: The Front End Interface.
23///
24/// A front end reads a given type of binary format and constructs a
25/// libagbigail internal representation from it.
26///
27/// The middle-end then manipulates that IR.
29{
30protected:
31 struct priv;
32 priv* priv_;
33
34 public:
35
36 /// The status of the @ref fe_iface::read_corpus call.
37 enum status
38 {
39 /// The status is in an unknown state
41
42 /// This status is for when the call went OK.
44
45 /// This status is for when the debug info could not be read.
47
48 /// This status is for when the alternate debug info could not be
49 /// found.
51
52 /// This status is for when the symbols of the ELF binaries could
53 /// not be read.
55 };
56
57 /// The generic options that control the behaviour of all Front-End
58 /// interfaces.
59 struct options_type
60 {
61 environment& env;
62 bool load_in_linux_kernel_mode = false;
63 bool load_all_types = false;
64 /// If this option is set to true, then the functions and
65 /// variables that have an undefined symbol are going to be
66 /// represented in the IR.
68 bool drop_undefined_syms = false;
69 bool show_stats = false;
70 bool do_log = false;
71 bool leverage_dwarf_factorization = true;
72 bool assume_odr_for_cplusplus = true;
73 // If you add any new data member here, you need to update the
74 // function fe_iface::options_type::operator=() in
75 // abg-fe-iface.cc.
76
77 options_type() = delete;
78 options_type(environment&);
79 options_type& operator=(const options_type&);
80 };// font_end_iface::options_type
81
82 fe_iface(const std::string& corpus_path, environment& e);
83
84 virtual ~fe_iface();
85
86 virtual void
87 initialize(const std::string& corpus_path);
88
89 const options_type&
90 options() const;
91
93 options();
94
95 const std::string&
96 corpus_path() const;
97
98 void
99 corpus_path(const std::string&);
100
101 const string&
102 dt_soname() const;
103
104 void
105 dt_soname(const string&);
106
108 get_environment() const;
109
110 bool
112
114 suppressions();
115
117 suppressions() const;
118
119 void
121
122 void
124
125 corpus_sptr
126 corpus();
127
128 const corpus_sptr
129 corpus() const;
130
131 corpus_group_sptr&
132 corpus_group();
133
134 const corpus_group_sptr&
135 corpus_group() const;
136
137 void
138 corpus_group(const ir::corpus_group_sptr& cg);
139
140 bool
141 has_corpus_group() const;
142
143 corpus_sptr
145
146 bool
148
149 corpus_sptr
151
152 void
154 bool do_update = false);
155
156 void
158
159 virtual ir::corpus_sptr
160 read_corpus(status& status) = 0;
161}; //end class fe_iface
162
163typedef shared_ptr<fe_iface> fe_iface_sptr;
164
165std::string
167
170
173
176
179
180}// end namespace abigail
181#endif // __ABG_FE_IFAC_H__
Types of the main internal representation of libabigail.
bool has_corpus_group() const
Test if there is a corpus group being built.
status
The status of the fe_iface::read_corpus call.
@ STATUS_NO_SYMBOLS_FOUND
This status is for when the symbols of the ELF binaries could not be read.
@ STATUS_DEBUG_INFO_NOT_FOUND
This status is for when the debug info could not be read.
@ STATUS_ALT_DEBUG_INFO_NOT_FOUND
This status is for when the alternate debug info could not be found.
@ STATUS_OK
This status is for when the call went OK.
@ STATUS_UNKNOWN
The status is in an unknown state.
const options_type & options() const
Getter of the the options of the current Front End Interface.
corpus_sptr corpus()
Getter for the ABI corpus being built by the current front-end.
suppr::suppressions_type & suppressions()
Getter of the vector of suppression specifications associated with the current front-end.
environment & get_environment() const
Getter for the environment used by the current instance of fe_iface.
corpus_group_sptr & corpus_group()
Getter for the ABI corpus group being built by the current front-end.
fe_iface(const std::string &corpus_path, environment &e)
Constructor of the type fe_iface.
virtual void initialize(const std::string &corpus_path)
Re-initialize the current Front End.
corpus_sptr should_reuse_type_from_corpus_group()
Return true if the current corpus is part of a corpus group being built and if it's not the main corp...
bool load_in_linux_kernel_mode() const
Test if the input binary is to be considered as a Linux Kernel binary.
void add_var_to_exported_or_undefined_decls(const var_decl_sptr &var)
Add the representation of the ABI of a variable to the set of exported or undefined declarations of t...
bool current_corpus_is_main_corpus_from_current_group()
Test if the current corpus being built is the main corpus of the current corpus group.
virtual ~fe_iface()
Desctructor of the Front End Interface.
void add_fn_to_exported_or_undefined_decls(const function_decl *fn, bool do_update=false)
Add the representation of the ABI of a function to the set of exported declarations or undefined decl...
const std::string & corpus_path() const
Getter of the path to the file which an ABI corpus is to be created for.
const string & dt_soname() const
Getter for the SONAME of the analyzed binary.
corpus_sptr main_corpus_from_current_group()
Return the main corpus from the current corpus group, if any.
void add_suppressions(const suppr::suppressions_type &)
Add suppressions specifications to the set of suppressions to be used during the construction of the ...
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
Definition abg-ir.h:216
Abstraction for a function declaration.
Definition abg-ir.h:3167
visiting_kind operator&(visiting_kind l, visiting_kind r)
The overloaded and operator for visiting_kind.
visiting_kind operator|(visiting_kind l, visiting_kind r)
The overloaded or operator for visiting_kind.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
Definition abg-fwd.h:257
vector< suppression_sptr > suppressions_type
Convenience typedef for a vector of suppression_sptr.
Definition abg-fwd.h:1734
Toplevel namespace for libabigail.
std::string status_to_diagnostic_string(fe_iface::status s)
Return a diagnostic status with english sentences to describe the problems encoded in a given abigail...
The generic options that control the behaviour of all Front-End interfaces.
options_type & operator=(const options_type &)
Assignment operator for options_type.
bool load_undefined_interfaces
If this option is set to true, then the functions and variables that have an undefined symbol are goi...