This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] [PR/24474] Add gdb.lookup_static_symbol to the python API
- From: Simon Marchi <simark at simark dot ca>
- To: Christian Biesinger <cbiesinger at google dot com>, gdb-patches at sourceware dot org
- Date: Mon, 29 Jul 2019 21:14:37 -0400
- Subject: Re: [PATCH v2] [PR/24474] Add gdb.lookup_static_symbol to the python API
- References: <CAPTJ0XEh08SX1sAR4UBuFpPzP=yYf_G4U9PV+PYNgcy+V6AZuQ@mail.gmail.com> <20190726222259.12312-1-cbiesinger@google.com>
Hi Christian,
On 2019-07-26 6:22 p.m., Christian Biesinger via gdb-patches wrote:
> diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
> index 5b8a2be7c4..5d45e35da0 100644
> --- a/gdb/testsuite/gdb.python/py-symbol.exp
> +++ b/gdb/testsuite/gdb.python/py-symbol.exp
> @@ -48,6 +48,22 @@ 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') is None)" "True" \
> + "lookup_global_symbol for static var"
> +
> +gdb_test "python print (gdb.lookup_static_symbol ('rr').line)" "$rr_line" \
> + "print line number of rr"
> +
> +gdb_test "python print (gdb.lookup_static_symbol ('rr').value ())" "42" \
> + "print value of rr"
> +
> +gdb_test "python print (gdb.lookup_static_symbol ('rr').needs_frame)" \
> + "False" \
> + "print whether rr needs a frame"
> +
> +gdb_test "python print (gdb.lookup_global_symbol ('nonexistant') is None)" \
> + "True" "lookup_static_symbol for nonexistant var
The test name says "lookup_static_symbol" but the command uses lookup_global_symbol. I suppose you actually want to test lookup_static_symbol.
Is there a test that checks that lookup_static_symbol won't find a global symbol? If not, it would be good to add.
Simon