From patchwork Wed Oct 26 05:07:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 11062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp61813wru; Tue, 25 Oct 2022 22:07:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GaNvDW1+KgUwxnwVXu/UaBn+2C4UKdKI1EdGafhxC+G+0x7nXuqXayJ1dtUtJAjSch0Ov X-Received: by 2002:a05:6402:3487:b0:45d:2674:d187 with SMTP id v7-20020a056402348700b0045d2674d187mr38884018edc.386.1666760858528; Tue, 25 Oct 2022 22:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666760858; cv=none; d=google.com; s=arc-20160816; b=h1rc0U22QarzGv0P1vX7CWZsKy7Cwal6+YjXu47ZzpMxjxADGsbgXVttZ/rKeVe1Um Xt5j305BPaSQG2CPfPIqqtgBkvSuPu665TosXk8CikIdGEtT2+rOiFFZx4+x8HjACxbb kIdyts0YDnWNIXa3m4LdqG3MZLt+hGyuuGQEgfy4te7FlBHN6CduWAQSKpVGVp5OdK07 cFNHgr/lvCWVwrJqE7gaQK9opoc6oXqfbAQKmbIPY+D8x+a4N+pfl1ZjBcHy23VrKdYf 1vEh07+QXIk5RQfah8SixNXp6FYHDDGgSJDX+EAzgl0kCl6+SKMyM9f/FPRCsfJUHFoP QwZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=SgrffpC0AkEYvBwQMhhw91Pl6kKKDbqlOTetEAe2r3A=; b=bh0aXdCnOsWRJoQd+H4PayO/KXATRX4arURHY/PPWf0tI91uuOzNj3JHEwTN2oFQuc dAskDJJOAWm6LuSlLLg2zjoedO0I5vieCq7eTmhqUGwTe3RleIFzizEuBJBmX8UoMXTu yLtwjc7a3GVCtPm2GtSJsji6wMQzn6h/opgRsBL8DxaSsEL1W8AoDvAVY+MMPazhEB+P nsDqss3mlXqj22TCrR+mqBHtkqiThP/pOrDkA4kCB9Pq9TEDoN2py8l3tHIR0gWi5GvT DprbzjahjgvbEbIpFXl4omW0lSYrBbfvh2n+VAWSEmEg0/gf+07iSl6mdRtFWbZ+BfBu WhlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=u2LUAiPR; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c12-20020a0564021f8c00b00459b3e9983esi4546643edc.113.2022.10.25.22.07.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 22:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=u2LUAiPR; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B654385E02D for ; Wed, 26 Oct 2022 05:07:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B654385E02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666760857; bh=SgrffpC0AkEYvBwQMhhw91Pl6kKKDbqlOTetEAe2r3A=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=u2LUAiPRdAfIdGntpc2c8flfChNiBGoC68ZAHC6azCgwungCWnzEvI58/SOk6FL5n EKnaDbkajF3//I6Uo9ajqvBATJ4BziYsqdUHv2f8u7a9oKUWQsj61Udm2R71nWpSww WsnHDSfbCMcK1tvSpPVo6iZMaicFT1G4K2yIS+wI= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 875DD385735F for ; Wed, 26 Oct 2022 05:07:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 875DD385735F Received: by mail-pg1-x535.google.com with SMTP id q71so13750395pgq.8 for ; Tue, 25 Oct 2022 22:07:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SgrffpC0AkEYvBwQMhhw91Pl6kKKDbqlOTetEAe2r3A=; b=7cASyIazrSW6zC0+ZzA6gq2L7lOsjzATD0/1aNE16UTElWOevTYSJGljRRhJia9jgZ 6oT75ViejXiFEjHX5Ee5xKsZYHhiNclVrtf6HnNp2SnSzPrFnV1P1YpWENB1JuMy2Vdr 8TzItw91v8kBDBC78jkkq+/mmyFMQ8wqjb4me8uRM6K06JXGO+HlRT/YjJeFcwSG2Joc rhTIZjyyk8f0mNwFLC5ITQ04DMGC8Ge5m9gdlDT7thFkiXnbIIo6vS1SbepLxZDceqeV Li85mPe1N6CCnc2rRwVm3RxvgRFo00GiaQIStLAfMDQ7cuAM2SbZfG+d3XAhSQTExwLA aKMQ== X-Gm-Message-State: ACrzQf1l8jGdvqaMbgM2vxK0GHrhHn2J+BrZCgfbDXNbD7WnPAIFNZqo iKOevRNz9ah5TD2Ma/TwYBlsX+zsKPM= X-Received: by 2002:a05:6a00:18a8:b0:56c:702a:5f49 with SMTP id x40-20020a056a0018a800b0056c702a5f49mr111750pfh.1.1666760847221; Tue, 25 Oct 2022 22:07:27 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id c11-20020a170902d48b00b001869f2120a6sm2040403plg.108.2022.10.25.22.07.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 22:07:23 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 672F811407A8; Wed, 26 Oct 2022 15:37:19 +1030 (ACDT) Date: Wed, 26 Oct 2022 15:37:19 +1030 To: binutils@sourceware.org Subject: PR29720, objdump -S crashes if build-id is missing Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3036.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747725433881806591?= X-GMAIL-MSGID: =?utf-8?q?1747725433881806591?= PR 29720 * objdump.c (slurp_file): Don't call debuginfod_find_source when build_id is NULL. diff --git a/binutils/objdump.c b/binutils/objdump.c index f7b4695c3e8..a4ab0dbd66c 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -1879,17 +1879,19 @@ slurp_file (const char * fn, #if HAVE_LIBDEBUGINFOD if (fd < 0 && use_debuginfod && fn[0] == '/' && abfd != NULL) { - unsigned char * build_id; - debuginfod_client * client; + unsigned char *build_id = get_build_id (abfd); - client = debuginfod_begin (); - if (client == NULL) - return NULL; + if (build_id) + { + debuginfod_client *client = debuginfod_begin (); - build_id = get_build_id (abfd); - fd = debuginfod_find_source (client, build_id, 0, fn, NULL); - free (build_id); - debuginfod_end (client); + if (client) + { + fd = debuginfod_find_source (client, build_id, 0, fn, NULL); + debuginfod_end (client); + } + free (build_id); + } } #endif