From patchwork Thu Mar 16 17:39:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 19615 Received: (qmail 36529 invoked by alias); 16 Mar 2017 17:39:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 36515 invoked by uid 89); 16 Mar 2017 17:39:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2 spammy=ams, debug-only, H*f:sk:0bb6a99, Shouldn't X-HELO: mail-wr0-f175.google.com Received: from mail-wr0-f175.google.com (HELO mail-wr0-f175.google.com) (209.85.128.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Mar 2017 17:39:17 +0000 Received: by mail-wr0-f175.google.com with SMTP id l37so37149528wrc.1 for ; Thu, 16 Mar 2017 10:39:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=p+SY43nSVi7Srg4nMMoLHHn/1cm7lbH8qcL2gAiPWM0=; b=P8CL4ywXG3SyyffsY5NryPohY5xtROda8ZikBiY7I64CGMpKWf2dIVtkMv2AyWkMps jH4lGrGTFJeApS9PONsnt9yBA196J6OhXD3TQ5IQOBg3pL/tRwFtAkiSkjEbVw6GP1hH NzXjxZPGZHBvW20+8hQoXIlPH3H50h8ZQ/R9IpQMISENQxnOfooFSJcLbh5TeE6VISW3 yXQI8HS4OIMmNu9AH7sffTatIw4juuBtyRTUDfx8uoNaQbQg9CmzyYfx5COaXtHCb5m1 /00T2ArYpgDn+EajJoC8qHerHl9NjAoQ3Rv/1EuTCWrhmwzJaJgzqgLwNELVOl/pCQiU OYWQ== X-Gm-Message-State: AFeK/H0HV5GLqKrdeD/cjMwi5zUU8KxlknWAV8CCzbLb10jfSHopxGphqpXEFgs+Gc7c4/f5 X-Received: by 10.223.134.229 with SMTP id 34mr9215786wry.104.1489685955852; Thu, 16 Mar 2017 10:39:15 -0700 (PDT) Received: from host1.jankratochvil.net (host1.jankratochvil.net. [2a02:2b88:2:1::3b57:1]) by smtp.gmail.com with ESMTPSA id l10sm7008043wrb.3.2017.03.16.10.39.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Mar 2017 10:39:15 -0700 (PDT) From: Jan Kratochvil X-Google-Original-From: Jan Kratochvil Date: Thu, 16 Mar 2017 18:39:13 +0100 To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [patch] Fix warning: Invalid entry in .debug_gdb_scripts section Message-ID: <20170316173913.GA5173@host1.jankratochvil.net> References: <20170316154110.GA20969@host1.jankratochvil.net> <0bb6a990-7213-34dc-7b74-854e07bd9fe4@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <0bb6a990-7213-34dc-7b74-854e07bd9fe4@redhat.com> User-Agent: Mutt/1.8.0 (2017-02-23) On Thu, 16 Mar 2017 18:03:41 +0100, Pedro Alves wrote: > I don't think you've supplied enough rationale. I forgot to copy-paste prepared: /usr/bin/rustc Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [15] .debug_gdb_scripts PROGBITS 00000000000008ed 0008ed 000022 00 AMS 0 0 1 /usr/lib/debug/usr/bin/rustc.debug Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [15] .debug_gdb_scripts NOBITS 00000000000008ed 000280 000022 00 AMS 0 0 1 > Shouldn't we be able to load scripts from debug-only sections? I agree there is better to use SEC_HAS_CONTENTS, right? > A testcase would indeed be good to have. OK, I will update the patch later. Jan gdb/ChangeLog 2017-03-16 Jan Kratochvil * auto-load.c (auto_load_section_scripts): Check SEC_HAS_CONTENTS. diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 56914c8..edaf264 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -1174,7 +1174,8 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name) bfd_byte *data = NULL; scripts_sect = bfd_get_section_by_name (abfd, section_name); - if (scripts_sect == NULL) + if (scripts_sect == NULL + || (bfd_get_section_flags (abfd, scripts_sect) & SEC_HAS_CONTENTS) == 0) return; if (!bfd_get_full_section_contents (abfd, scripts_sect, &data))