From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by sourceware.org (Postfix) with ESMTPS id 6BBA238582A7 for ; Fri, 24 Jun 2022 10:59:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6BBA238582A7 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f50.google.com with SMTP id i10so2698111wrc.0 for ; Fri, 24 Jun 2022 03:59:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=VEH3qsrJPNIzETkxYZbSEfVA6UTsN5xrDoz+Y1TrvkY=; b=RxLKDY+7bT+9yx+CVnY0GrHiZaGz895HXjoStF+/SuVcPU3w6GeDkY8TtkoVFB8Fih Xe7Y09CmD/GdbZq72iEt5Skg25hBIlkds6AaLNUYr4PFlWSlAy1U8efhlyq1EKc7lWL0 6HEeloQ13Kl/nLYovKU9PcHapiUNb5z6HAa3rUF72SDbGEwdSr0fDJaAvfs0FwmCYEYJ BspUOQdJCW4fdwSTwMqw7BJRB1YqIHECrBj4LVpLTwKD7kWNDiENpyL78ffweGvQ+LkE gxhCut2fy+TIuclC0VCpD6IDF3poY+zuIKWD4m9LrFClW7R6jGSqmv29AmsVPSubSC6u yghw== X-Gm-Message-State: AJIora/hdPk/suu5CNW6d8thOEdonHDymo8NDpuuLUwhv3yr6fWZwMDn dFKxhD+bvYyiQ6+NJ65c2jWrKJrcXek= X-Google-Smtp-Source: AGRyM1uuWiS4lCXjCttSer2UwC4dYGyIlhV5f3FSPnu490OHnmfJI9+cV4lN3b2WwmhlATO78EgJmw== X-Received: by 2002:adf:fb84:0:b0:21a:10f2:1661 with SMTP id a4-20020adffb84000000b0021a10f21661mr13140512wrr.2.1656068381398; Fri, 24 Jun 2022 03:59:41 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c154d00b0039ee391a024sm7489335wmg.14.2022.06.24.03.59.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jun 2022 03:59:40 -0700 (PDT) Message-ID: <54d5da69-19f9-f2e9-1260-b37465b29fa6@palves.net> Date: Fri, 24 Jun 2022 11:59:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 1/2] Improve core file path detection & put cores in output dir Content-Language: en-US To: Andrew Burgess , gdb-patches@sourceware.org References: <20220623183053.172430-1-pedro@palves.net> <20220623183053.172430-2-pedro@palves.net> <87y1xmbdae.fsf@redhat.com> From: Pedro Alves In-Reply-To: <87y1xmbdae.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2022 10:59:43 -0000 On 2022-06-24 10:50, Andrew Burgess wrote: >> # Check for production of a core file and remove it! >> - >> -set test "cleanup core file" >> -if { [remote_file host exists core] } { >> - remote_file host delete core >> - pass "$test (removed)" >> -} elseif { $pid != -1 && [remote_file host exists core.$pid] } { >> - remote_file host delete core.$pid >> - pass "$test (removed)" >> -} else { >> - pass "$test (not dumped)" >> -} >> +remove_core $pid ... >> + >> +# Check for production of a core file and remove it. PID is the >> +# inferior's pid or -1 if not known. TEST is the test's message. >> + >> +proc remove_core {pid {test ""}} { >> + if {$test == ""} { >> + set test "cleanup core file" >> + } >> + >> + set file [find_core_file $pid] >> + if {$file != ""} { >> + remote_file host delete $file >> + pass "$test (removed)" >> + } else { >> + pass "$test (not dumped)" > > I wonder if 'not found' would be a more acurate description for this > last pass? With a particular core file pattern it might be that there > is a core file, we just can't find it, right? > > Otherwise, this looks good. > Yeah, I had just copied from that the annota testcases (see above). I'll make that change before pushing this. Thanks!