public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Cc: dodji@redhat.com
Subject: [PATCH] abicompat: Port this to the multi-front-end architecture
Date: Fri, 01 Mar 2024 18:22:15 +0100	[thread overview]
Message-ID: <87msrh7tq0.fsf@redhat.com> (raw)

Hello,

I forgot to port abicompat to the multi-front-end architecture that
was put in place a while ago.  Namely, all the other tools now use
abigail::tools_utils::create_best_elf_based_reader to create the best
elf-based reader depending on if they are given DWARF, BTF or CTF
debug information.

This patch make abicompat use
abigail::tools_utils::create_best_elf_based_reader too.

	* tools/abicompat.cc (read_corpus): Use
	abigail::tools_utils::create_best_elf_based_reader to create the
	right reader depending on the debug information at hand.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applying to the master branch
---
 tools/abicompat.cc | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/tools/abicompat.cc b/tools/abicompat.cc
index 9e264b0e..c1e658b2 100644
--- a/tools/abicompat.cc
+++ b/tools/abicompat.cc
@@ -53,6 +53,8 @@ using std::ofstream;
 using std::vector;
 using std::shared_ptr;
 
+using abigail::tools_utils::create_best_elf_based_reader;
+
 using namespace abigail;
 
 using abigail::tools_utils::emit_prefix;
@@ -672,19 +674,21 @@ read_corpus(options			opts,
       break;
     case abigail::tools_utils::FILE_TYPE_ELF:
       {
+	corpus::origin requested_fe_kind = corpus::DWARF_ORIGIN;
 #ifdef WITH_CTF
 	if (opts.use_ctf)
-	  {
-	    rdr = ctf::create_reader(path, env);
-	    ABG_ASSERT(rdr);
-
-	    retval = ctf::read_corpus(rdr.get(), status);
-	  }
-	else
+	  requested_fe_kind = corpus::CTF_ORIGIN;
 #endif
-	  retval = dwarf::read_corpus_from_elf(path, di_roots, env,
-					       /*load_all_types=*/opts.weak_mode,
-					       status);
+#ifdef WITH_BTF
+	if (opts.use_btf)
+	  requested_fe_kind = corpus::BTF_ORIGIN;
+#endif
+
+	rdr = create_best_elf_based_reader (path, di_roots, env, requested_fe_kind,
+					    /*load_all_types=*/opts.weak_mode,
+					    status);
+	ABG_ASSERT(rdr);
+	retval = rdr->read_corpus(status);
       }
       break;
     case abigail::tools_utils::FILE_TYPE_XML_CORPUS:
-- 
2.39.3


-- 
		Dodji


                 reply	other threads:[~2024-03-01 17:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msrh7tq0.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).