This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] [PR/24474] Add gdb.lookup_static_symbol to the python API


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]