diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ddb8f8b36fe..b752e6d4f07 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-28  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* lib/gdb.exp (default_gdb_init): Unset XDG_CONFIG_HOME.
+
 2021-01-28  Tom de Vries  <tdevries@suse.de>
 
 	* gdb.ada/out_of_line_in_inlined.exp: Use gdb_breakpoint.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2a952c6146f..53ac9f1408c 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5241,6 +5241,13 @@ proc default_gdb_init { test_file_name } {
     unset -nocomplain ::env(GDBHISTFILE)
     unset -nocomplain ::env(GDBHISTSIZE)
 
+    # Ensure that XDG_CONFIG_HOME is not set.  Some tests setup a fake
+    # home directory in order to test loading settings from gdbinit.
+    # If XDG_CONFIG_HOME is set then GDB will load a gdbinit from
+    # there (if one is present) rather than the home directory setup
+    # in the test.
+    unset -nocomplain ::env(XDG_CONFIG_HOME)
+
     # Initialize GDB's pty with a fixed size, to make sure we avoid pagination
     # during startup.  See "man expect" for details about stty_init.
     global stty_init