From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80391 invoked by alias); 7 Oct 2016 18:21:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 80378 invoked by uid 89); 7 Oct 2016 18:21:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,URIBL_RED autolearn=no version=3.3.2 spammy= X-HELO: emailserver1.aplushosting.com Received: from emailserver1.asdf456.com (HELO emailserver1.aplushosting.com) (72.18.207.136) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Fri, 07 Oct 2016 18:20:57 +0000 Received: (qmail 19667 invoked by uid 0); 7 Oct 2016 18:20:54 -0000 Received: from unknown (HELO pinnacle.lan) (70.176.31.165) by emailserver1.asdf456.com with SMTP; Fri, 07 Oct 2016 11:20:54 -0700 Date: Fri, 07 Oct 2016 18:21:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH] Fixup gdb.python/py-value.exp for bare-metal aarch64-elf Message-ID: <20161007112053.70106e51@pinnacle.lan> In-Reply-To: <1475771231-1739-1-git-send-email-lgustavo@codesourcery.com> References: <1475771231-1739-1-git-send-email-lgustavo@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00181.txt.bz2 On Thu, 6 Oct 2016 11:27:11 -0500 Luis Machado wrote: > I noticed that testing aarch64-elf gdb with a physical board > ran into issues with gdb.python/py-value.exp. Further investigation showed > that we were actually trying to dereference a NULL pointer (argv) when trying > to access argv[0]. > > Being bare-metal, argv is not guaranteed to be there. So we need to make sure > argv is sane before accessing argv[0]. > > After fixing that, i noticed we were assuming a value of 1 for argc, which is > also not true, as i see 0 in my tests. > > The following patch fixes up the test program to check for a NULL argv and also > touches the testcase itself to expect either 0 or 1 for argc depending on the > presence of argv, which is something we check early in the test. > > This gives me full passes for aarch64-elf when running gdb.python/py-value.exp > and doesn't regress things on x86-64. > > Ok? FWIW, I've run into some of these same problems while testing against some of the simulators. In such an environment, I think it makes sense to pass in NULL for argv. I'd like to see your patch (or something like it) go in. I think it's easier to adjust the tests than it is to adjust the startup code in a bunch of different places. Kevin