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-2023 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.
60 {
61 environment& env;
62 bool load_in_linux_kernel_mode = false;
63 bool load_all_types = false;
64 bool drop_undefined_syms = false;
65 bool show_stats = false;
66 bool do_log = false;
67 bool leverage_dwarf_factorization = true;
68 bool assume_odr_for_cplusplus = true;
70
71 };// font_end_iface::options_type
72
73 fe_iface(const std::string& corpus_path, environment& e);
74
75 virtual ~fe_iface();
76
77 void
78 reset(const std::string& corpus_path, environment& e);
79
80 const options_type&
81 options() const;
82
84 options();
85
86 const std::string&
87 corpus_path() const;
88
89 void
90 corpus_path(const std::string&);
91
92 const string&
93 dt_soname() const;
94
95 void
96 dt_soname(const string&);
97
98 bool
100
102 suppressions();
103
105 suppressions() const;
106
107 void
109
110 void
112
113 corpus_sptr
114 corpus();
115
116 const corpus_sptr
117 corpus() const;
118
119 corpus_group_sptr&
120 corpus_group();
121
122 const corpus_group_sptr&
123 corpus_group() const;
124
125 void
126 corpus_group(const ir::corpus_group_sptr& cg);
127
128 bool
129 has_corpus_group() const;
130
131 corpus_sptr
133
134 bool
136
137 corpus_sptr
139
140 void
142
143 void
145
146 virtual ir::corpus_sptr
147 read_corpus(status& status) = 0;
148}; //end class fe_iface
149
150typedef shared_ptr<fe_iface> fe_iface_sptr;
151
152std::string
154
157
160
163
166
167}// end namespace abigail
168#endif // __ABG_FE_IFAC_H__
Types of the main internal representation of libabigail.
The base class of all libabigail front-ends: The Front End Interface.
Definition: abg-fe-iface.h:29
bool has_corpus_group() const
Test if there is a corpus group being built.
status
The status of the fe_iface::read_corpus call.
Definition: abg-fe-iface.h:38
@ STATUS_NO_SYMBOLS_FOUND
This status is for when the symbols of the ELF binaries could not be read.
Definition: abg-fe-iface.h:54
@ STATUS_DEBUG_INFO_NOT_FOUND
This status is for when the debug info could not be read.
Definition: abg-fe-iface.h:46
@ STATUS_ALT_DEBUG_INFO_NOT_FOUND
This status is for when the alternate debug info could not be found.
Definition: abg-fe-iface.h:50
@ STATUS_OK
This status is for when the call went OK.
Definition: abg-fe-iface.h:43
@ STATUS_UNKNOWN
The status is in an unknown state.
Definition: abg-fe-iface.h:40
const options_type & options() const
Getter of the the options of the current Front End Interface.
Definition: abg-fe-iface.cc:95
void maybe_add_fn_to_exported_decls(const function_decl *fn)
Try and add the representation of the ABI of a function to the set of exported declarations of the cu...
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.
void maybe_add_var_to_exported_decls(const var_decl *var)
Try and add the representation of the ABI of a variable to the set of exported declarations of the cu...
corpus_group_sptr & corpus_group()
Getter for the ABI corpus group being built by 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 reset(const std::string &corpus_path, environment &e)
Re-initialize the current Front End.
Definition: abg-fe-iface.cc:84
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.
Definition: abg-fe-iface.cc:74
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:140
Abstraction for a function declaration.
Definition: abg-ir.h:3024
Abstracts a variable declaration.
Definition: abg-ir.h:2921
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.
vector< suppression_sptr > suppressions_type
Convenience typedef for a vector of suppression_sptr.
Definition: abg-fwd.h:1533
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.
Definition: abg-fe-iface.h:60