gdb: split get_discrete_bounds in two
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 9 Dec 2020 18:52:03 +0000 (13:52 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Wed, 9 Dec 2020 18:52:03 +0000 (13:52 -0500)
commit14c09924a070918034b465b8ca78282afee62839
tree711442c723f5afabb4985e2d5e6afaa6fa4e5403
parent1f8d2881175920d389078852bb1ff0799d744599
gdb: split get_discrete_bounds in two

get_discrete_bounds is not flexible for ranges (TYPE_CODE_RANGE), in the
sense that it returns true (success) only if both bounds are present and
constant values.

This is a problem for code that only needs to know the low bound and
fails unnecessarily if the high bound is unknown.

Split the function in two, get_discrete_low_bound and
get_discrete_high_bound, that both return an optional.  Provide a new
implementation of get_discrete_bounds based on the two others, so the
callers don't have to be changed.

gdb/ChangeLog:

* gdbtypes.c (get_discrete_bounds): Implement with
get_discrete_low_bound and get_discrete_high_bound.
(get_discrete_low_bound): New.
(get_discrete_high_bound): New.

Change-Id: I986b5e9c0dd969800e3fb9546af9c827d52e80d0
gdb/ChangeLog
gdb/gdbtypes.c