public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
       [not found] <20210526170536.657-1-ssbssa.ref@yahoo.de>
@ 2021-05-26 17:05 ` Hannes Domani
  2021-05-26 18:13   ` Andreas Schwab
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Hannes Domani @ 2021-05-26 17:05 UTC (permalink / raw)
  To: gdb-patches

It was removed (probably by mistake) in
51e78fc5fa21870d415c52f90b93e3c6ad57be46.

gdb/ChangeLog:

2021-05-26  Hannes Domani  <ssbssa@yahoo.de>

	* python/py-symbol.c (gdbpy_initialize_symbols): Restore
	gdb.SYMBOL_LABEL_DOMAIN constant.

gdb/testsuite/ChangeLog:

2021-05-26  Hannes Domani  <ssbssa@yahoo.de>

	* gdb.python/py-symbol.exp: Test symbol constants.
---
v2:
- Added tests.
---
 gdb/python/py-symbol.c                 |  2 ++
 gdb/testsuite/gdb.python/py-symbol.exp | 48 ++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 8953ee097cc..d44b55ed5a9 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -673,6 +673,8 @@ gdbpy_initialize_symbols (void)
 				  VAR_DOMAIN) < 0
       || PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN",
 				  STRUCT_DOMAIN) < 0
+      || PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN",
+				  LABEL_DOMAIN) < 0
       || PyModule_AddIntConstant (gdb_module, "SYMBOL_MODULE_DOMAIN",
 				  MODULE_DOMAIN) < 0
       || PyModule_AddIntConstant (gdb_module, "SYMBOL_COMMON_BLOCK_DOMAIN",
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index 341a8fcc2db..41b583cd79f 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -255,3 +255,51 @@ delete_breakpoints
 gdb_unload
 gdb_test "python print (a\[0\].is_valid())" "False" "test symbol non-validity"
 gdb_test_no_output "python a = None" "test symbol destructor"
+
+# Test gdb.Symbol domain categories
+gdb_test "python print gdb.SYMBOL_UNDEF_DOMAIN" \
+    "0" "test gdb.SYMBOL_UNDEF_DOMAIN"
+gdb_test "python print gdb.SYMBOL_VAR_DOMAIN" \
+    "1" "test gdb.SYMBOL_VAR_DOMAIN"
+gdb_test "python print gdb.SYMBOL_STRUCT_DOMAIN" \
+    "2" "test gdb.SYMBOL_STRUCT_DOMAIN"
+gdb_test "python print gdb.SYMBOL_MODULE_DOMAIN" \
+    "3" "test gdb.SYMBOL_MODULE_DOMAIN"
+gdb_test "python print gdb.SYMBOL_LABEL_DOMAIN" \
+    "4" "test gdb.SYMBOL_LABEL_DOMAIN"
+gdb_test "python print gdb.SYMBOL_COMMON_BLOCK_DOMAIN" \
+    "5" "test gdb.SYMBOL_COMMON_BLOCK_DOMAIN"
+
+# Test gdb.Symbol address class categories
+gdb_test "python print gdb.SYMBOL_LOC_UNDEF" \
+    "0" "test gdb.SYMBOL_LOC_UNDEF"
+gdb_test "python print gdb.SYMBOL_LOC_CONST" \
+    "1" "test gdb.SYMBOL_LOC_CONST"
+gdb_test "python print gdb.SYMBOL_LOC_STATIC" \
+    "2" "test gdb.SYMBOL_LOC_STATIC"
+gdb_test "python print gdb.SYMBOL_LOC_REGISTER" \
+    "3" "test gdb.SYMBOL_LOC_REGISTER"
+gdb_test "python print gdb.SYMBOL_LOC_ARG" \
+    "4" "test gdb.SYMBOL_LOC_ARG"
+gdb_test "python print gdb.SYMBOL_LOC_REF_ARG" \
+    "5" "test gdb.SYMBOL_LOC_REF_ARG"
+gdb_test "python print gdb.SYMBOL_LOC_REGPARM_ADDR" \
+    "6" "test gdb.SYMBOL_LOC_REGPARM_ADDR"
+gdb_test "python print gdb.SYMBOL_LOC_LOCAL" \
+    "7" "test gdb.SYMBOL_LOC_LOCAL"
+gdb_test "python print gdb.SYMBOL_LOC_TYPEDEF" \
+    "8" "test gdb.SYMBOL_LOC_TYPEDEF"
+gdb_test "python print gdb.SYMBOL_LOC_LABEL" \
+    "9" "test gdb.SYMBOL_LOC_LABEL"
+gdb_test "python print gdb.SYMBOL_LOC_BLOCK" \
+    "10" "test gdb.SYMBOL_LOC_BLOCK"
+gdb_test "python print gdb.SYMBOL_LOC_CONST_BYTES" \
+    "11" "test gdb.SYMBOL_LOC_CONST_BYTES"
+gdb_test "python print gdb.SYMBOL_LOC_UNRESOLVED" \
+    "12" "test gdb.SYMBOL_LOC_UNRESOLVED"
+gdb_test "python print gdb.SYMBOL_LOC_OPTIMIZED_OUT" \
+    "13" "test gdb.SYMBOL_LOC_OPTIMIZED_OUT"
+gdb_test "python print gdb.SYMBOL_LOC_COMPUTED" \
+    "14" "test gdb.SYMBOL_LOC_COMPUTED"
+gdb_test "python print gdb.SYMBOL_LOC_COMMON_BLOCK" \
+    "15" "test gdb.SYMBOL_LOC_COMMON_BLOCK"
-- 
2.31.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-05-26 17:05 ` [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant Hannes Domani
@ 2021-05-26 18:13   ` Andreas Schwab
  2021-05-26 18:19     ` Hannes Domani
  2021-05-29  3:19   ` Simon Marchi
  2021-06-02 18:39   ` Tom Tromey
  2 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2021-05-26 18:13 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches

On Mai 26 2021, Hannes Domani via Gdb-patches wrote:

> 	* python/py-symbol.c (gdbpy_initialize_symbols): Restore
> 	gdb.SYMBOL_LABEL_DOMAIN constant.

That doesn't agree with the subject.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-05-26 18:13   ` Andreas Schwab
@ 2021-05-26 18:19     ` Hannes Domani
  0 siblings, 0 replies; 11+ messages in thread
From: Hannes Domani @ 2021-05-26 18:19 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches, Andreas Schwab

 Am Mittwoch, 26. Mai 2021, 20:13:16 MESZ hat Andreas Schwab <schwab@linux-m68k.org> Folgendes geschrieben:

> On Mai 26 2021, Hannes Domani via Gdb-patches wrote:
>
>
> >     * python/py-symbol.c (gdbpy_initialize_symbols): Restore
> >     gdb.SYMBOL_LABEL_DOMAIN constant.
>
>
> That doesn't agree with the subject.

You're absolutely right.

I've changed it locally to:
Restore gdb.SYMBOL_LABEL_DOMAIN constant


Hannes

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-05-26 17:05 ` [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant Hannes Domani
  2021-05-26 18:13   ` Andreas Schwab
@ 2021-05-29  3:19   ` Simon Marchi
  2021-06-02 18:39   ` Tom Tromey
  2 siblings, 0 replies; 11+ messages in thread
From: Simon Marchi @ 2021-05-29  3:19 UTC (permalink / raw)
  To: Hannes Domani, gdb-patches; +Cc: Tom Tromey

On 2021-05-26 1:05 p.m., Hannes Domani via Gdb-patches wrote:
> It was removed (probably by mistake) in
> 51e78fc5fa21870d415c52f90b93e3c6ad57be46.

Tom, can you take a look?

Thanks,

Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-05-26 17:05 ` [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant Hannes Domani
  2021-05-26 18:13   ` Andreas Schwab
  2021-05-29  3:19   ` Simon Marchi
@ 2021-06-02 18:39   ` Tom Tromey
  2021-06-03 13:00     ` Hannes Domani
  2 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2021-06-02 18:39 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches

>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:

Hannes> It was removed (probably by mistake) in
Hannes> 51e78fc5fa21870d415c52f90b93e3c6ad57be46.

Yes, sorry about that.

Hannes> gdb/ChangeLog:

Hannes> 2021-05-26  Hannes Domani  <ssbssa@yahoo.de>

Hannes> 	* python/py-symbol.c (gdbpy_initialize_symbols): Restore
Hannes> 	gdb.SYMBOL_LABEL_DOMAIN constant.

Hannes> gdb/testsuite/ChangeLog:

Hannes> 2021-05-26  Hannes Domani  <ssbssa@yahoo.de>

Hannes> 	* gdb.python/py-symbol.exp: Test symbol constants.

This is ok.  Thank you.

Hannes> +# Test gdb.Symbol domain categories
Hannes> +gdb_test "python print gdb.SYMBOL_UNDEF_DOMAIN" \
Hannes> +    "0" "test gdb.SYMBOL_UNDEF_DOMAIN"
Hannes> +gdb_test "python print gdb.SYMBOL_VAR_DOMAIN" \
Hannes> +    "1" "test gdb.SYMBOL_VAR_DOMAIN"

While we don't want people to rely on the values of these constants, it
seems harmless in the test suite.  If someone changes one, they can just
update the test.

Tom

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-06-02 18:39   ` Tom Tromey
@ 2021-06-03 13:00     ` Hannes Domani
  2021-06-05 12:27       ` Tom de Vries
  0 siblings, 1 reply; 11+ messages in thread
From: Hannes Domani @ 2021-06-03 13:00 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches, Tom Tromey

 Am Mittwoch, 2. Juni 2021, 20:39:58 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> >>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Hannes> It was removed (probably by mistake) in
> Hannes> 51e78fc5fa21870d415c52f90b93e3c6ad57be46.
>
> Yes, sorry about that.
>
> Hannes> gdb/ChangeLog:
>
> Hannes> 2021-05-26  Hannes Domani  <ssbssa@yahoo.de>
>
> Hannes>     * python/py-symbol.c (gdbpy_initialize_symbols): Restore
> Hannes>     gdb.SYMBOL_LABEL_DOMAIN constant.
>
> Hannes> gdb/testsuite/ChangeLog:
>
> Hannes> 2021-05-26  Hannes Domani  <ssbssa@yahoo.de>
>
> Hannes>     * gdb.python/py-symbol.exp: Test symbol constants.
>
> This is ok.  Thank you.
>
> Hannes> +# Test gdb.Symbol domain categories
> Hannes> +gdb_test "python print gdb.SYMBOL_UNDEF_DOMAIN" \
> Hannes> +    "0" "test gdb.SYMBOL_UNDEF_DOMAIN"
> Hannes> +gdb_test "python print gdb.SYMBOL_VAR_DOMAIN" \
> Hannes> +    "1" "test gdb.SYMBOL_VAR_DOMAIN"
>
> While we don't want people to rely on the values of these constants, it
> seems harmless in the test suite.  If someone changes one, they can just
> update the test.

Pushed, thanks.


Hannes

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-06-03 13:00     ` Hannes Domani
@ 2021-06-05 12:27       ` Tom de Vries
  2021-06-05 12:43         ` Hannes Domani
  0 siblings, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2021-06-05 12:27 UTC (permalink / raw)
  To: Hannes Domani, Hannes Domani via Gdb-patches, Tom Tromey

On 6/3/21 3:00 PM, Hannes Domani via Gdb-patches wrote:
>  Am Mittwoch, 2. Juni 2021, 20:39:58 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
> 
>>>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>> Hannes> It was removed (probably by mistake) in
>> Hannes> 51e78fc5fa21870d415c52f90b93e3c6ad57be46.
>>
>> Yes, sorry about that.
>>
>> Hannes> gdb/ChangeLog:
>>
>> Hannes> 2021-05-26  Hannes Domani  <ssbssa@yahoo.de>
>>
>> Hannes>     * python/py-symbol.c (gdbpy_initialize_symbols): Restore
>> Hannes>     gdb.SYMBOL_LABEL_DOMAIN constant.
>>
>> Hannes> gdb/testsuite/ChangeLog:
>>
>> Hannes> 2021-05-26  Hannes Domani  <ssbssa@yahoo.de>
>>
>> Hannes>     * gdb.python/py-symbol.exp: Test symbol constants.
>>
>> This is ok.  Thank you.
>>
>> Hannes> +# Test gdb.Symbol domain categories
>> Hannes> +gdb_test "python print gdb.SYMBOL_UNDEF_DOMAIN" \
>> Hannes> +    "0" "test gdb.SYMBOL_UNDEF_DOMAIN"
>> Hannes> +gdb_test "python print gdb.SYMBOL_VAR_DOMAIN" \
>> Hannes> +    "1" "test gdb.SYMBOL_VAR_DOMAIN"
>>
>> While we don't want people to rely on the values of these constants, it
>> seems harmless in the test suite.  If someone changes one, they can just
>> update the test.
> 
> Pushed, thanks.

With python 3, I'm running into:
...
(gdb) PASS: gdb.python/py-symbol.exp: test symbol destructor
python print gdb.SYMBOL_UNDEF_DOMAIN^M
  File "<string>", line 1^M
    print gdb.SYMBOL_UNDEF_DOMAIN^M
            ^^M
SyntaxError: Missing parentheses in call to 'print'. Did you mean
print(gdb.SYMBOL_UNDEF_DOMAIN)?^M
Error while executing Python code.^M
(gdb) FAIL: gdb.python/py-symbol.exp: test gdb.SYMBOL_UNDEF_DOMAIN
...

Thanks,
- Tom


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-06-05 12:27       ` Tom de Vries
@ 2021-06-05 12:43         ` Hannes Domani
  2021-06-05 13:57           ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Hannes Domani @ 2021-06-05 12:43 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches, Tom Tromey, Tom de Vries

 Am Samstag, 5. Juni 2021, 14:27:18 MESZ hat Tom de Vries <tdevries@suse.de> Folgendes geschrieben:

> On 6/3/21 3:00 PM, Hannes Domani via Gdb-patches wrote:
> >  Am Mittwoch, 2. Juni 2021, 20:39:58 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
> >
> >>>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
> >>
> >> Hannes> It was removed (probably by mistake) in
> >> Hannes> 51e78fc5fa21870d415c52f90b93e3c6ad57be46.
> >>
> >> Yes, sorry about that.
> >>
> >> Hannes> gdb/ChangeLog:
> >>
> >> Hannes> 2021-05-26  Hannes Domani  <ssbssa@yahoo.de>
> >>
> >> Hannes>     * python/py-symbol.c (gdbpy_initialize_symbols): Restore
> >> Hannes>     gdb.SYMBOL_LABEL_DOMAIN constant.
> >>
> >> Hannes> gdb/testsuite/ChangeLog:
> >>
> >> Hannes> 2021-05-26  Hannes Domani  <ssbssa@yahoo.de>
> >>
> >> Hannes>     * gdb.python/py-symbol.exp: Test symbol constants.
> >>
> >> This is ok.  Thank you.
> >>
> >> Hannes> +# Test gdb.Symbol domain categories
> >> Hannes> +gdb_test "python print gdb.SYMBOL_UNDEF_DOMAIN" \
> >> Hannes> +    "0" "test gdb.SYMBOL_UNDEF_DOMAIN"
> >> Hannes> +gdb_test "python print gdb.SYMBOL_VAR_DOMAIN" \
> >> Hannes> +    "1" "test gdb.SYMBOL_VAR_DOMAIN"
> >>
> >> While we don't want people to rely on the values of these constants, it
> >> seems harmless in the test suite.  If someone changes one, they can just
> >> update the test.
> >
> > Pushed, thanks.
>
> With python 3, I'm running into:
> ...
> (gdb) PASS: gdb.python/py-symbol.exp: test symbol destructor
> python print gdb.SYMBOL_UNDEF_DOMAIN^M
>   File "<string>", line 1^M
>     print gdb.SYMBOL_UNDEF_DOMAIN^M
>             ^^M
> SyntaxError: Missing parentheses in call to 'print'. Did you mean
> print(gdb.SYMBOL_UNDEF_DOMAIN)?^M
> Error while executing Python code.^M
> (gdb) FAIL: gdb.python/py-symbol.exp: test gdb.SYMBOL_UNDEF_DOMAIN
> ...

Sorry about that.
I'm gonna push the below as obvious.


Hannes


From fb3f973143033b3c9c98ee5c34467c81081e71c4 Mon Sep 17 00:00:00 2001
From: Hannes Domani <ssbssa@yahoo.de>
Date: Sat, 5 Jun 2021 14:37:53 +0200
Subject: [PATCH] Fix symbol constants tests for Python 3

gdb/testsuite/ChangeLog:

2021-06-05  Hannes Domani  <ssbssa@yahoo.de>

    * gdb.python/py-symbol.exp: Fix tests for Python 3.
---
 gdb/testsuite/gdb.python/py-symbol.exp | 44 +++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index 41b583cd79f..98acdbe3621 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -257,49 +257,49 @@ gdb_test "python print (a\[0\].is_valid())" "False" "test symbol non-validity"
 gdb_test_no_output "python a = None" "test symbol destructor"
 
 # Test gdb.Symbol domain categories
-gdb_test "python print gdb.SYMBOL_UNDEF_DOMAIN" \
+gdb_test "python print (gdb.SYMBOL_UNDEF_DOMAIN)" \
     "0" "test gdb.SYMBOL_UNDEF_DOMAIN"
-gdb_test "python print gdb.SYMBOL_VAR_DOMAIN" \
+gdb_test "python print (gdb.SYMBOL_VAR_DOMAIN)" \
     "1" "test gdb.SYMBOL_VAR_DOMAIN"
-gdb_test "python print gdb.SYMBOL_STRUCT_DOMAIN" \
+gdb_test "python print (gdb.SYMBOL_STRUCT_DOMAIN)" \
     "2" "test gdb.SYMBOL_STRUCT_DOMAIN"
-gdb_test "python print gdb.SYMBOL_MODULE_DOMAIN" \
+gdb_test "python print (gdb.SYMBOL_MODULE_DOMAIN)" \
     "3" "test gdb.SYMBOL_MODULE_DOMAIN"
-gdb_test "python print gdb.SYMBOL_LABEL_DOMAIN" \
+gdb_test "python print (gdb.SYMBOL_LABEL_DOMAIN)" \
     "4" "test gdb.SYMBOL_LABEL_DOMAIN"
-gdb_test "python print gdb.SYMBOL_COMMON_BLOCK_DOMAIN" \
+gdb_test "python print (gdb.SYMBOL_COMMON_BLOCK_DOMAIN)" \
     "5" "test gdb.SYMBOL_COMMON_BLOCK_DOMAIN"
 
 # Test gdb.Symbol address class categories
-gdb_test "python print gdb.SYMBOL_LOC_UNDEF" \
+gdb_test "python print (gdb.SYMBOL_LOC_UNDEF)" \
     "0" "test gdb.SYMBOL_LOC_UNDEF"
-gdb_test "python print gdb.SYMBOL_LOC_CONST" \
+gdb_test "python print (gdb.SYMBOL_LOC_CONST)" \
     "1" "test gdb.SYMBOL_LOC_CONST"
-gdb_test "python print gdb.SYMBOL_LOC_STATIC" \
+gdb_test "python print (gdb.SYMBOL_LOC_STATIC)" \
     "2" "test gdb.SYMBOL_LOC_STATIC"
-gdb_test "python print gdb.SYMBOL_LOC_REGISTER" \
+gdb_test "python print (gdb.SYMBOL_LOC_REGISTER)" \
     "3" "test gdb.SYMBOL_LOC_REGISTER"
-gdb_test "python print gdb.SYMBOL_LOC_ARG" \
+gdb_test "python print (gdb.SYMBOL_LOC_ARG)" \
     "4" "test gdb.SYMBOL_LOC_ARG"
-gdb_test "python print gdb.SYMBOL_LOC_REF_ARG" \
+gdb_test "python print (gdb.SYMBOL_LOC_REF_ARG)" \
     "5" "test gdb.SYMBOL_LOC_REF_ARG"
-gdb_test "python print gdb.SYMBOL_LOC_REGPARM_ADDR" \
+gdb_test "python print (gdb.SYMBOL_LOC_REGPARM_ADDR)" \
     "6" "test gdb.SYMBOL_LOC_REGPARM_ADDR"
-gdb_test "python print gdb.SYMBOL_LOC_LOCAL" \
+gdb_test "python print (gdb.SYMBOL_LOC_LOCAL)" \
     "7" "test gdb.SYMBOL_LOC_LOCAL"
-gdb_test "python print gdb.SYMBOL_LOC_TYPEDEF" \
+gdb_test "python print (gdb.SYMBOL_LOC_TYPEDEF)" \
     "8" "test gdb.SYMBOL_LOC_TYPEDEF"
-gdb_test "python print gdb.SYMBOL_LOC_LABEL" \
+gdb_test "python print (gdb.SYMBOL_LOC_LABEL)" \
     "9" "test gdb.SYMBOL_LOC_LABEL"
-gdb_test "python print gdb.SYMBOL_LOC_BLOCK" \
+gdb_test "python print (gdb.SYMBOL_LOC_BLOCK)" \
     "10" "test gdb.SYMBOL_LOC_BLOCK"
-gdb_test "python print gdb.SYMBOL_LOC_CONST_BYTES" \
+gdb_test "python print (gdb.SYMBOL_LOC_CONST_BYTES)" \
     "11" "test gdb.SYMBOL_LOC_CONST_BYTES"
-gdb_test "python print gdb.SYMBOL_LOC_UNRESOLVED" \
+gdb_test "python print (gdb.SYMBOL_LOC_UNRESOLVED)" \
     "12" "test gdb.SYMBOL_LOC_UNRESOLVED"
-gdb_test "python print gdb.SYMBOL_LOC_OPTIMIZED_OUT" \
+gdb_test "python print (gdb.SYMBOL_LOC_OPTIMIZED_OUT)" \
     "13" "test gdb.SYMBOL_LOC_OPTIMIZED_OUT"
-gdb_test "python print gdb.SYMBOL_LOC_COMPUTED" \
+gdb_test "python print (gdb.SYMBOL_LOC_COMPUTED)" \
     "14" "test gdb.SYMBOL_LOC_COMPUTED"
-gdb_test "python print gdb.SYMBOL_LOC_COMMON_BLOCK" \
+gdb_test "python print (gdb.SYMBOL_LOC_COMMON_BLOCK)" \
     "15" "test gdb.SYMBOL_LOC_COMMON_BLOCK"
--
2.15.1.windows.2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-06-05 12:43         ` Hannes Domani
@ 2021-06-05 13:57           ` Tom Tromey
  2021-06-05 22:36             ` Tom de Vries
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2021-06-05 13:57 UTC (permalink / raw)
  To: Hannes Domani; +Cc: Hannes Domani via Gdb-patches, Tom Tromey, Tom de Vries

>>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes:

Hannes> Sorry about that.
Hannes> I'm gonna push the below as obvious.

Thank you.  It's an easy error to make :)

Tom

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-06-05 13:57           ` Tom Tromey
@ 2021-06-05 22:36             ` Tom de Vries
  2021-06-10 18:48               ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2021-06-05 22:36 UTC (permalink / raw)
  To: Tom Tromey, Hannes Domani; +Cc: Hannes Domani via Gdb-patches

On 6/5/21 3:57 PM, Tom Tromey wrote:
>>>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes:
> 
> Hannes> Sorry about that.
> Hannes> I'm gonna push the below as obvious.
> 
> Thank you.  It's an easy error to make :)
> 

Indeed, it is :)

Maybe easy enough to warn about in gdb_test_multiple:
...
    if { [regexp -line {python print +[^(]} $command] } {
        warning [concat \
                     "Missing parentheses in python print command," \
                     " will fail with python3"]
    }
...
?

Or, even correct automatically:
...

    if { [regexp -line {python print +[^(]} $command] } {
        set command [regsub {python print (.*)} $command \
                         {python print (\1)}]
    }
...
?

Thanks,
- Tom

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
  2021-06-05 22:36             ` Tom de Vries
@ 2021-06-10 18:48               ` Tom Tromey
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2021-06-10 18:48 UTC (permalink / raw)
  To: Tom de Vries; +Cc: Tom Tromey, Hannes Domani, Hannes Domani via Gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> Maybe easy enough to warn about in gdb_test_multiple:
Tom> ...
Tom>     if { [regexp -line {python print +[^(]} $command] } {
Tom>         warning [concat \
Tom>                      "Missing parentheses in python print command," \
Tom>                      " will fail with python3"]
Tom>     }
Tom> ...
Tom> ?

Tom> Or, even correct automatically:
Tom> ...

Tom>     if { [regexp -line {python print +[^(]} $command] } {
Tom>         set command [regsub {python print (.*)} $command \
Tom>                          {python print (\1)}]
Tom>     }
Tom> ...
Tom> ?

I find auto-fixing pretty funny somehow, but I feel like it might be
confusing or even bite us someday.

Another way out would be a new proc to wrap "python print" so that it's
just not possible to mess up.

Tom

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-06-10 18:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210526170536.657-1-ssbssa.ref@yahoo.de>
2021-05-26 17:05 ` [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant Hannes Domani
2021-05-26 18:13   ` Andreas Schwab
2021-05-26 18:19     ` Hannes Domani
2021-05-29  3:19   ` Simon Marchi
2021-06-02 18:39   ` Tom Tromey
2021-06-03 13:00     ` Hannes Domani
2021-06-05 12:27       ` Tom de Vries
2021-06-05 12:43         ` Hannes Domani
2021-06-05 13:57           ` Tom Tromey
2021-06-05 22:36             ` Tom de Vries
2021-06-10 18:48               ` Tom Tromey

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