From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42004 invoked by alias); 13 Apr 2015 23:57:09 -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 41994 invoked by uid 89); 13 Apr 2015 23:57:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-pd0-f201.google.com Received: from mail-pd0-f201.google.com (HELO mail-pd0-f201.google.com) (209.85.192.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 13 Apr 2015 23:57:07 +0000 Received: by pdjg10 with SMTP id g10so7469725pdj.0 for ; Mon, 13 Apr 2015 16:57:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:cc:subject:in-reply-to :references; bh=U7HxP350vVqnQp3ujROxmBS7FYyy9b9Qke5gydrCLbk=; b=hloMneaTIuPDuQl7op8/4pEyA6m24GHLMTHihcLYuv1cWqqB/QPtNSejveaqZXB2CC flb+o8SZBT6EPbtwMGq9psJWqizh/51EhhnfQjTeGyR36E95XN0Fk3lvo3B875IdzuR4 QyoPXkymXBfhd/tfuR/ZhNJJFZdVkVC6EDKlCE0NZ+rnm9IM55HQ1+r3bHcpBGGyRSvI 10QpfL6WqcFf7bQ8Uu7nMO9VxnHtf/8rQ6X6d4551oUTdXClGA0M0O+g/QMHliwn04rb j3x/fvPIXnU9Jc0/9Kz/VXeyw2xpn5A152aXVOF/dcFYu9G5ai36JU4twvG3qoKUXhd5 tFAA== X-Gm-Message-State: ALoCoQn6Z7MTkBS+9r/U8pYMg/zbsob/9AyYgkR6EM4HUudTakRJjvQJ5GRm63Xl0mryP3DrDYpl72VVMcO6KC8GK/VdhvXFoBKldJsdxcbX8xLv8DLa72+pVh5wHWKoVNcteV6mIKEYSTHpRWOiLL2Jz1hhl4zKSjgtFs/Q3Sy6/rHsK3+6DSY= X-Received: by 10.66.186.172 with SMTP id fl12mr23205695pac.10.1428969426024; Mon, 13 Apr 2015 16:57:06 -0700 (PDT) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id u27si459783yhu.4.2015.04.13.16.57.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 16:57:05 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com ([172.17.128.107]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id mbUvKHos.1; Mon, 13 Apr 2015 16:57:05 -0700 From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21804.22480.660123.561679@ruffy2.mtv.corp.google.com> Date: Mon, 13 Apr 2015 23:57:00 -0000 To: eliz@gnu.org Cc: Alexander Smundak , gdb-patches Subject: Re: RFC: Python gdb.Type method returning optimized out gdb.Value In-Reply-To: References: <21796.6013.264282.101943@ruffy2.mtv.corp.google.com> X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00507.txt.bz2 Doug Evans writes: > On Tue, Apr 7, 2015 at 2:23 PM, Alexander Smundak wrote: > > Thank you for the quick review. > > Edited NEWS, renamed `create_optimized_out' to `optimized_out', > > elided 'unavailable' from description, added blank line. > > PTAL. > > > > gdb/doc/ChangeLog: > > > > 2015-04-07 Sasha Smundak > > > > * python.texi: New method documented. > > > > gdb/ChangeLog: > > > > 2015-04-07 Sasha Smundak > > > > * NEWS: Mention gdb.Type.optimized_out method. > > * python/py-type.c (typy_optimized_out): New function. > > > > gdb/testsuite/ChangeLog: > > > > 2015-04-07 Sasha Smundak > > > > * gdb.python/py-type.exp: New test. Hi. Just need a doc approval. > > LGTM with one nit below. > [no need to resubmit another patch] > > > diff --git a/gdb/NEWS b/gdb/NEWS > > index 884c381..ebb573a 100644 > > --- a/gdb/NEWS > > +++ b/gdb/NEWS > > @@ -37,6 +37,8 @@ > > which is the name of the objfile as specified by the user, > > without, for example, resolving symlinks. > > ** You can now write frame unwinders in Python. > > + ** gdb.Type objects have a new method "optimized_out", > > + returning optimized out gdb.Value instance of this type. > > > > * New commands > > > > diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi > > index 098d718..091521c6 100644 > > --- a/gdb/doc/python.texi > > +++ b/gdb/doc/python.texi > > @@ -1060,6 +1060,11 @@ If @var{block} is given, then @var{name} is > > looked up in that scope. > > Otherwise, it is searched for globally. > > @end defun > > > > +@defun Type.optimized_out () > > +Return @code{gdb.Value} instance of this type whose value is optimized > > +out. This allows a frame decorator to indicate that the value of an > > +argument or a local variable is not known. > > +@end defun > > > > Each type has a code, which indicates what category this type falls > > into. The available type categories are represented by constants > > diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c > > index 39376a1..0461b26 100644 > > --- a/gdb/python/py-type.c > > +++ b/gdb/python/py-type.c > > @@ -1181,6 +1181,15 @@ typy_nonzero (PyObject *self) > > return 1; > > } > > > > +/* Return optimized out value of this type. */ > > + > > +static PyObject * > > +typy_optimized_out (PyObject *self, PyObject *args) > > +{ > > + struct type *type = ((type_object *) self)->type; > > Style rules require a blank line here. > Sorry for not catching this earlier. > > > + return value_to_value_object (allocate_optimized_out_value (type)); > > +} > > + > > /* Return a gdb.Field object for the field named by the argument. */ > > > > static PyObject * > > @@ -1493,6 +1502,8 @@ They are first class values." }, > > { "const", typy_const, METH_NOARGS, > > "const () -> Type\n\ > > Return a const variant of this type." }, > > + { "optimized_out", typy_optimized_out, METH_NOARGS, > > +"optimized_out() -> Value\nReturn optimized out value of this type." }, > > { "fields", typy_fields, METH_NOARGS, > > "fields () -> list\n\ > > Return a list holding all the fields of this type.\n\ > > diff --git a/gdb/testsuite/gdb.python/py-type.exp > > b/gdb/testsuite/gdb.python/py-type.exp > > index c4c8d9f..2edbfe3 100644 > > --- a/gdb/testsuite/gdb.python/py-type.exp > > +++ b/gdb/testsuite/gdb.python/py-type.exp > > @@ -253,6 +253,9 @@ gdb_test "python print > > gdb.lookup_type('char').array(1, 0)" \ > > gdb_test "python print gdb.lookup_type('char').array(1, -1)" \ > > "Array length must not be negative.*" > > > > +gdb_test "python print gdb.lookup_type('int').optimized_out()" \ > > + "" > > + > > with_test_prefix "lang_c" { > > runto_bp "break to inspect struct and array." > > test_fields "c" > > -- /dje