]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix create_breakpoint_parse_arg_string self-test
authorTom Tromey <tromey@adacore.com>
Mon, 12 May 2025 17:30:33 +0000 (11:30 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 14 May 2025 15:18:01 +0000 (09:18 -0600)
The emoji patch broke the create_breakpoint_parse_arg_string self-test
when gdb is running on a suitable terminal.  The problem is that the
test case doesn't take the error prefix string into account.

This patch fixes the test by having it compare the exception message
directly, rather than relying on the result of exception_print.  I did
try a different approach, of having the test mimic exception_print,
but this one seemed cleaner to me.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/break-cond-parse.c

index 705f4f64c0546a88f14b824f0ad0639cd31cbf0e..caf13a79ee7260d239876feb6e2889606a1bed7b 100644 (file)
@@ -569,10 +569,10 @@ test (const char *input, const char *condition, int thread = -1,
   gdb::unique_xmalloc_ptr<char> extracted_rest;
   int extracted_thread, extracted_inferior, extracted_task;
   bool extracted_force_condition;
-  std::string exception_msg, error_str;
+  std::string exception_msg;
 
-  if (error_msg != nullptr)
-    error_str = std::string (error_msg) + "\n";
+  if (error_msg == nullptr)
+    error_msg = "";
 
   try
     {
@@ -584,10 +584,7 @@ test (const char *input, const char *condition, int thread = -1,
     }
   catch (const gdb_exception_error &ex)
     {
-      string_file buf;
-
-      exception_print (&buf, ex);
-      exception_msg = buf.release ();
+      exception_msg = ex.what ();
     }
 
   if ((condition == nullptr) != (extracted_condition.get () == nullptr)
@@ -599,7 +596,7 @@ test (const char *input, const char *condition, int thread = -1,
       || inferior != extracted_inferior
       || task != extracted_task
       || force != extracted_force_condition
-      || exception_msg != error_str)
+      || exception_msg != error_msg)
     {
       if (run_verbose ())
        {