From patchwork Thu Nov 13 12:54:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 3703 Received: (qmail 10980 invoked by alias); 13 Nov 2014 12:55:39 -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 10944 invoked by uid 89); 13 Nov 2014 12:55:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f46.google.com Received: from mail-pa0-f46.google.com (HELO mail-pa0-f46.google.com) (209.85.220.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 13 Nov 2014 12:55:37 +0000 Received: by mail-pa0-f46.google.com with SMTP id lf10so15230235pab.33 for ; Thu, 13 Nov 2014 04:55:36 -0800 (PST) X-Received: by 10.68.109.3 with SMTP id ho3mr2534549pbb.74.1415883336036; Thu, 13 Nov 2014 04:55:36 -0800 (PST) Received: from sspiff.org (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by mx.google.com with ESMTPSA id zr9sm24888907pab.44.2014.11.13.04.55.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Nov 2014 04:55:35 -0800 (PST) Message-ID: <5464aa47.e9a7420a.2e39.ffffa21b@mx.google.com> Received: by sspiff.org (sSMTP sendmail emulation); Thu, 13 Nov 2014 04:54:43 -0800 Date: Thu, 13 Nov 2014 04:54:43 -0800 From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH 18/21] struct symtab split part 2: python/py-symtab.c X-IsSubscribed: yes This patch contains the changes to the python support. Full ChangeLog: https://sourceware.org/ml/gdb-patches/2014-11/msg00233.html 2014-11-12 Doug Evans * python/py-symtab.c (stpy_get_producer): Fetch producer from compunit. diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c index 7dee782..3741762 100644 --- a/gdb/python/py-block.c +++ b/gdb/python/py-block.c @@ -372,8 +372,7 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args) { gdb_py_ulongest pc; const struct block *block = NULL; - struct obj_section *section = NULL; - struct symtab *symtab = NULL; + struct compunit_symtab *cust = NULL; volatile struct gdb_exception except; if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc)) @@ -381,15 +380,14 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args) TRY_CATCH (except, RETURN_MASK_ALL) { - section = find_pc_mapped_section (pc); - symtab = find_pc_sect_symtab (pc, section); + cust = find_pc_compunit_symtab (pc); - if (symtab != NULL && SYMTAB_OBJFILE (symtab) != NULL) + if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL) block = block_for_pc (pc); } GDB_PY_HANDLE_EXCEPTION (except); - if (!symtab || SYMTAB_OBJFILE (symtab) == NULL) + if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL) { PyErr_SetString (PyExc_RuntimeError, _("Cannot locate object file for block.")); @@ -397,7 +395,7 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args) } if (block) - return block_to_block_object (block, SYMTAB_OBJFILE (symtab)); + return block_to_block_object (block, COMPUNIT_OBJFILE (cust)); Py_RETURN_NONE; } diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c index 6f4070d..caa0998 100644 --- a/gdb/python/py-symtab.c +++ b/gdb/python/py-symtab.c @@ -132,11 +132,13 @@ static PyObject * stpy_get_producer (PyObject *self, void *closure) { struct symtab *symtab = NULL; + struct compunit_symtab *cust; STPY_REQUIRE_VALID (self, symtab); - if (symtab->producer != NULL) + cust = SYMTAB_COMPUNIT (symtab); + if (COMPUNIT_PRODUCER (cust) != NULL) { - const char *producer = symtab->producer; + const char *producer = COMPUNIT_PRODUCER (cust); return PyString_Decode (producer, strlen (producer), host_charset (), NULL);