mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-14 05:54:50 +00:00
ddad560153
The DWARF reader is no longer the only ELF-based reader in libabigail: the CTF reader also operates on ELF files. Other ELF-based formats (such as BTF) may also join in the future. These readers share a lot of similarities: they all operate on object files, they fetch debugging information from certain sections, they rely on the symtab of the read object, the debugging info may be in a separated file (for certain formats) and so on. It follows that a lot of logic can be shared among all the ELF-based readers. This patch is oriented to that direction. A new namespace, abigail::elf_reader, is introduced with the goal of holding features and definitions useful for any ELF-based abigail reader. Then all the definitions related to the status resulting from extracting a corpus from an object file (the dwarf_reader::status) are moved to abigail::elf_reader. The utilities and tests are adjusted accordingly. Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com> * include/abg-reader-common.h: New file. * include/abg-dwarf-reader.h (enum status): Move to abg-reader-status.h. (status_to_diagnostic_string): Likewise. (operator|): Likewise. (operator&): Likewise. (operator|=): Likewise. (operator&=): Likewise. Include abg-reader-common.h. * include/Makefile.am (pkginclude_HEADERS): Add abg-elf-reader-common.h. * src/abg-elf-reader-status.cc: New file. * src/abg-dwarf-reader.cc (operator|): Move to abg-elf-reader-common.cc. (operator&): Likewise. (operator|): Likewise. (operator|=): Likewise. (operator&=): Likewise. (status_to_diagnostic_string): Likewise. * src/Makefile.am (libabigail_la_SOURCES): Add elf-reader-common.cc. * src/abg-tools-utils.cc: Use abigail::elf_reader instead of abigail::dwarf_reader for the status definitions. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-symtab.cc: Likewise. * tests/test-ir-walker.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
71 lines
1.5 KiB
C++
71 lines
1.5 KiB
C++
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
// -*- Mode: C++ -*-
|
|
//
|
|
// Copyright (C) 2013-2021 Oracle, Inc.
|
|
//
|
|
// Author: Jose E. Marchesi
|
|
|
|
/// @file
|
|
///
|
|
/// This file contains declarations implementing the different status
|
|
/// in which a corpus read from an ELF file can result. It is used by
|
|
/// the readers based on ELF files, such as DWARF and CTF.
|
|
///
|
|
/// More generally, this file contains declarations related to
|
|
/// facilities shared by the various readers that handle the ELF
|
|
/// format, e.g, the DWARF and CTF realder.
|
|
|
|
#ifndef __ABG_ELF_READER_COMMON_H__
|
|
#define __ABG_ELF_READER_COMMON_H__
|
|
|
|
#include <string>
|
|
|
|
namespace abigail
|
|
{
|
|
|
|
/// The namespace for an ELF based reader.
|
|
namespace elf_reader
|
|
{
|
|
|
|
/// The status of the @ref read_corpus_from_elf() call.
|
|
enum status
|
|
{
|
|
/// The status is in an unknown state
|
|
STATUS_UNKNOWN = 0,
|
|
|
|
/// This status is for when the call went OK.
|
|
STATUS_OK = 1,
|
|
|
|
/// This status is for when the debug info could not be read.
|
|
STATUS_DEBUG_INFO_NOT_FOUND = 1 << 1,
|
|
|
|
/// This status is for when the alternate debug info could not be
|
|
/// found.
|
|
STATUS_ALT_DEBUG_INFO_NOT_FOUND = 1 << 2,
|
|
|
|
/// This status is for when the symbols of the ELF binaries could
|
|
/// not be read.
|
|
STATUS_NO_SYMBOLS_FOUND = 1 << 3,
|
|
};
|
|
|
|
std::string
|
|
status_to_diagnostic_string(status s);
|
|
|
|
status
|
|
operator|(status, status);
|
|
|
|
status
|
|
operator&(status, status);
|
|
|
|
status&
|
|
operator|=(status&, status);
|
|
|
|
status&
|
|
operator&=(status&, status);
|
|
|
|
}// end namespace elf_reader
|
|
|
|
}// end namespace abigail
|
|
|
|
#endif //__ABG_ELF_READER_COMMON_H__
|