public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] internal_error: remove need to pass __FILE__/__LINE__
@ 2022-10-17 18:50 Pedro Alves
  2022-10-17 18:59 ` Simon Marchi
  0 siblings, 1 reply; 11+ messages in thread
From: Pedro Alves @ 2022-10-17 18:50 UTC (permalink / raw)
  To: gdb-patches

Currently, every internal_error call must be passed __FILE__/__LINE__
explicitly, like:

  internal_error (__FILE__, __LINE__, "foo %d", var);

The need to pass in explicit __FILE__/__LINE__ is there probably
because the function predates widespread and portable variadic macros
availability.  We can use variadic macros nowadays, and in fact, we
already use them in several places, including the related
gdb_assert_not_reached.

So this patch renames the internal_error function to something else,
and then reimplements internal_error as a variadic macro that expands
__FILE__/__LINE__ itself.

The result is that we now should call internal_error like so:

  internal_error ("foo %d", var);

Likewise for internal_warning.

The patch adjusts all calls sites.  99% of the adjustments were done
with a perl/sed script.

The non-mechanical changes are in gdbsupport/errors.h,
gdbsupport/gdb_assert.h, and gdb/gdbarch.py.

Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
---
 gdb/aarch64-tdep.c                  | 11 ++---
 gdb/ada-exp.y                       |  3 +-
 gdb/ada-lang.c                      | 11 +++--
 gdb/addrmap.c                       |  6 +--
 gdb/alpha-tdep.c                    | 12 ++----
 gdb/amd64-tdep.c                    |  2 +-
 gdb/arc-tdep.c                      |  6 +--
 gdb/arch-utils.c                    | 33 +++++----------
 gdb/arch/arm.c                      |  2 +-
 gdb/arm-linux-tdep.c                |  3 +-
 gdb/arm-netbsd-tdep.c               |  3 +-
 gdb/arm-tdep.c                      | 49 +++++++++-------------
 gdb/avr-tdep.c                      |  4 +-
 gdb/ax-gdb.c                        | 30 +++++--------
 gdb/ax-general.c                    |  6 +--
 gdb/bfin-tdep.c                     |  6 +--
 gdb/blockframe.c                    |  3 +-
 gdb/breakpoint.c                    | 41 +++++++-----------
 gdb/btrace.c                        |  6 +--
 gdb/c-exp.y                         |  5 +--
 gdb/c-lang.c                        |  4 +-
 gdb/cli/cli-script.c                |  4 +-
 gdb/coffread.c                      |  2 +-
 gdb/compile/compile-c-support.c     |  2 +-
 gdb/compile/compile-c-symbols.c     |  2 +-
 gdb/compile/compile-cplus-symbols.c |  2 +-
 gdb/compile/compile-cplus-types.c   |  3 +-
 gdb/compile/compile-object-load.c   |  2 +-
 gdb/corefile.c                      |  3 +-
 gdb/cp-abi.c                        |  6 +--
 gdb/cp-namespace.c                  |  3 +-
 gdb/cris-tdep.c                     |  9 ++--
 gdb/dbxread.c                       |  3 +-
 gdb/dictionary.c                    |  6 +--
 gdb/dtrace-probe.c                  |  3 +-
 gdb/dwarf2/comp-unit-head.c         | 12 ++----
 gdb/dwarf2/expr.c                   | 10 ++---
 gdb/dwarf2/frame.c                  | 20 ++++-----
 gdb/dwarf2/leb.c                    |  3 +-
 gdb/dwarf2/loc.c                    |  4 +-
 gdb/elfread.c                       |  3 +-
 gdb/event-top.c                     |  2 +-
 gdb/exceptions.c                    |  2 +-
 gdb/exec.c                          |  3 +-
 gdb/fbsd-nat.c                      |  2 +-
 gdb/fbsd-tdep.c                     |  2 +-
 gdb/findvar.c                       |  6 +--
 gdb/frame-unwind.c                  |  2 +-
 gdb/frame.c                         |  9 ++--
 gdb/frv-linux-tdep.c                |  2 +-
 gdb/frv-tdep.c                      |  8 ++--
 gdb/gdbarch.c                       |  3 +-
 gdb/gdbarch.py                      |  4 +-
 gdb/gdbtypes.c                      |  5 +--
 gdb/go32-nat.c                      | 18 +++-----
 gdb/h8300-tdep.c                    |  3 +-
 gdb/hppa-tdep.c                     |  6 +--
 gdb/i386-linux-nat.c                |  6 +--
 gdb/i386-tdep.c                     | 16 ++++---
 gdb/i387-tdep.c                     |  5 +--
 gdb/ia64-tdep.c                     |  3 +-
 gdb/infcall.c                       |  2 +-
 gdb/infcmd.c                        |  5 +--
 gdb/infrun.c                        | 17 +++-----
 gdb/interps.c                       |  3 +-
 gdb/language.c                      | 17 +++-----
 gdb/linux-nat.c                     | 14 +++----
 gdb/loongarch-tdep.c                |  3 +-
 gdb/m32c-tdep.c                     |  6 +--
 gdb/m32r-linux-nat.c                |  6 +--
 gdb/m68k-linux-nat.c                |  6 +--
 gdb/m68k-tdep.c                     |  9 ++--
 gdb/macroexp.c                      |  5 +--
 gdb/maint.c                         |  4 +-
 gdb/mi/mi-cmd-stack.c               |  3 +-
 gdb/mi/mi-getopt.c                  |  3 +-
 gdb/mi/mi-out.c                     |  4 +-
 gdb/microblaze-tdep.c               |  3 +-
 gdb/minsyms.c                       |  6 +--
 gdb/mips-tdep.c                     | 51 ++++++++++------------
 gdb/mn10300-tdep.c                  | 11 ++---
 gdb/msp430-tdep.c                   |  3 +-
 gdb/nat/linux-btrace.c              |  4 +-
 gdb/nat/linux-namespaces.c          |  9 ++--
 gdb/nat/mips-linux-watch.c          | 21 ++++------
 gdb/nat/x86-dregs.c                 |  9 ++--
 gdb/nds32-tdep.c                    |  9 ++--
 gdb/netbsd-tdep.c                   |  2 +-
 gdb/objfiles.h                      |  9 ++--
 gdb/osabi.c                         | 20 ++++-----
 gdb/ppc-linux-nat.c                 |  3 +-
 gdb/ppc-linux-tdep.c                |  2 +-
 gdb/ppc-sysv-tdep.c                 |  2 +-
 gdb/printcmd.c                      |  6 +--
 gdb/process-stratum-target.c        |  3 +-
 gdb/psymtab.c                       |  3 +-
 gdb/record-btrace.c                 |  4 +-
 gdb/regcache.c                      |  6 +--
 gdb/reggroups.c                     |  2 +-
 gdb/remote-sim.c                    |  6 +--
 gdb/remote.c                        | 65 ++++++++++-------------------
 gdb/riscv-tdep.c                    |  3 +-
 gdb/rl78-tdep.c                     |  3 +-
 gdb/rs6000-aix-nat.c                |  3 +-
 gdb/rs6000-tdep.c                   | 18 ++++----
 gdb/s390-tdep.c                     | 14 +++----
 gdb/sentinel-frame.c                |  2 +-
 gdb/ser-event.c                     |  3 +-
 gdb/ser-mingw.c                     |  3 +-
 gdb/ser-unix.c                      |  3 +-
 gdb/serial.c                        |  3 +-
 gdb/source.c                        |  2 +-
 gdb/sparc-tdep.c                    |  3 +-
 gdb/sparc64-tdep.c                  |  5 +--
 gdb/stack.c                         |  3 +-
 gdb/stap-probe.c                    |  9 ++--
 gdb/symtab.c                        |  3 +-
 gdb/target-descriptions.c           | 18 +++-----
 gdb/target.c                        | 20 ++++-----
 gdb/tic6x-tdep.c                    |  8 ++--
 gdb/tracectf.c                      |  2 +-
 gdb/tracefile-tfile.c               |  2 +-
 gdb/tracepoint.c                    |  8 ++--
 gdb/tui/tui-interp.c                |  2 +-
 gdb/ui-out.c                        | 30 +++++--------
 gdb/utils.c                         |  9 ++--
 gdb/valops.c                        |  5 +--
 gdb/valprint.c                      |  3 +-
 gdb/value.c                         |  9 ++--
 gdb/windows-nat.c                   |  3 +-
 gdb/xml-support.c                   |  6 +--
 gdb/xml-syscall.c                   |  3 +-
 gdb/xtensa-tdep.c                   | 17 +++-----
 gdbserver/ax.cc                     |  3 +-
 gdbserver/linux-amd64-ipa.cc        |  9 ++--
 gdbserver/linux-arm-low.cc          |  4 +-
 gdbserver/linux-i386-ipa.cc         |  5 +--
 gdbserver/linux-low.cc              | 20 ++++-----
 gdbserver/linux-ppc-ipa.cc          |  3 +-
 gdbserver/linux-s390-ipa.cc         |  3 +-
 gdbserver/mem-break.cc              |  3 +-
 gdbserver/regcache.cc               |  2 +-
 gdbserver/remote-utils.cc           |  3 +-
 gdbserver/tracepoint.cc             | 50 ++++++++--------------
 gdbsupport/btrace-common.cc         | 10 ++---
 gdbsupport/common-exceptions.cc     | 10 ++---
 gdbsupport/common-utils.cc          |  2 +-
 gdbsupport/errors.cc                |  4 +-
 gdbsupport/errors.h                 | 18 +++++---
 gdbsupport/event-loop.cc            |  3 +-
 gdbsupport/gdb_assert.h             |  8 ++--
 gdbsupport/print-utils.cc           | 11 ++---
 152 files changed, 465 insertions(+), 752 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 32e85794ca5..d9ddc84a140 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1278,8 +1278,7 @@ aarch64_dwarf2_prev_register (frame_info_ptr this_frame,
       return frame_unwind_got_constant (this_frame, regnum, lr);
 
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Unexpected register %d"), regnum);
+      internal_error (_("Unexpected register %d"), regnum);
     }
 }
 
@@ -2663,8 +2662,7 @@ aarch64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
   if (tdep->has_pauth () && regnum == tdep->ra_sign_state_regnum)
     return "";
 
-  internal_error (__FILE__, __LINE__,
-		  _("aarch64_pseudo_register_name: bad register number %d"),
+  internal_error (_("aarch64_pseudo_register_name: bad register number %d"),
 		  p_regnum);
 }
 
@@ -2703,8 +2701,7 @@ aarch64_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
   if (tdep->has_pauth () && regnum == tdep->ra_sign_state_regnum)
     return builtin_type (gdbarch)->builtin_uint64;
 
-  internal_error (__FILE__, __LINE__,
-		  _("aarch64_pseudo_register_type: bad register number %d"),
+  internal_error (_("aarch64_pseudo_register_type: bad register number %d"),
 		  p_regnum);
 }
 
@@ -3503,7 +3500,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   uint64_t vq = aarch64_get_tdesc_vq (info.target_desc);
 
   if (vq > AARCH64_MAX_SVE_VQ)
-    internal_error (__FILE__, __LINE__, _("VQ out of bounds: %s (max %d)"),
+    internal_error (_("VQ out of bounds: %s (max %d)"),
 		    pulongest (vq), AARCH64_MAX_SVE_VQ);
 
   /* If there is already a candidate, use it.  */
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index f67c221d873..9e078512993 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1659,8 +1659,7 @@ write_var_or_type (struct parser_state *par_state,
 	      write_selectors (par_state, encoded_name + tail_index);
 	      return NULL;
 	    default:
-	      internal_error (__FILE__, __LINE__,
-			      _("impossible value from ada_parse_renaming"));
+	      internal_error (_("impossible value from ada_parse_renaming"));
 	    }
 
 	  if (type_sym != NULL)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index adacf1dd1c9..16480b9fef4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12001,7 +12001,7 @@ ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex)
 	break;
 
       default:
-	internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+	internal_error (_("unexpected catchpoint type"));
 	break;
     }
 
@@ -12471,7 +12471,7 @@ ada_catchpoint::print_one (bp_location **last_loc) const
 	break;
 
       default:
-	internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+	internal_error (_("unexpected catchpoint type"));
 	break;
     }
 
@@ -12525,7 +12525,7 @@ ada_catchpoint::print_mention () const
 	break;
 
       default:
-	internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+	internal_error (_("unexpected catchpoint type"));
 	break;
     }
 }
@@ -12557,7 +12557,7 @@ ada_catchpoint::print_recreate (struct ui_file *fp) const
 	break;
 
       default:
-	internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+	internal_error (_("unexpected catchpoint type"));
     }
   print_recreate_thread (fp);
 }
@@ -12672,8 +12672,7 @@ ada_exception_sym_name (enum ada_exception_catchpoint_kind ex)
 	return (data->exception_info->catch_handlers_sym);
 	break;
       default:
-	internal_error (__FILE__, __LINE__,
-			_("unexpected catchpoint kind (%d)"), ex);
+	internal_error (_("unexpected catchpoint kind (%d)"), ex);
     }
 }
 
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 8c357fbf7e5..9c46bd7bed1 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -34,8 +34,7 @@ void
 addrmap_fixed::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
 			  void *obj)
 {
-  internal_error (__FILE__, __LINE__,
-		  "addrmap_fixed_set_empty: "
+  internal_error ("addrmap_fixed_set_empty: "
 		  "fixed addrmaps can't be changed\n");
 }
 
@@ -301,8 +300,7 @@ void
 addrmap_mutable::relocate (CORE_ADDR offset)
 {
   /* Not needed yet.  */
-  internal_error (__FILE__, __LINE__,
-		  _("addrmap_relocate is not implemented yet "
+  internal_error (_("addrmap_relocate is not implemented yet "
 		    "for mutable addrmaps"));
 }
 
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 646d4270636..99e51b8afec 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -494,8 +494,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
 	  break;
 
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("unknown floating point width"));
+	  internal_error (_("unknown floating point width"));
 	}
       break;
 
@@ -518,8 +517,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
 	  break;
 
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("unknown floating point width"));
+	  internal_error (_("unknown floating point width"));
 	}
       break;
 
@@ -563,8 +561,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
 	  error (_("Cannot set a 128-bit long double return value."));
 
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("unknown floating point width"));
+	  internal_error (_("unknown floating point width"));
 	}
       break;
 
@@ -588,8 +585,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
 	  error (_("Cannot set a 128-bit long double return value."));
 
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("unknown floating point width"));
+	  internal_error (_("unknown floating point width"));
 	}
       break;
 
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index ccdceeef0e5..a6894d82dbc 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -1313,7 +1313,7 @@ amd64_get_unused_input_int_reg (const struct amd64_insn *details)
       }
 
     /* We shouldn't get here.  */
-    internal_error (__FILE__, __LINE__, _("unable to find free reg"));
+    internal_error (_("unable to find free reg"));
   }
 }
 
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index edca4d0803d..3ab0930bb29 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1947,8 +1947,7 @@ mach_type_to_arc_isa (const unsigned long mach)
     case bfd_mach_arc_arcv2:
       return ARC_ISA_ARCV2;
     default:
-	internal_error (__FILE__, __LINE__,
-			_("unknown machine id %lu"), mach);
+	internal_error (_("unknown machine id %lu"), mach);
     }
 }
 
@@ -1973,8 +1972,7 @@ arc_arch_features_create (const bfd *abfd, const unsigned long mach)
       else if (eclass == ELFCLASS64)
 	reg_size = 8;
       else
-	internal_error (__FILE__, __LINE__,
-			_("unknown ELF header class %d"), eclass);
+	internal_error (_("unknown ELF header class %d"), eclass);
     }
 
   /* MACH from a bfd_arch_info struct is used here.  It should be a safe
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 6a72b3f5efd..5218bfc05e1 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -269,8 +269,7 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch,
   else
     /* Should this be an internal error?  I guess so, it is reflecting
        an architectural limitation in the current design.  */
-    internal_error (__FILE__, __LINE__, 
-		    _("No virtual frame pointer available"));
+    internal_error (_("No virtual frame pointer available"));
   *frame_offset = 0;
 }
 
@@ -398,8 +397,7 @@ set_endian (const char *ignore_args, int from_tty, struct cmd_list_element *c)
     {
       target_byte_order_user = BFD_ENDIAN_UNKNOWN;
       if (! gdbarch_update_p (info))
-	internal_error (__FILE__, __LINE__,
-			_("set_endian: architecture update failed"));
+	internal_error (_("set_endian: architecture update failed"));
     }
   else if (set_endian_string == endian_little)
     {
@@ -420,8 +418,7 @@ set_endian (const char *ignore_args, int from_tty, struct cmd_list_element *c)
 	target_byte_order_user = BFD_ENDIAN_BIG;
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("set_endian: bad value"));
+    internal_error (_("set_endian: bad value"));
 
   show_endian (gdb_stdout, from_tty, NULL, NULL);
 }
@@ -557,15 +554,13 @@ set_architecture (const char *ignore_args,
     {
       target_architecture_user = NULL;
       if (!gdbarch_update_p (info))
-	internal_error (__FILE__, __LINE__,
-			_("could not select an architecture automatically"));
+	internal_error (_("could not select an architecture automatically"));
     }
   else
     {
       info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
       if (info.bfd_arch_info == NULL)
-	internal_error (__FILE__, __LINE__,
-			_("set_architecture: bfd_scan_arch failed"));
+	internal_error (_("set_architecture: bfd_scan_arch failed"));
       if (gdbarch_update_p (info))
 	target_architecture_user = info.bfd_arch_info;
       else
@@ -700,13 +695,11 @@ initialize_current_architecture (void)
 	}
 
       if (chosen == NULL)
-	internal_error (__FILE__, __LINE__,
-			_("initialize_current_architecture: No arch"));
+	internal_error (_("initialize_current_architecture: No arch"));
 
       default_bfd_arch = bfd_scan_arch (chosen);
       if (default_bfd_arch == NULL)
-	internal_error (__FILE__, __LINE__,
-			_("initialize_current_architecture: Arch not found"));
+	internal_error (_("initialize_current_architecture: Arch not found"));
     }
 
   gdbarch_info info;
@@ -749,8 +742,7 @@ initialize_current_architecture (void)
   info.byte_order_for_code = info.byte_order;
 
   if (! gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__,
-		    _("initialize_current_architecture: Selection of "
+    internal_error (_("initialize_current_architecture: Selection of "
 		      "initial architecture failed"));
 
   /* Create the ``set architecture'' command appending ``auto'' to the
@@ -1233,8 +1225,7 @@ gdbarch_printable_names ()
       const struct bfd_arch_info *ap
 	= bfd_lookup_arch (rego->bfd_architecture, 0);
       if (ap == nullptr)
-	internal_error (__FILE__, __LINE__,
-			_("gdbarch_architecture_names: multi-arch unknown"));
+	internal_error (_("gdbarch_architecture_names: multi-arch unknown"));
       do
 	{
 	  arches.push_back (ap->printable_name);
@@ -1259,8 +1250,7 @@ gdbarch_register (enum bfd_architecture bfd_architecture,
   bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
   if (bfd_arch_info == NULL)
     {
-      internal_error (__FILE__, __LINE__,
-		      _("gdbarch: Attempt to register "
+      internal_error (_("gdbarch: Attempt to register "
 			"unknown architecture (%d)"),
 		      bfd_architecture);
     }
@@ -1270,8 +1260,7 @@ gdbarch_register (enum bfd_architecture bfd_architecture,
        curr = &(*curr)->next)
     {
       if (bfd_architecture == (*curr)->bfd_architecture)
-	internal_error (__FILE__, __LINE__,
-			_("gdbarch: Duplicate registration "
+	internal_error (_("gdbarch: Duplicate registration "
 			  "of architecture (%s)"),
 			bfd_arch_info->printable_name);
     }
diff --git a/gdb/arch/arm.c b/gdb/arch/arm.c
index 14f0a7a7f6c..b302276f8d1 100644
--- a/gdb/arch/arm.c
+++ b/gdb/arch/arm.c
@@ -194,7 +194,7 @@ arm_instruction_changes_pc (uint32_t this_instr)
 	return 0;
 
       default:
-	internal_error (__FILE__, __LINE__, _("bad value in switch"));
+	internal_error (_("bad value in switch"));
       }
 }
 
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 7fa8a67ae42..27aca0c39e6 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1759,8 +1759,7 @@ arm_linux_init_abi (struct gdbarch_info info,
       break;
     default:
       internal_error
-	(__FILE__, __LINE__,
-	 _("arm_linux_init_abi: Floating point model not supported"));
+	(_("arm_linux_init_abi: Floating point model not supported"));
       break;
     }
   tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
diff --git a/gdb/arm-netbsd-tdep.c b/gdb/arm-netbsd-tdep.c
index aa4d15df4c6..e92eef36a67 100644
--- a/gdb/arm-netbsd-tdep.c
+++ b/gdb/arm-netbsd-tdep.c
@@ -131,8 +131,7 @@ arm_netbsd_init_abi_common (struct gdbarch_info info,
       break;
 
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("arm_gdbarch_init: bad byte order for float format"));
+      internal_error (_("arm_gdbarch_init: bad byte order for float format"));
     }
 
   tdep->jb_pc = ARM_NBSD_JB_PC;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index b5facae8a5e..2af6aa1eff1 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3692,11 +3692,11 @@ arm_m_exception_cache (frame_info_ptr this_frame)
       return cache;
     }
 
-  internal_error (__FILE__, __LINE__, _("While unwinding an exception frame, "
-					"found unexpected Link Register value "
-					"%s.  This should not happen and may "
-					"be caused by corrupt data or a bug in"
-					" GDB."),
+  internal_error (_("While unwinding an exception frame, "
+		    "found unexpected Link Register value "
+		    "%s.  This should not happen and may "
+		    "be caused by corrupt data or a bug in"
+		    " GDB."),
 		  phex (lr, ARM_INT_REGISTER_SIZE));
 }
 
@@ -3970,8 +3970,7 @@ arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
       return frame_unwind_got_constant (this_frame, regnum, val);
     }
 
-  internal_error (__FILE__, __LINE__,
-		  _("Unexpected register %d"), regnum);
+  internal_error (_("Unexpected register %d"), regnum);
 }
 
 /* Implement the stack_frame_destroyed_p gdbarch method.  */
@@ -4226,7 +4225,7 @@ arm_vfp_cprc_unit_length (enum arm_vfp_cprc_base_type b)
     case VFP_CPRC_VEC128:
       return 16;
     default:
-      internal_error (__FILE__, __LINE__, _("Invalid VFP CPRC type: %d."),
+      internal_error (_("Invalid VFP CPRC type: %d."),
 		      (int) b);
     }
 }
@@ -4248,7 +4247,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b)
     case VFP_CPRC_VEC128:
       return 'q';
     default:
-      internal_error (__FILE__, __LINE__, _("Invalid VFP CPRC type: %d."),
+      internal_error (_("Invalid VFP CPRC type: %d."),
 		      (int) b);
     }
 }
@@ -5078,7 +5077,7 @@ arm_register_sim_regno (struct gdbarch *gdbarch, int regnum)
     return SIM_ARM_FPS_REGNUM + reg;
   reg -= NUM_SREGS;
 
-  internal_error (__FILE__, __LINE__, _("Bad REGNUM %d"), regnum);
+  internal_error (_("Bad REGNUM %d"), regnum);
 }
 
 static const unsigned char op_lit0 = DW_OP_lit0;
@@ -5484,8 +5483,7 @@ displaced_write_reg (regcache *regs, arm_displaced_step_copy_insn_closure *dsc,
 	  break;
 
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("Invalid argument to displaced_write_reg"));
+	  internal_error (_("Invalid argument to displaced_write_reg"));
 	}
 
       dsc->wrote_to_pc = 1;
@@ -6413,8 +6411,7 @@ arm_copy_extra_ld_st (struct gdbarch *gdbarch, uint32_t insn, int unprivileged,
   opcode = ((op2 << 2) | (op1 & 0x1) | ((op1 & 0x4) >> 1)) - 4;
 
   if (opcode < 0)
-    internal_error (__FILE__, __LINE__,
-		    _("copy_extra_ld_st: instruction decode error"));
+    internal_error (_("copy_extra_ld_st: instruction decode error"));
 
   dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
   dsc->tmp[1] = displaced_read_reg (regs, dsc, 1);
@@ -8167,8 +8164,7 @@ thumb_process_displaced_16bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
     }
 
   if (err)
-    internal_error (__FILE__, __LINE__,
-		    _("thumb_process_displaced_16bit_insn: Instruction decode error"));
+    internal_error (_("thumb_process_displaced_16bit_insn: Instruction decode error"));
 }
 
 static int
@@ -8374,8 +8370,7 @@ thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
     }
 
   if (err)
-    internal_error (__FILE__, __LINE__,
-		    _("thumb_process_displaced_32bit_insn: Instruction decode error"));
+    internal_error (_("thumb_process_displaced_32bit_insn: Instruction decode error"));
 
 }
 
@@ -8455,8 +8450,7 @@ arm_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
     }
 
   if (err)
-    internal_error (__FILE__, __LINE__,
-		    _("arm_process_displaced_insn: Instruction decode error"));
+    internal_error (_("arm_process_displaced_insn: Instruction decode error"));
 }
 
 /* Actually set up the scratch space for a displaced instruction.  */
@@ -8767,8 +8761,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
 	  break;
 
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("arm_extract_return_value: "
+	  internal_error (_("arm_extract_return_value: "
 			    "Floating point model not supported"));
 	  break;
 	}
@@ -8975,8 +8968,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
 	  break;
 
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("arm_store_return_value: Floating "
+	  internal_error (_("arm_store_return_value: Floating "
 			    "point model not supported"));
 	  break;
 	}
@@ -9296,7 +9288,7 @@ arm_update_current_architecture (void)
   /* Update the architecture.  */
   gdbarch_info info;
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, _("could not update architecture"));
+    internal_error (_("could not update architecture"));
 }
 
 static void
@@ -9313,7 +9305,7 @@ set_fp_model_sfunc (const char *args, int from_tty,
       }
 
   if (fp_model == ARM_FLOAT_LAST)
-    internal_error (__FILE__, __LINE__, _("Invalid fp model accepted: %s."),
+    internal_error (_("Invalid fp model accepted: %s."),
 		    current_fp_model);
 
   arm_update_current_architecture ();
@@ -9353,7 +9345,7 @@ arm_set_abi (const char *args, int from_tty,
       }
 
   if (arm_abi == ARM_ABI_LAST)
-    internal_error (__FILE__, __LINE__, _("Invalid ABI accepted: %s."),
+    internal_error (_("Invalid ABI accepted: %s."),
 		    arm_abi_string);
 
   arm_update_current_architecture ();
@@ -10499,8 +10491,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       break;
 
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("arm_gdbarch_init: bad byte order for float format"));
+      internal_error (_("arm_gdbarch_init: bad byte order for float format"));
     }
 
   /* On ARM targets char defaults to unsigned.  */
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 41ffa046b40..bac0b3f5008 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -405,7 +405,7 @@ avr_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
       store_unsigned_integer (buf, 4, gdbarch_byte_order (gdbarch), val);
       return status;
     default:
-      internal_error (__FILE__, __LINE__, _("invalid regnum"));
+      internal_error (_("invalid regnum"));
     }
 }
 
@@ -423,7 +423,7 @@ avr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
       regcache_raw_write_unsigned (regcache, AVR_PC_REGNUM, val);
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("invalid regnum"));
+      internal_error (_("invalid regnum"));
     }
 }
 
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 3a223b34ba3..82e6e35dccf 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -400,8 +400,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
 	     implementing something we should be (this code's fault).
 	     In any case, it's a bug the user shouldn't see.  */
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("gen_fetch: strange size"));
+	  internal_error (_("gen_fetch: strange size"));
 	}
 
       gen_sign_extend (ax, type);
@@ -533,8 +532,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
       break;
 
     case LOC_CONST_BYTES:
-      internal_error (__FILE__, __LINE__,
-		      _("gen_var_ref: LOC_CONST_BYTES "
+      internal_error (_("gen_var_ref: LOC_CONST_BYTES "
 			"symbols are not supported"));
 
       /* Variable at a fixed location in memory.  Easy.  */
@@ -1096,8 +1094,7 @@ gen_deref (struct axs_value *value)
   /* The caller should check the type, because several operators use
      this, and we don't know what error message to generate.  */
   if (!value->type->is_pointer_or_reference ())
-    internal_error (__FILE__, __LINE__,
-		    _("gen_deref: expected a pointer"));
+    internal_error (_("gen_deref: expected a pointer"));
 
   /* We've got an rvalue now, which is a pointer.  We want to yield an
      lvalue, whose address is exactly that pointer.  So we don't
@@ -1200,8 +1197,7 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
 
   /* Can we fetch the number of bits requested at all?  */
   if ((end - start) > ((1 << num_ops) * 8))
-    internal_error (__FILE__, __LINE__,
-		    _("gen_bitfield_ref: bitfield too wide"));
+    internal_error (_("gen_bitfield_ref: bitfield too wide"));
 
   /* Note that we know here that we only need to try each opcode once.
      That may not be true on machines with weird byte sizes.  */
@@ -1362,8 +1358,7 @@ gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value,
 	    }
 #if 0 /* is this right? */
 	  if (this_name[0] == '\0')
-	    internal_error (__FILE__, __LINE__,
-			    _("find_field: anonymous unions not supported"));
+	    internal_error (_("find_field: anonymous unions not supported"));
 #endif
 	}
     }
@@ -1476,8 +1471,7 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
 
   if (t->code () != TYPE_CODE_STRUCT
       && t->code () != TYPE_CODE_UNION)
-    internal_error (__FILE__, __LINE__,
-		    _("non-aggregate type to gen_struct_elt_for_reference"));
+    internal_error (_("non-aggregate type to gen_struct_elt_for_reference"));
 
   for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); i--)
     {
@@ -1569,8 +1563,7 @@ gen_aggregate_elt_ref (struct agent_expr *ax, struct axs_value *value,
       return gen_namespace_elt (ax, value, type, field);
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("non-aggregate type in gen_aggregate_elt_ref"));
+      internal_error (_("non-aggregate type in gen_aggregate_elt_ref"));
     }
 
   return 0;
@@ -1654,8 +1647,7 @@ register_operation::do_generate_ax (struct expression *exp,
 
   reg = user_reg_map_name_to_regnum (ax->gdbarch, name, len);
   if (reg == -1)
-    internal_error (__FILE__, __LINE__,
-		    _("Register $%s not available"), name);
+    internal_error (_("Register $%s not available"), name);
   /* No support for tracing user registers yet.  */
   if (reg >= gdbarch_num_cooked_regs (ax->gdbarch))
     error (_("'%s' is a user-register; "
@@ -2214,8 +2206,7 @@ gen_expr_binop_rest (struct expression *exp,
     default:
       /* We should only list operators in the outer case statement
 	 that we actually handle in the inner case statement.  */
-      internal_error (__FILE__, __LINE__,
-		      _("gen_expr: op case sets don't match"));
+      internal_error (_("gen_expr: op case sets don't match"));
     }
 }
 
@@ -2254,8 +2245,7 @@ gen_expr_structop (struct expression *exp,
   else
     /* If this `if' chain doesn't handle it, then the case list
        shouldn't mention it, and we shouldn't be here.  */
-    internal_error (__FILE__, __LINE__,
-		    _("gen_expr: unhandled struct case"));
+    internal_error (_("gen_expr: unhandled struct case"));
 }
 
 /* A helper function that emits a unary operation.  */
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index c025aa214b4..758706ad662 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -309,8 +309,7 @@ ax_tsv (struct agent_expr *x, enum agent_op op, int num)
 {
   /* Make sure the tsv number is in range.  */
   if (num < 0 || num > 0xffff)
-    internal_error (__FILE__, __LINE__, 
-		    _("ax-general.c (ax_tsv): variable "
+    internal_error (_("ax-general.c (ax_tsv): variable "
 		      "number is %d, out of range"), num);
 
   grow_expr (x, 3);
@@ -332,8 +331,7 @@ ax_string (struct agent_expr *x, const char *str, int slen)
 
   /* Make sure the string length is reasonable.  */
   if (slen < 0 || slen > 0xffff)
-    internal_error (__FILE__, __LINE__, 
-		    _("ax-general.c (ax_string): string "
+    internal_error (_("ax-general.c (ax_string): string "
 		      "length is %d, out of allowed range"), slen);
 
   grow_expr (x, 2 + slen + 1);
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index cdaa8111472..f751e278211 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -696,8 +696,7 @@ bfin_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
   enum register_status status;
 
   if (regnum != BFIN_CC_REGNUM)
-    internal_error (__FILE__, __LINE__,
-		    _("invalid register number %d"), regnum);
+    internal_error (_("invalid register number %d"), regnum);
 
   /* Extract the CC bit from the ASTAT register.  */
   status = regcache->raw_read (BFIN_ASTAT_REGNUM, buf);
@@ -716,8 +715,7 @@ bfin_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
   gdb_byte buf[BFIN_MAX_REGISTER_SIZE];
 
   if (regnum != BFIN_CC_REGNUM)
-    internal_error (__FILE__, __LINE__,
-		    _("invalid register number %d"), regnum);
+    internal_error (_("invalid register number %d"), regnum);
 
   /* Overlay the CC bit in the ASTAT register.  */
   regcache->raw_read (BFIN_ASTAT_REGNUM, buf);
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index a1b4a476b0f..49bafa34b60 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -410,8 +410,7 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name,
 
       /* It's an internal error if we exit the above loop without finding
 	 the range.  */
-      internal_error (__FILE__, __LINE__,
-		      _("Entry block not found in find_function_entry_range_from_pc"));
+      internal_error (_("Entry block not found in find_function_entry_range_from_pc"));
     }
 
   return status;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 91e13a03360..eb4dedf3f10 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4721,8 +4721,7 @@ print_bp_stop_message (bpstat *bs)
       break;
 
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("print_bp_stop_message: unrecognized enum value"));
+      internal_error (_("print_bp_stop_message: unrecognized enum value"));
       break;
     }
 }
@@ -5838,8 +5837,7 @@ bpstat_what (bpstat *bs_head)
 	  /* Tracepoint hits should not be reported back to GDB, and
 	     if one got through somehow, it should have been filtered
 	     out already.  */
-	  internal_error (__FILE__, __LINE__,
-			  _("bpstat_what: tracepoint encountered"));
+	  internal_error (_("bpstat_what: tracepoint encountered"));
 	  break;
 	case bp_gnu_ifunc_resolver:
 	  /* Step over it (and insert bp_gnu_ifunc_resolver_return).  */
@@ -5859,8 +5857,7 @@ bpstat_what (bpstat *bs_head)
 	  break;
 
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("bpstat_what: unhandled bptype %d"), (int) bptype);
+	  internal_error (_("bpstat_what: unhandled bptype %d"), (int) bptype);
 	}
 
       retval.main_action = std::max (retval.main_action, this_action);
@@ -6127,8 +6124,7 @@ bptype_string (enum bptype type)
 
   if (((int) type >= (sizeof (bptypes) / sizeof (bptypes[0])))
       || ((int) type != bptypes[(int) type].type))
-    internal_error (__FILE__, __LINE__,
-		    _("bptypes table does not describe type #%d."),
+    internal_error (_("bptypes table does not describe type #%d."),
 		    (int) type);
 
   return bptypes[(int) type].description;
@@ -7231,7 +7227,7 @@ bp_location_from_bp_type (bptype type)
     case bp_static_marker_tracepoint:
       return bp_loc_other;
     default:
-      internal_error (__FILE__, __LINE__, _("unknown breakpoint type"));
+      internal_error (_("unknown breakpoint type"));
     }
 }
 
@@ -8244,8 +8240,7 @@ update_dprintf_command_list (struct breakpoint *b)
 	}
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Invalid dprintf style."));
+    internal_error (_("Invalid dprintf style."));
 
   gdb_assert (printf_line != NULL);
 
@@ -9646,8 +9641,7 @@ watchpoint::print_mention () const
       tuple_name = "hw-awpt";
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Invalid hardware watchpoint type."));
+      internal_error (_("Invalid hardware watchpoint type."));
     }
 
   ui_out_emit_tuple tuple_emitter (uiout, tuple_name);
@@ -9674,8 +9668,7 @@ watchpoint::print_recreate (struct ui_file *fp) const
       gdb_printf (fp, "awatch");
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Invalid watchpoint type."));
+      internal_error (_("Invalid watchpoint type."));
     }
 
   gdb_printf (fp, " %s", exp_string.get ());
@@ -9783,8 +9776,7 @@ masked_watchpoint::print_it (const bpstat *bs) const
 	   async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Invalid hardware watchpoint type."));
+      internal_error (_("Invalid hardware watchpoint type."));
     }
 
   mention (b);
@@ -9835,8 +9827,7 @@ masked_watchpoint::print_mention () const
       tuple_name = "hw-awpt";
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Invalid hardware watchpoint type."));
+      internal_error (_("Invalid hardware watchpoint type."));
     }
 
   ui_out_emit_tuple tuple_emitter (uiout, tuple_name);
@@ -9863,8 +9854,7 @@ masked_watchpoint::print_recreate (struct ui_file *fp) const
       gdb_printf (fp, "awatch");
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Invalid hardware watchpoint type."));
+      internal_error (_("Invalid hardware watchpoint type."));
     }
 
   gdb_printf (fp, " %s mask 0x%s", exp_string.get (),
@@ -11684,8 +11674,7 @@ ordinary_breakpoint::print_recreate (struct ui_file *fp) const
   else if (type == bp_hardware_breakpoint)
     gdb_printf (fp, "hbreak");
   else
-    internal_error (__FILE__, __LINE__,
-		    _("unhandled breakpoint type %d"), (int) type);
+    internal_error (_("unhandled breakpoint type %d"), (int) type);
 
   gdb_printf (fp, " %s", locspec->to_string ());
 
@@ -11926,8 +11915,7 @@ tracepoint::print_mention () const
       gdb_printf (_(" %d"), number);
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("unhandled tracepoint type %d"), (int) type);
+      internal_error (_("unhandled tracepoint type %d"), (int) type);
     }
 
   say_where (this);
@@ -11944,8 +11932,7 @@ tracepoint::print_recreate (struct ui_file *fp) const
   else if (type == bp_tracepoint)
     gdb_printf (fp, "trace");
   else
-    internal_error (__FILE__, __LINE__,
-		    _("unhandled tracepoint type %d"), (int) type);
+    internal_error (_("unhandled tracepoint type %d"), (int) type);
 
   gdb_printf (fp, " %s", locspec->to_string ());
   print_recreate_thread (fp);
diff --git a/gdb/btrace.c b/gdb/btrace.c
index c4f0d4911ab..a8e6049265c 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1512,7 +1512,7 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
 			  const struct btrace_data_pt *btrace,
 			  std::vector<unsigned int> &gaps)
 {
-  internal_error (__FILE__, __LINE__, _("Unexpected branch trace format."));
+  internal_error (_("Unexpected branch trace format."));
 }
 
 #endif /* defined (HAVE_LIBIPT)  */
@@ -1548,7 +1548,7 @@ btrace_compute_ftrace_1 (struct thread_info *tp,
       return;
     }
 
-  internal_error (__FILE__, __LINE__, _("Unknown branch trace format."));
+  internal_error (_("Unknown branch trace format."));
 }
 
 static void
@@ -1808,7 +1808,7 @@ btrace_stitch_trace (struct btrace_data *btrace, struct thread_info *tp)
       return -1;
     }
 
-  internal_error (__FILE__, __LINE__, _("Unknown branch trace format."));
+  internal_error (_("Unknown branch trace format."));
 }
 
 /* Clear the branch trace histories in BTINFO.  */
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 5a3569a7606..2d010de8951 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1036,8 +1036,7 @@ exp	:	string_exp
 				  break;
 				default:
 				  /* internal error */
-				  internal_error (__FILE__, __LINE__,
-						  "unrecognized type in string concatenation");
+				  internal_error ("unrecognized type in string concatenation");
 				}
 			    }
 
@@ -3216,7 +3215,7 @@ classify_inner_name (struct parser_state *par_state,
     default:
       return NAME;
     }
-  internal_error (__FILE__, __LINE__, _("not reached"));
+  internal_error (_("not reached"));
 }
 
 /* The outer level of a two-level lexer.  This calls the inner lexer
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 437f79c025a..36b4d1ae3dd 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -64,7 +64,7 @@ charset_for_string_type (c_string_type str_type, struct gdbarch *gdbarch)
       else
 	return "UTF-32LE";
     }
-  internal_error (__FILE__, __LINE__, _("unhandled c_string_type"));
+  internal_error (_("unhandled c_string_type"));
 }
 
 /* Classify ELTTYPE according to what kind of character it is.  Return
@@ -613,7 +613,7 @@ c_string_operation::evaluate (struct type *expect_type,
       type = lookup_typename (exp->language_defn, "char32_t", NULL, 0);
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("unhandled c_string_type"));
+      internal_error (_("unhandled c_string_type"));
     }
 
   /* Ensure TYPE_LENGTH is valid for TYPE.  */
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 22e3efa5643..2442f7ae38b 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1489,7 +1489,7 @@ do_define_command (const char *comname, int from_tty,
 	  break;
 	default:
 	  /* Should never come here as hookc would be 0.  */
-	  internal_error (__FILE__, __LINE__, _("bad switch"));
+	  internal_error (_("bad switch"));
 	}
     }
 }
@@ -1621,7 +1621,7 @@ void
 script_from_file (FILE *stream, const char *file)
 {
   if (stream == NULL)
-    internal_error (__FILE__, __LINE__, _("called with NULL file pointer!"));
+    internal_error (_("called with NULL file pointer!"));
 
   scoped_restore restore_line_number
     = make_scoped_restore (&source_line_number, 0);
diff --git a/gdb/coffread.c b/gdb/coffread.c
index babf6bdbaa8..f29627d9797 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1360,7 +1360,7 @@ coff_getfilename (union internal_auxent *aux_entry)
   if (aux_entry->x_file.x_n.x_n.x_zeroes == 0)
     {
       if (strlen (stringtab + aux_entry->x_file.x_n.x_n.x_offset) >= BUFSIZ)
-	internal_error (__FILE__, __LINE__, _("coff file name too long"));
+	internal_error (_("coff file name too long"));
       strcpy (buffer, stringtab + aux_entry->x_file.x_n.x_n.x_offset);
     }
   else
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index 19fcf00594f..c652c96217b 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -53,7 +53,7 @@ c_get_mode_for_size (int size)
       mode = "DI";
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("Invalid GCC mode size %d."), size);
+      internal_error (_("Invalid GCC mode size %d."), size);
     }
 
   return mode;
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 3a5d70bfeb0..ad6daba27a0 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -115,7 +115,7 @@ convert_one_symbol (compile_c_instance *context,
 		 sym.symbol->print_name ());
 
 	case LOC_UNDEF:
-	  internal_error (__FILE__, __LINE__, _("LOC_UNDEF found for \"%s\"."),
+	  internal_error (_("LOC_UNDEF found for \"%s\"."),
 			  sym.symbol->print_name ());
 
 	case LOC_COMMON_BLOCK:
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 4d3f1602322..b8e8e07a39d 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -109,7 +109,7 @@ convert_one_symbol (compile_cplus_instance *instance,
 		 sym.symbol->print_name ());
 
 	case LOC_UNDEF:
-	  internal_error (__FILE__, __LINE__, _("LOC_UNDEF found for \"%s\"."),
+	  internal_error (_("LOC_UNDEF found for \"%s\"."),
 			  sym.symbol->print_name ());
 
 	case LOC_COMMON_BLOCK:
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 245345d1dbf..bd90753eae1 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -178,8 +178,7 @@ type_name_to_scope (const char *type_name, const struct block *block)
 	      /* This shouldn't happen since we are not attempting to
 		 loop over user input.  This name is generated by GDB
 		 from debug info.  */
-	      internal_error (__FILE__, __LINE__,
-			      _("malformed TYPE_NAME during parsing"));
+	      internal_error (_("malformed TYPE_NAME during parsing"));
 	    }
 	}
     }
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index f3573cb7c72..4c94ec53899 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -678,7 +678,7 @@ compile_object_load (const compile_file_names &file_names,
       expect_return_type = builtin_type (target_gdbarch ())->builtin_void;
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("invalid scope %d"), scope);
+      internal_error (_("invalid scope %d"), scope);
     }
   if (func_type->num_fields () != expect_parameters)
     error (_("Invalid %d parameters of function \"%s\" in compiled "
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 6a226cc4755..bb423b7631b 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -173,8 +173,7 @@ memory_error_message (enum target_xfer_status err,
       return string_printf (_("Memory at address %s unavailable."),
 			    paddress (gdbarch, memaddr));
     default:
-      internal_error (__FILE__, __LINE__,
-		      "unhandled target_xfer_status: %s (%s)",
+      internal_error ("unhandled target_xfer_status: %s (%s)",
 		      target_xfer_status_to_string (err),
 		      plongest (err));
     }
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index f10117491ec..c32b1f7d2f0 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -251,8 +251,7 @@ int
 register_cp_abi (struct cp_abi_ops *abi)
 {
   if (num_cp_abis == CP_ABI_MAX)
-    internal_error (__FILE__, __LINE__,
-		    _("Too many C++ ABIs, please increase "
+    internal_error (_("Too many C++ ABIs, please increase "
 		      "CP_ABI_MAX in cp-abi.c"));
 
   cp_abis[num_cp_abis++] = abi;
@@ -268,8 +267,7 @@ set_cp_abi_as_auto_default (const char *short_name)
   struct cp_abi_ops *abi = find_cp_abi (short_name);
 
   if (abi == NULL)
-    internal_error (__FILE__, __LINE__,
-		    _("Cannot find C++ ABI \"%s\" to set it as auto default."),
+    internal_error (_("Cannot find C++ ABI \"%s\" to set it as auto default."),
 		    short_name);
 
   xfree ((char *) auto_cp_abi.longname);
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 1d7759a7669..634dab6ada0 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -977,8 +977,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
       return {};
 
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("cp_lookup_nested_symbol called "
+      internal_error (_("cp_lookup_nested_symbol called "
 			"on a non-aggregate type."));
     }
 }
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 4a2f14ad076..d38850aa1af 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3884,8 +3884,7 @@ set_cris_version (const char *ignore_args, int from_tty,
   
   /* Update the current architecture, if needed.  */
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, 
-		    _("cris_gdbarch_update: failed to update architecture."));
+    internal_error (_("cris_gdbarch_update: failed to update architecture."));
 }
 
 static void
@@ -3896,8 +3895,7 @@ set_cris_mode (const char *ignore_args, int from_tty,
 
   /* Update the current architecture, if needed.  */
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, 
-		    "cris_gdbarch_update: failed to update architecture.");
+    internal_error ("cris_gdbarch_update: failed to update architecture.");
 }
 
 static void
@@ -3908,8 +3906,7 @@ set_cris_dwarf2_cfi (const char *ignore_args, int from_tty,
 
   /* Update the current architecture, if needed.  */
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, 
-		    _("cris_gdbarch_update: failed to update architecture."));
+    internal_error (_("cris_gdbarch_update: failed to update architecture."));
 }
 
 static struct gdbarch *
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 1f93eb5aafd..b0047cf0e79 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2711,8 +2711,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
 	  case N_ROSYM:
 	    goto case_N_ROSYM;
 	  default:
-	    internal_error (__FILE__, __LINE__,
-			    _("failed internal consistency check"));
+	    internal_error (_("failed internal consistency check"));
 	  }
       }
 
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 849d07469cf..f87f183fe68 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -522,8 +522,7 @@ free_obstack (struct dictionary *dict)
 static void
 add_symbol_nonexpandable (struct dictionary *dict, struct symbol *sym)
 {
-  internal_error (__FILE__, __LINE__,
-		  _("dict_add_symbol: non-expandable dictionary"));
+  internal_error (_("dict_add_symbol: non-expandable dictionary"));
 }
 
 /* Functions for DICT_HASHED and DICT_HASHED_EXPANDABLE.  */
@@ -1094,8 +1093,7 @@ create_new_language_dictionary (struct multidictionary *mdict,
     {
     case DICT_HASHED:
     case DICT_LINEAR:
-      internal_error (__FILE__, __LINE__,
-		      _("create_new_language_dictionary: attempted to expand "
+      internal_error (_("create_new_language_dictionary: attempted to expand "
 			"non-expandable multidictionary"));
 
     case DICT_HASHED_EXPANDABLE:
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 44f3de22a01..14b35e8d41c 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -655,8 +655,7 @@ dtrace_probe::get_arg_by_number (unsigned n, struct gdbarch *gdbarch)
     this->build_arg_exprs (gdbarch);
 
   if (n > m_args.size ())
-    internal_error (__FILE__, __LINE__,
-		    _("Probe '%s' has %d arguments, but GDB is requesting\n"
+    internal_error (_("Probe '%s' has %d arguments, but GDB is requesting\n"
 		      "argument %u.  This should not happen.  Please\n"
 		      "report this bug."),
 		    this->get_name ().c_str (),
diff --git a/gdb/dwarf2/comp-unit-head.c b/gdb/dwarf2/comp-unit-head.c
index 5f78ac8c5b2..edb2a8aa55a 100644
--- a/gdb/dwarf2/comp-unit-head.c
+++ b/gdb/dwarf2/comp-unit-head.c
@@ -65,8 +65,7 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
 	cu_header->unit_type = DW_UT_type;
 	break;
       default:
-	internal_error (__FILE__, __LINE__,
-			_("read_comp_unit_head: invalid section_kind"));
+	internal_error (_("read_comp_unit_head: invalid section_kind"));
       }
   else
     {
@@ -113,8 +112,7 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
     }
   signed_addr = bfd_get_sign_extend_vma (abfd);
   if (signed_addr < 0)
-    internal_error (__FILE__, __LINE__,
-		    _("read_comp_unit_head: dwarf from non elf file"));
+    internal_error (_("read_comp_unit_head: dwarf from non elf file"));
   cu_header->signed_addr_p = signed_addr;
 
   bool header_has_signature = section_kind == rcuh_kind::TYPE
@@ -215,8 +213,7 @@ comp_unit_head::read_address (bfd *abfd, const gdb_byte *buf,
 	  retval = bfd_get_signed_64 (abfd, buf);
 	  break;
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("read_address: bad switch, signed [in module %s]"),
+	  internal_error (_("read_address: bad switch, signed [in module %s]"),
 			  bfd_get_filename (abfd));
 	}
     }
@@ -234,8 +231,7 @@ comp_unit_head::read_address (bfd *abfd, const gdb_byte *buf,
 	  retval = bfd_get_64 (abfd, buf);
 	  break;
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("read_address: bad switch, "
+	  internal_error (_("read_address: bad switch, "
 			    "unsigned [in module %s]"),
 			  bfd_get_filename (abfd));
 	}
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 2df069602a3..73dfd4b4ffb 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -162,8 +162,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
   else
     {
       if (value_type (v) != value_enclosing_type (v))
-	internal_error (__FILE__, __LINE__,
-			_("Should not be able to create a lazy value with "
+	internal_error (_("Should not be able to create a lazy value with "
 			  "an enclosing type"));
       if (check_optimized)
 	v_contents = nullptr;
@@ -432,7 +431,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
 	  break;
 
 	default:
-	  internal_error (__FILE__, __LINE__, _("invalid location type"));
+	  internal_error (_("invalid location type"));
 	}
 
       offset += this_size_bits;
@@ -1057,7 +1056,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
 	  /* DWARF_VALUE_OPTIMIZED_OUT can't occur in this context --
 	     it can only be encountered when making a piece.  */
 	default:
-	  internal_error (__FILE__, __LINE__, _("invalid location type"));
+	  internal_error (_("invalid location type"));
 	}
     }
 
@@ -2103,8 +2102,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 		result_val = value_from_ulongest (address_type, result);
 		break;
 	      default:
-		internal_error (__FILE__, __LINE__,
-				_("Can't be reached."));
+		internal_error (_("Can't be reached."));
 	      }
 	  }
 	  break;
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 83565ea7c99..d4bc53e5dd8 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -500,8 +500,7 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
 			   insn);
 		}
 	      else
-		internal_error (__FILE__, __LINE__,
-				_("Unknown CFI encountered."));
+		internal_error (_("Unknown CFI encountered."));
 	    }
 	}
     }
@@ -827,7 +826,7 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
       return 0;
 
     default:
-      internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
+      internal_error (_("Unknown CFA rule."));
     }
 }
 
@@ -974,7 +973,7 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache)
 	  break;
 
 	default:
-	  internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
+	  internal_error (_("Unknown CFA rule."));
 	}
     }
   catch (const gdb_exception_error &ex)
@@ -1218,7 +1217,7 @@ dwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
       return cache->reg[regnum].loc.fn (this_frame, this_cache, regnum);
 
     default:
-      internal_error (__FILE__, __LINE__, _("Unknown register rule."));
+      internal_error (_("Unknown register rule."));
     }
 }
 
@@ -1405,7 +1404,7 @@ encoding_for_size (unsigned int size)
     case 8:
       return DW_EH_PE_udata8;
     default:
-      internal_error (__FILE__, __LINE__, _("Unsupported address size"));
+      internal_error (_("Unsupported address size"));
     }
 }
 
@@ -1421,8 +1420,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
   /* GCC currently doesn't generate DW_EH_PE_indirect encodings for
      FDE's.  */
   if (encoding & DW_EH_PE_indirect)
-    internal_error (__FILE__, __LINE__, 
-		    _("Unsupported encoding: DW_EH_PE_indirect"));
+    internal_error (_("Unsupported encoding: DW_EH_PE_indirect"));
 
   *bytes_read_ptr = 0;
 
@@ -1454,8 +1452,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
 	}
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Invalid or unsupported encoding"));
+      internal_error (_("Invalid or unsupported encoding"));
     }
 
   if ((encoding & 0x07) == 0x00)
@@ -1502,8 +1499,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
       *bytes_read_ptr += 8;
       return (base + bfd_get_signed_64 (unit->abfd, (bfd_byte *) buf));
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Invalid or unsupported encoding"));
+      internal_error (_("Invalid or unsupported encoding"));
     }
 }
 \f
diff --git a/gdb/dwarf2/leb.c b/gdb/dwarf2/leb.c
index 75af98c554a..199a5b9e7a4 100644
--- a/gdb/dwarf2/leb.c
+++ b/gdb/dwarf2/leb.c
@@ -127,8 +127,7 @@ read_offset (bfd *abfd, const gdb_byte *buf, unsigned int offset_size)
       retval = bfd_get_64 (abfd, buf);
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("read_offset_1: bad switch [in module %s]"),
+      internal_error (_("read_offset_1: bad switch [in module %s]"),
 		      bfd_get_filename (abfd));
     }
 
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 791648d6e7e..c42359ab96e 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -739,7 +739,7 @@ call_site_target::iterate_over_addresses
       break;
 
     default:
-      internal_error (__FILE__, __LINE__, _("invalid call site target kind"));
+      internal_error (_("invalid call site target kind"));
     }
 }
 
@@ -3035,7 +3035,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
     {
       int targ = offsets[dw_labels[i]];
       if (targ == -1)
-	internal_error (__FILE__, __LINE__, _("invalid label"));
+	internal_error (_("invalid label"));
       ax_label (expr, patches[i], targ);
     }
 }
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 88f5a713c4f..19b51f9dc22 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1003,8 +1003,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
 	  delete_breakpoint (b);
 	  break;
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("handle_inferior_event: Invalid "
+	  internal_error (_("handle_inferior_event: Invalid "
 			    "gnu-indirect-function breakpoint type %d"),
 			  (int) b->type);
 	}
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 88c53b720a9..0e371194ee3 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -399,7 +399,7 @@ display_gdb_prompt (const char *new_prompt)
       struct ui *ui = current_ui;
 
       if (ui->prompt_state == PROMPTED)
-	internal_error (__FILE__, __LINE__, _("double prompt"));
+	internal_error (_("double prompt"));
       else if (ui->prompt_state == PROMPT_BLOCKED)
 	{
 	  /* This is to trick readline into not trying to display the
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index fdb65b3dc4b..2a0dfb29217 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -97,7 +97,7 @@ print_exception (struct ui_file *file, const struct gdb_exception &e)
       annotate_error ();
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("Bad switch."));
+      internal_error (_("Bad switch."));
     }
 }
 
diff --git a/gdb/exec.c b/gdb/exec.c
index 40c89d53ba9..0890193faa3 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -123,8 +123,7 @@ set_exec_file_mismatch_command (const char *ignore,
 	  return;
 	}
       if (mode == exec_file_mismatch_off)
-	internal_error (__FILE__, __LINE__,
-			_("Unrecognized exec-file-mismatch setting: \"%s\""),
+	internal_error (_("Unrecognized exec-file-mismatch setting: \"%s\""),
 			exec_file_mismatch);
     }
 }
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index f38d5d8745b..ad26503a2ad 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -983,7 +983,7 @@ fbsd_nat_target::async (bool enable)
   if (enable)
     {
       if (!async_file_open ())
-	internal_error (__FILE__, __LINE__, "failed to create event pipe.");
+	internal_error ("failed to create event pipe.");
 
       add_file_handler (async_wait_fd (), handle_target_event, NULL, "fbsd-nat");
 
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 8431caf8f59..bb5a8f3f61e 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -1925,7 +1925,7 @@ fbsd_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
      However, system call catching requires this function to be
      set.  */
 
-  internal_error (__FILE__, __LINE__, _("fbsd_get_sycall_number called"));
+  internal_error (_("fbsd_get_sycall_number called"));
 }
 
 /* Read an integer symbol value from the current target.  */
diff --git a/gdb/findvar.c b/gdb/findvar.c
index d45a1583b79..91de3fd5c3e 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -153,8 +153,7 @@ CORE_ADDR
 extract_typed_address (const gdb_byte *buf, struct type *type)
 {
   if (!type->is_pointer_or_reference ())
-    internal_error (__FILE__, __LINE__,
-		    _("extract_typed_address: "
+    internal_error (_("extract_typed_address: "
 		    "type is not a pointer or reference"));
 
   return gdbarch_pointer_to_address (type->arch (), type, buf);
@@ -206,8 +205,7 @@ void
 store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
 {
   if (!type->is_pointer_or_reference ())
-    internal_error (__FILE__, __LINE__,
-		    _("store_typed_address: "
+    internal_error (_("store_typed_address: "
 		    "type is not a pointer or reference"));
 
   gdbarch_address_to_pointer (type->arch (), type, buf, addr);
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index ed24e6e1747..e535d41225c 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -207,7 +207,7 @@ frame_unwind_find_by_frame (frame_info_ptr this_frame, void **this_cache)
     if (frame_unwind_try_unwinder (this_frame, this_cache, entry->unwinder))
       return;
 
-  internal_error (__FILE__, __LINE__, _("frame_unwind_find_by_frame failed"));
+  internal_error (_("frame_unwind_find_by_frame failed"));
 }
 
 /* A default frame sniffer which always accepts the frame.  Used by
diff --git a/gdb/frame.c b/gdb/frame.c
index e08b9c90065..3ddc0d06996 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -988,8 +988,7 @@ frame_unwind_pc (frame_info_ptr this_frame)
   else if (this_frame->prev_pc.status == CC_NOT_SAVED)
     throw_error (OPTIMIZED_OUT_ERROR, _("PC not saved"));
   else
-    internal_error (__FILE__, __LINE__,
-		    "unexpected prev_pc status: %d",
+    internal_error ("unexpected prev_pc status: %d",
 		    (int) this_frame->prev_pc.status);
 }
 
@@ -3008,8 +3007,7 @@ unwind_stop_reason_to_string (enum unwind_stop_reason reason)
 #undef SET
 
     default:
-      internal_error (__FILE__, __LINE__,
-		      "Invalid frame stop reason");
+      internal_error ("Invalid frame stop reason");
     }
 }
 
@@ -3041,8 +3039,7 @@ frame_stop_reason_symbol_string (enum unwind_stop_reason reason)
 #undef SET
 
     default:
-      internal_error (__FILE__, __LINE__,
-		      "Invalid frame stop reason");
+      internal_error ("Invalid frame stop reason");
     }
 }
 
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index 9a2593e10dc..41344c82370 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -215,7 +215,7 @@ frv_linux_sigcontext_reg_addr (frame_info_ptr this_frame, int regno,
 	  sc_addr += 24;
 	}
       else
-	internal_error (__FILE__, __LINE__, _("not a signal trampoline"));
+	internal_error (_("not a signal trampoline"));
 
       if (sc_addr_cache_ptr)
 	*sc_addr_cache_ptr = sc_addr;
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index a72f999f139..056aad3f17e 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -410,7 +410,7 @@ frv_register_sim_regno (struct gdbarch *gdbarch, int reg)
 	return SIM_FRV_SPR0_REGNUM + spr_reg_offset;
     }
 
-  internal_error (__FILE__, __LINE__, _("Bad register number %d"), reg);
+  internal_error (_("Bad register number %d"), reg);
 }
 
 constexpr gdb_byte frv_break_insn[] = {0xc0, 0x70, 0x00, 0x01};
@@ -1122,8 +1122,7 @@ frv_extract_return_value (struct type *type, struct regcache *regcache,
       store_unsigned_integer ((bfd_byte *) valbuf + 4, 4, byte_order, regval);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Illegal return value length: %d"), len);
+    internal_error (_("Illegal return value length: %d"), len);
 }
 
 static CORE_ADDR
@@ -1328,8 +1327,7 @@ frv_store_return_value (struct type *type, struct regcache *regcache,
       regcache->cooked_write (9, (bfd_byte *) valbuf + 4);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Don't know how to return a %d-byte value."), len);
+    internal_error (_("Don't know how to return a %d-byte value."), len);
 }
 
 static enum return_value_convention
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 559e92dee58..a096f2a9c2c 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -609,8 +609,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of get_pc_address_flags, invalid_p == 0 */
   /* Skip verify of read_core_file_mappings, invalid_p == 0 */
   if (!log.empty ())
-    internal_error (__FILE__, __LINE__,
-		    _("verify_gdbarch: the following are invalid ...%s"),
+    internal_error (_("verify_gdbarch: the following are invalid ...%s"),
 		    log.c_str ());
 }
 
diff --git a/gdb/gdbarch.py b/gdb/gdbarch.py
index da848feae84..6cee1c7de6f 100755
--- a/gdb/gdbarch.py
+++ b/gdb/gdbarch.py
@@ -373,8 +373,8 @@ with open("gdbarch.c", "w") as f:
             # here.
             raise Exception("unhandled case when generating gdbarch validation")
     print("  if (!log.empty ())", file=f)
-    print("    internal_error (__FILE__, __LINE__,", file=f)
-    print("""		    _("verify_gdbarch: the following are invalid ...%s"),""", file=f)
+    print("""    internal_error (_("verify_gdbarch: the following are invalid ...%s"),""",
+          file=f)
     print("		    log.c_str ());", file=f)
     print("}", file=f)
     print(file=f)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 643bb0a14a3..ecccaf77405 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4400,7 +4400,7 @@ check_types_equal (struct type *type1, struct type *type2,
 	      }
 	      break;
 	    default:
-	      internal_error (__FILE__, __LINE__, _("Unsupported field kind "
+	      internal_error (_("Unsupported field kind "
 						    "%d by check_types_equal"),
 			      field1->loc_kind ());
 	    }
@@ -5704,8 +5704,7 @@ copy_type_recursive (struct type *type, htab_t copied_types)
 		(type->field (i).loc_dwarf_block ());
               break;
 	    default:
-	      internal_error (__FILE__, __LINE__,
-			      _("Unexpected type field location kind: %d"),
+	      internal_error (_("Unexpected type field location kind: %d"),
 			      type->field (i).loc_kind ());
 	    }
 	}
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 475425d9f3b..437826616dc 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -544,8 +544,7 @@ fetch_register (struct regcache *regcache, int regno)
 								   regno))
     i387_supply_fsave (regcache, regno, &npx);
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Invalid register no. %d in fetch_register."), regno);
+    internal_error (_("Invalid register no. %d in fetch_register."), regno);
 }
 
 void
@@ -574,8 +573,7 @@ store_register (const struct regcache *regcache, int regno)
 								   regno))
     i387_collect_fsave (regcache, regno, &npx);
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Invalid register no. %d in store_register."), regno);
+    internal_error (_("Invalid register no. %d in store_register."), regno);
 }
 
 void
@@ -700,8 +698,7 @@ go32_nat_target::create_inferior (const char *exec_file,
 
   /* Init command line storage.  */
   if (redir_debug_init (&child_cmd) == -1)
-    internal_error (__FILE__, __LINE__,
-		    _("Cannot allocate redirection storage: "
+    internal_error (_("Cannot allocate redirection storage: "
 		      "not enough memory.\n"));
 
   /* Parse the command line and create redirections.  */
@@ -800,8 +797,7 @@ static void
 go32_set_dr (int i, CORE_ADDR addr)
 {
   if (i < 0 || i > 3)
-    internal_error (__FILE__, __LINE__, 
-		    _("Invalid register %d in go32_set_dr.\n"), i);
+    internal_error (_("Invalid register %d in go32_set_dr.\n"), i);
   D_REGS[i] = addr;
 }
 
@@ -841,8 +837,7 @@ static CORE_ADDR
 go32_get_dr (int i)
 {
   if (i < 0 || i > 3)
-    internal_error (__FILE__, __LINE__,
-		    _("Invalid register %d in go32_get_dr.\n"), i);
+    internal_error (_("Invalid register %d in go32_get_dr.\n"), i);
   return D_REGS[i];
 }
 
@@ -2086,8 +2081,7 @@ _initialize_go32_nat ()
 
   /* Initialize child's command line storage.  */
   if (redir_debug_init (&child_cmd) == -1)
-    internal_error (__FILE__, __LINE__,
-		    _("Cannot allocate redirection storage: "
+    internal_error (_("Cannot allocate redirection storage: "
 		      "not enough memory.\n"));
 
   /* We are always processing GCC-compiled programs.  */
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 503c01bc8a9..38e7135601e 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1117,8 +1117,7 @@ static struct type *
 h8300_register_type (struct gdbarch *gdbarch, int regno)
 {
   if (regno < 0 || regno >= gdbarch_num_cooked_regs (gdbarch))
-    internal_error (__FILE__, __LINE__,
-		    _("h8300_register_type: illegal register number %d"),
+    internal_error (_("h8300_register_type: illegal register number %d"),
 		    regno);
   else
     {
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 9088225f206..2996fca931f 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -3059,7 +3059,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 					   hppa64_cannot_fetch_register);
 	break;
       default:
-	internal_error (__FILE__, __LINE__, _("Unsupported address size: %d"),
+	internal_error (_("Unsupported address size: %d"),
 			tdep->bytes_per_address);
     }
 
@@ -3108,7 +3108,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_frame_align (gdbarch, hppa64_frame_align);
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
       
   /* Struct return methods.  */
@@ -3121,7 +3121,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_return_value (gdbarch, hppa64_return_value);
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
       
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, hppa_breakpoint::kind_from_pc);
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index e9b0f8a222f..294fb2ff17e 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -527,8 +527,7 @@ i386_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
       return;
     }
 
-  internal_error (__FILE__, __LINE__,
-		  _("Got request for bad register number %d."), regno);
+  internal_error (_("Got request for bad register number %d."), regno);
 }
 
 /* Store register REGNO back into the child process.  If REGNO is -1,
@@ -592,8 +591,7 @@ i386_linux_nat_target::store_registers (struct regcache *regcache, int regno)
       return;
     }
 
-  internal_error (__FILE__, __LINE__,
-		  _("Got request to store bad register number %d."), regno);
+  internal_error (_("Got request to store bad register number %d."), regno);
 }
 \f
 
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 59d4d7b976c..e027df2b9c5 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -476,7 +476,7 @@ i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
   else if (i386_word_regnum_p (gdbarch, regnum))
     return i386_word_names[regnum - tdep->ax_regnum];
 
-  internal_error (__FILE__, __LINE__, _("invalid regnum"));
+  internal_error (_("invalid regnum"));
 }
 
 /* Convert a dbx register number REG to the appropriate register
@@ -2906,8 +2906,7 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
 	  memcpy (valbuf + low_size, buf, len - low_size);
 	}
       else
-	internal_error (__FILE__, __LINE__,
-			_("Cannot extract return value of %d bytes long."),
+	internal_error (_("Cannot extract return value of %d bytes long."),
 			len);
     }
 }
@@ -2971,8 +2970,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
 				    valbuf + low_size);
 	}
       else
-	internal_error (__FILE__, __LINE__,
-			_("Cannot store return value of %d bytes long."), len);
+	internal_error (_("Cannot store return value of %d bytes long."), len);
     }
 }
 \f
@@ -3337,7 +3335,7 @@ i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
 	return bt->builtin_int64;
     }
 
-  internal_error (__FILE__, __LINE__, _("invalid regnum"));
+  internal_error (_("invalid regnum"));
 }
 
 /* Map a cooked register onto a raw register or memory.  For the i386,
@@ -3539,7 +3537,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
 	    memcpy (buf, raw_buf, 1);
 	}
       else
-	internal_error (__FILE__, __LINE__, _("invalid regnum"));
+	internal_error (_("invalid regnum"));
     }
 }
 
@@ -3676,7 +3674,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
 	  regcache->raw_write (gpnum % 4, raw_buf);
 	}
       else
-	internal_error (__FILE__, __LINE__, _("invalid regnum"));
+	internal_error (_("invalid regnum"));
     }
 }
 
@@ -3758,7 +3756,7 @@ i386_ax_pseudo_register_collect (struct gdbarch *gdbarch,
       return 0;
     }
   else
-    internal_error (__FILE__, __LINE__, _("invalid regnum"));
+    internal_error (_("invalid regnum"));
   return 1;
 }
 \f
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index a3c642b2643..6b9baf5a10e 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -1410,7 +1410,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
 	   || regnum == I387_MXCSR_REGNUM (tdep))
     regclass = x87_ctrl_or_mxcsr;
   else
-    internal_error (__FILE__, __LINE__, _("invalid i387 regnum %d"), regnum);
+    internal_error (_("invalid i387 regnum %d"), regnum);
 
   if (gcore)
     {
@@ -1683,8 +1683,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
       switch (regclass)
 	{
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("invalid i387 regclass"));
+	  internal_error (_("invalid i387 regclass"));
 
 	case pkeys:
 	  /* This is a PKEYS register.  */
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 281c5f13ae9..d7b456b11df 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -713,8 +713,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
      a single instance by update_global_location_list.  */
   instr_breakpoint = slotN_contents (bundle, slotnum);
   if (instr_breakpoint == IA64_BREAKPOINT)
-    internal_error (__FILE__, __LINE__,
-		    _("Address %s already contains a breakpoint."),
+    internal_error (_("Address %s already contains a breakpoint."),
 		    paddress (gdbarch, bp_tgt->placed_address));
   replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum);
 
diff --git a/gdb/infcall.c b/gdb/infcall.c
index e2de045d7b7..c1db3e22189 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -1061,7 +1061,7 @@ call_function_by_hand_dummy (struct value *function,
 	break;
       }
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
 
   /* Coerce the arguments and handle pass-by-reference.
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index d729732c81c..c03ca103c91 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1499,7 +1499,7 @@ get_return_value (struct symbol *func_symbol, struct value *function)
       value = NULL;
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
 
   return value;
@@ -1628,8 +1628,7 @@ finish_command_fsm::should_stop (struct thread_info *tp)
 
       rv->type = function->type ()->target_type ();
       if (rv->type == NULL)
-	internal_error (__FILE__, __LINE__,
-			_("finish_command: function has no target type"));
+	internal_error (_("finish_command: function has no target type"));
 
       if (check_typedef (rv->type)->code () != TYPE_CODE_VOID)
 	{
diff --git a/gdb/infrun.c b/gdb/infrun.c
index cdfe02393f5..2e462be5ba7 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -847,8 +847,7 @@ follow_fork ()
       /* Nothing to follow.  */
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      "Unexpected pending_follow.kind %d\n",
+      internal_error ("Unexpected pending_follow.kind %d\n",
 		      tp->pending_follow.kind ());
       break;
     }
@@ -2007,8 +2006,7 @@ start_step_over (void)
 	  || tp->resumed ()
 	  || tp->executing ())
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "[%s] has inconsistent state: "
+	  internal_error ("[%s] has inconsistent state: "
 			  "trap_expected=%d, resumed=%d, executing=%d\n",
 			  tp->ptid.to_string ().c_str (),
 			  tp->control.trap_expected,
@@ -5515,8 +5513,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 	    return;
 	  }
 
-	internal_error (__FILE__, __LINE__,
-			_("unhandled stop_soon: %d"), (int) stop_soon);
+	internal_error (_("unhandled stop_soon: %d"), (int) stop_soon);
       }
 
     case TARGET_WAITKIND_SPURIOUS:
@@ -5967,8 +5964,7 @@ restart_threads (struct thread_info *event_thread, inferior *inf)
 	 above.  */
       if (thread_still_needs_step_over (tp))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "thread [%s] needs a step-over, but not in "
+	  internal_error ("thread [%s] needs a step-over, but not in "
 			  "step-over queue\n",
 			  tp->ptid.to_string ().c_str ());
 	}
@@ -8492,7 +8488,7 @@ print_stop_location (const target_waitstatus &ws)
       do_frame_printing = 0;
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("Unknown value."));
+      internal_error (_("Unknown value."));
     }
 
   /* The behavior of this routine with respect to the source
@@ -9523,8 +9519,7 @@ show_exec_direction_func (struct ui_file *out, int from_tty,
     gdb_printf (out, _("Reverse.\n"));
     break;
   default:
-    internal_error (__FILE__, __LINE__,
-		    _("bogus execution_direction value: %d"),
+    internal_error (_("bogus execution_direction value: %d"),
 		    (int) execution_direction);
   }
 }
diff --git a/gdb/interps.c b/gdb/interps.c
index 3a9c590b8c8..a8bd67258e4 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -115,8 +115,7 @@ interp_factory_register (const char *name, interp_factory_func func)
   for (const interp_factory &f : interpreter_factories)
     if (strcmp (f.name, name) == 0)
       {
-	internal_error (__FILE__, __LINE__,
-			_("interpreter factory already registered: \"%s\"\n"),
+	internal_error (_("interpreter factory already registered: \"%s\"\n"),
 			name);
       }
 
diff --git a/gdb/language.c b/gdb/language.c
index 076e429ff55..3962ee8fa24 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -189,8 +189,7 @@ set_language_command (const char *ignore,
 	}
     }
 
-  internal_error (__FILE__, __LINE__,
-		  "Couldn't find language `%s' in known languages list.",
+  internal_error ("Couldn't find language `%s' in known languages list.",
 		  language);
 }
 
@@ -216,8 +215,7 @@ show_range_command (struct ui_file *file, int from_tty,
 	  tmp = "warn";
 	  break;
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  "Unrecognized range check setting.");
+	  internal_error ("Unrecognized range check setting.");
 	}
 
       gdb_printf (file,
@@ -263,8 +261,7 @@ set_range_command (const char *ignore,
     }
   else
     {
-      internal_error (__FILE__, __LINE__,
-		      _("Unrecognized range check setting: \"%s\""), range);
+      internal_error (_("Unrecognized range check setting: \"%s\""), range);
     }
   if (range_check == range_check_warn
       || ((range_check == range_check_on)
@@ -292,8 +289,7 @@ show_case_command (struct ui_file *file, int from_tty,
 	  tmp = "off";
 	  break;
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  "Unrecognized case-sensitive setting.");
+	  internal_error ("Unrecognized case-sensitive setting.");
 	}
 
       gdb_printf (file,
@@ -334,8 +330,7 @@ set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c)
      }
    else
      {
-       internal_error (__FILE__, __LINE__,
-		       "Unrecognized case-sensitive setting: \"%s\"",
+       internal_error ("Unrecognized case-sensitive setting: \"%s\"",
 		       case_sensitive);
      }
 
@@ -418,7 +413,7 @@ range_error (const char *string,...)
       gdb_printf (gdb_stderr, "\n");
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
   va_end (args);
 }
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index d4639766088..f4f7aa81845 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1116,8 +1116,7 @@ linux_nat_target::attach (const char *args, int from_tty)
 		 gdb_signal_to_string (signo));
 	}
 
-      internal_error (__FILE__, __LINE__,
-		      _("unexpected status %d for PID %ld"),
+      internal_error (_("unexpected status %d for PID %ld"),
 		      status, (long) ptid.lwp ());
     }
 
@@ -1844,11 +1843,9 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 	  if (ret == -1)
 	    perror_with_name (_("waiting for new child"));
 	  else if (ret != new_pid)
-	    internal_error (__FILE__, __LINE__,
-			    _("wait returned unexpected PID %d"), ret);
+	    internal_error (_("wait returned unexpected PID %d"), ret);
 	  else if (!WIFSTOPPED (status))
-	    internal_error (__FILE__, __LINE__,
-			    _("wait returned unexpected status 0x%x"), status);
+	    internal_error (_("wait returned unexpected status 0x%x"), status);
 	}
 
       ptid_t child_ptid (new_pid, new_pid);
@@ -1989,8 +1986,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
 	return 0;
     }
 
-  internal_error (__FILE__, __LINE__,
-		  _("unknown ptrace event %d"), event);
+  internal_error (_("unknown ptrace event %d"), event);
 }
 
 /* Suspend waiting for a signal.  We're mostly interested in
@@ -4231,7 +4227,7 @@ linux_nat_target::async (bool enable)
   if (enable)
     {
       if (!async_file_open ())
-	internal_error (__FILE__, __LINE__, "creating event pipe failed.");
+	internal_error ("creating event pipe failed.");
 
       add_file_handler (async_wait_fd (), handle_target_event, NULL,
 			"linux-nat");
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index 8f72dd2c173..d727bc85062 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -1394,8 +1394,7 @@ loongarch_features_from_bfd (const bfd *abfd)
       else if (eclass == ELFCLASS64)
 	features.xlen = 8;
       else
-	internal_error (__FILE__, __LINE__,
-			_("unknown ELF header class %d"), eclass);
+	internal_error (_("unknown ELF header class %d"), eclass);
 
       if (EF_LOONGARCH_IS_SINGLE_FLOAT (e_flags))
 	features.fputype = SINGLE_FLOAT;
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 9b839c754dd..f5101635aed 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2558,8 +2558,7 @@ m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
   m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (gdbarch);
   
   if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
-    internal_error (__FILE__, __LINE__,
-		    _("No virtual frame pointer available"));
+    internal_error (_("No virtual frame pointer available"));
 
   m32c_analyze_prologue (gdbarch, func_addr, pc, &p);
   switch (p.kind)
@@ -2579,8 +2578,7 @@ m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
     }
   /* Sanity check */
   if (*frame_regnum > gdbarch_num_regs (gdbarch))
-    internal_error (__FILE__, __LINE__,
-		    _("No virtual frame pointer available"));
+    internal_error (_("No virtual frame pointer available"));
 }
 
 \f
diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c
index 502020dd1e0..47e879f0b61 100644
--- a/gdb/m32r-linux-nat.c
+++ b/gdb/m32r-linux-nat.c
@@ -213,8 +213,7 @@ m32r_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
       return;
     }
 
-  internal_error (__FILE__, __LINE__,
-		  _("Got request for bad register number %d."), regno);
+  internal_error (_("Got request for bad register number %d."), regno);
 }
 
 /* Store register REGNO back into the child process.  If REGNO is -1,
@@ -233,8 +232,7 @@ m32r_linux_nat_target::store_registers (struct regcache *regcache, int regno)
       return;
     }
 
-  internal_error (__FILE__, __LINE__,
-		  _("Got request to store bad register number %d."), regno);
+  internal_error (_("Got request to store bad register number %d."), regno);
 }
 
 void _initialize_m32r_linux_nat ();
diff --git a/gdb/m68k-linux-nat.c b/gdb/m68k-linux-nat.c
index 3c8392f7ced..c449b8efe91 100644
--- a/gdb/m68k-linux-nat.c
+++ b/gdb/m68k-linux-nat.c
@@ -445,8 +445,7 @@ m68k_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
       return;
     }
 
-  internal_error (__FILE__, __LINE__,
-		  _("Got request for bad register number %d."), regno);
+  internal_error (_("Got request for bad register number %d."), regno);
 }
 
 /* Store register REGNO back into the child process.  If REGNO is -1,
@@ -489,8 +488,7 @@ m68k_linux_nat_target::store_registers (struct regcache *regcache, int regno)
       return;
     }
 
-  internal_error (__FILE__, __LINE__,
-		  _("Got request to store bad register number %d."), regno);
+  internal_error (_("Got request to store bad register number %d."), regno);
 }
 \f
 
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 002c7e0742f..c0a33118814 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -312,8 +312,7 @@ m68k_extract_return_value (struct type *type, struct regcache *regcache,
       regcache->raw_read (M68K_D1_REGNUM, valbuf + (len - 4));
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Cannot extract return value of %d bytes long."), len);
+    internal_error (_("Cannot extract return value of %d bytes long."), len);
 }
 
 static void
@@ -359,8 +358,7 @@ m68k_store_return_value (struct type *type, struct regcache *regcache,
       regcache->raw_write (M68K_D1_REGNUM, valbuf + (len - 4));
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Cannot store return value of %d bytes long."), len);
+    internal_error (_("Cannot store return value of %d bytes long."), len);
 }
 
 static void
@@ -1060,8 +1058,7 @@ m68k_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
 
   if (tdep->jb_pc < 0)
     {
-      internal_error (__FILE__, __LINE__,
-		      _("m68k_get_longjmp_target: not implemented"));
+      internal_error (_("m68k_get_longjmp_target: not implemented"));
       return 0;
     }
 
diff --git a/gdb/macroexp.c b/gdb/macroexp.c
index be5723fe600..6bd5ef513fd 100644
--- a/gdb/macroexp.c
+++ b/gdb/macroexp.c
@@ -632,8 +632,7 @@ append_tokens_without_splicing (growable_macro_buffer *dest,
 
   /* As far as I know, there's no case where inserting a space isn't
      enough to prevent a splice.  */
-  internal_error (__FILE__, __LINE__,
-		  _("unable to avoid splicing tokens during macro expansion"));
+  internal_error (_("unable to avoid splicing tokens during macro expansion"));
 }
 
 /* Stringify an argument, and insert it into DEST.  ARG is the text to
@@ -1311,7 +1310,7 @@ expand (const char *id,
       return 1;
     }
   else
-    internal_error (__FILE__, __LINE__, _("bad macro definition kind"));
+    internal_error (_("bad macro definition kind"));
 }
 
 
diff --git a/gdb/maint.c b/gdb/maint.c
index 76ac7bece38..c3241b22268 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -76,7 +76,7 @@ maintenance_dump_me (const char *args, int from_tty)
 static void
 maintenance_internal_error (const char *args, int from_tty)
 {
-  internal_error (__FILE__, __LINE__, "%s", (args == NULL ? "" : args));
+  internal_error ("%s", (args == NULL ? "" : args));
 }
 
 /* Stimulate the internal error mechanism that GDB uses when an
@@ -87,7 +87,7 @@ maintenance_internal_error (const char *args, int from_tty)
 static void
 maintenance_internal_warning (const char *args, int from_tty)
 {
-  internal_warning (__FILE__, __LINE__, "%s", (args == NULL ? "" : args));
+  internal_warning ("%s", (args == NULL ? "" : args));
 }
 
 /* Stimulate the internal error mechanism that GDB uses when an
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 78688d58b40..f0af7c9a014 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -591,8 +591,7 @@ list_args_or_locals (const frame_print_options &fp_opts,
       name_of_result = "variables";
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      "unexpected what_to_list: %d", (int) what);
+      internal_error ("unexpected what_to_list: %d", (int) what);
     }
 
   ui_out_emit_list list_emitter (uiout, name_of_result);
diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
index 8c0821691bf..50c53a0b389 100644
--- a/gdb/mi/mi-getopt.c
+++ b/gdb/mi/mi-getopt.c
@@ -33,8 +33,7 @@ mi_getopt_1 (const char *prefix, int argc, char **argv,
 
   /* We assume that argv/argc are ok.  */
   if (*oind > argc || *oind < 0)
-    internal_error (__FILE__, __LINE__,
-		    _("mi_getopt_long: oind out of bounds"));
+    internal_error (_("mi_getopt_long: oind out of bounds"));
   if (*oind == argc)
     return -1;
   arg = argv[*oind];
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 96a847eb6b6..028c0058e58 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -225,7 +225,7 @@ mi_ui_out::open (const char *name, ui_out_type type)
       break;
 
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
 }
 
@@ -245,7 +245,7 @@ mi_ui_out::close (ui_out_type type)
       break;
 
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
 
   m_suppress_field_separator = false;
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 7ed7116de76..efa1daaa7fc 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -533,8 +533,7 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
 	memcpy (valbuf, buf, type->length ());
 	return;
       default:
-	internal_error (__FILE__, __LINE__, 
-			_("Unsupported return value size requested"));
+	internal_error (_("Unsupported return value size requested"));
     }
 }
 
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 0da615564b6..3b65669d176 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1021,8 +1021,7 @@ stub_gnu_ifunc_resolve_name (const char *function_name,
 static void
 stub_gnu_ifunc_resolver_stop (code_breakpoint *b)
 {
-  internal_error (__FILE__, __LINE__,
-		  _("elf_gnu_ifunc_resolver_stop cannot be reached."));
+  internal_error (_("elf_gnu_ifunc_resolver_stop cannot be reached."));
 }
 
 /* See elf_gnu_ifunc_resolver_return_stop for its real implementation.  */
@@ -1030,8 +1029,7 @@ stub_gnu_ifunc_resolver_stop (code_breakpoint *b)
 static void
 stub_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
 {
-  internal_error (__FILE__, __LINE__,
-		  _("elf_gnu_ifunc_resolver_return_stop cannot be reached."));
+  internal_error (_("elf_gnu_ifunc_resolver_return_stop cannot be reached."));
 }
 
 /* See elf_gnu_ifunc_fns for its real implementation.  */
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index a5c39ce224f..72bf8fd660d 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -321,7 +321,7 @@ mips_abi_regsize (struct gdbarch *gdbarch)
     case MIPS_ABI_UNKNOWN:
     case MIPS_ABI_LAST:
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
 }
 
@@ -527,7 +527,7 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
       reg_offset = 0;
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
   if (mips_debug)
     gdb_printf (gdb_stderr,
@@ -690,8 +690,7 @@ mips_register_name (struct gdbarch *gdbarch, int regno)
       return "";
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("mips_register_name: bad register number %d"), rawnum);
+    internal_error (_("mips_register_name: bad register number %d"), rawnum);
 }
 
 /* Return the groups that a MIPS register can be categorised into.  */
@@ -793,7 +792,7 @@ mips_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
 	}
     }
   else
-    internal_error (__FILE__, __LINE__, _("bad register size"));
+    internal_error (_("bad register size"));
 }
 
 static void
@@ -824,7 +823,7 @@ mips_pseudo_register_write (struct gdbarch *gdbarch,
 	}
     }
   else
-    internal_error (__FILE__, __LINE__, _("bad register size"));
+    internal_error (_("bad register size"));
 }
 
 static int
@@ -867,7 +866,7 @@ mips_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
 	}
     }
   else
-    internal_error (__FILE__, __LINE__, _("bad register size"));
+    internal_error (_("bad register size"));
 
   return 0;
 }
@@ -977,8 +976,7 @@ mips_register_to_value (frame_info_ptr frame, int regnum,
     }
   else
     {
-      internal_error (__FILE__, __LINE__,
-		      _("mips_register_to_value: unrecognized case"));
+      internal_error (_("mips_register_to_value: unrecognized case"));
     }
 }
 
@@ -1025,8 +1023,7 @@ mips_value_to_register (frame_info_ptr frame, int regnum,
     }
   else
     {
-      internal_error (__FILE__, __LINE__,
-		      _("mips_value_to_register: unrecognized case"));
+      internal_error (_("mips_value_to_register: unrecognized case"));
     }
 }
 
@@ -1172,8 +1169,7 @@ mips_mask_address_p (mips_gdbarch_tdep *tdep)
     case AUTO_BOOLEAN_AUTO:
       return tdep->default_mask_address_p;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("mips_mask_address_p: bad switch"));
+      internal_error (_("mips_mask_address_p: bad switch"));
       return -1;
     }
 }
@@ -1482,7 +1478,7 @@ mips_fetch_instruction (struct gdbarch *gdbarch,
       instlen = MIPS_INSN32_SIZE;
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("invalid ISA"));
+      internal_error (_("invalid ISA"));
       break;
     }
   err = target_read_memory (addr, buf, instlen);
@@ -1566,7 +1562,7 @@ mips_insn_size (enum mips_isa isa, ULONGEST insn)
     case ISA_MIPS:
 	return MIPS_INSN32_SIZE;
     }
-  internal_error (__FILE__, __LINE__, _("invalid ISA"));
+  internal_error (_("invalid ISA"));
 }
 
 static LONGEST
@@ -2258,7 +2254,7 @@ unpack_mips16 (struct gdbarch *gdbarch, CORE_ADDR pc,
 	break;
       }
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
   upk->offset = offset;
   upk->regx = regx;
@@ -5805,7 +5801,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
 				  readbuf, writebuf, 4);
 	      break;
 	    default:
-	      internal_error (__FILE__, __LINE__, _("bad switch"));
+	      internal_error (_("bad switch"));
 	    }
 	}
       if (fval_reg != mips_fval_fpr)
@@ -6306,8 +6302,7 @@ mips_read_fp_register_double (frame_info_ptr frame, int regno,
       int rawnum = regno % gdbarch_num_regs (gdbarch);
 
       if ((rawnum - mips_regnum (gdbarch)->fp0) & 1)
-	internal_error (__FILE__, __LINE__,
-			_("mips_read_fp_register_double: bad access to "
+	internal_error (_("mips_read_fp_register_double: bad access to "
 			"odd-numbered FP register"));
 
       /* mips_read_fp_register_single will find the correct 32 bits from
@@ -6949,7 +6944,7 @@ show_mipsfpu_command (const char *args, int from_tty)
       fpu = "absent (none)";
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
   if (mips_fpu_type_auto)
     gdb_printf ("The MIPS floating-point coprocessor "
@@ -6971,7 +6966,7 @@ set_mipsfpu_single_command (const char *args, int from_tty)
      instead of relying on globals.  Doing that would let generic code
      handle the search for this specific architecture.  */
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, _("set mipsfpu failed"));
+    internal_error (_("set mipsfpu failed"));
 }
 
 static void
@@ -6984,7 +6979,7 @@ set_mipsfpu_double_command (const char *args, int from_tty)
      instead of relying on globals.  Doing that would let generic code
      handle the search for this specific architecture.  */
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, _("set mipsfpu failed"));
+    internal_error (_("set mipsfpu failed"));
 }
 
 static void
@@ -6997,7 +6992,7 @@ set_mipsfpu_none_command (const char *args, int from_tty)
      instead of relying on globals.  Doing that would let generic code
      handle the search for this specific architecture.  */
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, _("set mipsfpu failed"));
+    internal_error (_("set mipsfpu failed"));
 }
 
 static void
@@ -8033,7 +8028,7 @@ global_mips_abi (void)
     if (mips_abi_strings[i] == mips_abi_string)
       return (enum mips_abi) i;
 
-  internal_error (__FILE__, __LINE__, _("unknown ABI string"));
+  internal_error (_("unknown ABI string"));
 }
 
 /* Return the default compressed instruction set, either of MIPS16
@@ -8050,7 +8045,7 @@ global_mips_compression (void)
     if (mips_compression_strings[i] == mips_compression_string)
       return (enum mips_isa) i;
 
-  internal_error (__FILE__, __LINE__, _("unknown compressed ISA string"));
+  internal_error (_("unknown compressed ISA string"));
 }
 
 static void
@@ -8604,7 +8599,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_long_double_format (gdbarch, floatformats_ibm_long_double);
       break;
     default:
-      internal_error (__FILE__, __LINE__, _("unknown ABI in switch"));
+      internal_error (_("unknown ABI in switch"));
     }
 
   /* GCC creates a pseudo-section whose name specifies the size of
@@ -8653,7 +8648,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 	      set_gdbarch_ptr_bit (gdbarch, long_bit);
 	      break;
 	    default:
-	      internal_error (__FILE__, __LINE__, _("unknown ABI in switch"));
+	      internal_error (_("unknown ABI in switch"));
 	    }
 	}
     }
@@ -8980,7 +8975,7 @@ _initialize_mips_tdep ()
   mips_abi_string = mips_abi_strings[MIPS_ABI_UNKNOWN];
   if (MIPS_ABI_LAST + 1
       != sizeof (mips_abi_strings) / sizeof (mips_abi_strings[0]))
-    internal_error (__FILE__, __LINE__, _("mips_abi_strings out of sync"));
+    internal_error (_("mips_abi_strings out of sync"));
 
   gdbarch_register (bfd_arch_mips, mips_gdbarch_init, mips_dump_tdep);
 
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 5be02132a5d..815949c67ae 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -124,7 +124,7 @@ mn10300_type_align (struct type *type)
       return mn10300_type_align (check_typedef (type));
 
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
 }
 
@@ -190,8 +190,7 @@ mn10300_store_return_value (struct gdbarch *gdbarch, struct type *type,
       regcache->raw_write_part (reg + 1, 0, len - regsz, valbuf + regsz);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Cannot store return value %d bytes long."), len);
+    internal_error (_("Cannot store return value %d bytes long."), len);
 }
 
 static void
@@ -223,8 +222,7 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
       memcpy ((char *) valbuf + regsz, buf, len - regsz);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Cannot extract return value %d bytes long."), len);
+    internal_error (_("Cannot extract return value %d bytes long."), len);
 }
 
 /* Determine, for architecture GDBARCH, how a return value of TYPE
@@ -1364,8 +1362,7 @@ mn10300_gdbarch_init (struct gdbarch_info info,
       set_gdbarch_fp0_regnum (gdbarch, 32);
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("mn10300_gdbarch_init: Unknown mn10300 variant"));
+      internal_error (_("mn10300_gdbarch_init: Unknown mn10300 variant"));
       break;
     }
 
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 77868f78bd3..54554247230 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -865,8 +865,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 	    code_model = MSP_LARGE_CODE_MODEL;
 	    break;
 	  default:
-	    internal_error (__FILE__, __LINE__,
-			    _("Unknown msp430x code memory model"));
+	    internal_error (_("Unknown msp430x code memory model"));
 	    break;
 	  }
 	break;
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index c31fb5ffe43..4911630ba5c 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -912,7 +912,7 @@ linux_read_pt (struct btrace_data_pt *btrace,
       return BTRACE_ERR_NONE;
     }
 
-  internal_error (__FILE__, __LINE__, _("Unknown btrace read type."));
+  internal_error (_("Unknown btrace read type."));
 }
 
 /* See linux-btrace.h.  */
@@ -943,7 +943,7 @@ linux_read_btrace (struct btrace_data *btrace,
       return linux_read_pt (&btrace->variant.pt, tinfo, type);
     }
 
-  internal_error (__FILE__, __LINE__, _("Unkown branch trace format."));
+  internal_error (_("Unkown branch trace format."));
 }
 
 /* See linux-btrace.h.  */
diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index 94b247c514d..0ac51cbf221 100644
--- a/gdb/nat/linux-namespaces.c
+++ b/gdb/nat/linux-namespaces.c
@@ -734,8 +734,7 @@ mnsh_maybe_mourn_peer (void)
 	  if (errno == ECHILD)
 	    warning (_("mount namespace helper vanished?"));
 	  else
-	    internal_warning (__FILE__, __LINE__,
-			      _("unhandled error %d"), errno);
+	    internal_warning (_("unhandled error %d"), errno);
 	}
       else if (pid == helper->pid)
 	{
@@ -746,12 +745,10 @@ mnsh_maybe_mourn_peer (void)
 	    warning (_("mount namespace helper killed by signal %d"),
 		     WTERMSIG (status));
 	  else
-	    internal_warning (__FILE__, __LINE__,
-			      _("unhandled status %d"), status);
+	    internal_warning (_("unhandled status %d"), status);
 	}
       else
-	internal_warning (__FILE__, __LINE__,
-			  _("unknown pid %d"), pid);
+	internal_warning (_("unknown pid %d"), pid);
 
       /* Something unrecoverable happened.  */
       helper->pid = -1;
diff --git a/gdb/nat/mips-linux-watch.c b/gdb/nat/mips-linux-watch.c
index 04fd0b01dd8..deeeb00b028 100644
--- a/gdb/nat/mips-linux-watch.c
+++ b/gdb/nat/mips-linux-watch.c
@@ -32,8 +32,7 @@ mips_linux_watch_get_irw_mask (struct pt_watch_regs *regs, int n)
     case pt_watch_style_mips64:
       return regs->mips64.watch_masks[n] & IRW_MASK;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Unrecognized watch register style"));
+      internal_error (_("Unrecognized watch register style"));
     }
 }
 
@@ -50,8 +49,7 @@ get_reg_mask (struct pt_watch_regs *regs, int n)
     case pt_watch_style_mips64:
       return regs->mips64.watch_masks[n] & ~IRW_MASK;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Unrecognized watch register style"));
+      internal_error (_("Unrecognized watch register style"));
     }
 }
 
@@ -67,8 +65,7 @@ mips_linux_watch_get_num_valid (struct pt_watch_regs *regs)
     case pt_watch_style_mips64:
       return regs->mips64.num_valid;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Unrecognized watch register style"));
+      internal_error (_("Unrecognized watch register style"));
     }
 }
 
@@ -85,8 +82,7 @@ mips_linux_watch_get_watchlo (struct pt_watch_regs *regs, int n)
     case pt_watch_style_mips64:
       return regs->mips64.watchlo[n];
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Unrecognized watch register style"));
+      internal_error (_("Unrecognized watch register style"));
     }
 }
 
@@ -108,8 +104,7 @@ mips_linux_watch_set_watchlo (struct pt_watch_regs *regs, int n,
       regs->mips64.watchlo[n] = value;
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Unrecognized watch register style"));
+      internal_error (_("Unrecognized watch register style"));
     }
 }
 
@@ -126,8 +121,7 @@ mips_linux_watch_get_watchhi (struct pt_watch_regs *regs, int n)
     case pt_watch_style_mips64:
       return regs->mips64.watchhi[n];
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Unrecognized watch register style"));
+      internal_error (_("Unrecognized watch register style"));
     }
 }
 
@@ -147,8 +141,7 @@ mips_linux_watch_set_watchhi (struct pt_watch_regs *regs, int n,
       regs->mips64.watchhi[n] = value;
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Unrecognized watch register style"));
+      internal_error (_("Unrecognized watch register style"));
     }
 }
 
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 94de0265cf6..f4e742f3171 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -261,8 +261,7 @@ x86_length_and_rw_bits (int len, enum target_hw_bp_type type)
 	rw = DR_RW_WRITE;
 	break;
       case hw_read:
-	internal_error (__FILE__, __LINE__,
-			_("The i386 doesn't support "
+	internal_error (_("The i386 doesn't support "
 			  "data-read watchpoints.\n"));
       case hw_access:
 	rw = DR_RW_READ;
@@ -274,7 +273,7 @@ x86_length_and_rw_bits (int len, enum target_hw_bp_type type)
 	break;
 #endif
       default:
-	internal_error (__FILE__, __LINE__, _("\
+	internal_error (_("\
 Invalid hardware breakpoint type %d in x86_length_and_rw_bits.\n"),
 			(int) type);
     }
@@ -292,7 +291,7 @@ Invalid hardware breakpoint type %d in x86_length_and_rw_bits.\n"),
 	  return (DR_LEN_8 | rw);
 	/* FALL THROUGH */
       default:
-	internal_error (__FILE__, __LINE__, _("\
+	internal_error (_("\
 Invalid hardware breakpoint length %d in x86_length_and_rw_bits.\n"), len);
     }
 }
@@ -462,7 +461,7 @@ x86_handle_nonaligned_watchpoint (struct x86_debug_reg_state *state,
 	  else if (what == WP_REMOVE)
 	    retval = x86_remove_aligned_watchpoint (state, addr, len_rw);
 	  else
-	    internal_error (__FILE__, __LINE__, _("\
+	    internal_error (_("\
 Invalid value %d of operation in x86_handle_nonaligned_watchpoint.\n"),
 			    (int) what);
 	  if (retval)
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 12cf4f602c5..4ab91e67f06 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1518,8 +1518,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		  break;
 		default:
 		  /* Long double?  */
-		  internal_error (__FILE__, __LINE__,
-				  "Do not know how to handle %d-byte double.\n",
+		  internal_error ("Do not know how to handle %d-byte double.\n",
 				  len);
 		  break;
 		}
@@ -1664,8 +1663,7 @@ nds32_extract_return_value (struct gdbarch *gdbarch, struct type *type,
       else if (len == 8)
 	regcache->cooked_read (NDS32_FD0_REGNUM, valbuf);
       else
-	internal_error (__FILE__, __LINE__,
-			_("Cannot extract return value of %d bytes "
+	internal_error (_("Cannot extract return value of %d bytes "
 			  "long floating-point."), len);
     }
   else
@@ -1754,8 +1752,7 @@ nds32_store_return_value (struct gdbarch *gdbarch, struct type *type,
       else if (len == 8)
 	regcache->cooked_write (NDS32_FD0_REGNUM, valbuf);
       else
-	internal_error (__FILE__, __LINE__,
-			_("Cannot store return value of %d bytes "
+	internal_error (_("Cannot store return value of %d bytes "
 			  "long floating-point."), len);
     }
   else
diff --git a/gdb/netbsd-tdep.c b/gdb/netbsd-tdep.c
index 80d132231fe..d7c8ee7bc5e 100644
--- a/gdb/netbsd-tdep.c
+++ b/gdb/netbsd-tdep.c
@@ -601,7 +601,7 @@ nbsd_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
      However, system call catching requires this function to be
      set.  */
 
-  internal_error (__FILE__, __LINE__, _("nbsd_get_sycall_number called"));
+  internal_error (_("nbsd_get_sycall_number called"));
 }
 
 /* See netbsd-tdep.h.  */
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 16dab0d2c69..9a152cbc387 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -137,20 +137,17 @@ struct entry_info
 
 #define SECT_OFF_DATA(objfile) \
      ((objfile->sect_index_data == -1) \
-      ? (internal_error (__FILE__, __LINE__, \
-			 _("sect_index_data not initialized")), -1)	\
+      ? (internal_error (_("sect_index_data not initialized")), -1)	\
       : objfile->sect_index_data)
 
 #define SECT_OFF_RODATA(objfile) \
      ((objfile->sect_index_rodata == -1) \
-      ? (internal_error (__FILE__, __LINE__, \
-			 _("sect_index_rodata not initialized")), -1)	\
+      ? (internal_error (_("sect_index_rodata not initialized")), -1)	\
       : objfile->sect_index_rodata)
 
 #define SECT_OFF_TEXT(objfile) \
      ((objfile->sect_index_text == -1) \
-      ? (internal_error (__FILE__, __LINE__, \
-			 _("sect_index_text not initialized")), -1)	\
+      ? (internal_error (_("sect_index_text not initialized")), -1)	\
       : objfile->sect_index_text)
 
 /* Sometimes the .bss section is missing from the objfile, so we don't
diff --git a/gdb/osabi.c b/gdb/osabi.c
index f1b7f227b87..57e2df6b25c 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -156,8 +156,7 @@ gdbarch_register_osabi (enum bfd_architecture arch, unsigned long machine,
   if (osabi == GDB_OSABI_UNKNOWN)
     {
       internal_error
-	(__FILE__, __LINE__,
-	 _("gdbarch_register_osabi: An attempt to register a handler for "
+	(_("gdbarch_register_osabi: An attempt to register a handler for "
 	 "OS ABI \"%s\" for architecture %s was made.  The handler will "
 	 "not be registered"),
 	 gdbarch_osabi_name (osabi),
@@ -174,8 +173,7 @@ gdbarch_register_osabi (enum bfd_architecture arch, unsigned long machine,
 	  && (*handler_p)->osabi == osabi)
 	{
 	  internal_error
-	    (__FILE__, __LINE__,
-	     _("gdbarch_register_osabi: A handler for OS ABI \"%s\" "
+	    (_("gdbarch_register_osabi: A handler for OS ABI \"%s\" "
 	     "has already been registered for architecture %s"),
 	     gdbarch_osabi_name (osabi),
 	     arch_info->printable_name);
@@ -266,8 +264,7 @@ gdbarch_lookup_osabi (bfd *abfd)
 	  if (osabi < GDB_OSABI_UNKNOWN || osabi >= GDB_OSABI_INVALID)
 	    {
 	      internal_error
-		(__FILE__, __LINE__,
-		 _("gdbarch_lookup_osabi: invalid OS ABI (%d) from sniffer "
+		(_("gdbarch_lookup_osabi: invalid OS ABI (%d) from sniffer "
 		 "for architecture %s flavour %d"),
 		 (int) osabi,
 		 bfd_printable_arch_mach (bfd_get_arch (abfd), 0),
@@ -285,8 +282,7 @@ gdbarch_lookup_osabi (bfd *abfd)
 		   || (!match_specific && sniffer->arch == bfd_arch_unknown))
 		    {
 		      internal_error
-			(__FILE__, __LINE__,
-			 _("gdbarch_lookup_osabi: multiple %sspecific OS ABI "
+			(_("gdbarch_lookup_osabi: multiple %sspecific OS ABI "
 			 "match for architecture %s flavour %d: first "
 			 "match \"%s\", second match \"%s\""),
 			 match_specific ? "" : "non-",
@@ -644,8 +640,7 @@ set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
 	    }
 	}
       if (i == GDB_OSABI_INVALID)
-	internal_error (__FILE__, __LINE__,
-			_("Invalid OS ABI \"%s\" passed to command handler."),
+	internal_error (_("Invalid OS ABI \"%s\" passed to command handler."),
 			set_osabi_string);
     }
 
@@ -653,7 +648,7 @@ set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
      graceful here.  */
   gdbarch_info info;
   if (! gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, _("Updating OS ABI failed."));
+    internal_error (_("Updating OS ABI failed."));
 }
 
 static void
@@ -680,8 +675,7 @@ _initialize_gdb_osabi ()
 {
   if (strcmp (gdb_osabi_names[GDB_OSABI_INVALID].pretty, "<invalid>") != 0)
     internal_error
-      (__FILE__, __LINE__,
-       _("_initialize_gdb_osabi: gdb_osabi_names[] is inconsistent"));
+      (_("_initialize_gdb_osabi: gdb_osabi_names[] is inconsistent"));
 
   /* Register a generic sniffer for ELF flavoured files.  */
   gdbarch_register_osabi_sniffer (bfd_arch_unknown,
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 795bb298955..bf46a91c6b2 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1113,8 +1113,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
       regcache->raw_supply (regno, buf + padding);
     }
   else 
-    internal_error (__FILE__, __LINE__,
-		    _("fetch_register: unexpected byte order: %d"),
+    internal_error (_("fetch_register: unexpected byte order: %d"),
 		    gdbarch_byte_order (gdbarch));
 }
 
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index f7d13bac8a3..14800619cbe 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1888,7 +1888,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
       record_tdep->size_time_t = 4;
     }
   else
-    internal_error (__FILE__, __LINE__, _("unexpected wordsize"));
+    internal_error (_("unexpected wordsize"));
 
   /* These values are the second argument of system call "sys_fcntl"
      and "sys_fcntl64".  They are obtained from Linux Kernel source.  */
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index f57c261d9dc..d7f05ddc6b4 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -654,7 +654,7 @@ get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype,
     }
   else
     /* Can't happen.  */
-    internal_error (__FILE__, __LINE__, _("Unknown decimal float size."));
+    internal_error (_("Unknown decimal float size."));
 
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index d077f13fa55..273aa5931a9 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1028,8 +1028,7 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
 	size = 'h';
       else
 	/* Bad value for gdbarch_ptr_bit.  */
-	internal_error (__FILE__, __LINE__,
-			_("failed internal consistency check"));
+	internal_error (_("failed internal consistency check"));
     }
 
   if (size == 'b')
@@ -2872,8 +2871,7 @@ ui_printf (const char *arg, struct ui_file *stream)
 	    DIAGNOSTIC_POP
 	    break;
 	  default:
-	    internal_error (__FILE__, __LINE__,
-			    _("failed internal consistency check"));
+	    internal_error (_("failed internal consistency check"));
 	  }
 	/* Maybe advance to the next argument.  */
 	if (piece.argclass != literal_piece)
diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c
index 50bb13e4b83..ad43b7c9556 100644
--- a/gdb/process-stratum-target.c
+++ b/gdb/process-stratum-target.c
@@ -33,8 +33,7 @@ process_stratum_target::thread_address_space (ptid_t ptid)
   inferior *inf = find_inferior_ptid (this, ptid);
 
   if (inf == NULL || inf->aspace == NULL)
-    internal_error (__FILE__, __LINE__,
-		    _("Can't determine the current "
+    internal_error (_("Can't determine the current "
 		      "address space of thread %s\n"),
 		    target_pid_to_str (ptid).c_str ());
 
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 012073d8bbe..424e611b87b 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -553,8 +553,7 @@ psymbol_functions::find_last_source_symtab (struct objfile *ofp)
     {
       if (cs_pst->readin_p (ofp))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  _("select_source_symtab: "
+	  internal_error (_("select_source_symtab: "
 			  "readin pst found and no symtabs."));
 	}
       else
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index c0679a35f92..5cf978b932c 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -548,7 +548,7 @@ record_btrace_print_conf (const struct btrace_config *conf)
       return;
     }
 
-  internal_error (__FILE__, __LINE__, _("Unknown branch trace format."));
+  internal_error (_("Unknown branch trace format."));
 }
 
 /* The info_record method of target record-btrace.  */
@@ -2439,7 +2439,7 @@ record_btrace_step_thread (struct thread_info *tp)
   switch (flags)
     {
     default:
-      internal_error (__FILE__, __LINE__, _("invalid stepping type."));
+      internal_error (_("invalid stepping type."));
 
     case BTHR_STOP:
       return btrace_step_stopped_on_request ();
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 11565909d7d..650e5bbe955 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1335,8 +1335,7 @@ regcache_read_pc (struct regcache *regcache)
       pc_val = gdbarch_addr_bits_remove (gdbarch, raw_val);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("regcache_read_pc: Unable to find PC"));
+    internal_error (_("regcache_read_pc: Unable to find PC"));
   return pc_val;
 }
 
@@ -1369,8 +1368,7 @@ regcache_write_pc (struct regcache *regcache, CORE_ADDR pc)
     regcache_cooked_write_unsigned (regcache,
 				    gdbarch_pc_regnum (gdbarch), pc);
   else
-    internal_error (__FILE__, __LINE__,
-		    _("regcache_write_pc: Unable to update PC"));
+    internal_error (_("regcache_write_pc: Unable to update PC"));
 
   /* Writing the PC (for instance, from "load") invalidates the
      current frame.  */
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index 8e4af303c54..52952f7bfec 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -205,7 +205,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
 	  type = "internal";
 	  break;
 	default:
-	  internal_error (__FILE__, __LINE__, _("bad switch"));
+	  internal_error (_("bad switch"));
 	}
 
       /* Note: If you change this, be sure to also update the
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 01f88fc9da2..d383f47d302 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -537,11 +537,9 @@ gdbsim_target::store_registers (struct regcache *regcache, int regno)
 				     tmp.data (), regsize);
 
       if (nr_bytes > 0 && nr_bytes != regsize)
-	internal_error (__FILE__, __LINE__,
-			_("Register size different to expected"));
+	internal_error (_("Register size different to expected"));
       if (nr_bytes < 0)
-	internal_error (__FILE__, __LINE__,
-			_("Register %d not updated"), regno);
+	internal_error (_("Register %d not updated"), regno);
       if (nr_bytes == 0)
 	warning (_("Register %s not updated"),
 		 gdbarch_register_name (gdbarch, regno));
diff --git a/gdb/remote.c b/gdb/remote.c
index 17c2d17c8fe..5118ecd0a31 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1593,8 +1593,7 @@ show_interrupt_sequence (struct ui_file *file, int from_tty,
 		  "the remote target to interrupt the execution "
 		  "of Linux kernel.\n"));
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Invalid value for interrupt_sequence_mode: %s."),
+    internal_error (_("Invalid value for interrupt_sequence_mode: %s."),
 		    interrupt_sequence_mode);
 }
 
@@ -2028,8 +2027,7 @@ packet_ok (const char *buf, struct packet_config *config)
 
   if (config->detect != AUTO_BOOLEAN_TRUE
       && config->support == PACKET_DISABLE)
-    internal_error (__FILE__, __LINE__,
-		    _("packet_ok: attempt to use a disabled packet"));
+    internal_error (_("packet_ok: attempt to use a disabled packet"));
 
   result = packet_check_result (buf);
   switch (result)
@@ -2286,7 +2284,7 @@ show_remote_protocol_packet_cmd (struct ui_file *file, int from_tty,
 	  return;
 	}
     }
-  internal_error (__FILE__, __LINE__, _("Could not find config for %s"),
+  internal_error (_("Could not find config for %s"),
 		  c->name);
 }
 
@@ -4041,8 +4039,7 @@ remote_target::extra_thread_info (thread_info *tp)
   struct gdb_ext_thread_info threadinfo;
 
   if (rs->remote_desc == 0)		/* paranoia */
-    internal_error (__FILE__, __LINE__,
-		    _("remote_threads_extra_info"));
+    internal_error (_("remote_threads_extra_info"));
 
   if (tp->ptid == magic_null_ptid
       || (tp->ptid.pid () != 0 && tp->ptid.lwp () == 0))
@@ -4401,8 +4398,7 @@ remote_target::send_interrupt_sequence ()
       remote_serial_write ("g", 1);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("Invalid value for interrupt_sequence_mode: %s."),
+    internal_error (_("Invalid value for interrupt_sequence_mode: %s."),
 		    interrupt_sequence_mode);
 }
 
@@ -8538,8 +8534,7 @@ remote_target::process_g_packet (struct regcache *regcache)
     {
       if (p[0] == 0 || p[1] == 0)
 	/* This shouldn't happen - we adjusted sizeof_g_packet above.  */
-	internal_error (__FILE__, __LINE__,
-			_("unexpected end of 'g' packet reply"));
+	internal_error (_("unexpected end of 'g' packet reply"));
 
       if (p[0] == 'x' && p[1] == 'x')
 	regs[i] = 0;		/* 'x' */
@@ -8557,8 +8552,7 @@ remote_target::process_g_packet (struct regcache *regcache)
 	{
 	  if ((r->offset + reg_size) * 2 > strlen (rs->buf.data ()))
 	    /* This shouldn't happen - we adjusted in_g_packet above.  */
-	    internal_error (__FILE__, __LINE__,
-			    _("unexpected end of 'g' packet reply"));
+	    internal_error (_("unexpected end of 'g' packet reply"));
 	  else if (rs->buf[r->offset * 2] == 'x')
 	    {
 	      gdb_assert (r->offset * 2 < strlen (rs->buf.data ()));
@@ -8713,7 +8707,7 @@ remote_target::store_register_using_P (const struct regcache *regcache,
     case PACKET_UNKNOWN:
       return 0;
     default:
-      internal_error (__FILE__, __LINE__, _("Bad result from packet_ok"));
+      internal_error (_("Bad result from packet_ok"));
     }
 }
 
@@ -8985,8 +8979,7 @@ remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
   int payload_length_bytes;
 
   if (packet_format != 'X' && packet_format != 'M')
-    internal_error (__FILE__, __LINE__,
-		    _("remote_write_bytes_aux: bad packet format"));
+    internal_error (_("remote_write_bytes_aux: bad packet format"));
 
   if (len_units == 0)
     return TARGET_XFER_EOF;
@@ -9035,8 +9028,7 @@ remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
     }
 
   if (todo_units <= 0)
-    internal_error (__FILE__, __LINE__,
-		    _("minimum packet size too small to write data"));
+    internal_error (_("minimum packet size too small to write data"));
 
   /* If we already need another packet, then try to align the end
      of this packet to a useful boundary.  */
@@ -9151,10 +9143,9 @@ remote_target::remote_write_bytes (CORE_ADDR memaddr, const gdb_byte *myaddr,
       packet_format = "M";
       break;
     case PACKET_SUPPORT_UNKNOWN:
-      internal_error (__FILE__, __LINE__,
-		      _("remote_write_bytes: bad internal state"));
+      internal_error (_("remote_write_bytes: bad internal state"));
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
 
   return remote_write_bytes_aux (packet_format,
@@ -9352,7 +9343,7 @@ remote_target::remote_send_printf (const char *format, ...)
   va_end (ap);
 
   if (size >= max_size)
-    internal_error (__FILE__, __LINE__, _("Too long remote packet."));
+    internal_error (_("Too long remote packet."));
 
   if (putpkt (rs->buf) < 0)
     error (_("Communication problem with target."));
@@ -10172,7 +10163,7 @@ remote_target::remote_vkill (int pid)
     case PACKET_UNKNOWN:
       return -1;
     default:
-      internal_error (__FILE__, __LINE__, _("Bad result from packet_ok"));
+      internal_error (_("Bad result from packet_ok"));
     }
 }
 
@@ -10666,8 +10657,7 @@ watchpoint_to_Z_packet (int type)
       return Z_PACKET_ACCESS_WP;
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("hw_bp_to_z: bad watchpoint type %d"), type);
+      internal_error (_("hw_bp_to_z: bad watchpoint type %d"), type);
     }
 }
 
@@ -10706,8 +10696,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len,
     case PACKET_OK:
       return 0;
     }
-  internal_error (__FILE__, __LINE__,
-		  _("remote_insert_watchpoint: reached end of function"));
+  internal_error (_("remote_insert_watchpoint: reached end of function"));
 }
 
 bool
@@ -10753,8 +10742,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len,
     case PACKET_OK:
       return 0;
     }
-  internal_error (__FILE__, __LINE__,
-		  _("remote_remove_watchpoint: reached end of function"));
+  internal_error (_("remote_remove_watchpoint: reached end of function"));
 }
 
 
@@ -10923,8 +10911,7 @@ remote_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
     case PACKET_OK:
       return 0;
     }
-  internal_error (__FILE__, __LINE__,
-		  _("remote_insert_hw_breakpoint: reached end of function"));
+  internal_error (_("remote_insert_hw_breakpoint: reached end of function"));
 }
 
 
@@ -10964,8 +10951,7 @@ remote_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
     case PACKET_OK:
       return 0;
     }
-  internal_error (__FILE__, __LINE__,
-		  _("remote_remove_hw_breakpoint: reached end of function"));
+  internal_error (_("remote_remove_hw_breakpoint: reached end of function"));
 }
 
 /* Verify memory using the "qCRC:" request.  */
@@ -12017,8 +12003,7 @@ register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
 
   for (const remote_g_packet_guess &guess : data->guesses)
     if (guess.bytes == bytes)
-      internal_error (__FILE__, __LINE__,
-		      _("Duplicate g packet description added for size %d"),
+      internal_error (_("Duplicate g packet description added for size %d"),
 		      bytes);
 
   data->guesses.emplace_back (bytes, tdesc);
@@ -13181,9 +13166,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 	  else
 	    /* If it passed validation at definition but fails now,
 	       something is very wrong.  */
-	    internal_error (__FILE__, __LINE__,
-			    _("Fast tracepoint not "
-			      "valid during download"));
+	    internal_error (_("Fast tracepoint not valid during download"));
 	}
       else
 	/* Fast tracepoints are functionally identical to regular
@@ -14265,8 +14248,7 @@ remote_target::read_btrace (struct btrace_data *btrace,
       annex = "delta";
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Bad branch tracing read type: %u."),
+      internal_error (_("Bad branch tracing read type: %u."),
 		      (unsigned int) type);
     }
 
@@ -14317,8 +14299,7 @@ remote_target::pid_to_exec_file (int pid)
 
   inferior *inf = find_inferior_pid (this, pid);
   if (inf == NULL)
-    internal_error (__FILE__, __LINE__,
-		    _("not currently attached to process %d"), pid);
+    internal_error (_("not currently attached to process %d"), pid);
 
   if (!inf->fake_pid_p)
     {
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index d819f6d6d6a..0a050b272ff 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -3567,8 +3567,7 @@ riscv_features_from_bfd (const bfd *abfd)
       else if (eclass == ELFCLASS64)
 	features.xlen = 8;
       else
-	internal_error (__FILE__, __LINE__,
-			_("unknown ELF header class %d"), eclass);
+	internal_error (_("unknown ELF header class %d"), eclass);
 
       if (e_flags & EF_RISCV_FLOAT_ABI_DOUBLE)
 	features.flen = 8;
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index af0174759f7..206b9e2794f 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -849,8 +849,7 @@ opc_reg_to_gdb_regnum (int opcreg)
       case RL78_Reg_MEM:
 	return RL78_MEM_REGNUM;
       default:
-	internal_error (__FILE__, __LINE__,
-			_("Undefined mapping for opc reg %d"),
+	internal_error (_("Undefined mapping for opc reg %d"),
 			opcreg);
     }
 
diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c
index cb141427696..a295781db31 100644
--- a/gdb/rs6000-aix-nat.c
+++ b/gdb/rs6000-aix-nat.c
@@ -599,8 +599,7 @@ rs6000_nat_target::create_inferior (const char *exec_file,
   info.abfd = current_program_space->exec_bfd ();
 
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__,
-		    _("rs6000_create_inferior: failed "
+    internal_error (_("rs6000_create_inferior: failed "
 		      "to select architecture"));
 }
 \f
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 8b6d666bbe7..aac424a65be 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2628,8 +2628,7 @@ rs6000_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
     /* POWER7 Extended FP pseudo-registers.  */
     return builtin_type (gdbarch)->builtin_double;
   else
-    internal_error (__FILE__, __LINE__,
-		    _("rs6000_pseudo_register_type: "
+    internal_error (_("rs6000_pseudo_register_type: "
 		      "called on unexpected register '%s' (%d)"),
 		    gdbarch_register_name (gdbarch, regnum), regnum);
 }
@@ -3104,8 +3103,7 @@ rs6000_pseudo_register_read (struct gdbarch *gdbarch,
 	   || IS_CEFP_PSEUDOREG (tdep, reg_nr))
     return efp_pseudo_register_read (gdbarch, regcache, reg_nr, buffer);
   else
-    internal_error (__FILE__, __LINE__,
-		    _("rs6000_pseudo_register_read: "
+    internal_error (_("rs6000_pseudo_register_read: "
 		    "called on unexpected register '%s' (%d)"),
 		    gdbarch_register_name (gdbarch, reg_nr), reg_nr);
 }
@@ -3134,8 +3132,7 @@ rs6000_pseudo_register_write (struct gdbarch *gdbarch,
 	   || IS_CEFP_PSEUDOREG (tdep, reg_nr))
     efp_pseudo_register_write (gdbarch, regcache, reg_nr, buffer);
   else
-    internal_error (__FILE__, __LINE__,
-		    _("rs6000_pseudo_register_write: "
+    internal_error (_("rs6000_pseudo_register_write: "
 		    "called on unexpected register '%s' (%d)"),
 		    gdbarch_register_name (gdbarch, reg_nr), reg_nr);
 }
@@ -3276,8 +3273,7 @@ rs6000_ax_pseudo_register_collect (struct gdbarch *gdbarch,
       efp_ax_pseudo_register_collect (gdbarch, ax, reg_nr);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("rs6000_pseudo_register_collect: "
+    internal_error (_("rs6000_pseudo_register_collect: "
 		    "called on unexpected register '%s' (%d)"),
 		    gdbarch_register_name (gdbarch, reg_nr), reg_nr);
   return 0;
@@ -8467,7 +8463,7 @@ powerpc_set_soft_float (const char *args, int from_tty,
 
   /* Update the architecture.  */
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, _("could not update architecture"));
+    internal_error (_("could not update architecture"));
 }
 
 static void
@@ -8487,13 +8483,13 @@ powerpc_set_vector_abi (const char *args, int from_tty,
       }
 
   if (vector_abi == POWERPC_VEC_LAST)
-    internal_error (__FILE__, __LINE__, _("Invalid vector ABI accepted: %s."),
+    internal_error (_("Invalid vector ABI accepted: %s."),
 		    powerpc_vector_abi_string);
 
   /* Update the architecture.  */
   gdbarch_info info;
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__, _("could not update architecture"));
+    internal_error (_("could not update architecture"));
 }
 
 /* Show the current setting of the exact watchpoints flag.  */
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 3682ee7d2d3..d0dba7654bb 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1276,7 +1276,7 @@ s390_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
       return full_name[regnum - tdep->v0_full_regnum];
     }
 
-  internal_error (__FILE__, __LINE__, _("invalid regnum"));
+  internal_error (_("invalid regnum"));
 }
 
 /* Implement pseudo_register_type tdesc method.  */
@@ -1299,7 +1299,7 @@ s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
   if (regnum_is_vxr_full (tdep, regnum))
     return tdesc_register_type (gdbarch, S390_V16_REGNUM);
 
-  internal_error (__FILE__, __LINE__, _("invalid regnum"));
+  internal_error (_("invalid regnum"));
 }
 
 /* Implement pseudo_register_read gdbarch method.  */
@@ -1374,7 +1374,7 @@ s390_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
       return status;
     }
 
-  internal_error (__FILE__, __LINE__, _("invalid regnum"));
+  internal_error (_("invalid regnum"));
 }
 
 /* Implement pseudo_register_write gdbarch method.  */
@@ -1431,7 +1431,7 @@ s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
       return;
     }
 
-  internal_error (__FILE__, __LINE__, _("invalid regnum"));
+  internal_error (_("invalid regnum"));
 }
 
 /* Register groups.  */
@@ -1493,7 +1493,7 @@ s390_ax_pseudo_register_collect (struct gdbarch *gdbarch,
     }
   else
     {
-      internal_error (__FILE__, __LINE__, _("invalid regnum"));
+      internal_error (_("invalid regnum"));
     }
   return 0;
 }
@@ -1539,7 +1539,7 @@ s390_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
     }
   else
     {
-      internal_error (__FILE__, __LINE__, _("invalid regnum"));
+      internal_error (_("invalid regnum"));
     }
   return 0;
 }
@@ -2061,7 +2061,7 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type,
 	}
     }
   else
-    internal_error (__FILE__, __LINE__, _("invalid return type"));
+    internal_error (_("invalid return type"));
 }
 
 /* Implement the 'return_value' gdbarch method.  */
diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c
index a948ddd10b0..e1014fc0d7f 100644
--- a/gdb/sentinel-frame.c
+++ b/gdb/sentinel-frame.c
@@ -64,7 +64,7 @@ sentinel_frame_this_id (frame_info_ptr this_frame,
   /* The sentinel frame is used as a starting point for creating the
      previous (inner most) frame.  That frame's THIS_ID method will be
      called to determine the inner most frame's ID.  Not this one.  */
-  internal_error (__FILE__, __LINE__, _("sentinel_frame_this_id called"));
+  internal_error (_("sentinel_frame_this_id called"));
 }
 
 static struct gdbarch *
diff --git a/gdb/ser-event.c b/gdb/ser-event.c
index aaec65fcacf..a0a507e5b6e 100644
--- a/gdb/ser-event.c
+++ b/gdb/ser-event.c
@@ -61,8 +61,7 @@ serial_event_open (struct serial *scb, const char *name)
     int fds[2];
 
     if (gdb_pipe_cloexec (fds) == -1)
-      internal_error (__FILE__, __LINE__,
-		      "creating serial event pipe failed.");
+      internal_error ("creating serial event pipe failed.");
 
     fcntl (fds[0], F_SETFL, O_NONBLOCK);
     fcntl (fds[1], F_SETFL, O_NONBLOCK);
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index afe04102e15..a62502b8d54 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -219,8 +219,7 @@ ser_windows_setparity (struct serial *scb, int parity)
       state.fParity = TRUE;
       break;
     default:
-      internal_warning (__FILE__, __LINE__,
-			"Incorrect parity value: %d", parity);
+      internal_warning ("Incorrect parity value: %d", parity);
       return -1;
     }
 
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 37ac0b6403c..bfedbd87642 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -447,8 +447,7 @@ hardwire_setparity (struct serial *scb, int parity)
       newparity = PARENB;
       break;
     default:
-      internal_warning (__FILE__, __LINE__,
-			"Incorrect parity value: %d", parity);
+      internal_warning ("Incorrect parity value: %d", parity);
       return -1;
     }
 
diff --git a/gdb/serial.c b/gdb/serial.c
index 0a8c7abf615..b304807c597 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -387,8 +387,7 @@ serial_readchar (struct serial *scb, int timeout)
   /* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
      code is finished.  */
   if (0 && serial_is_async_p (scb) && timeout < 0)
-    internal_error (__FILE__, __LINE__,
-		    _("serial_readchar: blocking read in async mode"));
+    internal_error (_("serial_readchar: blocking read in async mode"));
 
   ch = scb->ops->readchar (scb, timeout);
   if (serial_logfp != NULL)
diff --git a/gdb/source.c b/gdb/source.c
index 25ad1ecb3da..d0f2d1c7635 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1293,7 +1293,7 @@ symtab_to_filename_for_display (struct symtab *symtab)
   else if (filename_display_string == filename_display_relative)
     return symtab->filename;
   else
-    internal_error (__FILE__, __LINE__, _("invalid filename_display_string"));
+    internal_error (_("invalid filename_display_string"));
 }
 
 \f
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index cdcf8ae2319..49c055e43cb 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -484,8 +484,7 @@ sparc32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
   if (regnum >= SPARC32_D0_REGNUM && regnum <= SPARC32_D30_REGNUM)
     return builtin_type (gdbarch)->builtin_double;
 
-  internal_error (__FILE__, __LINE__,
-		  _("sparc32_pseudo_register_type: bad register number %d"),
+  internal_error (_("sparc32_pseudo_register_type: bad register number %d"),
 		  regnum);
 }
 
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 25e8ce377c1..b1368c7fc54 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -847,8 +847,7 @@ sparc64_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
   if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)
     return builtin_type (gdbarch)->builtin_long_double;
 
-  internal_error (__FILE__, __LINE__,
-		  _("sparc64_pseudo_register_type: bad register number %d"),
+  internal_error (_("sparc64_pseudo_register_type: bad register number %d"),
 		  regnum);
 }
 
@@ -889,7 +888,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
   if (regnum >= gdbarch_num_regs (gdbarch))
     return sparc64_pseudo_register_type (gdbarch, regnum);
 
-  internal_error (__FILE__, __LINE__, _("invalid regnum"));
+  internal_error (_("invalid regnum"));
 }
 
 static enum register_status
diff --git a/gdb/stack.c b/gdb/stack.c
index 4867669dba8..653251c200b 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -996,8 +996,7 @@ print_frame_info_to_print_what (const char *print_frame_info)
     if (print_frame_info == print_frame_info_choices[i])
       return print_frame_info_print_what[i];
 
-  internal_error (__FILE__, __LINE__,
-		  "Unexpected print frame-info value `%s'.",
+  internal_error ("Unexpected print frame-info value `%s'.",
 		  print_frame_info);
 }
 
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index e3a97c03368..7e3d26bc849 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -185,15 +185,13 @@ class stap_probe : public probe
 
     gdb_assert (m_have_parsed_args);
     if (m_parsed_args.empty ())
-      internal_error (__FILE__, __LINE__,
-		      _("Probe '%s' apparently does not have arguments, but \n"
+      internal_error (_("Probe '%s' apparently does not have arguments, but \n"
 			"GDB is requesting its argument number %u anyway.  "
 			"This should not happen.  Please report this bug."),
 		      this->get_name ().c_str (), n);
 
     if (n > m_parsed_args.size ())
-      internal_error (__FILE__, __LINE__,
-		      _("Probe '%s' has %d arguments, but GDB is requesting\n"
+      internal_error (_("Probe '%s' has %d arguments, but GDB is requesting\n"
 			"argument %u.  This should not happen.  Please\n"
 			"report this bug."),
 		      this->get_name ().c_str (),
@@ -811,8 +809,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
 						newregname.size ());
 
 	  if (regnum == -1)
-	    internal_error (__FILE__, __LINE__,
-			    _("Invalid register name '%s' after replacing it"
+	    internal_error (_("Invalid register name '%s' after replacing it"
 			      " (previous name was '%s')"),
 			    newregname.c_str (), regname.c_str ());
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 50ee87ee0a9..cbb55bb45dc 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3228,8 +3228,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 	       should occur, we'd like to know about it, so error out,
 	       fatally.  */
 	    if (mfunsym.value_address () == pc)
-	      internal_error (__FILE__, __LINE__,
-		_("Infinite recursion detected in find_pc_sect_line;"
+	      internal_error (_("Infinite recursion detected in find_pc_sect_line;"
 		  "please file a bug report"));
 
 	    return find_pc_line (mfunsym.value_address (), 0);
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 13cc9e44a53..44dea711a39 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -148,8 +148,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
 	  return;
 	}
 
-      internal_error (__FILE__, __LINE__,
-		      "Type \"%s\" has an unknown kind %d",
+      internal_error ("Type \"%s\" has an unknown kind %d",
 		      e->name.c_str (), e->kind);
     }
 
@@ -187,8 +186,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
 	  return;
 	}
 
-      internal_error (__FILE__, __LINE__,
-		      "Type \"%s\" has an unknown kind %d",
+      internal_error ("Type \"%s\" has an unknown kind %d",
 		      e->name.c_str (), e->kind);
     }
 
@@ -601,8 +599,7 @@ target_clear_description (void)
 
   gdbarch_info info;
   if (!gdbarch_update_p (info))
-    internal_error (__FILE__, __LINE__,
-		    _("Could not remove target-supplied description"));
+    internal_error (_("Could not remove target-supplied description"));
 }
 
 /* Return the global current target description.  This should only be
@@ -982,8 +979,7 @@ tdesc_register_type (struct gdbarch *gdbarch, int regno)
 	}
 
       if (arch_reg->type == NULL)
-	internal_error (__FILE__, __LINE__,
-			"Register \"%s\" has an unknown type \"%s\"",
+	internal_error ("Register \"%s\" has an unknown type \"%s\"",
 			reg->name.c_str (), reg->type.c_str ());
     }
 
@@ -1227,8 +1223,7 @@ tdesc_add_compatible (struct target_desc *target_desc,
 
   for (const tdesc_compatible_info_up &compat : target_desc->compatible)
     if (compat->arch () == compatible)
-      internal_error (__FILE__, __LINE__,
-		      _("Attempted to add duplicate "
+      internal_error (_("Attempted to add duplicate "
 			"compatible architecture \"%s\""),
 		      compatible->printable_name);
 
@@ -1244,8 +1239,7 @@ set_tdesc_property (struct target_desc *target_desc,
   gdb_assert (key != NULL && value != NULL);
 
   if (tdesc_property (target_desc, key) != NULL)
-    internal_error (__FILE__, __LINE__,
-		    _("Attempted to add duplicate property \"%s\""), key);
+    internal_error (_("Attempted to add duplicate property \"%s\""), key);
 
   target_desc->properties.emplace_back (key, value);
 }
diff --git a/gdb/target.c b/gdb/target.c
index 28560983625..74925e139dc 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -867,8 +867,7 @@ add_target (const target_info &t, target_open_ftype *func,
 
   auto &func_slot = target_factories[&t];
   if (func_slot != nullptr)
-    internal_error (__FILE__, __LINE__,
-		    _("target already added (\"%s\")."), t.shortname);
+    internal_error (_("target already added (\"%s\")."), t.shortname);
   func_slot = func;
 
   if (targetlist == NULL)
@@ -1203,8 +1202,7 @@ target_stack::unpush (target_ops *t)
   strata stratum = t->stratum ();
 
   if (stratum == dummy_stratum)
-    internal_error (__FILE__, __LINE__,
-		    _("Attempt to unpush the dummy target"));
+    internal_error (_("Attempt to unpush the dummy target"));
 
   /* Look for the specified target.  Note that a target can only occur
      once in the target stack.  */
@@ -1243,8 +1241,7 @@ unpush_target_and_assert (struct target_ops *target)
       gdb_printf (gdb_stderr,
 		  "pop_all_targets couldn't find target %s\n",
 		  target->shortname ());
-      internal_error (__FILE__, __LINE__,
-		      _("failed internal consistency check"));
+      internal_error (_("failed internal consistency check"));
     }
 }
 
@@ -2713,8 +2710,7 @@ default_follow_fork (struct target_ops *self, inferior *child_inf,
 		     bool follow_child, bool detach_fork)
 {
   /* Some target returned a fork event, but did not know how to follow it.  */
-  internal_error (__FILE__, __LINE__,
-		  _("could not find a target to follow fork"));
+  internal_error (_("could not find a target to follow fork"));
 }
 
 /* See target.h.  */
@@ -2753,8 +2749,7 @@ target_follow_exec (inferior *follow_inf, ptid_t ptid,
 static void
 default_mourn_inferior (struct target_ops *self)
 {
-  internal_error (__FILE__, __LINE__,
-		  _("could not find a target to follow mourn inferior"));
+  internal_error (_("could not find a target to follow mourn inferior"));
 }
 
 void
@@ -2849,7 +2844,7 @@ target_require_runnable (void)
   /* This function is only called if the target is running.  In that
      case there should have been a process_stratum target and it
      should either know how to create inferiors, or not...  */
-  internal_error (__FILE__, __LINE__, _("No targets found"));
+  internal_error (_("No targets found"));
 }
 
 /* Whether GDB is allowed to fall back to the default run target for
@@ -2877,8 +2872,7 @@ void
 set_native_target (target_ops *target)
 {
   if (the_native_target != NULL)
-    internal_error (__FILE__, __LINE__,
-		    _("native target already set (\"%s\")."),
+    internal_error (_("native target already set (\"%s\")."),
 		    the_native_target->longname ());
 
   the_native_target = target;
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index b080f9f17ae..054f0e6f3b2 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -845,7 +845,7 @@ tic6x_arg_type_alignment (struct type *type)
 	    return 16;
 	}
       else
-	internal_error (__FILE__, __LINE__, _("unexpected length %d of type"),
+	internal_error (_("unexpected length %d of type"),
 			len);
     }
 }
@@ -1063,13 +1063,11 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
 		}
 	      else
-		internal_error (__FILE__, __LINE__,
-				_("unexpected type %d of arg %d"),
+		internal_error (_("unexpected type %d of arg %d"),
 				typecode, argnum);
 	    }
 	  else
-	    internal_error (__FILE__, __LINE__,
-			    _("unexpected length %d of arg %d"), len, argnum);
+	    internal_error (_("unexpected length %d of arg %d"), len, argnum);
 
 	  addr = sp + stack_offset;
 	  write_memory (addr, val, len);
diff --git a/gdb/tracectf.c b/gdb/tracectf.c
index 155c8b7db06..0fe57c3fffa 100644
--- a/gdb/tracectf.c
+++ b/gdb/tracectf.c
@@ -1622,7 +1622,7 @@ ctf_target::trace_find (enum trace_find_type type, int num,
 			found = 1;
 		      break;
 		    default:
-		      internal_error (__FILE__, __LINE__, _("unknown tfind type"));
+		      internal_error (_("unknown tfind type"));
 		    }
 		}
 	    }
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index f84ad2f4a3f..3266f357a27 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -752,7 +752,7 @@ tfile_target::trace_find (enum trace_find_type type, int num,
 		    found = 1;
 		  break;
 		default:
-		  internal_error (__FILE__, __LINE__, _("unknown tfind type"));
+		  internal_error (_("unknown tfind type"));
 		}
 	    }
 	}
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 39408ae8941..14c54c7614f 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -594,13 +594,12 @@ report_agent_reqs_errors (struct agent_expr *aexpr)
   /* All of the "flaws" are serious bytecode generation issues that
      should never occur.  */
   if (aexpr->flaw != agent_flaw_none)
-    internal_error (__FILE__, __LINE__, _("expression is malformed"));
+    internal_error (_("expression is malformed"));
 
   /* If analysis shows a stack underflow, GDB must have done something
      badly wrong in its bytecode generation.  */
   if (aexpr->min_height < 0)
-    internal_error (__FILE__, __LINE__,
-		    _("expression has min height < 0"));
+    internal_error (_("expression has min height < 0"));
 
   /* Issue this error if the stack is predicted to get too deep.  The
      limit is rather arbitrary; a better scheme might be for the
@@ -1364,8 +1363,7 @@ encode_actions_1 (struct command_line *action,
 			i = user_reg_map_name_to_regnum (target_gdbarch (),
 							 name, strlen (name));
 			if (i == -1)
-			  internal_error (__FILE__, __LINE__,
-					  _("Register $%s not available"),
+			  internal_error (_("Register $%s not available"),
 					  name);
 			if (info_verbose)
 			  gdb_printf ("OP_REGISTER: ");
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index e0846fe80c4..425bed5639c 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -152,7 +152,7 @@ tui_interp::interp_ui_out ()
 gdb_exception
 tui_interp::exec (const char *command_str)
 {
-  internal_error (__FILE__, __LINE__, _("tui_exec called"));
+  internal_error (_("tui_exec called"));
 }
 
 
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index e34e40fae76..0da2b3a068b 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -212,16 +212,14 @@ class ui_out_table
 void ui_out_table::start_body ()
 {
   if (m_state != state::HEADERS)
-    internal_error (__FILE__, __LINE__,
-		    _("extra table_body call not allowed; there must be only "
+    internal_error (_("extra table_body call not allowed; there must be only "
 		      "one table_body after a table_begin and before a "
 		      "table_end."));
 
   /* Check if the number of defined headers matches the number of expected
      columns.  */
   if (m_headers.size () != m_nr_cols)
-    internal_error (__FILE__, __LINE__,
-		    _("number of headers differ from number of table "
+    internal_error (_("number of headers differ from number of table "
 		      "columns."));
 
   m_state = state::BODY;
@@ -235,8 +233,7 @@ void ui_out_table::append_header (int width, ui_align alignment,
 				  const std::string &col_hdr)
 {
   if (m_state != state::HEADERS)
-    internal_error (__FILE__, __LINE__,
-		    _("table header must be specified after table_begin and "
+    internal_error (_("table header must be specified after table_begin and "
 		      "before table_body."));
 
   std::unique_ptr<ui_out_hdr> header (new ui_out_hdr (m_headers.size () + 1,
@@ -354,8 +351,7 @@ void
 ui_out::table_begin (int nr_cols, int nr_rows, const std::string &tblid)
 {
   if (m_table_up != nullptr)
-    internal_error (__FILE__, __LINE__,
-		    _("tables cannot be nested; table_begin found before \
+    internal_error (_("tables cannot be nested; table_begin found before \
 previous table_end."));
 
   m_table_up.reset (new ui_out_table (level () + 1, nr_cols, tblid));
@@ -368,8 +364,7 @@ ui_out::table_header (int width, ui_align alignment,
 		      const std::string &col_name, const std::string &col_hdr)
 {
   if (m_table_up == nullptr)
-    internal_error (__FILE__, __LINE__,
-		    _("table_header outside a table is not valid; it must be \
+    internal_error (_("table_header outside a table is not valid; it must be \
 after a table_begin and before a table_body."));
 
   m_table_up->append_header (width, alignment, col_name, col_hdr);
@@ -381,8 +376,7 @@ void
 ui_out::table_body ()
 {
   if (m_table_up == nullptr)
-    internal_error (__FILE__, __LINE__,
-		    _("table_body outside a table is not valid; it must be "
+    internal_error (_("table_body outside a table is not valid; it must be "
 		      "after a table_begin and before a table_end."));
 
   m_table_up->start_body ();
@@ -394,8 +388,7 @@ void
 ui_out::table_end ()
 {
   if (m_table_up == nullptr)
-    internal_error (__FILE__, __LINE__,
-		    _("misplaced table_end or missing table_begin."));
+    internal_error (_("misplaced table_end or missing table_begin."));
 
   do_table_end ();
 
@@ -772,8 +765,7 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
 	  call_do_message (style, current_substring, 0);
 	  break;
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  _("failed internal consistency check"));
+	  internal_error (_("failed internal consistency check"));
 	}
     }
 }
@@ -833,8 +825,7 @@ ui_out::verify_field (int *fldno, int *width, ui_align *align)
   if (m_table_up != nullptr
       && m_table_up->current_state () != ui_out_table::state::BODY)
     {
-      internal_error (__FILE__, __LINE__,
-		      _("table_body missing; table fields must be \
+      internal_error (_("table_body missing; table fields must be \
 specified after table_body and inside a list."));
     }
 
@@ -846,8 +837,7 @@ specified after table_body and inside a list."));
       && m_table_up->get_next_header (fldno, width, align, &text))
     {
       if (*fldno != current->field_count ())
-	internal_error (__FILE__, __LINE__,
-			_("ui-out internal error in handling headers."));
+	internal_error (_("ui-out internal error in handling headers."));
     }
   else
     {
diff --git a/gdb/utils.c b/gdb/utils.c
index b0841e1fe5e..c37d9add500 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -412,7 +412,7 @@ internal_vproblem (struct internal_problem *problem,
   else if (problem->should_quit == internal_problem_no)
     quit_p = 0;
   else
-    internal_error (__FILE__, __LINE__, _("bad switch"));
+    internal_error (_("bad switch"));
 
   gdb_puts (_("\nThis is a bug, please report it."), gdb_stderr);
   if (REPORT_BUGS_TO[0])
@@ -442,7 +442,7 @@ internal_vproblem (struct internal_problem *problem,
   else if (problem->should_dump_core == internal_problem_no)
     dump_core_p = 0;
   else
-    internal_error (__FILE__, __LINE__, _("bad switch"));
+    internal_error (_("bad switch"));
 
   if (quit_p)
     {
@@ -714,13 +714,12 @@ malloc_failure (long size)
 {
   if (size > 0)
     {
-      internal_error (__FILE__, __LINE__,
-		      _("virtual memory exhausted: can't allocate %ld bytes."),
+      internal_error (_("virtual memory exhausted: can't allocate %ld bytes."),
 		      size);
     }
   else
     {
-      internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
+      internal_error (_("virtual memory exhausted."));
     }
 }
 
diff --git a/gdb/valops.c b/gdb/valops.c
index 748f154252a..ecfceed199a 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3402,8 +3402,7 @@ value_aggregate_elt (struct type *curtype, const char *name,
       return enum_constant_from_type (curtype, name);
 
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("non-aggregate type in value_aggregate_elt"));
+      internal_error (_("non-aggregate type in value_aggregate_elt"));
     }
 }
 
@@ -3848,7 +3847,7 @@ value_rtti_indirect_type (struct value *v, int *full,
       else if (type->code () == TYPE_CODE_PTR)
 	real_type = lookup_pointer_type (real_type);
       else
-	internal_error (__FILE__, __LINE__, _("Unexpected value type."));
+	internal_error (_("Unexpected value type."));
 
       /* Copy qualifiers to the pointer/reference.  */
       real_type = make_cv_type (TYPE_CONST (type), TYPE_VOLATILE (type),
diff --git a/gdb/valprint.c b/gdb/valprint.c
index f079f31fa7b..685f8900628 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1338,8 +1338,7 @@ print_longest (struct ui_file *stream, int format, int use_c_format,
     case 'o':
       val = int_string (val_long, 8, 0, 0, use_c_format); break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("failed internal consistency check"));
+      internal_error (_("failed internal consistency check"));
     } 
   gdb_puts (val, stream);
 }
diff --git a/gdb/value.c b/gdb/value.c
index 605e52dee82..47028630259 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2254,7 +2254,7 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
       break;
 
     default:
-      internal_error (__FILE__, __LINE__, _("bad kind"));
+      internal_error (_("bad kind"));
     }
 
   /* Change the VALUE_LVAL to lval_internalvar so that future operations
@@ -2348,7 +2348,7 @@ set_internalvar_component (struct internalvar *var,
 
     default:
       /* We can never get a component of any other kind.  */
-      internal_error (__FILE__, __LINE__, _("set_internalvar_component"));
+      internal_error (_("set_internalvar_component"));
     }
 }
 
@@ -4005,8 +4005,7 @@ value_fetch_lazy_register (struct value *val)
       if (VALUE_LVAL (new_val) == lval_register
 	  && value_lazy (new_val)
 	  && VALUE_NEXT_FRAME_ID (new_val) == next_frame_id)
-	internal_error (__FILE__, __LINE__,
-			_("infinite loop while fetching a register"));
+	internal_error (_("infinite loop while fetching a register"));
     }
 
   /* If it's still lazy (for instance, a saved register on the
@@ -4104,7 +4103,7 @@ value_fetch_lazy (struct value *val)
 	   && value_computed_funcs (val)->read != NULL)
     value_computed_funcs (val)->read (val);
   else
-    internal_error (__FILE__, __LINE__, _("Unexpected lazy value type."));
+    internal_error (_("Unexpected lazy value type."));
 
   set_value_lazy (val, 0);
 }
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index a01af2d17c8..77ab2706fff 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -3215,8 +3215,7 @@ static void
 cygwin_set_dr (int i, CORE_ADDR addr)
 {
   if (i < 0 || i > 3)
-    internal_error (__FILE__, __LINE__,
-		    _("Invalid register %d in cygwin_set_dr.\n"), i);
+    internal_error (_("Invalid register %d in cygwin_set_dr.\n"), i);
   windows_process.dr[i] = addr;
 
   for (auto &th : windows_process.thread_list)
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 9659fd0877a..780c70568a8 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -521,8 +521,7 @@ gdb_xml_fetch_external_entity (XML_Parser expat_parser,
 
       text = fetch_xml_builtin (parser->dtd_name ());
       if (text == NULL)
-	internal_error (__FILE__, __LINE__,
-			_("could not locate built-in DTD %s"),
+	internal_error (_("could not locate built-in DTD %s"),
 			parser->dtd_name ());
     }
   else
@@ -564,8 +563,7 @@ gdb_xml_parser::use_dtd (const char *dtd_name)
   /* Even if no DTD is provided, use the built-in DTD anyway.  */
   err = XML_UseForeignDTD (m_expat_parser, XML_TRUE);
   if (err != XML_ERROR_NONE)
-    internal_error (__FILE__, __LINE__,
-		    _("XML_UseForeignDTD failed: %s"),
+    internal_error (_("XML_UseForeignDTD failed: %s"),
 		    XML_ErrorString (err));
 }
 
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index 4803e8ba3e0..8a5387d577c 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -254,8 +254,7 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
       else if (strcmp (attr.name, "groups") == 0)
 	groups = (char *) attr.value.get ();
       else
-	internal_error (__FILE__, __LINE__,
-			_("Unknown attribute name '%s'."), attr.name);
+	internal_error (_("Unknown attribute name '%s'."), attr.name);
     }
 
   gdb_assert (name);
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 4ca46e2e20a..27634f5f4ce 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -322,7 +322,7 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
       return reg->ctype;
     }
 
-  internal_error (__FILE__, __LINE__, _("invalid register number %d"), regnum);
+  internal_error (_("invalid register number %d"), regnum);
   return 0;
 }
 
@@ -615,8 +615,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
       return regcache->raw_read (regnum, buffer);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("invalid register number %d"), regnum);
+    internal_error (_("invalid register number %d"), regnum);
 }
 
 
@@ -704,8 +703,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
       regcache->raw_write (regnum, buffer);
     }
   else
-    internal_error (__FILE__, __LINE__,
-		    _("invalid register number %d"), regnum);
+    internal_error (_("invalid register number %d"), regnum);
 }
 
 static const reggroup *xtensa_ar_reggroup;
@@ -1551,8 +1549,7 @@ xtensa_extract_return_value (struct type *type,
 
       /* On Xtensa, we can return up to 4 words (or 2 for call12).  */
       if (len > (callsize > 8 ? 8 : 16))
-	internal_error (__FILE__, __LINE__,
-			_("cannot extract return value of %d bytes long"),
+	internal_error (_("cannot extract return value of %d bytes long"),
 			len);
 
       /* Get the register offset of the return
@@ -1607,8 +1604,7 @@ xtensa_store_return_value (struct type *type,
       callsize = extract_call_winsize (gdbarch, pc);
 
       if (len > (callsize > 8 ? 8 : 16))
-	internal_error (__FILE__, __LINE__,
-			_("unimplemented for this length: %s"),
+	internal_error (_("unimplemented for this length: %s"),
 			pulongest (type->length ()));
       areg = arreg_number (gdbarch,
 			   tdep->a0_base + 2 + callsize, wb);
@@ -3067,8 +3063,7 @@ xtensa_verify_config (struct gdbarch *gdbarch)
     log.printf (_("\n\ta0_base: No Ax registers"));
 
   if (!log.empty ())
-    internal_error (__FILE__, __LINE__,
-		    _("the following are invalid: %s"), log.c_str ());
+    internal_error (_("the following are invalid: %s"), log.c_str ());
 }
 
 
diff --git a/gdbserver/ax.cc b/gdbserver/ax.cc
index 365bd2195b2..e5b4542825c 100644
--- a/gdbserver/ax.cc
+++ b/gdbserver/ax.cc
@@ -1207,8 +1207,7 @@ gdb_eval_agent_expr (struct eval_agent_expr_context *ctx,
 		top = cnv.u8.val;
 		break;
 	      default:
-		internal_error (__FILE__, __LINE__,
-				"unhandled register size");
+		internal_error ("unhandled register size");
 	      }
 	  }
 	  break;
diff --git a/gdbserver/linux-amd64-ipa.cc b/gdbserver/linux-amd64-ipa.cc
index bb89ba575bc..46c2578b81c 100644
--- a/gdbserver/linux-amd64-ipa.cc
+++ b/gdbserver/linux-amd64-ipa.cc
@@ -159,8 +159,7 @@ supply_static_tracepoint_registers (struct regcache *regcache,
 	    }
 	    break;
 	  default:
-	    internal_error (__FILE__, __LINE__,
-			    "unhandled register size: %d",
+	    internal_error ("unhandled register size: %d",
 			    x86_64_st_collect_regmap[i].size);
 	    break;
 	  }
@@ -190,8 +189,7 @@ get_ipa_tdesc (int idx)
 {
   if (idx >= X86_TDESC_LAST)
     {
-      internal_error (__FILE__, __LINE__,
-		      "unknown ipa tdesc index: %d", idx);
+      internal_error ("unknown ipa tdesc index: %d", idx);
     }
 
 #if defined __ILP32__
@@ -210,8 +208,7 @@ get_ipa_tdesc (int idx)
   return amd64_linux_read_description (idx2mask[idx], false);
 #endif
 
-  internal_error (__FILE__, __LINE__,
-		  "unknown ipa tdesc index: %d", idx);
+  internal_error ("unknown ipa tdesc index: %d", idx);
 }
 
 /* Allocate buffer for the jump pads.  The branch instruction has a
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index ab6209a3abc..a458b0f14a6 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -413,9 +413,9 @@ arm_linux_init_hwbp_cap (int pid)
   arm_linux_hwbp_cap.bp_count = (unsigned char)(val & 0xff);
 
   if (arm_linux_hwbp_cap.wp_count > MAX_WPTS)
-    internal_error (__FILE__, __LINE__, "Unsupported number of watchpoints");
+    internal_error ("Unsupported number of watchpoints");
   if (arm_linux_hwbp_cap.bp_count > MAX_BPTS)
-    internal_error (__FILE__, __LINE__, "Unsupported number of breakpoints");
+    internal_error ("Unsupported number of breakpoints");
 }
 
 /* How many hardware breakpoints are available?  */
diff --git a/gdbserver/linux-i386-ipa.cc b/gdbserver/linux-i386-ipa.cc
index 88383a87b4c..33909d5c54b 100644
--- a/gdbserver/linux-i386-ipa.cc
+++ b/gdbserver/linux-i386-ipa.cc
@@ -179,7 +179,7 @@ supply_static_tracepoint_registers (struct regcache *regcache,
 	    }
 	    break;
 	  default:
-	    internal_error (__FILE__, __LINE__, "unhandled register size: %d",
+	    internal_error ("unhandled register size: %d",
 			    i386_st_collect_regmap[i].size);
 	  }
       }
@@ -264,8 +264,7 @@ get_ipa_tdesc (int idx)
 {
   if (idx >= X86_TDESC_LAST)
     {
-      internal_error (__FILE__, __LINE__,
-		      "unknown ipa tdesc index: %d", idx);
+      internal_error ("unknown ipa tdesc index: %d", idx);
     }
   return i386_linux_read_description (idx2mask[idx]);
 }
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 2f71360d3bd..5ae16a5815a 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -741,7 +741,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
       return 0;
     }
 
-  internal_error (__FILE__, __LINE__, _("unknown ptrace event %d"), event);
+  internal_error (_("unknown ptrace event %d"), event);
 }
 
 CORE_ADDR
@@ -1892,8 +1892,7 @@ lwp_suspended_decr (struct lwp_info *lwp)
     {
       struct thread_info *thread = get_lwp_thread (lwp);
 
-      internal_error (__FILE__, __LINE__,
-		      "unsuspend LWP %ld, suspended=%d\n", lwpid_of (thread),
+      internal_error ("unsuspend LWP %ld, suspended=%d\n", lwpid_of (thread),
 		      lwp->suspended);
     }
 }
@@ -2524,8 +2523,7 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
       if (requested_child->suspended
 	  && requested_child->status_pending_p)
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "requesting an event out of a"
+	  internal_error ("requesting an event out of a"
 			  " suspended child?");
 	}
 
@@ -3793,8 +3791,7 @@ linux_process_target::stuck_in_jump_pad (thread_info *thread)
 
   if (lwp->suspended != 0)
     {
-      internal_error (__FILE__, __LINE__,
-		      "LWP %ld is suspended, suspended=%d\n",
+      internal_error ("LWP %ld is suspended, suspended=%d\n",
 		      lwpid_of (thread), lwp->suspended);
     }
   gdb_assert (lwp->stopped);
@@ -3817,8 +3814,7 @@ linux_process_target::move_out_of_jump_pad (thread_info *thread)
 
   if (lwp->suspended != 0)
     {
-      internal_error (__FILE__, __LINE__,
-		      "LWP %ld is suspended, suspended=%d\n",
+      internal_error ("LWP %ld is suspended, suspended=%d\n",
 		      lwpid_of (thread), lwp->suspended);
     }
   gdb_assert (lwp->stopped);
@@ -4067,8 +4063,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
 	step = 1;
       else
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "moving out of jump pad single-stepping"
+	  internal_error ("moving out of jump pad single-stepping"
 			  " not implemented on this target");
 	}
     }
@@ -4469,8 +4464,7 @@ linux_process_target::start_step_over (lwp_info *lwp)
 
   if (lwp->suspended != 0)
     {
-      internal_error (__FILE__, __LINE__,
-		      "LWP %ld suspended=%d\n", lwpid_of (thread),
+      internal_error ("LWP %ld suspended=%d\n", lwpid_of (thread),
 		      lwp->suspended);
     }
 
diff --git a/gdbserver/linux-ppc-ipa.cc b/gdbserver/linux-ppc-ipa.cc
index 892583833dc..362ae0edfd7 100644
--- a/gdbserver/linux-ppc-ipa.cc
+++ b/gdbserver/linux-ppc-ipa.cc
@@ -218,8 +218,7 @@ get_ipa_tdesc (int idx)
       return tdesc_powerpc_e500l;
 #endif
     default:
-      internal_error (__FILE__, __LINE__,
-		     "unknown ipa tdesc index: %d", idx);
+      internal_error ("unknown ipa tdesc index: %d", idx);
 #ifdef __powerpc64__
       return tdesc_powerpc_64l;
 #else
diff --git a/gdbserver/linux-s390-ipa.cc b/gdbserver/linux-s390-ipa.cc
index 500e57baada..3305eead698 100644
--- a/gdbserver/linux-s390-ipa.cc
+++ b/gdbserver/linux-s390-ipa.cc
@@ -372,8 +372,7 @@ get_ipa_tdesc (int idx)
       return tdesc_s390_gs_linux64;
 #endif
     default:
-      internal_error (__FILE__, __LINE__,
-		      "unknown ipa tdesc index: %d", idx);
+      internal_error ("unknown ipa tdesc index: %d", idx);
 #ifdef __s390x__
       return tdesc_s390x_linux64;
 #else
diff --git a/gdbserver/mem-break.cc b/gdbserver/mem-break.cc
index 72ce8c8a5cb..47dace492bb 100644
--- a/gdbserver/mem-break.cc
+++ b/gdbserver/mem-break.cc
@@ -253,8 +253,7 @@ raw_bkpt_type_to_target_hw_bp_type (enum raw_bkpt_type raw_type)
     case raw_bkpt_type_access_wp:
       return hw_access;
     default:
-      internal_error (__FILE__, __LINE__,
-		      "bad raw breakpoint type %d", (int) raw_type);
+      internal_error ("bad raw breakpoint type %d", (int) raw_type);
     }
 }
 
diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 27491efc52d..5cbcea978a0 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -252,7 +252,7 @@ find_regno (const struct target_desc *tdesc, const char *name)
       if (strcmp (name, find_register_by_number (tdesc, i).name) == 0)
 	return i;
     }
-  internal_error (__FILE__, __LINE__, "Unknown register %s requested",
+  internal_error ("Unknown register %s requested",
 		  name);
 }
 
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index db9b2a66f3c..2ddb275bd15 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -296,8 +296,7 @@ remote_prepare (const char *name)
       ((struct sockaddr_in6 *) iter->ai_addr)->sin6_addr = in6addr_any;
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("Invalid 'ai_family' %d\n"), iter->ai_family);
+      internal_error (_("Invalid 'ai_family' %d\n"), iter->ai_family);
     }
 
   if (bind (listen_desc, iter->ai_addr, iter->ai_addrlen) != 0)
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index 18b2b0b3d77..d82b8e2c3ce 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -2921,8 +2921,7 @@ get_jump_space_head (void)
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer,
 				      &gdb_jump_pad_head))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "error extracting jump_pad_buffer");
+	  internal_error ("error extracting jump_pad_buffer");
 	}
     }
 
@@ -2954,15 +2953,13 @@ claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline)
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer,
 				      &trampoline_buffer_tail))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "error extracting trampoline_buffer");
+	  internal_error ("error extracting trampoline_buffer");
 	}
 
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
 				      &trampoline_buffer_head))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "error extracting trampoline_buffer_end");
+	  internal_error ("error extracting trampoline_buffer_end");
 	}
     }
 
@@ -2997,8 +2994,7 @@ have_fast_tracepoint_trampoline_buffer (char *buf)
   if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
 				  &trampoline_end))
     {
-      internal_error (__FILE__, __LINE__,
-		      "error extracting trampoline_buffer_end");
+      internal_error ("error extracting trampoline_buffer_end");
     }
   
   if (buf)
@@ -3008,8 +3004,7 @@ have_fast_tracepoint_trampoline_buffer (char *buf)
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_error,
 				  &errbuf))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "error extracting errbuf");
+	  internal_error ("error extracting errbuf");
 	}
 
       read_inferior_memory (errbuf, (unsigned char *) buf, 100);
@@ -3173,7 +3168,7 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf)
 
     }
   else
-    internal_error (__FILE__, __LINE__, "Unknown tracepoint type");
+    internal_error ("Unknown tracepoint type");
 
   if (tpoint->handle == NULL)
     {
@@ -3362,22 +3357,19 @@ cmd_qtstart (char *packet)
     {
       if (write_inferior_integer (ipa_sym_addrs.addr_tracing, 1))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "Error setting tracing variable in lib");
+	  internal_error ("Error setting tracing variable in lib");
 	}
 
       if (write_inferior_data_pointer (ipa_sym_addrs.addr_stopping_tracepoint,
 				       0))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "Error clearing stopping_tracepoint variable"
+	  internal_error ("Error clearing stopping_tracepoint variable"
 			  " in lib");
 	}
 
       if (write_inferior_integer (ipa_sym_addrs.addr_trace_buffer_is_full, 0))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "Error clearing trace_buffer_is_full variable"
+	  internal_error ("Error clearing trace_buffer_is_full variable"
 			  " in lib");
 	}
 
@@ -3429,8 +3421,7 @@ stop_tracing (void)
     {
       if (write_inferior_integer (ipa_sym_addrs.addr_tracing, 0))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "Error clearing tracing variable in lib");
+	  internal_error ("Error clearing tracing variable in lib");
 	}
     }
 
@@ -5599,27 +5590,23 @@ 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))
     {
-      internal_error (__FILE__, __LINE__,
-		      "error extracting `gdb_jump_pad_buffer'");
+      internal_error ("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))
     {
-      internal_error (__FILE__, __LINE__,
-		      "error extracting `gdb_jump_pad_buffer_end'");
+      internal_error ("error extracting `gdb_jump_pad_buffer_end'");
     }
 
   if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer,
 				  &ipa_gdb_trampoline_buffer))
     {
-      internal_error (__FILE__, __LINE__,
-		      "error extracting `gdb_trampoline_buffer'");
+      internal_error ("error extracting `gdb_trampoline_buffer'");
     }
   if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
 				  &ipa_gdb_trampoline_buffer_end))
     {
-      internal_error (__FILE__, __LINE__,
-		      "error extracting `gdb_trampoline_buffer_end'");
+      internal_error ("error extracting `gdb_trampoline_buffer_end'");
     }
 
   if (ipa_gdb_jump_pad_buffer <= stop_pc
@@ -5978,8 +5965,7 @@ target_malloc (ULONGEST size)
       if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_tp_heap_buffer,
 				      &target_tp_heap))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "couldn't get target heap head pointer");
+	  internal_error ("couldn't get target heap head pointer");
 	}
     }
 
@@ -6205,8 +6191,7 @@ download_tracepoint (struct tracepoint *tpoint)
 				      + offsetof (struct tracepoint, next),
 				      &tp_prev_target_next_addr))
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "error reading `tp_prev->next'");
+	  internal_error ("error reading `tp_prev->next'");
 	}
 
       /* tpoint->next = tp_prev->next */
@@ -6458,8 +6443,7 @@ upload_fast_traceframes (void)
 
       if (ipa_tframe.tpnum == 0)
 	{
-	  internal_error (__FILE__, __LINE__,
-			  "Uploading: No (more) fast traceframes, but"
+	  internal_error ("Uploading: No (more) fast traceframes, but"
 			  " ipa_traceframe_count == %u??\n",
 			  ipa_traceframe_write_count
 			  - ipa_traceframe_read_count);
diff --git a/gdbsupport/btrace-common.cc b/gdbsupport/btrace-common.cc
index ace04133a15..d3f4fa4620b 100644
--- a/gdbsupport/btrace-common.cc
+++ b/gdbsupport/btrace-common.cc
@@ -38,7 +38,7 @@ btrace_format_string (enum btrace_format format)
       return _("Intel Processor Trace");
     }
 
-  internal_error (__FILE__, __LINE__, _("Unknown branch trace format"));
+  internal_error (_("Unknown branch trace format"));
 }
 
 /* See btrace-common.h.  */
@@ -58,7 +58,7 @@ btrace_format_short_string (enum btrace_format format)
       return "pt";
     }
 
-  internal_error (__FILE__, __LINE__, _("Unknown branch trace format"));
+  internal_error (_("Unknown branch trace format"));
 }
 
 /* See btrace-common.h.  */
@@ -82,7 +82,7 @@ btrace_data::fini ()
       return;
     }
 
-  internal_error (__FILE__, __LINE__, _("Unkown branch trace format."));
+  internal_error (_("Unkown branch trace format."));
 }
 
 /* See btrace-common.h.  */
@@ -102,7 +102,7 @@ btrace_data::empty () const
       return (variant.pt.size == 0);
     }
 
-  internal_error (__FILE__, __LINE__, _("Unkown branch trace format."));
+  internal_error (_("Unkown branch trace format."));
 }
 
 /* See btrace-common.h.  */
@@ -187,5 +187,5 @@ btrace_data_append (struct btrace_data *dst,
       return 0;
     }
 
-  internal_error (__FILE__, __LINE__, _("Unkown branch trace format."));
+  internal_error (_("Unkown branch trace format."));
 }
diff --git a/gdbsupport/common-exceptions.cc b/gdbsupport/common-exceptions.cc
index 2d686c4ee65..a9bda756d49 100644
--- a/gdbsupport/common-exceptions.cc
+++ b/gdbsupport/common-exceptions.cc
@@ -74,7 +74,7 @@ exceptions_state_mc (enum catcher_action action)
 	  catchers.front ().state = CATCHER_RUNNING;
 	  return 1;
 	default:
-	  internal_error (__FILE__, __LINE__, _("bad state"));
+	  internal_error (_("bad state"));
 	}
     case CATCHER_RUNNING:
       switch (action)
@@ -90,7 +90,7 @@ exceptions_state_mc (enum catcher_action action)
 	  /* See also throw_exception.  */
 	  return 1;
 	default:
-	  internal_error (__FILE__, __LINE__, _("bad switch"));
+	  internal_error (_("bad switch"));
 	}
     case CATCHER_RUNNING_1:
       switch (action)
@@ -106,7 +106,7 @@ exceptions_state_mc (enum catcher_action action)
 	  /* See also throw_exception.  */
 	  return 1;
 	default:
-	  internal_error (__FILE__, __LINE__, _("bad switch"));
+	  internal_error (_("bad switch"));
 	}
     case CATCHER_ABORTING:
       switch (action)
@@ -119,10 +119,10 @@ exceptions_state_mc (enum catcher_action action)
 	    return 0;
 	  }
 	default:
-	  internal_error (__FILE__, __LINE__, _("bad state"));
+	  internal_error (_("bad state"));
 	}
     default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
+      internal_error (_("bad switch"));
     }
 }
 
diff --git a/gdbsupport/common-utils.cc b/gdbsupport/common-utils.cc
index 2b69e0ba326..3658ffcf93e 100644
--- a/gdbsupport/common-utils.cc
+++ b/gdbsupport/common-utils.cc
@@ -54,7 +54,7 @@ xstrvprintf (const char *format, va_list ap)
      status (the printed length) with a non-NULL buffer should never
      happen, but just to be sure.  */
   if (ret == NULL || status < 0)
-    internal_error (__FILE__, __LINE__, _("vasprintf call failed"));
+    internal_error (_("vasprintf call failed"));
   return gdb::unique_xmalloc_ptr<char> (ret);
 }
 
diff --git a/gdbsupport/errors.cc b/gdbsupport/errors.cc
index b98d0154eb3..7464df3d067 100644
--- a/gdbsupport/errors.cc
+++ b/gdbsupport/errors.cc
@@ -50,7 +50,7 @@ error (const char *fmt, ...)
 /* See gdbsupport/errors.h.  */
 
 void
-internal_error (const char *file, int line, const char *fmt, ...)
+internal_error_loc (const char *file, int line, const char *fmt, ...)
 {
   va_list ap;
 
@@ -62,7 +62,7 @@ internal_error (const char *file, int line, const char *fmt, ...)
 /* See gdbsupport/errors.h.  */
 
 void
-internal_warning (const char *file, int line, const char *fmt, ...)
+internal_warning_loc (const char *file, int line, const char *fmt, ...)
 {
   va_list ap;
 
diff --git a/gdbsupport/errors.h b/gdbsupport/errors.h
index 9a671d3e289..5a925789893 100644
--- a/gdbsupport/errors.h
+++ b/gdbsupport/errors.h
@@ -48,13 +48,18 @@ extern void verror (const char *fmt, va_list args)
    functions do not return.  An error message is constructed using
    a printf- or vprintf-style argument list.  FILE and LINE
    indicate the file and line number where the programming error
-   was detected.  The function "internal_verror" must be provided
+   was detected.  Most client code should call the internal_error
+   wrapper macro instead, which expands the source location
+   automatically.  The function "internal_verror" must be provided
    by the client.  */
 
-extern void internal_error (const char *file, int line,
-			    const char *fmt, ...)
+extern void internal_error_loc (const char *file, int line,
+				const char *fmt, ...)
      ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 4);
 
+#define internal_error(fmt, ...)				\
+  internal_error_loc (__FILE__, __LINE__, fmt, ##__VA_ARGS__)
+
 extern void internal_verror (const char *file, int line,
 			     const char *fmt, va_list args)
      ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 0);
@@ -66,10 +71,13 @@ extern void internal_verror (const char *file, int line,
    argument list.  The function "internal_vwarning" must be provided
    by the client.  */
 
-extern void internal_warning (const char *file, int line,
-			      const char *fmt, ...)
+extern void internal_warning_loc (const char *file, int line,
+				  const char *fmt, ...)
      ATTRIBUTE_PRINTF (3, 4);
 
+#define internal_warning(fmt, ...)				\
+  internal_warning_loc (__FILE__, __LINE__, fmt, ##__VA_ARGS__)
+
 extern void internal_vwarning (const char *file, int line,
 			       const char *fmt, va_list args)
      ATTRIBUTE_PRINTF (3, 0);
diff --git a/gdbsupport/event-loop.cc b/gdbsupport/event-loop.cc
index 941885529f1..b1a5c1ad439 100644
--- a/gdbsupport/event-loop.cc
+++ b/gdbsupport/event-loop.cc
@@ -221,8 +221,7 @@ gdb_do_one_event (int mstimeout)
 	  res = check_async_event_handlers ();
 	  break;
 	default:
-	  internal_error (__FILE__, __LINE__,
-			  "unexpected event_source_head %d",
+	  internal_error ("unexpected event_source_head %d",
 			  event_source_head);
 	}
 
diff --git a/gdbsupport/gdb_assert.h b/gdbsupport/gdb_assert.h
index 074d2e717fc..e1444d5f53b 100644
--- a/gdbsupport/gdb_assert.h
+++ b/gdbsupport/gdb_assert.h
@@ -38,14 +38,14 @@
 /* This prints an "Assertion failed" message, asking the user if they
    want to continue, dump core, or just exit.  */
 #define gdb_assert_fail(assertion, file, line, function)                      \
-  internal_error (file, line, _("%s: Assertion `%s' failed."),                \
-		  function, assertion)
+  internal_error_loc (file, line, _("%s: Assertion `%s' failed."),                \
+		      function, assertion)
 
 /* The canonical form of gdb_assert (0).
    MESSAGE is a string to include in the error message.  */
 
 #define gdb_assert_not_reached(message, ...) \
-  internal_error (__FILE__, __LINE__, _("%s: " message), __func__, \
-		  ##__VA_ARGS__)
+  internal_error_loc (__FILE__, __LINE__, _("%s: " message), __func__, \
+		      ##__VA_ARGS__)
 
 #endif /* COMMON_GDB_ASSERT_H */
diff --git a/gdbsupport/print-utils.cc b/gdbsupport/print-utils.cc
index 7bbb6deea74..a1b245e9bda 100644
--- a/gdbsupport/print-utils.cc
+++ b/gdbsupport/print-utils.cc
@@ -73,8 +73,7 @@ decimal2str (const char *sign, ULONGEST addr, int width)
 		 temp[2], temp[1], temp[0]);
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("failed internal consistency check"));
+      internal_error (_("failed internal consistency check"));
     }
 
   return str;
@@ -116,8 +115,7 @@ octal2str (ULONGEST addr, int width)
 		 temp[2], temp[1], temp[0]);
       break;
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("failed internal consistency check"));
+      internal_error (_("failed internal consistency check"));
     }
 
   return str;
@@ -246,7 +244,7 @@ hex_string_custom (LONGEST num, int width)
   if (hex_len > width)
     width = hex_len;
   if (width + 2 >= PRINT_CELL_SIZE)
-    internal_error (__FILE__, __LINE__, _("\
+    internal_error (_("\
 hex_string_custom: insufficient space to store result"));
 
   strcpy (result_end - width - 2, "0x");
@@ -296,8 +294,7 @@ int_string (LONGEST val, int radix, int is_signed, int width,
 	  return result + 1;
       }
     default:
-      internal_error (__FILE__, __LINE__,
-		      _("failed internal consistency check"));
+      internal_error (_("failed internal consistency check"));
     }
 }
 

base-commit: 39e9d8670cea9d3d2959387b6d51050b0716eb19
-- 
2.36.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-17 18:50 [PATCH] internal_error: remove need to pass __FILE__/__LINE__ Pedro Alves
@ 2022-10-17 18:59 ` Simon Marchi
  2022-10-17 19:26   ` Pedro Alves
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Marchi @ 2022-10-17 18:59 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches



On 2022-10-17 14:50, Pedro Alves wrote:
> Currently, every internal_error call must be passed __FILE__/__LINE__
> explicitly, like:
> 
>   internal_error (__FILE__, __LINE__, "foo %d", var);
> 
> The need to pass in explicit __FILE__/__LINE__ is there probably
> because the function predates widespread and portable variadic macros
> availability.  We can use variadic macros nowadays, and in fact, we
> already use them in several places, including the related
> gdb_assert_not_reached.
> 
> So this patch renames the internal_error function to something else,
> and then reimplements internal_error as a variadic macro that expands
> __FILE__/__LINE__ itself.
> 
> The result is that we now should call internal_error like so:
> 
>   internal_error ("foo %d", var);
> 
> Likewise for internal_warning.
> 
> The patch adjusts all calls sites.  99% of the adjustments were done
> with a perl/sed script.
> 
> The non-mechanical changes are in gdbsupport/errors.h,
> gdbsupport/gdb_assert.h, and gdb/gdbarch.py.

I think it's a good change, but as a result gdb_assert_not_reached and
internal_error become essentially the same thing.  Can we just keep one?
The only difference is that gdb_assert_not_reached includes the
function name, but I don't think it's an important difference.  I think
we could switch to a single one that does include the function name.

Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-17 18:59 ` Simon Marchi
@ 2022-10-17 19:26   ` Pedro Alves
  2022-10-17 19:27     ` Simon Marchi
  0 siblings, 1 reply; 11+ messages in thread
From: Pedro Alves @ 2022-10-17 19:26 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 2022-10-17 7:59 p.m., Simon Marchi wrote:
> 
> 
> On 2022-10-17 14:50, Pedro Alves wrote:
>> Currently, every internal_error call must be passed __FILE__/__LINE__
>> explicitly, like:
>>
>>   internal_error (__FILE__, __LINE__, "foo %d", var);
>>
>> The need to pass in explicit __FILE__/__LINE__ is there probably
>> because the function predates widespread and portable variadic macros
>> availability.  We can use variadic macros nowadays, and in fact, we
>> already use them in several places, including the related
>> gdb_assert_not_reached.
>>
>> So this patch renames the internal_error function to something else,
>> and then reimplements internal_error as a variadic macro that expands
>> __FILE__/__LINE__ itself.
>>
>> The result is that we now should call internal_error like so:
>>
>>   internal_error ("foo %d", var);
>>
>> Likewise for internal_warning.
>>
>> The patch adjusts all calls sites.  99% of the adjustments were done
>> with a perl/sed script.
>>
>> The non-mechanical changes are in gdbsupport/errors.h,
>> gdbsupport/gdb_assert.h, and gdb/gdbarch.py.
> 
> I think it's a good change, but as a result gdb_assert_not_reached and
> internal_error become essentially the same thing.  Can we just keep one?

Most probably.  I prefer keeping internal_error for it being more pervasive
and older.  gdb_assert_not_reached is a more recent addition.

> The only difference is that gdb_assert_not_reached includes the
> function name, but I don't think it's an important difference.  I think
> we could switch to a single one that does include the function name.

I don't think it needs to be in this patch, though?

This one is just making internal_error more convenient to call.  We can
always look at doing something to its internals separately.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-17 19:26   ` Pedro Alves
@ 2022-10-17 19:27     ` Simon Marchi
  2022-10-17 19:37       ` Pedro Alves
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Marchi @ 2022-10-17 19:27 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches



On 2022-10-17 15:26, Pedro Alves wrote:
> On 2022-10-17 7:59 p.m., Simon Marchi wrote:
>>
>>
>> On 2022-10-17 14:50, Pedro Alves wrote:
>>> Currently, every internal_error call must be passed __FILE__/__LINE__
>>> explicitly, like:
>>>
>>>   internal_error (__FILE__, __LINE__, "foo %d", var);
>>>
>>> The need to pass in explicit __FILE__/__LINE__ is there probably
>>> because the function predates widespread and portable variadic macros
>>> availability.  We can use variadic macros nowadays, and in fact, we
>>> already use them in several places, including the related
>>> gdb_assert_not_reached.
>>>
>>> So this patch renames the internal_error function to something else,
>>> and then reimplements internal_error as a variadic macro that expands
>>> __FILE__/__LINE__ itself.
>>>
>>> The result is that we now should call internal_error like so:
>>>
>>>   internal_error ("foo %d", var);
>>>
>>> Likewise for internal_warning.
>>>
>>> The patch adjusts all calls sites.  99% of the adjustments were done
>>> with a perl/sed script.
>>>
>>> The non-mechanical changes are in gdbsupport/errors.h,
>>> gdbsupport/gdb_assert.h, and gdb/gdbarch.py.
>>
>> I think it's a good change, but as a result gdb_assert_not_reached and
>> internal_error become essentially the same thing.  Can we just keep one?
> 
> Most probably.  I prefer keeping internal_error for it being more pervasive
> and older.  gdb_assert_not_reached is a more recent addition.

Fine with me.

>> The only difference is that gdb_assert_not_reached includes the
>> function name, but I don't think it's an important difference.  I think
>> we could switch to a single one that does include the function name.
> 
> I don't think it needs to be in this patch, though?
> 
> This one is just making internal_error more convenient to call.  We can
> always look at doing something to its internals separately.

Sure, it's just an idea for eventually.

Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-17 19:27     ` Simon Marchi
@ 2022-10-17 19:37       ` Pedro Alves
  2022-10-17 19:45         ` Simon Marchi
  0 siblings, 1 reply; 11+ messages in thread
From: Pedro Alves @ 2022-10-17 19:37 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 2022-10-17 8:27 p.m., Simon Marchi wrote:

>> Most probably.  I prefer keeping internal_error for it being more pervasive
>> and older.  gdb_assert_not_reached is a more recent addition.
> 
> Fine with me.
> 
>>> The only difference is that gdb_assert_not_reached includes the
>>> function name, but I don't think it's an important difference.  I think
>>> we could switch to a single one that does include the function name.
>>
>> I don't think it needs to be in this patch, though?
>>
>> This one is just making internal_error more convenient to call.  We can
>> always look at doing something to its internals separately.
> 
> Sure, it's just an idea for eventually.

Cool, thanks.  

I guess I am not sure whether your earlier comment meant that you're OK
with the patch itself (rather than the idea), though.  :-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-17 19:37       ` Pedro Alves
@ 2022-10-17 19:45         ` Simon Marchi
  2022-10-18 11:15           ` Pedro Alves
  2022-10-18 12:34           ` Bruno Larsen
  0 siblings, 2 replies; 11+ messages in thread
From: Simon Marchi @ 2022-10-17 19:45 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches



On 2022-10-17 15:37, Pedro Alves wrote:
> On 2022-10-17 8:27 p.m., Simon Marchi wrote:
> 
>>> Most probably.  I prefer keeping internal_error for it being more pervasive
>>> and older.  gdb_assert_not_reached is a more recent addition.
>>
>> Fine with me.
>>
>>>> The only difference is that gdb_assert_not_reached includes the
>>>> function name, but I don't think it's an important difference.  I think
>>>> we could switch to a single one that does include the function name.
>>>
>>> I don't think it needs to be in this patch, though?
>>>
>>> This one is just making internal_error more convenient to call.  We can
>>> always look at doing something to its internals separately.
>>
>> Sure, it's just an idea for eventually.
> 
> Cool, thanks.  
> 
> I guess I am not sure whether your earlier comment meant that you're OK
> with the patch itself (rather than the idea), though.  :-)

Heh, I forgot to look at the code.  It all looks good, except black
reformats gdbarch.py for me here.  With that fixed you can add my
Reviewed-By or Approved-By (not sure which one we use when someone who
can approve a patch reviews the patch of someone else who can approve).

Another though for later: like gdb_assert_not_reached, we could move the
gettext translation call, `_(...)`, into the internal_error macro.  That
would make the callers a bit simpler (although IMO these strings don't
really need translation, since they are meant for GDB developers).

Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-17 19:45         ` Simon Marchi
@ 2022-10-18 11:15           ` Pedro Alves
  2022-10-18 14:53             ` Simon Marchi
  2022-10-18 12:34           ` Bruno Larsen
  1 sibling, 1 reply; 11+ messages in thread
From: Pedro Alves @ 2022-10-18 11:15 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches



On 2022-10-17 8:45 p.m., Simon Marchi wrote:
> 
> 
> On 2022-10-17 15:37, Pedro Alves wrote:
>> On 2022-10-17 8:27 p.m., Simon Marchi wrote:
>>
>>>> Most probably.  I prefer keeping internal_error for it being more pervasive
>>>> and older.  gdb_assert_not_reached is a more recent addition.
>>>
>>> Fine with me.
>>>
>>>>> The only difference is that gdb_assert_not_reached includes the
>>>>> function name, but I don't think it's an important difference.  I think
>>>>> we could switch to a single one that does include the function name.
>>>>
>>>> I don't think it needs to be in this patch, though?
>>>>
>>>> This one is just making internal_error more convenient to call.  We can
>>>> always look at doing something to its internals separately.
>>>
>>> Sure, it's just an idea for eventually.
>>
>> Cool, thanks.  
>>
>> I guess I am not sure whether your earlier comment meant that you're OK
>> with the patch itself (rather than the idea), though.  :-)
> 
> Heh, I forgot to look at the code.  It all looks good, except black
> reformats gdbarch.py for me here.  

Thanks.  Ran black locally now.

> With that fixed you can add my
> Reviewed-By or Approved-By (not sure which one we use when someone who
> can approve a patch reviews the patch of someone else who can approve).

I'll just go with Approved-By.  However, I don't know which of 3 email addresses
you've been using would you like to be put in the tags.  :-)  I guess the one
listed in gdb/MAINTAINERS should be canonical?

Pedro Alves

> 
> Another though for later: like gdb_assert_not_reached, we could move the
> gettext translation call, `_(...)`, into the internal_error macro.  That
> would make the callers a bit simpler (although IMO these strings don't
> really need translation, since they are meant for GDB developers).
> 
> Simon
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-17 19:45         ` Simon Marchi
  2022-10-18 11:15           ` Pedro Alves
@ 2022-10-18 12:34           ` Bruno Larsen
  2022-10-18 14:55             ` Simon Marchi
  1 sibling, 1 reply; 11+ messages in thread
From: Bruno Larsen @ 2022-10-18 12:34 UTC (permalink / raw)
  To: Simon Marchi, Pedro Alves, gdb-patches


On 17/10/2022 21:45, Simon Marchi via Gdb-patches wrote:
> Heh, I forgot to look at the code.  It all looks good, except black
> reformats gdbarch.py for me here.  With that fixed you can add my
> Reviewed-By or Approved-By (not sure which one we use when someone who
> can approve a patch reviews the patch of someone else who can approve).

I would suggest Pedro use the Approved-by tag. Preferably the approver 
of the patch should be different to the submitter.

My thought process for someone who can approve using a reviewed-by tag 
is if you don't know enough for the area of code but you did look at the 
patch and saw nothing wrong with it. About the same situation when you'd 
say "this patch looks good to me but I'd defer to XXX, who knows this 
better" before we started using tags.

Cheers,
Bruno


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-18 11:15           ` Pedro Alves
@ 2022-10-18 14:53             ` Simon Marchi
  2022-10-19 14:47               ` Pedro Alves
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Marchi @ 2022-10-18 14:53 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

> I'll just go with Approved-By.  However, I don't know which of 3 email addresses
> you've been using would you like to be put in the tags.  :-)  I guess the one
> listed in gdb/MAINTAINERS should be canonical?

Haha, good question.  Given that most of my time spent working on GDB is
for work, and not on my own time anymore, it should probably be my work
address, so go with the @efficios.com one.  I'll update MAINTAINERS to
reflect that.

Simon


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-18 12:34           ` Bruno Larsen
@ 2022-10-18 14:55             ` Simon Marchi
  0 siblings, 0 replies; 11+ messages in thread
From: Simon Marchi @ 2022-10-18 14:55 UTC (permalink / raw)
  To: Bruno Larsen, Pedro Alves, gdb-patches

On 10/18/22 08:34, Bruno Larsen via Gdb-patches wrote:
> 
> On 17/10/2022 21:45, Simon Marchi via Gdb-patches wrote:
>> Heh, I forgot to look at the code.  It all looks good, except black
>> reformats gdbarch.py for me here.  With that fixed you can add my
>> Reviewed-By or Approved-By (not sure which one we use when someone who
>> can approve a patch reviews the patch of someone else who can approve).
> 
> I would suggest Pedro use the Approved-by tag. Preferably the approver of the patch should be different to the submitter.
> 
> My thought process for someone who can approve using a reviewed-by tag is if you don't know enough for the area of code but you did look at the patch and saw nothing wrong with it. About the same situation when you'd say "this patch looks good to me but I'd defer to XXX, who knows this better" before we started using tags.

Thanks, that makes sense.

In the case of reviewing Pedro's patches, we would need a tag to say "It
looks good, I don't think I understand it all, but given that Pedro
wrote the patch, it's most likely correct" :).

Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] internal_error: remove need to pass __FILE__/__LINE__
  2022-10-18 14:53             ` Simon Marchi
@ 2022-10-19 14:47               ` Pedro Alves
  0 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2022-10-19 14:47 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 2022-10-18 3:53 p.m., Simon Marchi wrote:
>> I'll just go with Approved-By.  However, I don't know which of 3 email addresses
>> you've been using would you like to be put in the tags.  :-)  I guess the one
>> listed in gdb/MAINTAINERS should be canonical?
> 
> Haha, good question.  Given that most of my time spent working on GDB is
> for work, and not on my own time anymore, it should probably be my work
> address, so go with the @efficios.com one.  I'll update MAINTAINERS to
> reflect that.

Done, and pushed.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-10-19 14:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 18:50 [PATCH] internal_error: remove need to pass __FILE__/__LINE__ Pedro Alves
2022-10-17 18:59 ` Simon Marchi
2022-10-17 19:26   ` Pedro Alves
2022-10-17 19:27     ` Simon Marchi
2022-10-17 19:37       ` Pedro Alves
2022-10-17 19:45         ` Simon Marchi
2022-10-18 11:15           ` Pedro Alves
2022-10-18 14:53             ` Simon Marchi
2022-10-19 14:47               ` Pedro Alves
2022-10-18 12:34           ` Bruno Larsen
2022-10-18 14:55             ` Simon Marchi

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).