From patchwork Sun Mar 19 22:38:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 19654 Received: (qmail 55110 invoked by alias); 19 Mar 2017 22:39:00 -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 55094 invoked by uid 89); 19 Mar 2017 22:38:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2379 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 19 Mar 2017 22:38:57 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67996F6231 for ; Sun, 19 Mar 2017 22:38:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 67996F6231 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jan.kratochvil@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 67996F6231 Received: from host1.jankratochvil.net (ovpn-117-182.ams2.redhat.com [10.36.117.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7B2571D5E; Sun, 19 Mar 2017 22:38:57 +0000 (UTC) Date: Sun, 19 Mar 2017 23:38:53 +0100 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: [patchv3] Fix warning: Invalid entry in .debug_gdb_scripts section Message-ID: <20170319223853.GA16240@host1.jankratochvil.net> References: <20170316154110.GA20969@host1.jankratochvil.net> <0bb6a990-7213-34dc-7b74-854e07bd9fe4@redhat.com> <20170316173913.GA5173@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170316173913.GA5173@host1.jankratochvil.net> User-Agent: Mutt/1.8.0 (2017-02-23) On Thu, 16 Mar 2017 18:39:13 +0100, Jan Kratochvil wrote: > OK, I will update the patch later. Included. OK for check-in? Jan gdb/ChangeLog 2017-03-16 Jan Kratochvil * auto-load.c (auto_load_section_scripts): Check SEC_HAS_CONTENTS. gdb/testsuite/ChangeLog 2017-03-19 Jan Kratochvil * gdb.python/py-section-script.exp (sepdebug): New testcases. 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)) diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp index 52e1e3e..cf6b631 100644 --- a/gdb/testsuite/gdb.python/py-section-script.exp +++ b/gdb/testsuite/gdb.python/py-section-script.exp @@ -114,3 +114,38 @@ gdb_test "continue" ".*Breakpoint.*" gdb_test "print ss" " = a=<1> b=<2>" gdb_test "test-cmd 1 2 3" "test-cmd output, arg = 1 2 3" + + +with_test_prefix "sepdebug" { + gdb_exit + + set result [catch "exec eu-strip -g -f ${binfile}.debug ${binfile}" output] + verbose "result is $result" + verbose "output is $output" + if {$result != 0 || $output != ""} { + unsupported "cannot produce separate debug info files" + return + } + + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + + gdb_test_no_output "set auto-load safe-path ${remote_python_file}:${binfile}" \ + "set auto-load safe-path" + set test "load sepdebug" + gdb_test_multiple "file $binfile" $test { + -re "\r\nwarning: Invalid entry in \\.debug_gdb_scripts section.*\r\n$gdb_prompt $" { + fail $test + } + -re "done\\.\r\n$gdb_prompt $" { + pass $test + } + } + + # Again, with a regexp this time. + gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*" + + # Again, with a regexp that matches no scripts. + gdb_test "info auto-load python-scripts no-script-matches-this" \ + "No auto-load scripts matching no-script-matches-this." +}