public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: Doug Evans <dje@google.com>, Ales Novak <alnovak@suse.cz>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/4] Add Jeff Mahoney's py-crash patches.
Date: Tue, 02 Feb 2016 02:56:00 -0000	[thread overview]
Message-ID: <56B01AB9.90005@suse.com> (raw)
In-Reply-To: <CADPb22TwarW84NbuqczsjFFq5DPEEMVuyHjtFHGU4LVBjj6wGQ@mail.gmail.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/1/16 5:22 PM, Doug Evans wrote:
> 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.

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.

- -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

iQIcBAEBAgAGBQJWsBq4AAoJEB57S2MheeWyiNkP/ihEmdfSciKJ1oZjW8bFM3pb
IopJO86jZWhLMdG5CcDvoc/Mhf/xbGGeCvPgJOVvgdhLOqBR+8H3xT4ot0TzPfba
yCas29vKis2+wLEFBGoFVWXzxhYF6SZ4YjZSlUleD7kGvja2kWAj173Oj8q9xuy5
A88hWy/+bTTxVuaBE4NW9RNy+2kt+XwneP2ccBRdaVK2FUUHk62znEAcs/SmAoeN
20Nq8a24pYl+6T/GM1E2lnA2OdBtadcY3G3zXKGtw3JExaNpytlndvdRaDUUJLFV
0TbAE1WsaK5LzOxZzfgn43MLr5y1APdihvGJN1voSnz6mmnmQ6q008z4M7eKVhf6
GuQAMNW8lI4Ki+WwEIOJHiORDNjummRHrzvI8PY5ci9xbD0JEpf3cQVOwGW9Wlqz
M7tLdREWll4fm85V8W8wdq7ETsMmoL5SUaAGVn2ZucJLoNDif0jNoLsOeee0YPEa
2EjgB7hleE3GkFgpwPa/75FRANO2AnxzDQPCELoJJ1bMRFONMT46A7T3zbfzijwf
+MZWY9h40QUewtLJlqCpVcXWWhNPpNCuzRhwrpKLYAXnT2dBT0zhRRNxKaFzeQo6
YfmFEDWapK97biwKen6/snNSfWpZJAEGprSsU5uqv2iLVzITtlr9euaL9bR9p1fq
geG2m6SRtR9JUzIvUn71
=7HLd
-----END PGP SIGNATURE-----

  reply	other threads:[~2016-02-02  2:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-31 21:45 Enable gdb to open Linux kernel dumps Ales Novak
2016-01-31 21:45 ` [PATCH 4/4] Minor cleanups Ales Novak
2016-01-31 21:45 ` [PATCH 1/4] Create new target "kdump" which uses libkdumpfile: https://github.com/ptesarik/libkdumpfile to access contents of compressed kernel dump Ales Novak
2016-02-04 12:40   ` Pedro Alves
2016-02-04 12:45     ` Ales Novak
2016-01-31 21:45 ` [PATCH 2/4] Add Jeff Mahoney's py-crash patches Ales Novak
2016-02-01 12:35   ` Kieran Bingham
2016-02-01 22:23   ` Doug Evans
2016-02-02  2:56     ` Jeff Mahoney [this message]
2016-02-02  8:25       ` Kieran Bingham
2016-02-03 17:55       ` Jeff Mahoney
2016-02-03 18:31         ` Doug Evans
2016-02-03 19:29           ` Jeff Mahoney
2016-02-04 17:25           ` Petr Tesarik
2016-02-04 18:32             ` Matt Rice
2016-02-04 22:27             ` Doug Evans
2016-01-31 21:45 ` [PATCH 3/4] Add SLAB allocator understanding Ales Novak
2016-02-01 13:21   ` Kieran Bingham
2016-02-01 22:30     ` Doug Evans
2016-02-02  2:05       ` Ales Novak
2016-02-02  7:22         ` Jan Kiszka
2016-02-02 13:22           ` Petr Tesarik
2016-02-02 14:42             ` Jeff Mahoney
2016-02-02  8:11       ` Kieran Bingham
2016-02-02 10:04     ` Vlastimil Babka
2016-02-01 11:27 ` Enable gdb to open Linux kernel dumps Kieran Bingham
2016-02-01 11:51   ` Kieran Bingham
2016-02-01 14:32     ` Ales Novak
2016-02-01 15:01       ` Jeff Mahoney
2016-02-02  9:12         ` Kieran Bingham
2016-02-10  3:24         ` Jeff Mahoney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B01AB9.90005@suse.com \
    --to=jeffm@suse.com \
    --cc=alnovak@suse.cz \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).