]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: fix gdb.mi/mi-catch-cpp-exceptions.exp with clang
authorGuinevere Larsen <blarsen@redhat.com>
Tue, 23 Jul 2024 16:56:17 +0000 (13:56 -0300)
committerGuinevere Larsen <blarsen@redhat.com>
Tue, 17 Sep 2024 20:18:36 +0000 (17:18 -0300)
Clang adds line table information for a try/catch block differently to
gcc. Instead of linking the instructions related to __cxa_begin_catch to
the line containing the "catch" statement in the source code, it links
to the closing brace of the try block.

This was causing gdb.mi/mi-catch-cpp-exceptions.exp to fail when tested
with clang. The test was updated to have the catch in the same line as
the closing brace so it passes with no additional modifications with
clang.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc

index be1f50fad7fa68d63f084142b5a95b733e574951..d41b55d27f649c92fcc7b9dcb38892d795525223 100644 (file)
@@ -43,8 +43,7 @@ foo ()
       try
        {
          bar ();
-       }
-      catch (const my_exception &ex)   /* Catch 1.  */
+       } catch (const my_exception &ex)        /* Catch 1.  */
        {
          if (i == 1)
            throw;      /* Throw 2.  */
@@ -60,8 +59,7 @@ main ()
       try
        {
          foo ();
-       }
-      catch (const my_exception &ex)   /* Catch 2.  */
+       } catch (const my_exception &ex)        /* Catch 2.  */
        {
          if (i == 1)
            return 1;   /* Stop here.  */