Message ID | 20170316173913.GA5173@host1.jankratochvil.net |
---|---|
State | New, archived |
Headers |
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: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> 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 <gdb-patches@sourceware.org>; 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 <jkratoch@redhat.com> X-Google-Original-From: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Thu, 16 Mar 2017 18:39:13 +0100 To: Pedro Alves <palves@redhat.com> 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-Type: multipart/mixed; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline In-Reply-To: <0bb6a990-7213-34dc-7b74-854e07bd9fe4@redhat.com> User-Agent: Mutt/1.8.0 (2017-02-23) |
Commit Message
Jan Kratochvil
March 16, 2017, 5:39 p.m. UTC
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 <jan.kratochvil@redhat.com> * auto-load.c (auto_load_section_scripts): Check SEC_HAS_CONTENTS.
Comments
On 03/16/2017 05:39 PM, Jan Kratochvil wrote: > 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 > Well, that's just a tool output, not a self-contained rationale/explanation. With only that, any reviewer will have to guess things that you probably have already discovered while debugging the issue. Josh said that the script is still loaded fine. I guess that's because GDB actually tries to read the script twice, once from rustc, which succeeds, and another time from rustc.debug, which runs into a zero'ed script ID type, which is invalid exactly to catch this type of problems. >> Shouldn't we be able to load scripts from debug-only sections? > > I agree there is better to use SEC_HAS_CONTENTS, right? Yes, I think so. Thanks, Pedro Alves
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))