From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47598 invoked by alias); 3 Feb 2016 17:55:47 -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 47588 invoked by uid 89); 3 Feb 2016 17:55:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=constitute, separation X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 03 Feb 2016 17:55:44 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1F72AABE5; Wed, 3 Feb 2016 17:55:41 +0000 (UTC) Subject: Re: [PATCH 2/4] Add Jeff Mahoney's py-crash patches. To: Doug Evans , Ales Novak References: <1454276692-7119-1-git-send-email-alnovak@suse.cz> <1454276692-7119-3-git-send-email-alnovak@suse.cz> <56B01AB9.90005@suse.com> Cc: gdb-patches From: Jeff Mahoney Message-ID: <56B23F1A.20408@suse.com> Date: Wed, 03 Feb 2016 17:55:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56B01AB9.90005@suse.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00093.txt.bz2 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2/1/16 9:55 PM, Jeff Mahoney wrote: > On 2/1/16 5:22 PM, Doug Evans wrote: >> On Sun, Jan 31, 2016 at 1:44 PM, Ales Novak >> wrote: >>> --- gdb/Makefile.in | 12 ++ >>> gdb/python/py-minsymbol.c | 353 >>> +++++++++++++++++++++++++++++++++++++ gdb/python/py-objfile.c | >>> 29 +++- gdb/python/py-section.c | 401 >>> +++++++++++++++++++++++++++++++++++++++++++ >>> gdb/python/py-symbol.c | 52 ++++-- >>> gdb/python/python-internal.h | 14 ++ gdb/python/python.c | 7 >>> +- 7 files changed, 853 insertions(+), 15 deletions(-) create >>> mode 100644 gdb/python/py-minsymbol.c create mode 100644 >>> gdb/python/py-section.c > > >> Hi. > > Hi Doug - > >> Part of what this patch is doing is exporting bfd to python. >> E.g., all the SEC_* constants. > >> As a rule we absolutely discourage people from using bfd outside >> of the the binutils+gdb source tree. Either this rule needs to >> change, or I don't think we can allow this patch. I'd be >> interested to hear what others in the community think. > > That's unfortunate. The Linux kernel uses ELF sections for a > number of purposes. Most notably is the definition of per-cpu > variables. Without the ELF section, we can't resolve the addresses > for the variables. So, from our perspective, it's a requirement. > >> For myself, I would much rather export ELF separately (e.g., a >> separate python API one can use independent of any particular >> tool, including gdb), and then have gdb provide the necessary >> glue to use this API. [I can imagine some compromises being >> needed, at least for now; e.g., it'd be cumbersome to read in all >> ELF symbols twice. But fixing that is just an optimization.] > > Ok, that's doable. As it is, the section code mixes GDB and BFD > pretty heavily. It shouldn't be too difficult to separate the two > out and push the section stuff into a new BFD python interface and > associate the objfiles with it. And here's what I've come up with. Does this constitute enough of a separation? It /should/ cross over into the BFD code in the same way that the GDB code does: As soon as we hit a bfd object or a bfd_section object, we call into bfd's new python API to generate the objects. https://jeffm.io/git/cgit.cgi/gnu/binutils-gdb/log/?h=gdb/python-bfd For the fully-integrated kdump work, use the python-bfd-kdump branch (or SUSE folks, python-bfd-kdump-buildid will pick up the separate debuginfos as we usually expect). - -Jeff >>> ... + if (PyModule_AddIntConstant (gdb_module, >>> "SEC_NO_FLAGS", SEC_NO_FLAGS) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_ALLOC", SEC_ALLOC) < >>> 0 + || PyModule_AddIntConstant (gdb_module, "SEC_LOAD", >>> SEC_LOAD) < 0 + || PyModule_AddIntConstant (gdb_module, >>> "SEC_RELOC", SEC_RELOC) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_READONLY", SEC_READONLY) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_CODE", SEC_CODE) < 0 >>> + || PyModule_AddIntConstant (gdb_module, "SEC_DATA", >>> SEC_DATA) < 0 + || PyModule_AddIntConstant (gdb_module, >>> "SEC_ROM", SEC_ROM) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_CONSTRUCTOR", + SEC_CONSTRUCTOR) < 0 + >>> || PyModule_AddIntConstant (gdb_module, "SEC_HAS_CONTENTS", + >>> SEC_HAS_CONTENTS) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_NEVER_LOAD", + SEC_NEVER_LOAD) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_THREAD_LOCAL", + >>> SEC_THREAD_LOCAL) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_HAS_GOT_REF", + SEC_HAS_GOT_REF) < 0 + >>> || PyModule_AddIntConstant (gdb_module, "SEC_IS_COMMON", + >>> SEC_IS_COMMON) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_DEBUGGING", + >>> SEC_DEBUGGING) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_IN_MEMORY", + >>> SEC_IN_MEMORY) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_EXCLUDE", SEC_EXCLUDE) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_SORT_ENTRIES", + >>> SEC_SORT_ENTRIES) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_LINK_ONCE", + SEC_LINK_ONCE) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_LINK_DUPLICATES", + >>> SEC_LINK_DUPLICATES) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_LINK_DUPLICATES_DISCARD", + >>> SEC_LINK_DUPLICATES_DISCARD) < 0 + || >>> PyModule_AddIntConstant (gdb_module, >>> "SEC_LINK_DUPLICATES_ONE_ONLY", + SEC_LINK_DUPLICATES_ONE_ONLY) >>> < 0 + || PyModule_AddIntConstant (gdb_module, >>> "SEC_LINK_DUPLICATES_SAME_SIZE", + >>> SEC_LINK_DUPLICATES_SAME_SIZE) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_LINKER_CREATED", + >>> SEC_LINKER_CREATED) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_KEEP", SEC_KEEP) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_SMALL_DATA", + >>> SEC_SMALL_DATA) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_MERGE", SEC_MERGE) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_STRNGS", SEC_STRINGS) >>> < 0 + || PyModule_AddIntConstant (gdb_module, >>> "SEC_GROUP", SEC_GROUP) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_COFF_SHARED_LIBRARY", + >>> SEC_COFF_SHARED_LIBRARY) < 0 + || PyModule_AddIntConstant >>> (gdb_module, "SEC_ELF_REVERSE_COPY", + SEC_ELF_REVERSE_COPY) < >>> 0 + || PyModule_AddIntConstant (gdb_module, >>> "SEC_COFF_SHARED", + SEC_COFF_SHARED) < 0 + || >>> PyModule_AddIntConstant (gdb_module, "SEC_COFF_NOREAD", + >>> SEC_COFF_NOREAD) < 0) + return -1; ... > > > > - -- Jeff Mahoney SUSE Labs -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.19 (Darwin) Comment: GPGTools - http://gpgtools.org iQIcBAEBAgAGBQJWsj8aAAoJEB57S2MheeWyhQAP/jVlYhIHlLr/h1j1F64PR5mP i2+CRVorxMcRwVRMz8ymFJBzAoZoxzlEtjnX9b9rdfVnPd/wT8qmT0BBbj1FY1a6 kIPF5a6Wea6kJcbLeZ/yeyml9hhz2SULr9Lc0IqIQ20BGcPwPQkMqqEPgHZbalxZ HmboZWz4o9QObOUOdXyyBxgmU148Pi7WsnD3dmD+qi/cLc5hppDy7/xpv0H6cDRw mBlKVpvf8+Yv+yNTSx39k51XW7TKko13GxJ5Sdm1/zC+PGIHbRgKHvN4gYc5Fr4d kd8oR9w/S8DQRNypU4lUPwPVXLz7Njy6S2Kmz8rPobh6RvEpRv8koLZUjUzimcC8 BTKcwHwlI8eQCZ/t+OB7uMJLKte0oqItg+ynPuD1FWsWSGI2cqWmOHL3NBc4fU5/ RO/7u52Fr21gKwQ0EbaSZeEC0knAGMxw8gWmTaZaArkbSAIlPR2wsfEgVekFBZLb 7gyFY8ut6k641oivGumpTMVS6LhQxTxOMD41oTrCO7VWintuOhNmSjh0rkjy8Ax8 PdG16Pc6EI3th6LPKE28nsMKxLCXr2N5wOLLETWcAKDcgXgIa4aHTLTVMdy5MIuu 4C6AOoKnjNwlypqa36uuWAy9dzzUuY7zJrIgRiGesSDpmtlCxsDyxsqJicZZu5tF JKA7TkwqGAJsmyw7tNNe =DH0z -----END PGP SIGNATURE-----