public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCHv2] Restore gdb.SYMBOL_STRUCT_DOMAIN constant
Date: Wed, 26 May 2021 19:05:36 +0200	[thread overview]
Message-ID: <20210526170536.657-1-ssbssa@yahoo.de> (raw)
In-Reply-To: <20210526170536.657-1-ssbssa.ref@yahoo.de>

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


       reply	other threads:[~2021-05-26 17:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210526170536.657-1-ssbssa.ref@yahoo.de>
2021-05-26 17:05 ` Hannes Domani [this message]
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

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=20210526170536.657-1-ssbssa@yahoo.de \
    --to=ssbssa@yahoo.de \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).