[PATCH 2/4] Add Jeff Mahoney's py-crash patches.
Doug Evans
dje@google.com
Mon Feb 1 22:23:00 GMT 2016
On Sun, Jan 31, 2016 at 1:44 PM, Ales Novak <alnovak@suse.cz> 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.
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.
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.]
> ...
> + 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;
> ...
More information about the Gdb-patches
mailing list