From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTPS id ADCBC3858402 for ; Wed, 17 Nov 2021 21:16:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ADCBC3858402 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-501-b515OczrMQq_zQSitVAgsg-1; Wed, 17 Nov 2021 16:16:25 -0500 X-MC-Unique: b515OczrMQq_zQSitVAgsg-1 Received: by mail-qv1-f72.google.com with SMTP id q2-20020a05621419e200b003aeeeff5417so3879795qvc.9 for ; Wed, 17 Nov 2021 13:16:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vmjRFeLwORW22Eqrl50V8qLGWNiJZELvuvFD5vPusPg=; b=vV65EDZwFZSrJBbrfZ8h6HjiWLaGXnqTJvRibk7t0dVrMkw66GNy22OqwmYynpN7+k pVX18auUdd16oz1sAMtmWYvLT94QAiPmY5H8m/zRAjhkb7GqVYXJ8sAQcrdC7lQV69/p RwUqqKI8ggs5gxgNKxOw/Oqf3HkcQ22DbLyKwaQkmr54b3CEUt+nA7/AjWZnRM3n/SzK TiNGNCwyXeC0m8PHTWkJL2gciZmrk27ILHaVZZwikpSItYPKdd8cEoGC1JxO2WE7/dZz JMBo4G9ksJPmgtyJ2Wwt3RmppqeklBVlYSGNqJYLFCTOa6yQu9Csa7IZpepjcWJNdKI0 IS8w== X-Gm-Message-State: AOAM533SPr2DFJcHjzZfqKK8l0Z6hKAg+ToBipcfoSZfm5fsF7pVSlgH divJcWQNYh/3dTsJaDaVp5JrCIpgkDBjcG++QlOhyH8+lBCp2z1JUoWeBH4Yn3U7JZSFa5kziMr PjJ7xt2ZRujAfMeYQC9Lwug0hfXTx7NhAHfEB X-Received: by 2002:a05:622a:1190:: with SMTP id m16mr20019199qtk.287.1637183784785; Wed, 17 Nov 2021 13:16:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX2HRDnZ5C6HYrTlOatnHItOgLBGmbv6xgCYOiU435oxQwYsixtM2HIVx6+rjmFtpPr+IgZPfJVbnfJ1IrUSM= X-Received: by 2002:a05:622a:1190:: with SMTP id m16mr20019126qtk.287.1637183784253; Wed, 17 Nov 2021 13:16:24 -0800 (PST) MIME-Version: 1.0 References: <20211117032441.719270-1-amerey@redhat.com> <877dd6euil.fsf@tromey.com> In-Reply-To: <877dd6euil.fsf@tromey.com> From: Aaron Merey Date: Wed, 17 Nov 2021 16:16:13 -0500 Message-ID: Subject: Re: [PATCH 2/3] gdb: Add soname to build-id mapping for corefiles To: Tom Tromey Cc: Aaron Merey via Gdb-patches , Simon Marchi , lsix@lancelotsix.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2021 21:16:28 -0000 Hi Tom, On Wed, Nov 17, 2021 at 9:29 AM Tom Tromey wrote: > If re-opening and then calling bfd_check_format sets the flags > correctly, then I suppose the question is just why the call in > build_file_mappings isn't doing that: > > if (bfd == nullptr || !bfd_check_format (bfd, bfd_object)) > > Possibly the answer is that corelow passes "binary" as the target, but > your code does: > > Aaron> + gdb_bfd_ref_ptr abfd = gdb_bfd_open (bfd->filename, gnutarget); > > But then I wonder why "binary" is appropriate in corelow. Yes it would be much better if "bfd" was simply initialised with the proper fields. Corelow treats bfds in a target-agnostic manner but this shouldn't preclude having accurate information in "bfd". We could force "bfd" to have a format of bfd_unknown and let bfd_check_format figure out the correct format and fields. This is basically what I do in gdb_bfd_read_elf_soname. But really there should be a way to just initialise "bfd" with completely accurate contents at the time of creation. If this doesn't exist maybe now is the time to add it. Aaron