diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index 48d7700..d75c810 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -356,8 +356,6 @@ get_thread_process (struct thread_info *thread)
 struct process_info *
 current_process (void)
 {
-  if (current_inferior == NULL)
-    fatal ("Current inferior requested, but current_inferior is NULL\n");
-
+  gdb_assert (current_inferior != NULL);
   return get_thread_process (current_inferior);
 }
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index e65e276..4eaf2d2 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -2030,7 +2030,11 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
 
       if (requested_child->suspended
 	  && requested_child->status_pending_p)
-	fatal ("requesting an event out of a suspended child?");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "requesting an event out of a"
+			  " suspended child?");
+	}
 
       if (requested_child->status_pending_p)
 	{
@@ -3436,8 +3440,11 @@ linux_resume_one_lwp (struct lwp_info *lwp,
       if (can_hardware_single_step ())
 	step = 1;
       else
-	fatal ("moving out of jump pad single-stepping"
-	       " not implemented on this target");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "moving out of jump pad single-stepping"
+			  " not implemented on this target");
+	}
 
       /* Postpone any pending signal.  It was enqueued above.  */
       signal = 0;
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 850ed7c..7f32ea3 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -1228,8 +1228,7 @@ x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
   /* Is the inferior 32-bit?  If so, then fixup the siginfo object.  */
   if (!is_64bit_tdesc ())
     {
-      if (sizeof (siginfo_t) != sizeof (compat_siginfo_t))
-	fatal ("unexpected difference in siginfo");
+      gdb_assert (sizeof (siginfo_t) == sizeof (compat_siginfo_t));
 
       if (direction == 0)
 	compat_siginfo_from_siginfo ((struct compat_siginfo *) inf, native);
@@ -1241,8 +1240,7 @@ x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
   /* No fixup for native x32 GDB.  */
   else if (!is_elf64 && sizeof (void *) == 8)
     {
-      if (sizeof (siginfo_t) != sizeof (compat_x32_siginfo_t))
-	fatal ("unexpected difference in siginfo");
+      gdb_assert (sizeof (siginfo_t) == sizeof (compat_x32_siginfo_t));
 
       if (direction == 0)
 	compat_x32_siginfo_from_siginfo ((struct compat_x32_siginfo *) inf,
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 2ce3ab2..07f9b20 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -189,7 +189,8 @@ raw_bkpt_type_to_target_hw_bp_type (enum raw_bkpt_type raw_type)
     case raw_bkpt_type_access_wp:
       return hw_access;
     default:
-      fatal ("bad raw breakpoing type %d", (int) raw_type);
+      internal_error (__FILE__, __LINE__,
+		      "bad raw breakpoint type %d", (int) raw_type);
     }
 }
 
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index db99f8c..7868f1f 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -45,8 +45,7 @@ get_thread_regcache (struct thread_info *thread, int fetch)
     {
       struct process_info *proc = get_thread_process (thread);
 
-      if (proc->tdesc == NULL)
-	fatal ("no target description");
+      gdb_assert (proc->tdesc != NULL);
 
       regcache = new_register_cache (proc->tdesc);
       set_inferior_regcache_data (thread, regcache);
@@ -130,7 +129,7 @@ init_register_cache (struct regcache *regcache,
       regcache->register_status = xcalloc (1, tdesc->num_registers);
       gdb_assert (REG_UNAVAILABLE == 0);
 #else
-      fatal ("init_register_cache: can't allocate memory from the heap");
+      gdb_assert_not_reached ("can't allocate memory from the heap");
 #endif
     }
   else
@@ -243,8 +242,8 @@ find_register_by_name (const struct target_desc *tdesc, const char *name)
   for (i = 0; i < tdesc->num_registers; i++)
     if (strcmp (name, tdesc->reg_defs[i].name) == 0)
       return &tdesc->reg_defs[i];
-  fatal ("Unknown register %s requested", name);
-  return 0;
+  internal_error (__FILE__, __LINE__, "Unknown register %s requested",
+		  name);
 }
 
 int
@@ -255,8 +254,8 @@ find_regno (const struct target_desc *tdesc, const char *name)
   for (i = 0; i < tdesc->num_registers; i++)
     if (strcmp (name, tdesc->reg_defs[i].name) == 0)
       return i;
-  fatal ("Unknown register %s requested", name);
-  return -1;
+  internal_error (__FILE__, __LINE__, "Unknown register %s requested",
+		  name);
 }
 
 struct reg *
diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c
index 9710128..0c56f5c 100644
--- a/gdb/gdbserver/tdesc.c
+++ b/gdb/gdbserver/tdesc.c
@@ -35,8 +35,7 @@ init_target_desc (struct target_desc *tdesc)
 
   /* Make sure PBUFSIZ is large enough to hold a full register
      packet.  */
-  if (2 * tdesc->registers_size + 32 > PBUFSIZ)
-    fatal ("Register packet size exceeds PBUFSIZ.");
+  gdb_assert (2 * tdesc->registers_size + 32 <= PBUFSIZ);
 }
 
 #ifndef IN_PROCESS_AGENT
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index d69c9e4..eabfe20 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -193,8 +193,7 @@ thread_db_create_event (CORE_ADDR where)
   struct lwp_info *lwp;
   struct thread_db *thread_db = current_process ()->private->thread_db;
 
-  if (thread_db->td_ta_event_getmsg_p == NULL)
-    fatal ("unexpected thread_db->td_ta_event_getmsg_p == NULL");
+  gdb_assert (thread_db->td_ta_event_getmsg_p != NULL);
 
   if (debug_threads)
     debug_printf ("Thread creation event.\n");
@@ -561,8 +560,7 @@ thread_db_load_search (void)
   struct thread_db *tdb;
   struct process_info *proc = current_process ();
 
-  if (proc->private->thread_db != NULL)
-    fatal ("unexpected: proc->private->thread_db != NULL");
+  gdb_assert (proc->private->thread_db == NULL);
 
   tdb = xcalloc (1, sizeof (*tdb));
   proc->private->thread_db = tdb;
@@ -607,8 +605,7 @@ try_thread_db_load_1 (void *handle)
   struct thread_db *tdb;
   struct process_info *proc = current_process ();
 
-  if (proc->private->thread_db != NULL)
-    fatal ("unexpected: proc->private->thread_db != NULL");
+  gdb_assert (proc->private->thread_db == NULL);
 
   tdb = xcalloc (1, sizeof (*tdb));
   proc->private->thread_db = tdb;
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 7c4b291..92c26aa 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -2943,7 +2943,10 @@ get_jump_space_head (void)
     {
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer,
 				      &gdb_jump_pad_head))
-	fatal ("error extracting jump_pad_buffer");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "error extracting jump_pad_buffer");
+	}
     }
 
   return gdb_jump_pad_head;
@@ -2974,15 +2977,15 @@ claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline)
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer,
 				      &trampoline_buffer_tail))
 	{
-	  fatal ("error extracting trampoline_buffer");
-	  return 0;
+	  internal_error (__FILE__, __LINE__,
+			  "error extracting trampoline_buffer");
 	}
 
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
 				      &trampoline_buffer_head))
 	{
-	  fatal ("error extracting trampoline_buffer_end");
-	  return 0;
+	  internal_error (__FILE__, __LINE__,
+			  "error extracting trampoline_buffer_end");
 	}
     }
 
@@ -3017,8 +3020,8 @@ have_fast_tracepoint_trampoline_buffer (char *buf)
   if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
 				  &trampoline_end))
     {
-      fatal ("error extracting trampoline_buffer_end");
-      return 0;
+      internal_error (__FILE__, __LINE__,
+		      "error extracting trampoline_buffer_end");
     }
   
   if (buf)
@@ -3028,8 +3031,8 @@ have_fast_tracepoint_trampoline_buffer (char *buf)
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_error,
 				  &errbuf))
 	{
-	  fatal ("error extracting errbuf");
-	  return 0;
+	  internal_error (__FILE__, __LINE__,
+			  "error extracting errbuf");
 	}
 
       read_inferior_memory (errbuf, (unsigned char *) buf, 100);
@@ -3371,14 +3374,25 @@ cmd_qtstart (char *packet)
   if (agent_loaded_p ())
     {
       if (write_inferior_integer (ipa_sym_addrs.addr_tracing, 1))
-	fatal ("Error setting tracing variable in lib");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "Error setting tracing variable in lib");
+	}
 
       if (write_inferior_data_pointer (ipa_sym_addrs.addr_stopping_tracepoint,
 				       0))
-	fatal ("Error clearing stopping_tracepoint variable in lib");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "Error clearing stopping_tracepoint variable"
+			  " in lib");
+	}
 
       if (write_inferior_integer (ipa_sym_addrs.addr_trace_buffer_is_full, 0))
-	fatal ("Error clearing trace_buffer_is_full variable in lib");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "Error clearing trace_buffer_is_full variable"
+			  " in lib");
+	}
 
       stop_tracing_bkpt = set_breakpoint_at (ipa_sym_addrs.addr_stop_tracing,
 					     stop_tracing_handler);
@@ -3430,7 +3444,10 @@ stop_tracing (void)
   if (agent_loaded_p ())
     {
       if (write_inferior_integer (ipa_sym_addrs.addr_tracing, 0))
-	fatal ("Error clearing tracing variable in lib");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "Error clearing tracing variable in lib");
+	}
     }
 
   tracing_stop_time = get_timestamp ();
@@ -5608,17 +5625,29 @@ fast_tracepoint_collecting (CORE_ADDR thread_area,
 
   if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer,
 				  &ipa_gdb_jump_pad_buffer))
-    fatal ("error extracting `gdb_jump_pad_buffer'");
+    {
+      internal_error (__FILE__, __LINE__,
+		      "error extracting `gdb_jump_pad_buffer'");
+    }
   if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer_end,
 				  &ipa_gdb_jump_pad_buffer_end))
-    fatal ("error extracting `gdb_jump_pad_buffer_end'");
+    {
+      internal_error (__FILE__, __LINE__,
+		      "error extracting `gdb_jump_pad_buffer_end'");
+    }
 
   if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer,
 				  &ipa_gdb_trampoline_buffer))
-    fatal ("error extracting `gdb_trampoline_buffer'");
+    {
+      internal_error (__FILE__, __LINE__,
+		      "error extracting `gdb_trampoline_buffer'");
+    }
   if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
 				  &ipa_gdb_trampoline_buffer_end))
-    fatal ("error extracting `gdb_trampoline_buffer_end'");
+    {
+      internal_error (__FILE__, __LINE__,
+		      "error extracting `gdb_trampoline_buffer_end'");
+    }
 
   if (ipa_gdb_jump_pad_buffer <= stop_pc
       && stop_pc < ipa_gdb_jump_pad_buffer_end)
@@ -5938,7 +5967,10 @@ target_malloc (ULONGEST size)
       /* We have the pointer *address*, need what it points to.  */
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_tp_heap_buffer,
 				      &target_tp_heap))
-	fatal ("could get target heap head pointer");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "couldn't get target heap head pointer");
+	}
     }
 
   ptr = target_tp_heap;
@@ -6162,7 +6194,10 @@ download_tracepoint (struct tracepoint *tpoint)
       if (read_inferior_data_pointer (tp_prev->obj_addr_on_target
 				      + offsetof (struct tracepoint, next),
 				      &tp_prev_target_next_addr))
-	fatal ("error reading `tp_prev->next'");
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "error reading `tp_prev->next'");
+	}
 
       /* tpoint->next = tp_prev->next */
       write_inferior_data_ptr (tpoint->obj_addr_on_target
@@ -6239,10 +6274,7 @@ download_trace_state_variables (void)
 				   name_addr);
 	}
 
-      if (tsv->getter != NULL)
-	{
-	  fatal ("what to do with these?");
-	}
+      gdb_assert (tsv->getter == NULL);
     }
 
   if (prev_ptr != 0)
@@ -6415,9 +6447,13 @@ upload_fast_traceframes (void)
 	error ("Uploading: couldn't read traceframe at %s\n", paddress (tf));
 
       if (ipa_tframe.tpnum == 0)
-	fatal ("Uploading: No (more) fast traceframes, but "
-	       "ipa_traceframe_count == %u??\n",
-	       ipa_traceframe_write_count - ipa_traceframe_read_count);
+	{
+	  internal_error (__FILE__, __LINE__,
+			  "Uploading: No (more) fast traceframes, but"
+			  " ipa_traceframe_count == %u??\n",
+			  ipa_traceframe_write_count
+			  - ipa_traceframe_read_count);
+	}
 
       /* Note that this will be incorrect for multi-location
 	 tracepoints...  */
