From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id 5CB6C3AAA047 for ; Fri, 13 Mar 2020 19:09:01 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 565BA561B4; Fri, 13 Mar 2020 15:09:01 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id afvYqF60ow7i; Fri, 13 Mar 2020 15:09:01 -0400 (EDT) Received: from murgatroyd.Home (184-96-250-69.hlrn.qwest.net [184.96.250.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 1469F561B1; Fri, 13 Mar 2020 15:09:01 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v3 13/29] Wrap shared windows-nat code in windows_nat namespace Date: Fri, 13 Mar 2020 13:08:39 -0600 Message-Id: <20200313190855.28662-14-tromey@adacore.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200313190855.28662-1-tromey@adacore.com> References: <20200313190855.28662-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-25.0 required=5.0 tests=GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 13 Mar 2020 19:09:02 -0000 This wraps the shared windows-nat code in a windows_nat namespace. This helps avoid name clashes. gdb/ChangeLog 2020-03-13 Tom Tromey * windows-nat.c: Add "using namespace". * nat/windows-nat.h: Wrap contents in windows_nat namespace. * nat/windows-nat.c: Wrap contents in windows_nat namespace. gdbserver/ChangeLog 2020-03-13 Tom Tromey * win32-low.h (struct win32_target_ops): Use qualified names where needed. * win32-i386-low.c: Add "using namespace". * win32-low.c: Add "using namespace". * win32-arm-low.c: Add "using namespace". --- gdb/ChangeLog | 6 ++++++ gdb/nat/windows-nat.c | 5 +++++ gdb/nat/windows-nat.h | 5 +++++ gdb/windows-nat.c | 2 ++ gdbserver/ChangeLog | 8 ++++++++ gdbserver/win32-arm-low.cc | 2 ++ gdbserver/win32-i386-low.cc | 2 ++ gdbserver/win32-low.cc | 2 ++ gdbserver/win32-low.h | 16 +++++++++------- 9 files changed, 41 insertions(+), 7 deletions(-) diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index ca3e3087944..6c0218cd9d8 100644 --- a/gdb/nat/windows-nat.c +++ b/gdb/nat/windows-nat.c @@ -19,6 +19,9 @@ #include "gdbsupport/common-defs.h" #include "nat/windows-nat.h" +namespace windows_nat +{ + windows_thread_info::~windows_thread_info () { CloseHandle (h); @@ -65,3 +68,5 @@ windows_thread_info::resume () } suspended = 0; } + +} diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index ccdf207140e..df283646753 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -21,6 +21,9 @@ #include +namespace windows_nat +{ + /* Thread information structure used to track extra information about each thread. */ struct windows_thread_info @@ -87,4 +90,6 @@ struct windows_thread_info gdb::unique_xmalloc_ptr name; }; +} + #endif diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index e48fa57f74a..b05a27c7cac 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -75,6 +75,8 @@ #define STATUS_WX86_BREAKPOINT 0x4000001F #define STATUS_WX86_SINGLE_STEP 0x4000001E +using namespace windows_nat; + #define AdjustTokenPrivileges dyn_AdjustTokenPrivileges #define DebugActiveProcessStop dyn_DebugActiveProcessStop #define DebugBreakProcess dyn_DebugBreakProcess diff --git a/gdbserver/win32-arm-low.cc b/gdbserver/win32-arm-low.cc index c50c5dfdbf2..78b7fd09ec3 100644 --- a/gdbserver/win32-arm-low.cc +++ b/gdbserver/win32-arm-low.cc @@ -18,6 +18,8 @@ #include "server.h" #include "win32-low.h" +using namespace windows_nat; + #ifndef CONTEXT_FLOATING_POINT #define CONTEXT_FLOATING_POINT 0 #endif diff --git a/gdbserver/win32-i386-low.cc b/gdbserver/win32-i386-low.cc index 1b78cf98b33..1c14bc70362 100644 --- a/gdbserver/win32-i386-low.cc +++ b/gdbserver/win32-i386-low.cc @@ -26,6 +26,8 @@ #include "tdesc.h" #include "x86-tdesc.h" +using namespace windows_nat; + #ifndef CONTEXT_EXTENDED_REGISTERS #define CONTEXT_EXTENDED_REGISTERS 0 #endif diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index c642d47764c..8f8b6cedd28 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -36,6 +36,8 @@ #include "gdbsupport/common-inferior.h" #include "gdbsupport/gdb_wait.h" +using namespace windows_nat; + #ifndef USE_WIN32API #include #endif diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h index 28ac2b082d9..917f7275622 100644 --- a/gdbserver/win32-low.h +++ b/gdbserver/win32-low.h @@ -40,23 +40,25 @@ struct win32_target_ops void (*initial_stuff) (void); /* Fetch the context from the inferior. */ - void (*get_thread_context) (windows_thread_info *th); + void (*get_thread_context) (windows_nat::windows_thread_info *th); /* Called just before resuming the thread. */ - void (*prepare_to_resume) (windows_thread_info *th); + void (*prepare_to_resume) (windows_nat::windows_thread_info *th); /* Called when a thread was added. */ - void (*thread_added) (windows_thread_info *th); + void (*thread_added) (windows_nat::windows_thread_info *th); /* Fetch register from gdbserver regcache data. */ void (*fetch_inferior_register) (struct regcache *regcache, - windows_thread_info *th, int r); + windows_nat::windows_thread_info *th, + int r); /* Store a new register value into the thread context of TH. */ void (*store_inferior_register) (struct regcache *regcache, - windows_thread_info *th, int r); + windows_nat::windows_thread_info *th, + int r); - void (*single_step) (windows_thread_info *th); + void (*single_step) (windows_nat::windows_thread_info *th); const unsigned char *breakpoint; int breakpoint_len; @@ -143,7 +145,7 @@ class win32_process_target : public process_stratum_target }; /* Retrieve the context for this thread, if not already retrieved. */ -extern void win32_require_context (windows_thread_info *th); +extern void win32_require_context (windows_nat::windows_thread_info *th); /* Map the Windows error number in ERROR to a locale-dependent error message string and return a pointer to it. Typically, the values -- 2.21.1