--- /dev/null
+/* Copyright 2022-2023 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int
+foo ()
+{
+  return 0;    /* Breakpoint here.  */
+}
+
+int
+main ()
+{
+  int res = foo ();
+
+  return res;
+}
 
--- /dev/null
+# Copyright 2022-2023 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check the format of the error message given when a breakpoint
+# condition fails.
+#
+# In this case the breakpoint condition does not make use of inferior
+# function calls, instead, the expression used for the breakpoint
+# condition will throw an error when evaluated.
+#
+# We check that the correct breakpoint number appears in the error
+# message, and that the error is reported at the correct source
+# location.
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${binfile} "${srcfile}" \
+         {debug}] == -1 } {
+    return
+}
+
+# Run to main so that we connect to the target if using 'target
+# remote'.  This means that the is_address_zero_readable, and the
+# 'show breakpoint condition-evaluation' checks below will be
+# performed with the remote connection in place.
+if { ![runto_main] } {
+    return -1
+}
+
+# This test relies on reading address zero triggering a SIGSEGV.
+if { [is_address_zero_readable] } {
+    return
+}
+
+# Where the breakpoint will be placed.
+set bp_line [gdb_get_line_number "Breakpoint here"]
+
+proc run_test { cond_eval } {
+    clean_restart ${::binfile}
+
+    if { ![runto_main] } {
+       return -1
+    }
+
+    if { $cond_eval ne "auto" } {
+       gdb_test_no_output "set breakpoint condition-evaluation ${cond_eval}"
+    }
+
+    # Setup the conditional breakpoint and record its number.
+    gdb_breakpoint "${::srcfile}:${::bp_line} if (*(int *) 0) == 0"
+    set bp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*"]
+
+    gdb_test "continue" \
+       [multi_line \
+            "Continuing\\." \
+            "Error in testing condition for breakpoint ${bp_num}:" \
+            "Cannot access memory at address 0x0" \
+            "" \
+            "Breakpoint ${bp_num}, foo \\(\\) at \[^\r\n\]+:${::bp_line}" \
+            "${::decimal}\\s+\[^\r\n\]+Breakpoint here\[^\r\n\]+"]
+}
+
+# If we're using a remote target then conditions could be evaulated
+# locally on the host, or on the remote target.  Otherwise, conditions
+# are always evaluated locally.
+#
+# Using "auto" will select the target if the target supports condition
+# evaluation, otherwise, the local host will be used.
+#
+# So, we always include "auto", but then we look at the output of
+# 'show breakpoint condition-evaluation', if this tells us that "auto"
+# is using the target, then we specifically add "host" to the list of
+# modes to check.
+
+set cond_eval_modes { "auto" }
+
+gdb_test_multiple "show breakpoint condition-evaluation" "" {
+    -re -wrap "Breakpoint condition evaluation mode is auto \\(currently target\\)\\." {
+
+       ## NOTE: Instead of testing with "auto" and "host" in this
+       ## case we only test with "host".  This is because a GDB bug
+       ## prevents the "auto" (a.k.a. target) mode from working.
+       ##
+       ## Don't worry, this will be fixed in a later commit, and this
+       ## comment will be removed at that time.
+       ##
+       ## lappend cond_eval_modes "host"
+
+       set cond_eval_modes { "host" }
+       pass $gdb_test_name
+    }
+
+    -re -wrap "Breakpoint condition evaluation mode is auto \\(currently host\\)\\." {
+       pass $gdb_test_name
+    }
+}
+
+foreach_with_prefix cond_eval $cond_eval_modes {
+    run_test $cond_eval
+}