Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Guinevere Larsen <blarsen@redhat.com>
To: Lancelot SIX <lsix@lancelotsix.com>
Cc: gdb-patches@sourceware.org, Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH v2] gdb/testsuite: add test for backtracing for threaded inferiors from a corefile
Date: Wed, 25 Oct 2023 11:39:00 +0200	[thread overview]
Message-ID: <9c602a66-a314-7581-293a-fe9a020a979f@redhat.com> (raw)
In-Reply-To: <20231024204015.reo2rccae4uxdntf@octopus>

On 24/10/2023 22:40, Lancelot SIX wrote:
> Hi Guinevere,
>
> I only have a couple of small remarks below.

Hi Lancelot!

Thanks for the review. I'll fix them for v3.
>
> On Tue, Oct 24, 2023 at 02:27:52PM +0200, Guinevere Larsen wrote:
< snip >
>> diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
>> new file mode 100644
>> index 00000000000..9dd135b9167
>> --- /dev/null
>> +++ b/gdb/testsuite/gdb.threads/threadcrash.exp
>> @@ -0,0 +1,231 @@
>> +# This testcase is part of GDB, the GNU debugger.
>> +
>> +# Copyright 2023 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/>.
>> +
>> +# This test case looks at GDB's ability to get correct backtraces for a
>> +# crashed inferior, recreating it from a live inferior, a corefile and
>> +# a gcore.
>> +
>> +
>> +# First check that we have 7 threads.
>> +
>> +proc test_thread_count {} {
>> +    set thread_count 0
>> +
>> +    gdb_test_multiple "info threads" "getting thread count" -lbl {
>> +	-re "Thread" {
>> +	    incr thread_count
>> +	    exp_continue
>> +	}
>> +	-re "$::gdb_prompt " {
>> +	    gdb_assert {$thread_count == 7}
>> +	}
>> +    }
>> +
>> +    return $thread_count
>> +}
>> +
>> +# Apply all to quickly check if all expected states are
>> +# present.  Then, save the full desired backtrace in a list
>> +# so we can check full backtraces later.
>> +
>> +proc thread_apply_all {} {
>> +    global test_list
>> +
>> +    set unwind_fail false
>> +
>> +    gdb_test_multiple "thread apply all backtrace 100" \
> Is the 100 there to ensure that the backtrace is not truncated (there is
> no way that this test gives a backtrace of more than 100 frames)?  If so,
> why not use something like this?
>
>    with backtrace limit unlimited -- thread apply all bt
>
> This avoid the arbitrary 100 value.

Huh, I didn't know you could do  this.

I'll set the limit at the start of the test, so we don't need such long 
lines everywhere.

-- 
Cheers,
Guinevere Larsen
She/Her/Hers


      reply	other threads:[~2023-10-25  9:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 12:27 Guinevere Larsen
2023-10-24 20:40 ` Lancelot SIX
2023-10-25  9:39   ` Guinevere Larsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c602a66-a314-7581-293a-fe9a020a979f@redhat.com \
    --to=blarsen@redhat.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox