[C++] breakpoint.c: "no memory" software watchpoints and enum casts
authorPedro Alves <palves@redhat.com>
Thu, 19 Nov 2015 14:32:53 +0000 (14:32 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 19 Nov 2015 14:32:53 +0000 (14:32 +0000)
commitc6d811243634c84e185a25faf33491ee1a5f900a
tree0358961ff6696f3bfa8772a53e5285378ce70235
parent4d1931791d0aca95ce82d5391f03b31613d9173b
[C++] breakpoint.c: "no memory" software watchpoints and enum casts

Fixes:

 src/gdb/breakpoint.c: In function ‘void update_watchpoint(watchpoint*, int)’:
 src/gdb/breakpoint.c:2147:31: error: invalid conversion from ‘int’ to ‘target_hw_bp_type’ [-fpermissive]
     base->loc->watchpoint_type = -1;
^

Seems better to rely on "address == -1 && length == -1" than on a enum
value that's not really part of the set of supposedly valid enum
values.  Also, factor that out to separate functions for better
localization of the concept.

gdb/ChangeLog:
2015-11-19  Pedro Alves  <palves@redhat.com>

* breakpoint.c (software_watchpoint_add_no_memory_location)
(is_no_memory_software_watchpoint): New functions.
(update_watchpoint): Use
software_watchpoint_add_memoryless_location.
(breakpoint_address_bits): Use is_no_memory_software_watchpoint.
gdb/ChangeLog
gdb/breakpoint.c