Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
Cc: Christian Biesinger <cbiesinger@google.com>
Subject: Re: [PATCH] Add an Objfile.lookup_global_symbol function
Date: Wed, 26 Jun 2019 21:12:00 -0000	[thread overview]
Message-ID: <87lfxo3vbm.fsf@tromey.com> (raw)
In-Reply-To: <20190625220832.247935-1-cbiesinger@google.com> (Christian	Biesinger via gdb-patches's message of "Tue, 25 Jun 2019 17:08:32	-0500")

>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:

Christian> +static PyObject *
Christian> +objfpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
Christian> +{
...
Christian> +  if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &symbol_name,
Christian> +					&domain))
Christian> +    Py_RETURN_NONE;

Error cases must return NULL.

Christian> +      if (!sym) {

gdb style is an explicit check, like sym != nullptr.
Also the brace is misplaced.

Christian>  struct block_symbol
Christian>  lookup_global_symbol_from_objfile (struct objfile *main_objfile,
Christian> +				   int block_index,
Christian>  				   const char *name,
Christian>  				   const domain_enum domain)

I suspect the new parameter should probably have type `enum block_enum'.

Christian> +   block_index can be GLOBAL_BLOCK, STATIC_BLOCK, etc.

Does the "etc" case really work?  If not it should just assert that the
value is one of GLOBAL_BLOCK or STATIC_BLOCK.

Christian> +gdb_test "python print (gdb.lookup_objfile (\"${testfile}\").lookup_global_symbol (\"global_var\").name)" \
Christian> +    "global_var" "lookup_global_symbol find a valid symbol"
Christian> +gdb_test "python print (gdb.lookup_objfile (\"${testfile}\").lookup_global_symbol (\"static_var\").name)" \
Christian> +    "static_var" "lookup_global_symbol find a valid static symbol"

Perhaps this ought to test a case where it returns None.

Tom


  parent reply	other threads:[~2019-06-26 21:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 22:09 Christian Biesinger via gdb-patches
2019-06-26 15:37 ` Eli Zaretskii
2019-06-26 21:05   ` Tom Tromey
2019-06-27  2:36     ` Eli Zaretskii
2019-06-26 15:38 ` Eli Zaretskii
2019-06-26 21:12 ` Tom Tromey [this message]
2019-07-08 21:59 ` Christian Biesinger via gdb-patches
2019-07-09 15:42   ` Eli Zaretskii
2019-07-09 18:44 ` Christian Biesinger via gdb-patches
2019-07-09 19:16   ` Eli Zaretskii
2019-07-22 20:51 ` Christian Biesinger via gdb-patches
2019-07-23  1:30   ` Simon Marchi
2019-07-23 14:47     ` Eli Zaretskii
2019-07-26  1:38     ` Christian Biesinger via gdb-patches
2019-07-26  1:38       ` [PATCH v2] " Christian Biesinger via gdb-patches
2019-07-26  6:19         ` Eli Zaretskii
2019-07-27  0:31         ` [PATCH v3] Add Objfile.lookup_{global,static}_symbol functions Christian Biesinger via gdb-patches
2019-07-27  7:52           ` Eli Zaretskii
2019-07-27 18:31             ` [PATCH v4] " Christian Biesinger via gdb-patches
2019-07-27 18:38               ` Eli Zaretskii
2019-07-30  1:03               ` Simon Marchi
2019-07-30  1:51                 ` [PATCH v5] " Christian Biesinger via gdb-patches
2019-07-30 14:59                   ` Eli Zaretskii
2019-07-26 15:40       ` [PATCH] Add an Objfile.lookup_global_symbol function Simon Marchi
2019-07-23 14:54   ` Eli Zaretskii

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=87lfxo3vbm.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=cbiesinger@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