[00/11,gdb/testsuite] Refactor exception handling

Message ID 20260824135855.1195963-1-tdevries@suse.de
Headers
Series Refactor exception handling |

Message

Tom de Vries Aug. 24, 2026, 1:58 p.m. UTC
  This patch series does two things:
- use modern exception handling constructs like try/finally and
  "return -options" (PR34552).
- fix bug in "return -level 2" handling (PR34553).

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34552
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34553

Tom de Vries (11):
  [gdb/testsuite] Normalize indentation in with_test_prefix
  [gdb/testsuite] Fix return -level 2 bug in with_test_prefix
  [gdb/testsuite] Simplify foreach_with_prefix
  [gdb/testsuite] Refactor exception handling in foreach_with_prefix
  [gdb/testsuite] Add transparent_uplevel
  [gdb/testsuite] Refactor exception handling
  [gdb/testsuite] Refactor exception handling in gdb_expect
  [gdb/testsuite] Refactor exception handling in gdb_test_multiple
  [gdb/testsuite] Refactor exception handling in
    lock_file_acquire/release
  [gdb/testsuite] Refactor exception handling in tentative_rename
  [gdb/testsuite] Refactor exception handling in with_stub_devices

 gdb/testsuite/gdb.rocm/hcc-amdgpu-targets.exp |  15 +-
 .../gdb.testsuite/foreach_with_prefix.exp     |  27 ++
 gdb/testsuite/gdb.testsuite/gdb-test.exp      |  51 ++
 .../gdb.testsuite/with-test-prefix.exp        |  45 ++
 gdb/testsuite/lib/ada.exp                     |  14 +-
 gdb/testsuite/lib/dwarf.exp                   |  15 +-
 gdb/testsuite/lib/gdb-utils.exp               |  45 +-
 gdb/testsuite/lib/gdb.exp                     | 449 ++++++++----------
 gdb/testsuite/lib/mi-support.exp              |  22 +-
 gdb/testsuite/lib/tuiterm.exp                 |  15 +-
 10 files changed, 383 insertions(+), 315 deletions(-)
 create mode 100644 gdb/testsuite/gdb.testsuite/with-test-prefix.exp


base-commit: 7063b767cc9c2774e7ead41144e5613bacad6a0d
  

Comments

Keith Seitz Sept. 1, 2026, 5:07 p.m. UTC | #1
Hi,

On 8/24/26 6:58 AM, Tom de Vries wrote:
> This patch series does two things:
> - use modern exception handling constructs like try/finally and
>    "return -options" (PR34552).
> - fix bug in "return -level 2" handling (PR34553).

Thank you for simplifying this exception handling. I've sent
a few little nits, but otherwise, this LGTM.

Reviewed-By: Keith Seitz <keiths@redhat.com>

Keith

> 
> Tested on x86_64-linux.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34552
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34553
> 
> Tom de Vries (11):
>    [gdb/testsuite] Normalize indentation in with_test_prefix
>    [gdb/testsuite] Fix return -level 2 bug in with_test_prefix
>    [gdb/testsuite] Simplify foreach_with_prefix
>    [gdb/testsuite] Refactor exception handling in foreach_with_prefix
>    [gdb/testsuite] Add transparent_uplevel
>    [gdb/testsuite] Refactor exception handling
>    [gdb/testsuite] Refactor exception handling in gdb_expect
>    [gdb/testsuite] Refactor exception handling in gdb_test_multiple
>    [gdb/testsuite] Refactor exception handling in
>      lock_file_acquire/release
>    [gdb/testsuite] Refactor exception handling in tentative_rename
>    [gdb/testsuite] Refactor exception handling in with_stub_devices
> 
>   gdb/testsuite/gdb.rocm/hcc-amdgpu-targets.exp |  15 +-
>   .../gdb.testsuite/foreach_with_prefix.exp     |  27 ++
>   gdb/testsuite/gdb.testsuite/gdb-test.exp      |  51 ++
>   .../gdb.testsuite/with-test-prefix.exp        |  45 ++
>   gdb/testsuite/lib/ada.exp                     |  14 +-
>   gdb/testsuite/lib/dwarf.exp                   |  15 +-
>   gdb/testsuite/lib/gdb-utils.exp               |  45 +-
>   gdb/testsuite/lib/gdb.exp                     | 449 ++++++++----------
>   gdb/testsuite/lib/mi-support.exp              |  22 +-
>   gdb/testsuite/lib/tuiterm.exp                 |  15 +-
>   10 files changed, 383 insertions(+), 315 deletions(-)
>   create mode 100644 gdb/testsuite/gdb.testsuite/with-test-prefix.exp
> 
> 
> base-commit: 7063b767cc9c2774e7ead41144e5613bacad6a0d
  
Tom Tromey Sept. 2, 2026, 7:57 p.m. UTC | #2
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> Thank you for simplifying this exception handling. I've sent
Keith> a few little nits, but otherwise, this LGTM.

Keith> Reviewed-By: Keith Seitz <keiths@redhat.com>

Thanks for doing that.

I appreciate this series quite a bit.  I don't really get why Tcl came
up with such a convoluted approach to what seems like a pretty normal
thing to want to do; but oh well... anyway aside from the questions I
sent and Keith's comments, I think it all looks good.

Tom
  
Tom de Vries Sept. 24, 2026, 4:08 p.m. UTC | #3
On 9/2/26 9:57 PM, Tom Tromey wrote:
>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
> 
> Keith> Thank you for simplifying this exception handling. I've sent
> Keith> a few little nits, but otherwise, this LGTM.
> 
> Keith> Reviewed-By: Keith Seitz <keiths@redhat.com>
> 
> Thanks for doing that.
> 
> I appreciate this series quite a bit.  I don't really get why Tcl came
> up with such a convoluted approach to what seems like a pretty normal
> thing to want to do; but oh well... anyway aside from the questions I
> sent and Keith's comments, I think it all looks good.

Thanks both for the reviews, much appreciated.

I've pushed all patches now, with the exception of "[PATCH 02/11] 
[gdb/testsuite] Fix return -level 2 bug in with_test_prefix".

The code in this patch got merged into another patch, and the test-case 
was not all that useful.  The new test-case 
gdb.testsuite/transparent-uplevel.exp covers the tested functionality 
much better.

Thanks,
- Tom