From 38665d717a3e65c70e6432243d5eed9728a4888a Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Mon, 12 Dec 2022 14:09:40 +0000 Subject: [PATCH] gdb: use gdb_assert not internal_error Spotted a couple of places in findvar.c where we use: if ( ! CONDITION ) internal_error ("..."); this commit changes these to be: gdb_assert ( CONDITION ); which I think is better. Unless we happen to hit the internal_error calls (which was bad) there should be no user visible changes after this commit. --- gdb/findvar.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gdb/findvar.c b/gdb/findvar.c index 91de3fd5c3e..e609358df08 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -152,10 +152,7 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len, CORE_ADDR extract_typed_address (const gdb_byte *buf, struct type *type) { - if (!type->is_pointer_or_reference ()) - internal_error (_("extract_typed_address: " - "type is not a pointer or reference")); - + gdb_assert (type->is_pointer_or_reference ()); return gdbarch_pointer_to_address (type->arch (), type, buf); } @@ -204,10 +201,7 @@ template void store_integer (gdb_byte *addr, int len, void store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr) { - if (!type->is_pointer_or_reference ()) - internal_error (_("store_typed_address: " - "type is not a pointer or reference")); - + gdb_assert (type->is_pointer_or_reference ()); gdbarch_address_to_pointer (type->arch (), type, buf, addr); } -- 2.30.2