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.
This commit is contained in:
parent
0830d30190
commit
e2ff18a0a5
5 changed files with 21 additions and 18 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2020-04-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2020-04-02 Tom Tromey <tromey@adacore.com>
|
2020-04-02 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
* f-lang.c (build_fortran_types): Use arch_type to initialize
|
* f-lang.c (build_fortran_types): Use arch_type to initialize
|
||||||
|
|
10
gdb/exec.c
10
gdb/exec.c
|
@ -619,9 +619,9 @@ build_section_table (struct bfd *some_bfd, struct target_section **start,
|
||||||
*start = XNEWVEC (struct target_section, count);
|
*start = XNEWVEC (struct target_section, count);
|
||||||
*end = *start;
|
*end = *start;
|
||||||
bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
|
bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
|
||||||
if (*end > *start + count)
|
|
||||||
internal_error (__FILE__, __LINE__,
|
gdb_assert (*end <= *start + count);
|
||||||
_("failed internal consistency check"));
|
|
||||||
/* We could realloc the table, but it probably loses for most files. */
|
/* We could realloc the table, but it probably loses for most files. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -916,9 +916,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
|
||||||
ULONGEST memaddr = offset;
|
ULONGEST memaddr = offset;
|
||||||
ULONGEST memend = memaddr + len;
|
ULONGEST memend = memaddr + len;
|
||||||
|
|
||||||
if (len == 0)
|
gdb_assert (len != 0);
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
_("failed internal consistency check"));
|
|
||||||
|
|
||||||
for (p = sections; p < sections_end; p++)
|
for (p = sections; p < sections_end; p++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3576,9 +3576,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
|
||||||
CORE_ADDR svalue;
|
CORE_ADDR svalue;
|
||||||
short section;
|
short section;
|
||||||
|
|
||||||
if (ext_ptr->ifd != f_idx)
|
gdb_assert (ext_ptr->ifd == f_idx);
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
_("failed internal consistency check"));
|
|
||||||
psh = &ext_ptr->asym;
|
psh = &ext_ptr->asym;
|
||||||
|
|
||||||
/* Do not add undefined symbols to the partial symbol table. */
|
/* Do not add undefined symbols to the partial symbol table. */
|
||||||
|
|
|
@ -683,9 +683,9 @@ lookup_partial_symbol (struct objfile *objfile,
|
||||||
while (top > bottom)
|
while (top > bottom)
|
||||||
{
|
{
|
||||||
center = bottom + (top - bottom) / 2;
|
center = bottom + (top - bottom) / 2;
|
||||||
if (!(center < top))
|
|
||||||
internal_error (__FILE__, __LINE__,
|
gdb_assert (center < top);
|
||||||
_("failed internal consistency check"));
|
|
||||||
if (strcmp_iw_ordered ((*center)->ginfo.search_name (),
|
if (strcmp_iw_ordered ((*center)->ginfo.search_name (),
|
||||||
lookup_name.c_str ()) >= 0)
|
lookup_name.c_str ()) >= 0)
|
||||||
{
|
{
|
||||||
|
@ -696,9 +696,8 @@ lookup_partial_symbol (struct objfile *objfile,
|
||||||
bottom = center + 1;
|
bottom = center + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(top == bottom))
|
|
||||||
internal_error (__FILE__, __LINE__,
|
gdb_assert (top == bottom);
|
||||||
_("failed internal consistency check"));
|
|
||||||
|
|
||||||
/* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
|
/* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
|
||||||
search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
|
search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
|
||||||
|
|
|
@ -1578,9 +1578,7 @@ void
|
||||||
wrap_here (const char *indent)
|
wrap_here (const char *indent)
|
||||||
{
|
{
|
||||||
/* This should have been allocated, but be paranoid anyway. */
|
/* This should have been allocated, but be paranoid anyway. */
|
||||||
if (!filter_initialized)
|
gdb_assert (filter_initialized);
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
_("failed internal consistency check"));
|
|
||||||
|
|
||||||
flush_wrap_buffer (gdb_stdout);
|
flush_wrap_buffer (gdb_stdout);
|
||||||
if (chars_per_line == UINT_MAX) /* No line overflow checking. */
|
if (chars_per_line == UINT_MAX) /* No line overflow checking. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue