From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19857 invoked by alias); 30 Aug 2011 13:08:08 -0000 Received: (qmail 19696 invoked by uid 22791); 30 Aug 2011 13:08:07 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Aug 2011 13:07:52 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7UD7pNa015785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 30 Aug 2011 09:07:51 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7UD7o2O025239; Tue, 30 Aug 2011 09:07:51 -0400 From: Phil Muldoon To: matt rice Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 5/7] [python] API for macros: gdb.Objfile symtabs method. References: <1314198654-9008-1-git-send-email-ratmice@gmail.com> <1314198654-9008-6-git-send-email-ratmice@gmail.com> Reply-to: pmuldoon@redhat.com X-URL: http://www.redhat.com Date: Tue, 30 Aug 2011 13:08:00 -0000 In-Reply-To: <1314198654-9008-6-git-send-email-ratmice@gmail.com> (matt rice's message of "Wed, 24 Aug 2011 08:10:52 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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 X-SW-Source: 2011-08/txt/msg00597.txt.bz2 matt rice writes: > + list = PyList_New (0); > + if (!list) > + return NULL; > + > + symtabs = obj->objfile->symtabs; > + while(symtabs) > + { > + py_symtab = symtab_to_symtab_object (symtabs); > + if (! py_symtab) > + goto fail; > + > + if (PyList_Append (list, py_symtab) != 0) > + goto fail; > + > + Py_DECREF (py_symtab); > + > + symtabs = symtabs->next; > + } > + return list; If there are no symtabs, why return an empty list? Would Py_None make more sense here. And same rules apply to returning a Tuple, too, as others. > + { "symtabs", objfpy_symtabs, METH_NOARGS, > + "symtabs () -> List.\n\ > +A List containing the object file's valid symtabs." }, See above. > --- /dev/null > +++ b/gdb/python/py-symtab.h > @@ -0,0 +1,26 @@ > +/* Python interface to Symtabs and Symtab_and_line's. > + > + Copyright (C) 2011 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#ifndef GDB_PY_SYMTAB_H > +#define GDB_PY_SYMTAB_H > + > +PyObject * > +symtab_to_symtab_object (struct symtab *symtab); > + > +#endif /* GDB_PY_SYMTAB_H */ This is already exported in python-internal.h? Why do we need to re-export it here? Cheers, Phil