(gdb_assert_fail): Fix typo in comment.
* avr-tdep.c (avr_return_value): Use gdb_assert_not_reached instead of
gdb_assert (0).
* darwin-nat.c (darwin_check_new_threads): Ditto.
* dwarf2read.c (dwarf2_get_section_info): Ditto.
(munmap_section_buffer): Ditto.
* m32c-tdep.c (make_types): Ditto.
(m32c_decode_srcdest4, m32c_decode_sd23, m32c_frame_base): Ditto.
* macroexp.c (get_character_constant): Ditto.
(get_string_literal): Ditto.
* mep-tdep.c (mep_pseudo_cr_size): Ditto.
(mep_pseudo_cr_index, mep_register_type): Ditto.
(mep_pseudo_register_read, mep_pseudo_register_write): Ditto.
(mep_get_insn, mep_analyze_prologue): Ditto.
* objfiles.c (qsort_cmp): Ditto.
* prologue-value.c (pv_is_identical): Ditto.
* record.c (record_get_loc): Ditto.
* value.c (value_static_field): Ditto.
* xtensa-tdep.c (call0_track_op): Ditto.
+2010-08-18 Doug Evans <dje@google.com>
+
+ * gdb_assert.h (gdb_assert_not_reached): New macro.
+ (gdb_assert_fail): Fix typo in comment.
+ * avr-tdep.c (avr_return_value): Use gdb_assert_not_reached instead of
+ gdb_assert (0).
+ * darwin-nat.c (darwin_check_new_threads): Ditto.
+ * dwarf2read.c (dwarf2_get_section_info): Ditto.
+ (munmap_section_buffer): Ditto.
+ * m32c-tdep.c (make_types): Ditto.
+ (m32c_decode_srcdest4, m32c_decode_sd23, m32c_frame_base): Ditto.
+ * macroexp.c (get_character_constant): Ditto.
+ (get_string_literal): Ditto.
+ * mep-tdep.c (mep_pseudo_cr_size): Ditto.
+ (mep_pseudo_cr_index, mep_register_type): Ditto.
+ (mep_pseudo_register_read, mep_pseudo_register_write): Ditto.
+ (mep_get_insn, mep_analyze_prologue): Ditto.
+ * objfiles.c (qsort_cmp): Ditto.
+ * prologue-value.c (pv_is_identical): Ditto.
+ * record.c (record_get_loc): Ditto.
+ * value.c (value_static_field): Ditto.
+ * xtensa-tdep.c (call0_track_op): Ditto.
+
2010-08-18 Tom Tromey <tromey@redhat.com>
PR symtab/11919:
else if (TYPE_LENGTH (valtype) <= 8)
lsb_reg = 18;
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected type length");
if (writebuf != NULL)
{
old_ix++;
continue;
}
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected thread case");
}
if (darwin_inf->threads)
else if (section_is_p (section_name, FRAME_SECTION))
info = &data->frame;
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected section");
if (info->asection != NULL && info->size != 0 && info->buffer == NULL)
/* We haven't read this section in yet. Do it now. */
gdb_assert (munmap ((void *) map_begin, map_length) == 0);
#else
/* Without HAVE_MMAP, we should never be here to begin with. */
- gdb_assert (0);
+ gdb_assert_not_reached ("no mmap support");
#endif
}
}
#endif
#endif
-/* This prints an "Assertion failed" message, aksing the user if they
+/* This prints an "Assertion failed" message, asking the user if they
want to continue, dump core, or just exit. */
#if defined (ASSERT_FUNCTION)
#define gdb_assert_fail(assertion, file, line, function) \
assertion)
#endif
+/* The canonical form of gdb_assert (0).
+ MESSAGE is a string to include in the error message. */
+
+#if defined (ASSERT_FUNCTION)
+#define gdb_assert_not_reached(message) \
+ internal_error (__FILE__, __LINE__, "%s: %s", ASSERT_FUNCTION, _(message))
+#else
+#define gdb_assert_not_reached(message) \
+ internal_error (__FILE__, __LINE__, _(message))
+#endif
+
#endif /* gdb_assert.h */
break;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected mach");
}
/* The builtin_type_mumble variables are sometimes uninitialized when
case 0xf: sd.addr = pv_constant (m32c_udisp16 (st)); break;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected srcdest4");
}
return sd;
case 0x0f: sd.addr = pv_constant (m32c_udisp16 (st)); break;
case 0x0e: sd.addr = pv_constant (m32c_udisp24 (st)); break;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected sd23");
}
if (ind)
return 0;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected prologue kind");
}
}
else if (*p == 'L' || *p == 'u' || *p == 'U')
p += 2;
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected character constant");
body_start = p;
for (;;)
else if (*p == 'L' || *p == 'u' || *p == 'U')
p += 2;
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected string literal");
for (;;)
{
|| IS_FP_CR64_REGNUM (pseudo))
return 64;
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected coprocessor pseudo register");
}
else if (IS_FP_CR64_REGNUM (pseudo))
return pseudo - MEP_FIRST_FP_CR64_REGNUM;
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected coprocessor pseudo register");
}
return builtin_type (gdbarch)->builtin_uint64;
}
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected cr size");
}
/* All other registers are 32 bits long. */
|| IS_FP_CR64_REGNUM (cookednum))
mep_pseudo_cr64_read (gdbarch, regcache, cookednum, buf);
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected pseudo register");
}
else if (IS_CCR_REGNUM (cookednum))
regcache_raw_write (regcache, mep_pseudo_to_raw[cookednum], buf);
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected pseudo register");
}
/* We'd better be in either core, 32-bit VLIW, or 64-bit VLIW mode. */
else
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected vliw mode");
}
/* Otherwise, the top two bits of the major opcode are (again) what
int disp = SWBH_32_OFFSET (insn);
int size = (IS_SB (insn) ? 1
: IS_SH (insn) ? 2
- : IS_SW (insn) ? 4
- : (gdb_assert (0), 1));
+ : (gdb_assert (IS_SW (insn)), 4));
pv_t addr = pv_add_constant (reg[rm], disp);
if (pv_area_store_would_trash (stack, addr))
return 1;
/* We should have found one of the sections before getting here. */
- gdb_assert (0);
+ gdb_assert_not_reached ("section not found");
}
else
{
return 1;
/* We should have found one of the objfiles before getting here. */
- gdb_assert (0);
+ gdb_assert_not_reached ("objfile not found");
}
}
/* Unreachable. */
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected code path");
return 0;
}
case pvk_register:
return (a.reg == b.reg && a.k == b.k);
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected prologue value kind");
}
}
return rec->u.reg.u.buf;
case record_end:
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected record_entry type");
return NULL;
}
}
break;
}
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected field location kind");
}
return retval;
}
break;
default:
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected instruction kind");
}
}