Use gdb::checked_static_cast for watchpoints

This replaces some casts to 'watchpoint *' with checked_static_cast.
In one spot, an unnecessary block is also removed.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2023-09-15 11:56:35 -06:00
parent 093da43d2a
commit bcafd1c19e
3 changed files with 146 additions and 153 deletions

View File

@ -549,14 +549,13 @@ bppy_get_expression (PyObject *self, void *closure)
{
const char *str;
gdbpy_breakpoint_object *obj = (gdbpy_breakpoint_object *) self;
struct watchpoint *wp;
BPPY_REQUIRE_VALID (obj);
if (!is_watchpoint (obj->bp))
Py_RETURN_NONE;
wp = (struct watchpoint *) obj->bp;
watchpoint *wp = gdb::checked_static_cast<watchpoint *> (obj->bp);
str = wp->exp_string.get ();
if (! str)