public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] ir: Add new environment::get_type_id_from_type
@ 2023-04-14 13:38 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2023-04-14 13:38 UTC (permalink / raw)
  To: libabigail

Hello,

While debugging some issues, I felt the need to easily get the type-id
from a given ir::type_base* from within the debugger.

I have thus added this new environment::get_type_id_from_type member
function.

	* include/abg-ir.h (environment::get_pointer_type_id_map): Declare
	...
	* src/abg-ir.cc (environment::get_pointer_type_id_map): ... this
	new member function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 include/abg-ir.h |  3 +++
 src/abg-ir.cc    | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/include/abg-ir.h b/include/abg-ir.h
index d25e3a8c..263bff5e 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -253,6 +253,9 @@ public:
   string
   get_type_id_from_pointer(uintptr_t ptr);
 
+  string
+  get_type_id_from_type(const type_base *ptr);
+
   uintptr_t
   get_canonical_type_from_type_id(const char*);
 #endif
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 64dfee79..4da8c461 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -3944,6 +3944,25 @@ environment::get_type_id_from_pointer(uintptr_t ptr)
   return "";
 }
 
+/// Getter of the type-id that corresponds to the value of an
+/// abigail::ir::type_base that was created from the abixml reader.
+///
+/// That value is retrieved from the map returned from
+/// environment::get_pointer_type_id_map().
+///
+/// That map is populated at abixml reading time, (by build_type())
+/// when a given XML element representing a type is read into a
+/// corresponding abigail::ir::type_base.
+///
+/// This is used only for the purpose of debugging the
+/// self-comparison process.  That is, when invoking "abidw
+/// --debug-abidiff".
+///
+/// @return the type-id strings that corresponds
+string
+environment::get_type_id_from_type(const type_base *t)
+{return get_type_id_from_pointer(reinterpret_cast<uintptr_t>(t));}
+
 /// Getter of the canonical type of the artifact designated by a
 /// type-id.
 ///
-- 
2.39.1


-- 
		Dodji


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

only message in thread, other threads:[~2023-04-14 13:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 13:38 [PATCH, applied] ir: Add new environment::get_type_id_from_type 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).