| Message ID | 20251221170657.227525-1-ssbssa@yahoo.de |
|---|---|
| State | New |
| Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id A91204BA2E05 for <patchwork@sourceware.org>; Sun, 21 Dec 2025 17:07:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A91204BA2E05 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=yahoo.de header.i=@yahoo.de header.a=rsa-sha256 header.s=s2048 header.b=SNFAhvUq X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from sonic313-21.consmr.mail.ir2.yahoo.com (sonic313-21.consmr.mail.ir2.yahoo.com [77.238.179.188]) by sourceware.org (Postfix) with ESMTPS id 0FE6E4BA2E22 for <gdb-patches@sourceware.org>; Sun, 21 Dec 2025 17:07:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FE6E4BA2E22 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=yahoo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0FE6E4BA2E22 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=77.238.179.188 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766336839; cv=none; b=X4RbfGa3MfYW2mY6NpYHzbiECHVUI6I0UUl5AUenwYCJZW06jz+q2U57L7vnm6CEtknaMLRjnzLdr4DqVe42A1tB+Q0Y1QHGD69luCoXg1roly873LHH4Znwo05Gzt5ZX27s6HP5HmvvG7XyEJkQkNGQi36fJwaTkTNB/DNW0+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766336839; c=relaxed/simple; bh=l4V9GCqOaeo1f9ibCsLO16Z9SIqqCZ/lL5vCPe2mdJM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Nojd4IleD/UDcfhC5W1GU+76mKX5fq3dfjG8muTA5bOdKXYD6wqV1aDF8IFuipDcVe/SuxeRqrF1X69gMZl0wX/kcJCY80DbFEKpDPLhr2V8InSl708meI3VOf89PK/yaVu9Ool06sXomJnYi3RL0nlwxcjyio+wNva9MjKGyKw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0FE6E4BA2E22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1766336837; bh=GM4z36OfmUqwO7YbB6HJ1AYx11yGjZKWyTJHz6264/8=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=SNFAhvUqRs9kyyG9N8URqXf3PSUVNBXZwA8huUgTdLoTZAXlLYp0utSrXPYbZ1iGyXE0yLM45Zw3I5r41fepE3T6mOuYkrb4bE4UUaBTDggnKFvobwmsU37iE8/BXMcm2aq38+AHeTg7uYatzAvHBoq5IJ2KiGQH2Z7Y8EZELrJhe1NTK1+8IQt4u0OpmtoV2HcmFlHWoE8y/CCCLGJG3dqqosBczJtG7Hl1Q8U4p2OLvY0IDCgOY1sBPg/JJP2j8Q8yNmTnvj0NlxyhbdOkSDn4ZbN4SoClix8EFx0t7rtqONpLeOF04vYs9vCUgRdyjDGKkdVGayHJzgWW6jHTRw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1766336837; bh=fVPZCDV/lul/7l5od4Qi2vRpEOab4wolQVR7Qb99Abc=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=kOE4pBEfTXVj4iWSdQd/rs4Irh2bLUOc67MEQkuRxyVpPQDP8+c+fPukWlQJ/4usLbODeCkuK7gJyVAtzwDdUf+PGGXr168zTMoe1dEzjBhNcPGVLWP8jZkTDr5EYqkNpT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BHHNotvv7OcnYDSbGPUelxfe fULqQVWQGjvYZeGrzIyemt16fNy7KhWQ5a5oxBHcMzfA1b5nTKuNUFyhbkuY9BIJh6UBFtJ3Y1lM jwneyCQrK7yM_mRni2dgfV0JVUUu6KBMaNy9qGobLz7JBXcgZAJm05917GYQ2se4PQ4BQPlFGH64 VyTHyFAYTlhVBSwIQo5KImGH9Sh28dN3e957QVVw_sooQZjHQHnz6k5BhouH5vggv5uCktqRpPu. GSD.JOiIgM21dQu7m1sapD3KGrR7ZVF.MYo5sQUfjfFBAH1sq4QolQtIXdYrPCzUhTd7KrSUDInu w0yMPyKeK12RJkn7uieF2.ahyxkO0wMw- X-Sonic-MF: <ssbssa@yahoo.de> X-Sonic-ID: 61196532-a85b-4bd4-b011-091bd8e7a55a Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Sun, 21 Dec 2025 17:07:17 +0000 Received: by hermes--production-ir2-7679c5bc-jd2qw (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 2d7d71fe6b16cbf5317d110125030931; Sun, 21 Dec 2025 17:07:13 +0000 (UTC) From: Hannes Domani <ssbssa@yahoo.de> To: gdb-patches@sourceware.org Subject: [PATCH] Fix crash when breakpoint condition causes inferior exit Date: Sun, 21 Dec 2025 18:06:57 +0100 Message-ID: <20251221170657.227525-1-ssbssa@yahoo.de> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit References: <20251221170657.227525-1-ssbssa.ref@yahoo.de> X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
Fix crash when breakpoint condition causes inferior exit
|
|
Commit Message
Hannes Domani
Dec. 21, 2025, 5:06 p.m. UTC
When using a breakpoint condition that causes an inferior exit, gdb crashes with a null pointer access: (gdb) b main if callexit() Breakpoint 1 at 0x114b: file callexit.c, line 32. (gdb) r Starting program: /home/src/lappy/binutils-gdb.git/gdb/testsuite/gdb.base/callexit [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". [Inferior 1 (process 218586) exited normally] ../../gdb/infcall.c:895:50: runtime error: member call on null pointer of type 'struct thread_fsm' ../../gdb/infcall.c:895:50: runtime error: member access within null pointer of type 'struct thread_fsm' Fix this by checking the thread_fsm pointer beforehand, now the result looks like this: (gdb) b main if callexit() Breakpoint 1 at 0x114b: file callexit.c, line 32. (gdb) r Starting program: /home/src/lappy/binutils-gdb.git/gdb/testsuite/gdb.base/callexit [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". [Inferior 1 (process 220707) exited normally] ❌ Error in testing condition for breakpoint 1: The program being debugged exited while in a function called from GDB. Evaluation of the expression containing the function (callexit) will be abandoned. ❌ No registers. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16156 --- gdb/infcall.c | 3 +- gdb/testsuite/gdb.base/exit-in-condition.exp | 36 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/gdb.base/exit-in-condition.exp
Comments
Hannes Domani <ssbssa@yahoo.de> writes: > When using a breakpoint condition that causes an inferior exit, gdb > crashes with a null pointer access: > > (gdb) b main if callexit() > Breakpoint 1 at 0x114b: file callexit.c, line 32. > (gdb) r > Starting program: /home/src/lappy/binutils-gdb.git/gdb/testsuite/gdb.base/callexit > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". > [Inferior 1 (process 218586) exited normally] > ../../gdb/infcall.c:895:50: runtime error: member call on null pointer of type 'struct thread_fsm' > ../../gdb/infcall.c:895:50: runtime error: member access within null pointer of type 'struct thread_fsm' > > Fix this by checking the thread_fsm pointer beforehand, now the result > looks like this: > > (gdb) b main if callexit() > Breakpoint 1 at 0x114b: file callexit.c, line 32. > (gdb) r > Starting program: /home/src/lappy/binutils-gdb.git/gdb/testsuite/gdb.base/callexit > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". > [Inferior 1 (process 220707) exited normally] > ❌ Error in testing condition for breakpoint 1: > The program being debugged exited while in a function called from GDB. > Evaluation of the expression containing the function > (callexit) will be abandoned. > ❌ No registers. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16156 Thanks for fixing this. I have a tiny nit with the code, and some comments on the test (list your other patch). See below. > --- > gdb/infcall.c | 3 +- > gdb/testsuite/gdb.base/exit-in-condition.exp | 36 ++++++++++++++++++++ > 2 files changed, 38 insertions(+), 1 deletion(-) > create mode 100644 gdb/testsuite/gdb.base/exit-in-condition.exp > > diff --git a/gdb/infcall.c b/gdb/infcall.c > index 67053ae0f08..27757c38630 100644 > --- a/gdb/infcall.c > +++ b/gdb/infcall.c > @@ -892,7 +892,8 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm, > async_enable_stdin. */ > if (current_ui->prompt_state == PROMPT_BLOCKED) > { > - if (call_thread->thread_fsm ()->finished_p ()) > + if (call_thread->thread_fsm () This should be: if (call_thread->thread_fsm () != nullptr && call_thread->thread_fsm ()->finished_p ()) A comment explaining that thread_fsm() can return NULL if the thread has exited wouldn't hurt, but with the test isn't a requirement as far as I'm concerned. > + && call_thread->thread_fsm ()->finished_p ()) > async_disable_stdin (); > else > async_enable_stdin (); > diff --git a/gdb/testsuite/gdb.base/exit-in-condition.exp b/gdb/testsuite/gdb.base/exit-in-condition.exp > new file mode 100644 > index 00000000000..ad0b7f99f93 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/exit-in-condition.exp > @@ -0,0 +1,36 @@ > +# Copyright 2025 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/>. > + > +# Test exit call within breakpoint condition. > + > +# Some targets can't do function calls, so don't even bother with this > +# test. > +require {!target_info exists gdb,cannot_call_functions} As with your other patch: require !use_gdb_stub > + > +standard_testfile callexit.c > + > +if { [prepare_for_testing "prepare" $testfile $srcfile] != 0 } { > + return > +} > + > +gdb_test "break main if callexit()" "Breakpoint $decimal at .*" > + > +gdb_test "run" \ > + "\[Inferior $decimal \\(process $decimal\\) exited normally\].* And for the same reasons as your other recent patch, update the first line of this pattern to: \[Inferior $decimal \\(\[^\r\n\]*\\) exited normally\].* > +Error in testing condition for breakpoint $decimal:.* > +The program being debugged exited while in a function called from GDB..* The first period on this line should be escaped, so: The program being debugged exited while in a function called from GDB\\..* > +Evaluation of the expression containing the function.* > +\\(callexit\\) will be abandoned..* And escape the period here too. > +No registers." And here too. With those fixes: Approved-By: Andrew Burgess <aburgess@redhat.com> Thanks, Andrew > -- > 2.51.0
Am Montag, 22. Dezember 2025 um 11:48:55 MEZ hat Andrew Burgess <aburgess@redhat.com> Folgendes geschrieben: > Hannes Domani <ssbssa@yahoo.de> writes: > > > When using a breakpoint condition that causes an inferior exit, gdb > > crashes with a null pointer access: > > > > (gdb) b main if callexit() > > Breakpoint 1 at 0x114b: file callexit.c, line 32. > > (gdb) r > > Starting program: /home/src/lappy/binutils-gdb.git/gdb/testsuite/gdb.base/callexit > > [Thread debugging using libthread_db enabled] > > Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". > > [Inferior 1 (process 218586) exited normally] > > ../../gdb/infcall.c:895:50: runtime error: member call on null pointer of type 'struct thread_fsm' > > ../../gdb/infcall.c:895:50: runtime error: member access within null pointer of type 'struct thread_fsm' > > > > Fix this by checking the thread_fsm pointer beforehand, now the result > > looks like this: > > > > (gdb) b main if callexit() > > Breakpoint 1 at 0x114b: file callexit.c, line 32. > > (gdb) r > > Starting program: /home/src/lappy/binutils-gdb.git/gdb/testsuite/gdb.base/callexit > > [Thread debugging using libthread_db enabled] > > Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". > > [Inferior 1 (process 220707) exited normally] > > ❌ Error in testing condition for breakpoint 1: > > The program being debugged exited while in a function called from GDB. > > Evaluation of the expression containing the function > > (callexit) will be abandoned. > > ❌ No registers. > > > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16156 > > Thanks for fixing this. I have a tiny nit with the code, and some > comments on the test (list your other patch). See below. > > > --- > > gdb/infcall.c | 3 +- > > gdb/testsuite/gdb.base/exit-in-condition.exp | 36 ++++++++++++++++++++ > > 2 files changed, 38 insertions(+), 1 deletion(-) > > create mode 100644 gdb/testsuite/gdb.base/exit-in-condition.exp > > > > diff --git a/gdb/infcall.c b/gdb/infcall.c > > index 67053ae0f08..27757c38630 100644 > > --- a/gdb/infcall.c > > +++ b/gdb/infcall.c > > @@ -892,7 +892,8 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm, > > async_enable_stdin. */ > > if (current_ui->prompt_state == PROMPT_BLOCKED) > > { > > - if (call_thread->thread_fsm ()->finished_p ()) > > + if (call_thread->thread_fsm () > > This should be: > > if (call_thread->thread_fsm () != nullptr > && call_thread->thread_fsm ()->finished_p ()) > > A comment explaining that thread_fsm() can return NULL if the thread has > exited wouldn't hurt, but with the test isn't a requirement as far as > I'm concerned. > > > + && call_thread->thread_fsm ()->finished_p ()) > > async_disable_stdin (); > > else > > async_enable_stdin (); > > diff --git a/gdb/testsuite/gdb.base/exit-in-condition.exp b/gdb/testsuite/gdb.base/exit-in-condition.exp > > new file mode 100644 > > index 00000000000..ad0b7f99f93 > > --- /dev/null > > +++ b/gdb/testsuite/gdb.base/exit-in-condition.exp > > @@ -0,0 +1,36 @@ > > +# Copyright 2025 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/>. > > + > > +# Test exit call within breakpoint condition. > > + > > +# Some targets can't do function calls, so don't even bother with this > > +# test. > > +require {!target_info exists gdb,cannot_call_functions} > > As with your other patch: > > require !use_gdb_stub > > > > + > > +standard_testfile callexit.c > > + > > +if { [prepare_for_testing "prepare" $testfile $srcfile] != 0 } { > > + return > > +} > > + > > +gdb_test "break main if callexit()" "Breakpoint $decimal at .*" > > + > > +gdb_test "run" \ > > + "\[Inferior $decimal \\(process $decimal\\) exited normally\].* > > And for the same reasons as your other recent patch, update the first > line of this pattern to: > > \[Inferior $decimal \\(\[^\r\n\]*\\) exited normally\].* > > > +Error in testing condition for breakpoint $decimal:.* > > +The program being debugged exited while in a function called from GDB..* > > The first period on this line should be escaped, so: > > The program being debugged exited while in a function called from GDB\\..* > > > +Evaluation of the expression containing the function.* > > +\\(callexit\\) will be abandoned..* > > And escape the period here too. > > > +No registers." > > And here too. > > With those fixes: > > Approved-By: Andrew Burgess <aburgess@redhat.com> Pushed with those fixes, thanks. Hannes
diff --git a/gdb/infcall.c b/gdb/infcall.c index 67053ae0f08..27757c38630 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -892,7 +892,8 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm, async_enable_stdin. */ if (current_ui->prompt_state == PROMPT_BLOCKED) { - if (call_thread->thread_fsm ()->finished_p ()) + if (call_thread->thread_fsm () + && call_thread->thread_fsm ()->finished_p ()) async_disable_stdin (); else async_enable_stdin (); diff --git a/gdb/testsuite/gdb.base/exit-in-condition.exp b/gdb/testsuite/gdb.base/exit-in-condition.exp new file mode 100644 index 00000000000..ad0b7f99f93 --- /dev/null +++ b/gdb/testsuite/gdb.base/exit-in-condition.exp @@ -0,0 +1,36 @@ +# Copyright 2025 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/>. + +# Test exit call within breakpoint condition. + +# Some targets can't do function calls, so don't even bother with this +# test. +require {!target_info exists gdb,cannot_call_functions} + +standard_testfile callexit.c + +if { [prepare_for_testing "prepare" $testfile $srcfile] != 0 } { + return +} + +gdb_test "break main if callexit()" "Breakpoint $decimal at .*" + +gdb_test "run" \ + "\[Inferior $decimal \\(process $decimal\\) exited normally\].* +Error in testing condition for breakpoint $decimal:.* +The program being debugged exited while in a function called from GDB..* +Evaluation of the expression containing the function.* +\\(callexit\\) will be abandoned..* +No registers."