public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] abicompat: Port this to the multi-front-end architecture
@ 2024-03-01 17:22 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2024-03-01 17:22 UTC (permalink / raw)
  To: libabigail; +Cc: dodji

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-01 17:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 17:22 [PATCH] abicompat: Port this to the multi-front-end architecture Dodji Seketeli

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).