Update symbol domain and location values for Python

In the distant past, there was no distinction between domain_enum and
search_domain.  At that point, there were two sets of enumerators in a
single enum -- which is why these were eventually split.  This
confusion leaked out to the Python API as well, as noted in
PR python/21765.

This patch deprecates the constants that aren't useful to the Python
API.  They are left in place for now, but removed from the
documentation.  Also, their values are changed so that, if used, they
might work.  Finally, missing domains and location constants are
added.

gdb/ChangeLog
2018-10-06  Tom Tromey  <tom@tromey.com>

	PR python/21765:
	* python/py-symbol.c (gdbpy_initialize_symbols): Redefine
	SYMBOL_VARIABLES_DOMAIN, SYMBOL_FUNCTIONS_DOMAIN,
	SYMBOL_TYPES_DOMAIN.  Define SYMBOL_MODULE_DOMAIN,
	SYMBOL_COMMON_BLOCK_DOMAIN, SYMBOL_LOC_COMMON_BLOCK.

gdb/doc/ChangeLog
2018-10-06  Tom Tromey  <tom@tromey.com>

	PR python/21765:
	* python.texi (Symbols In Python): Document the module and
	common-block domains.  Remove documentation for incorrect
	domains.
This commit is contained in:
Tom Tromey 2018-10-06 22:55:19 -06:00
parent f9e48344d5
commit 51e78fc5fa
5 changed files with 52 additions and 17 deletions

View file

@ -537,6 +537,8 @@ gdbpy_initialize_symbols (void)
LOC_OPTIMIZED_OUT) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED",
LOC_COMPUTED) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMMON_BLOCK",
LOC_COMMON_BLOCK) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
LOC_REGPARM_ADDR) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN",
@ -545,14 +547,24 @@ 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_VARIABLES_DOMAIN",
VARIABLES_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_MODULE_DOMAIN",
MODULE_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_COMMON_BLOCK_DOMAIN",
COMMON_BLOCK_DOMAIN) < 0)
return -1;
/* These remain defined for compatibility, but as they were never
correct, they are no longer documented. Eventually we can remove
them. These exist because at one time, enum search_domain and
enum domain_enum_tag were combined -- but different values were
used differently. Here we try to give them values that will make
sense if they are passed to gdb.lookup_symbol. */
if (PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN",
VAR_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN",
FUNCTIONS_DOMAIN) < 0
VAR_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN",
TYPES_DOMAIN) < 0)
VAR_DOMAIN) < 0)
return -1;
return gdb_pymodule_addobject (gdb_module, "Symbol",