From: Guinevere Larsen Date: Tue, 23 Jul 2024 16:56:17 +0000 (-0300) Subject: gdb/testsuite: fix gdb.mi/mi-catch-cpp-exceptions.exp with clang X-Git-Tag: gdb-16-branchpoint~889 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd26cd1810ce4296b228cd31d137a0b54e40c189;p=thirdparty%2Fbinutils-gdb.git gdb/testsuite: fix gdb.mi/mi-catch-cpp-exceptions.exp with clang 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 --- diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc index be1f50fad7f..d41b55d27f6 100644 --- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc +++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc @@ -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. */