From patchwork Fri Apr 14 13:38:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 67738 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 54673385802F for ; Fri, 14 Apr 2023 13:38:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 54673385802F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681479521; bh=pyy7eyjZDlKCjDVqk7/YUD+uxmOSnxM0FCEXUPF6Cf8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=xAF4bEBrj5Rd5Dy/pSDJqZ07vANtEy1rrQXyXUASt/ulFHzot+PRzkZcmUnx8k3jQ 2s63epzmPnzIhdUtyJI0hr0Px6n5lgFjWPRLSnkohIKXkSpPmO16NYplJ9qNqMzonU UftLp7IQGWHF7ZQCWC+EIFbtTVuZ03V9vMIQZt8I= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 7312C3858C1F for ; Fri, 14 Apr 2023 13:38:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7312C3858C1F Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-oGBd5XVjMf-ngvcUx2xmOA-1; Fri, 14 Apr 2023 09:38:34 -0400 X-MC-Unique: oGBd5XVjMf-ngvcUx2xmOA-1 Received: by mail-qt1-f198.google.com with SMTP id y5-20020a05622a004500b003e3979be6abso12869944qtw.12 for ; Fri, 14 Apr 2023 06:38:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681479514; x=1684071514; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pyy7eyjZDlKCjDVqk7/YUD+uxmOSnxM0FCEXUPF6Cf8=; b=ipIBTfct/KFzK/1GoMCooul0rrSRLbH4AuHFalCBJnYqE0pX19WfCaOLnU2idr3Ft7 HUY12lOR0gEEd+ZEWexMPT20D1cCcB2yxqsI76GeKGc2CBfOklk1PBbEC9tX0sveOyAZ 3OVrONmhs963GDw8XIqHU+GBDWHAoHLBmRYiSK+BX5FdW70NcMyxIy5sCP/NY69nfHUG CL9OmVWiQfA9KC2h0YT+muxOSC7dV5Y3pl52Lh2U/m4WX3pcyzRCqypWqQ6hQv19mW0V JThJaBe1yThUUqsbSyTWG0r5NhhzYE/9FWWrmVTCKW5ly/HsEMgqNK3FWBF5FXiuSbEz 5O4Q== X-Gm-Message-State: AAQBX9e5XWYwBFQ2baYnczDbEe7FTqXS5CqL0vLFjmLvXfN/p1xIGwYL 82QMGL1ulbnwDRji/cp7vv+NXXjK0omCTtE/n5ivKwb4g7h6KjgkpFH937xm9iW764HfnhjoCGc Qx2c9yO+dEacpEYnHdcNCwb0m89cEG4FPGseH40QclpQdvF29vJ7sJ3LTkT0Op+/YvkqN9laZKQ xq X-Received: by 2002:a05:6214:407:b0:56e:a9c6:d2c6 with SMTP id z7-20020a056214040700b0056ea9c6d2c6mr4200698qvx.6.1681479513832; Fri, 14 Apr 2023 06:38:33 -0700 (PDT) X-Google-Smtp-Source: AKy350YzO9z8hP5Dki6o8ia3KdpA7qO97iOJjvjwEUzln17G8gaunup/i1eFhopnRiIKQoEw1R0+6g== X-Received: by 2002:a05:6214:407:b0:56e:a9c6:d2c6 with SMTP id z7-20020a056214040700b0056ea9c6d2c6mr4200670qvx.6.1681479513514; Fri, 14 Apr 2023 06:38:33 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id i2-20020a05620a404200b007468765b411sm1228647qko.45.2023.04.14.06.38.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 06:38:33 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 5C601BF0EA; Fri, 14 Apr 2023 15:38:31 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Add new environment::get_type_id_from_type Organization: Red Hat / France X-Operating-System: CentOS Stream release 9 X-URL: http://www.redhat.com Date: Fri, 14 Apr 2023 15:38:31 +0200 Message-ID: <87h6titwh4.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "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 --- 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(t));} + /// Getter of the canonical type of the artifact designated by a /// type-id. ///