From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
To: Christian Biesinger via gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PING] [PATCH][PR/24474] Make gdb.lookup_static_symbol also check the STATIC_SCOPE
Date: Mon, 15 Jul 2019 16:52:00 -0000 [thread overview]
Message-ID: <CAPTJ0XH0Do7mfJMF2f2ZjfydH8F_p2JhCNvip2VAk8+yi5PhAA@mail.gmail.com> (raw)
In-Reply-To: <CAPTJ0XHZtaY3gqQEOJ3sgGvrMdThp8J=QJna3xJEwFnJwV1Ecw@mail.gmail.com>
weekly ping
On Mon, Jul 8, 2019 at 5:04 PM Christian Biesinger
<cbiesinger@google.com> wrote:
>
> ping?
>
> On Tue, Jun 4, 2019 at 8:24 PM Christian Biesinger
> <cbiesinger@google.com> wrote:
> >
> > gdb/ChangeLog:
> >
> > 2019-06-04 Christian Biesinger <cbiesinger@google.com>
> >
> > PR/24474: Make gdb.lookup_global_symbol also check the STATIC_SCOPE
> > because from a C/C++ developer's perspective, these are also globals.
> > * NEWS: Mention this change.
> > * python/py-symbol.c (gdbpy_lookup_global_symbol): Call
> > lookup_static_symbol if lookup_global_symbol returns NULL.
> >
> > gdb/testsuite/ChangeLog:
> >
> > 2019-06-04 Christian Biesinger <cbiesinger@google.com>
> >
> > * gdb.python/py-symbol.c: Add a static variable and one in an anonymous
> > namespace.
> > * gdb.python/py-symbol.exp: Check that lookup_global_symbol finds those
> > variables.
> >
> >
> > ---
> > gdb/NEWS | 2 ++
> > gdb/python/py-symbol.c | 11 +++++++++++
> > gdb/testsuite/gdb.python/py-symbol.c | 5 +++++
> > gdb/testsuite/gdb.python/py-symbol.exp | 13 +++++++++++++
> > 4 files changed, 31 insertions(+)
> >
> > diff --git a/gdb/NEWS b/gdb/NEWS
> > index ded1fce406..bfd8d0a191 100644
> > --- a/gdb/NEWS
> > +++ b/gdb/NEWS
> > @@ -30,6 +30,8 @@
> > ** gdb.Type has a new property 'objfile' which returns the objfile the
> > type was defined in.
> >
> > + ** gdb.lookup_global_symbol will now also find symbols with static linkage.
> > +
> > * New built-in convenience variables $_shell_exitcode and $_shell_exitsignal
> > provide the exitcode or exit status of the shell commands launched by
> > GDB commands such as "shell", "pipe" and "make".
> > diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
> > index 8605ae71a2..5636ef9013 100644
> > --- a/gdb/python/py-symbol.c
> > +++ b/gdb/python/py-symbol.c
> > @@ -456,6 +456,17 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
> > GDB_PY_HANDLE_EXCEPTION (except);
> > }
> >
> > + if (symbol == NULL) {
> > + try
> > + {
> > + symbol = lookup_static_symbol (name, (domain_enum) domain).symbol;
> > + }
> > + catch (const gdb_exception &except)
> > + {
> > + GDB_PY_HANDLE_EXCEPTION (except);
> > + }
> > + }
> > +
> > if (symbol)
> > {
> > sym_obj = symbol_to_symbol_object (symbol);
> > diff --git a/gdb/testsuite/gdb.python/py-symbol.c b/gdb/testsuite/gdb.python/py-symbol.c
> > index f77c8c8585..06a931bf5d 100644
> > --- a/gdb/testsuite/gdb.python/py-symbol.c
> > +++ b/gdb/testsuite/gdb.python/py-symbol.c
> > @@ -32,9 +32,14 @@ class SimpleClass
> > return i; /* Break in class. */
> > }
> > };
> > +
> > +namespace {
> > + int anon = 10;
> > +};
> > #endif
> >
> > int qq = 72; /* line of qq */
> > +static int rr = 42; /* line of rr */
> >
> > int func (int arg)
> > {
> > diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
> > index 5b8a2be7c4..722fcda0f0 100644
> > --- a/gdb/testsuite/gdb.python/py-symbol.exp
> > +++ b/gdb/testsuite/gdb.python/py-symbol.exp
> > @@ -48,6 +48,16 @@ gdb_test "python print (gdb.lookup_global_symbol('qq').needs_frame)" \
> > "False" \
> > "print whether qq needs a frame"
> >
> > +set rr_line [gdb_get_line_number "line of rr"]
> > +gdb_test "python print (gdb.lookup_global_symbol ('rr').line)" "$rr_line" \
> > + "print line number of rr"
> > +
> > +gdb_test "python print (gdb.lookup_global_symbol ('rr').value ())" "42" \
> > + "print value of rr"
> > +
> > +gdb_test "python print (gdb.lookup_global_symbol ('rr').needs_frame)" \
> > + "False" \
> > + "print whether rr needs a frame"
> >
> > if ![runto_main] then {
> > fail "can't run to main"
> > @@ -137,6 +147,9 @@ gdb_start
> > gdb_reinitialize_dir $srcdir/$subdir
> > gdb_load ${binfile}-cxx
> >
> > +gdb_test "python print (gdb.lookup_global_symbol ('(anonymous namespace)::anon').value ())" "10" \
> > + "print value of rr"
> > +
> > if ![runto_main] then {
> > fail "can't run to main"
> > return 0
> > --
> > 2.22.0.rc1.311.g5d7573a151-goog
> >
next prev parent reply other threads:[~2019-07-15 16:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 1:24 Christian Biesinger via gdb-patches
2019-06-18 20:15 ` Christian Biesinger via gdb-patches
2019-07-08 22:05 ` [PING] " Christian Biesinger via gdb-patches
2019-07-15 16:52 ` Christian Biesinger via gdb-patches [this message]
2019-07-16 3:28 ` Simon Marchi
2019-07-26 22:05 ` Christian Biesinger via gdb-patches
2019-07-26 22:23 ` [PATCH v2] [PR/24474] Add gdb.lookup_static_symbol to the python API Christian Biesinger via gdb-patches
2019-07-30 1:14 ` Simon Marchi
2019-07-30 1:35 ` [PATCH v3] " Christian Biesinger via gdb-patches
2019-07-30 1:50 ` Simon Marchi
2019-07-30 1:59 ` [PATCH v4] " Christian Biesinger via gdb-patches
2019-07-30 15:41 ` Christian Biesinger via gdb-patches
2019-07-30 15:57 ` Eli Zaretskii
2019-07-30 16:01 ` Christian Biesinger via gdb-patches
2019-07-26 22:43 ` [PATCH][PR/24474] Make gdb.lookup_static_symbol also check the STATIC_SCOPE Simon Marchi
2019-08-01 19:05 ` Christian Biesinger via gdb-patches
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=CAPTJ0XH0Do7mfJMF2f2ZjfydH8F_p2JhCNvip2VAk8+yi5PhAA@mail.gmail.com \
--to=gdb-patches@sourceware.org \
--cc=cbiesinger@google.com \
/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