From e2ff18a0a54f98c38f8d9b80c36faa7aacacf6d6 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 2 Apr 2020 15:43:41 -0400 Subject: gdb: replace some calls to internal_error with gdb_assert There are a few spots using the pattern: if (condition) internal_error (__FILE__, __LINE__, _("failed internal consistency check")); The message brings no value, since it's pretty the description of a failed assertion. Replace a few of these that are obvious with gdb_assert. gdb/ChangeLog: * exec.c (build_section_table): Replace internal_error with gdb_assert. (section_table_xfer_memory_partial): Likewise. * mdebugread.c (parse_partial_symbols): Likewise. * psymtab.c (lookup_partial_symbol): Likewise. * utils.c (wrap_here): Likewise. --- gdb/exec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index 68bca1b..c885709 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -619,9 +619,9 @@ build_section_table (struct bfd *some_bfd, struct target_section **start, *start = XNEWVEC (struct target_section, count); *end = *start; bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end); - if (*end > *start + count) - internal_error (__FILE__, __LINE__, - _("failed internal consistency check")); + + gdb_assert (*end <= *start + count); + /* We could realloc the table, but it probably loses for most files. */ return 0; } @@ -916,9 +916,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr = offset; ULONGEST memend = memaddr + len; - if (len == 0) - internal_error (__FILE__, __LINE__, - _("failed internal consistency check")); + gdb_assert (len != 0); for (p = sections; p < sections_end; p++) { -- cgit v1.1