summaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-04-19 09:40:20 -0600
committerTom Tromey <tromey@adacore.com>2023-05-12 12:30:28 -0600
commit9c0fb73485cb2c90bb10cb4d3cf1d27e36f9ff01 (patch)
tree88f1ca4555a484b28c4fcbe822ac8c925835fd8b /gdb/python
parent14e8fded85efa824e6652ed876229e5c24758b72 (diff)
downloadbinutils-gdb-9c0fb73485cb2c90bb10cb4d3cf1d27e36f9ff01.tar.gz
Add dynamic_prop::is_constant
I noticed many spots checking whether a dynamic property's kind is PROP_CONST. Some spots, I think, are doing a slightly incorrect check -- checking for != PROP_UNDEFINED where == PROP_CONST is actually required, the key thing being that const_val may only be called for PROP_CONST properties. This patch adds dynamic::is_constant and then updates these checks to use it. Regression tested on x86-64 Fedora 36.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-type.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 1088ee39d96..b9fa741177f 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -609,12 +609,12 @@ typy_range (PyObject *self, PyObject *args)
case TYPE_CODE_ARRAY:
case TYPE_CODE_STRING:
case TYPE_CODE_RANGE:
- if (type->bounds ()->low.kind () == PROP_CONST)
+ if (type->bounds ()->low.is_constant ())
low = type->bounds ()->low.const_val ();
else
low = 0;
- if (type->bounds ()->high.kind () == PROP_CONST)
+ if (type->bounds ()->high.is_constant ())
high = type->bounds ()->high.const_val ();
else
high = 0;