From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114700 invoked by alias); 3 Jan 2020 20:08:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 114688 invoked by uid 89); 3 Jan 2020 20:08:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 Jan 2020 20:08:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578082091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=po/lUYtonUvMjG8oTTnYlUOAXhHr+Mrn0gt5P+LYYuI=; b=TUV0xGMY7SNvOhxXQ4IT59oDR3E4o3hrJLyHGF/uv29FiPALBJ7BwvRoB4414TLK9KmGSr XDjbyPKXgBrirwhrA9UudTOWFRZ1eHl2WzY92X9ODV6HsAEQZC+PeEjWKxYIUiN1FbkrKO OwhLF3KW4MDxglulV4mZE+JtIgA+Ho4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-52-KsezlxOvM8yLB4ltSQpAug-1; Fri, 03 Jan 2020 15:08:10 -0500 Received: by mail-wr1-f70.google.com with SMTP id h30so14748458wrh.5 for ; Fri, 03 Jan 2020 12:08:10 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id q3sm13243149wmc.47.2020.01.03.12.08.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jan 2020 12:08:08 -0800 (PST) Subject: Re: [RFAv3 2/6] Improve process exit status macros on MinGW To: Eli Zaretskii , philippe.waroquiers@skynet.be References: <20190504161753.15530-1-philippe.waroquiers@skynet.be> <20190504161753.15530-3-philippe.waroquiers@skynet.be> <835zie51mf.fsf@gnu.org> <52c4ca33-ffc4-8e1e-fe08-a92123ef02aa@redhat.com> <83o8w536l6.fsf@gnu.org> <3aacf88f-212e-f11f-0688-4f8219dab4c3@redhat.com> <83k16t32no.fsf@gnu.org> <83fth8v1nu.fsf@gnu.org> <52408aa9-5a86-2ade-ec23-c8293eff130d@redhat.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <493dbcb5-7788-6c58-b9b4-ce6a752727c3@redhat.com> Date: Fri, 03 Jan 2020 20:08:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <52408aa9-5a86-2ade-ec23-c8293eff130d@redhat.com> X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-01/txt/msg00049.txt.bz2 On 1/3/20 7:59 PM, Pedro Alves wrote: > #define AdjustTokenPrivileges dyn_AdjustTokenPrivileges > #define DebugActiveProcessStop dyn_DebugActiveProcessStop > @@ -1627,8 +1628,23 @@ get_windows_debug_event (struct target_ops *ops, > windows_delete_thread (ptid_t (current_event.dwProcessId, 0, > current_event.dwThreadId), > 0, true /* main_thread_p */); > - ourstatus->kind = TARGET_WAITKIND_EXITED; > - ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode; > + DWORD exit_status = current_event.u.ExitProcess.dwExitCode; > + /* If the exit status looks like a fatal exception, but we > + don't recognize the exception's code, make the original > + exit status value available, to avoid losing > + information. */ > + int exit_signal > + = WIFSIGNALED (exit_status) ? WTERMSIG (exit_status) : -1; > + if (exit_signal == -1) > + { > + ourstatus->kind = TARGET_WAITKIND_EXITED; > + ourstatus->value.integer = exit_status; > + } > + else > + { > + ourstatus->kind = TARGET_WAITKIND_SIGNALLED; > + ourstatus->value.sig = gdb_signal_from_host (WTERMSIG (w)); I notice now that this should be: ourstatus->value.sig = gdb_signal_from_host (exit_signal); I had fixed that on gdbserver, but not on windows-nat.c. And the reason I didn't notice is that the build tree I was using is only building gdbserver, not the whole of gdb + gdbserver, and I failed to notice it. Hopefully the rest of the code will build cleanly without requiring much more fixing. Thanks, Pedro Alves