From patchwork Tue May 7 23:42:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 89682 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 488FE384AB7D for ; Tue, 7 May 2024 23:44:28 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by sourceware.org (Postfix) with ESMTPS id A32DF384AB6F for ; Tue, 7 May 2024 23:42:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A32DF384AB6F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A32DF384AB6F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125371; cv=none; b=SCH3N2mUDq3VvcGCc6KJvGjd+HJmrotA5oRKE5E9livjWu6NPnVw7dZA29aAZIGAsHYC6yArKUTzuPmW+B2RYmestY0LGcLtTQGIhxBa3+Dgtgi/EgtX+2MDXD6LUcbQmH1v4JIXTaBN4JhKdQS+FfdGxcY/RRUDXb5SjJZLjFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125371; c=relaxed/simple; bh=wNKRHB1C4fynIVWRP1TUfoZXn3N/x4xSnOOkFkbI5v8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ptya7rvveUqeg/OXwCI2bTjYh/GZHhWyUyeoYvCEsJpO/bDMwfd/bCJI+7C3wXglBsmrRM3KhiuJ0Tud9kneGYMSYDjbywfJMz76DvpUMFGqJlDBtyUzIjHOW0E9W+nwa/pRcJnp3ldQFl8PIiw+YiwoAXGN1RjcqcWukUrQIm8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-41c7ac73fddso39378925e9.3 for ; Tue, 07 May 2024 16:42:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715125368; x=1715730168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fr4tOCFpVptBEjDFn/7o6KWLzh/ImV8bv8iRaPTsn4w=; b=n5O/TKCgaQk27pHGaDy9As4gZKJFIxI7xo1PWEvxQqsHH+iVk/9IgHbOdsc6GGNQ+v imP/WasAN7cHFlDCxnvCmT9J/8wia+YgDj30ZKi9XrMlB3oLh2GFyPV36fxrBqFdvElr VgElY3pmsEU5/56iaKvtrZgj8+vK7X8Mhcl5pUhaqnIh3Yg2adIZPblLrtGdB8SKfXEb 6FSb37cv9qOEi4az2ZXR7BOpK+wi8YHs/hhtZ8eMD43TS58vtRlz6SupEmqOLXgFHpPp ePb27lbKLuk9GfGvivIUhnRnMZGRC9wwvw+2cxvhmK04jsYR2uaZZKHShDWfl7uhMUmp YpWw== X-Gm-Message-State: AOJu0YzodKaC7q/fMyeV8q9+hOe8x5kxVFe4XGePwQ95XEQ2WZcm2XX4 K2v7c4x/YineyQXQRxNDnyg1nvj3pWfZQs3hLQkXUezHMdnhtr076TSzc49n X-Google-Smtp-Source: AGHT+IG1ZNLNapAO48lYDR5gDXpilxUv/f+qwBaKxlCfEc/iRlZHbh2UFzeRBL0654rU4pcUuKe46g== X-Received: by 2002:a05:600c:a4b:b0:41a:2c91:6352 with SMTP id 5b1f17b1804b1-41f71accef6mr10399735e9.36.1715125368244; Tue, 07 May 2024 16:42:48 -0700 (PDT) Received: from localhost ([2001:8a0:f908:4900:2dd1:1a0d:2b75:dc42]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-41f87d20488sm1963065e9.25.2024.05.07.16.42.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 May 2024 16:42:47 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 04/34] Windows gdb: handle_output_debug_string return type Date: Wed, 8 May 2024 00:42:03 +0100 Message-ID: <20240507234233.371123-5-pedro@palves.net> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240507234233.371123-1-pedro@palves.net> References: <20240507234233.371123-1-pedro@palves.net> MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org handle_output_debug_string returns a Windows thread id, so it should return a DWORD instead of an int. Change-Id: Icbd071a1a37de8a0fc8918bd13254a8d40311e32 --- gdb/nat/windows-nat.h | 2 +- gdb/windows-nat.c | 16 ++++++++-------- gdbserver/win32-low.cc | 2 +- gdbserver/win32-low.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index 9e8c87e81de..7d336346a86 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -196,7 +196,7 @@ struct windows_process_info a Cygwin signal. Otherwise just print the string as a warning. This function must be supplied by the embedding application. */ - virtual int handle_output_debug_string (struct target_waitstatus *ourstatus) = 0; + virtual DWORD handle_output_debug_string (struct target_waitstatus *ourstatus) = 0; /* Handle a DLL load event. diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 3a3dad5fb2e..4ffbeaaf7e4 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -93,7 +93,7 @@ struct windows_per_inferior : public windows_process_info windows_thread_info *find_thread (ptid_t ptid) override; windows_thread_info *thread_rec (ptid_t ptid, thread_disposition_type disposition) override; - int handle_output_debug_string (struct target_waitstatus *ourstatus) override; + DWORD handle_output_debug_string (struct target_waitstatus *ourstatus) override; void handle_load_dll (const char *dll_name, LPVOID base) override; void handle_unload_dll () override; bool handle_access_violation (const EXCEPTION_RECORD *rec) override; @@ -996,11 +996,11 @@ signal_event_command (const char *args, int from_tty) /* See nat/windows-nat.h. */ -int +DWORD windows_per_inferior::handle_output_debug_string (struct target_waitstatus *ourstatus) { - int retval = 0; + DWORD thread_id = 0; gdb::unique_xmalloc_ptr s = (target_read_string @@ -1041,19 +1041,19 @@ windows_per_inferior::handle_output_debug_string if (gotasig) { ourstatus->set_stopped (gotasig); - retval = strtoul (p, &p, 0); - if (!retval) - retval = current_event.dwThreadId; + thread_id = strtoul (p, &p, 0); + if (thread_id == 0) + thread_id = current_event.dwThreadId; else x = (LPCVOID) (uintptr_t) strtoull (p, NULL, 0); } DEBUG_EVENTS ("gdb: cygwin signal %d, thread 0x%x, CONTEXT @ %p", - gotasig, retval, x); + gotasig, thread_id, x); } #endif - return retval; + return thread_id; } static int diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 5a57eedd18b..5d3ad38cdbb 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -642,7 +642,7 @@ win32_process_target::attach (unsigned long pid) /* See nat/windows-nat.h. */ -int +DWORD gdbserver_windows_process::handle_output_debug_string (struct target_waitstatus *ourstatus) { diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h index c725c182ac4..8162d975227 100644 --- a/gdbserver/win32-low.h +++ b/gdbserver/win32-low.h @@ -178,7 +178,7 @@ struct gdbserver_windows_process : public windows_nat::windows_process_info windows_nat::windows_thread_info *thread_rec (ptid_t ptid, windows_nat::thread_disposition_type disposition) override; - int handle_output_debug_string (struct target_waitstatus *ourstatus) override; + DWORD handle_output_debug_string (struct target_waitstatus *ourstatus) override; void handle_load_dll (const char *dll_name, LPVOID base) override; void handle_unload_dll () override; bool handle_access_violation (const EXCEPTION_RECORD *rec) override;