From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id DF9C2388DD52; Thu, 15 Dec 2022 13:10:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF9C2388DD52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671109809; bh=xszmsJlELGompWXum9oEgJ/nDuvnMEVJkyQEli7kF0Y=; h=From:To:Subject:Date:From; b=loLKwQBZb087PsN84bFlYrqZ5ReLUgykGhvTCPvRx+hqyNO5iW5e3PzrWQzZVZF6S JWc73nEBe/r7qdN67uIqv3vK32gNKIrYHALPfYLOsKeiexre8C1B8QxE8XQ8yEmz4X PWVa+Vy+BgWeMGmbP0xuSiNChGNlS2pMT+ySw9aU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: use gdb_assert not internal_error X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: c896441822c9c5a506dfe302a292aaa41412058a X-Git-Newrev: 38665d717a3e65c70e6432243d5eed9728a4888a Message-Id: <20221215131009.DF9C2388DD52@sourceware.org> Date: Thu, 15 Dec 2022 13:10:09 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D38665d717a3e= 65c70e6432243d5eed9728a4888a commit 38665d717a3e65c70e6432243d5eed9728a4888a Author: Andrew Burgess Date: Mon Dec 12 14:09:40 2022 +0000 gdb: use gdb_assert not internal_error =20 Spotted a couple of places in findvar.c where we use: =20 if ( ! CONDITION ) internal_error ("..."); =20 this commit changes these to be: =20 gdb_assert ( CONDITION ); =20 which I think is better. =20 Unless we happen to hit the internal_error calls (which was bad) there should be no user visible changes after this commit. Diff: --- 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, i= nt 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); } =20 @@ -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); }