From patchwork Wed Jan 21 09:44:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 4746 Received: (qmail 11583 invoked by alias); 21 Jan 2015 09:44:50 -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 11562 invoked by uid 89); 21 Jan 2015 09:44:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 21 Jan 2015 09:44:46 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 326751164B9; Wed, 21 Jan 2015 04:44:44 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id h1j7xyn1YVX1; Wed, 21 Jan 2015 04:44:44 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id D75AA116472; Wed, 21 Jan 2015 04:44:43 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id C88F848E89; Wed, 21 Jan 2015 10:44:40 +0100 (CET) Date: Wed, 21 Jan 2015 10:44:40 +0100 From: Joel Brobecker To: Doug Evans Cc: gdb-patches Subject: Re: FYI: [python/Ada] gdb.lookup_type fails to looking primitive type Message-ID: <20150121094440.GA24515@adacore.com> References: <1421083588-927-1-git-send-email-brobecker@adacore.com> <20150113094426.GE8167@adacore.com> <20150114050051.GH8167@adacore.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150114050051.GH8167@adacore.com> User-Agent: Mutt/1.5.21 (2010-09-15) > > Not that I'm expecting anyone to go back and change things, > > but maybe for future reference it'd be better to print the result > > and record the expected output, instead of expecting no output. > > Performing a lookup action, and then expecting no output, > > is just too confusing to me. > > The only issue I have with that is that I'd like to do something > whose behavior is defined. Looking at the GDB manual, I can't see > anything said about what to expect when converting a gdb.Type to > a string... If we clarify that, I have no problem adding the extra > "print" in the test. I tried looking into the code as to what the semantics of printing the gdb.Type object should be, and couldn't figure it out. It seems to be printing the type name, but I'm not sure why. So, instead of waiting for a clarification that may never come, I propose the following. gdb/ChangeLog: * gdb.python/py-lookup-type.exp (test_lookup_type): Change the second test to print the name attribute of value returned by the call to gdb.lookup_type, and adjust the expected output accordingly. Tested on x86_64-linux. Does this change answer your concerns? From eea862a6a45741d97bca981b7c8356782e02c0a3 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 21 Jan 2015 10:29:09 +0100 Subject: [PATCH] check gdb.lookup_type return value in gdb.python/py-lookup-type.exp This further improves this testcase to check the output of our calls to gdb.lookup_type. gdb/ChangeLog: * gdb.python/py-lookup-type.exp (test_lookup_type): Change the second test to print the name attribute of value returned by the call to gdb.lookup_type, and adjust the expected output accordingly. --- gdb/testsuite/gdb.python/py-lookup-type.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.python/py-lookup-type.exp b/gdb/testsuite/gdb.python/py-lookup-type.exp index d8fb9e7..46d6fc6 100644 --- a/gdb/testsuite/gdb.python/py-lookup-type.exp +++ b/gdb/testsuite/gdb.python/py-lookup-type.exp @@ -32,7 +32,8 @@ if { [skip_python_tests] } { continue } proc test_lookup_type { lang type_name } { gdb_test_no_output "set language ${lang}" - gdb_test_no_output "python gdb.lookup_type('${type_name}')" \ + gdb_test "python print(gdb.lookup_type('${type_name}').name)" \ + "${type_name}" \ "lookup type ${type_name} using language ${lang}" } -- 1.9.1