From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 1/2] gdb: use gdb_assert not internal_error
Date: Wed, 14 Dec 2022 10:28:32 +0000 [thread overview]
Message-ID: <7de91e1876385d0b1d025f3ef4c7cd10bc3f1a2e.1671013621.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1671013621.git.aburgess@redhat.com>
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.25.4
next prev parent reply other threads:[~2022-12-14 10:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 10:28 [PATCH 0/2] Fix crash when accessing symbol value from Python API Andrew Burgess
2022-12-14 10:28 ` Andrew Burgess [this message]
2022-12-14 16:07 ` [PATCH 1/2] gdb: use gdb_assert not internal_error Tom Tromey
2022-12-15 13:10 ` Andrew Burgess
2022-12-14 10:28 ` [PATCH 2/2] gdb: fix crash when getting the value of a label symbol Andrew Burgess
2022-12-14 16:17 ` Tom Tromey
2022-12-15 13:25 ` Andrew Burgess
2022-12-15 19:28 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7de91e1876385d0b1d025f3ef4c7cd10bc3f1a2e.1671013621.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).