Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFA/win32] Avoid a couple of name collisions in win32-nat.c
Date: Wed, 07 Jan 2009 11:24:00 -0000	[thread overview]
Message-ID: <20090107112422.GB1751@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

This patch simply renames a couple of global variables that are pointers
to routines imported from kernel32.  The reason why they need to be
renamed is that the names chosen were identical to the name in kernel32,
and the declaration is clashing with the declaration in winbase.h.
I followed the example of the routines imported in psapi.dll where
the name is prefixed by psapi_.

2009-01-07  Joel Brobecker  <brobecker@adacore.com>

        * win32-nat.c (kernel32_DebugSetProcessKillOnExit): Renames
        DebugSetProcessKillOnExit.  Update all uses in this file.
        (kernel32_DebugActiveProcessStop): Renames DebugActiveProcessStop.
        Update all uses in this file.

Tested on x86-windows.

OK to apply?
-- 
Joel

[-- Attachment #2: clash.diff --]
[-- Type: text/plain, Size: 2287 bytes --]

diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index ed37cb4..0c1ec05 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -1581,8 +1581,8 @@ do_initial_win32_stuff (struct target_ops *ops, DWORD pid, int attaching)
    If loading these functions succeeds use them to actually detach from
    the inferior process, otherwise behave as usual, pretending that
    detach has worked. */
-static BOOL WINAPI (*DebugSetProcessKillOnExit)(BOOL);
-static BOOL WINAPI (*DebugActiveProcessStop)(DWORD);
+static BOOL WINAPI (*kernel32_DebugSetProcessKillOnExit)(BOOL);
+static BOOL WINAPI (*kernel32_DebugActiveProcessStop)(DWORD);
 
 static int
 has_detach_ability (void)
@@ -1593,13 +1593,14 @@ has_detach_ability (void)
     kernel32 = LoadLibrary ("kernel32.dll");
   if (kernel32)
     {
-      if (!DebugSetProcessKillOnExit)
-	DebugSetProcessKillOnExit = GetProcAddress (kernel32,
+      if (!kernel32_DebugSetProcessKillOnExit)
+	kernel32_DebugSetProcessKillOnExit = GetProcAddress (kernel32,
 						 "DebugSetProcessKillOnExit");
-      if (!DebugActiveProcessStop)
-	DebugActiveProcessStop = GetProcAddress (kernel32,
+      if (!kernel32_DebugActiveProcessStop)
+	kernel32_DebugActiveProcessStop = GetProcAddress (kernel32,
 						 "DebugActiveProcessStop");
-      if (DebugSetProcessKillOnExit && DebugActiveProcessStop)
+      if (kernel32_DebugSetProcessKillOnExit
+	  && kernel32_DebugActiveProcessStop)
 	return 1;
     }
   return 0;
@@ -1719,7 +1720,7 @@ win32_attach (struct target_ops *ops, char *args, int from_tty)
     error (_("Can't attach to process."));
 
   if (has_detach_ability ())
-    DebugSetProcessKillOnExit (FALSE);
+    kernel32_DebugSetProcessKillOnExit (FALSE);
 
   if (from_tty)
     {
@@ -1749,13 +1750,13 @@ win32_detach (struct target_ops *ops, char *args, int from_tty)
       ptid_t ptid = {-1};
       win32_resume (ptid, 0, TARGET_SIGNAL_0);
 
-      if (!DebugActiveProcessStop (current_event.dwProcessId))
+      if (!kernel32_DebugActiveProcessStop (current_event.dwProcessId))
 	{
 	  error (_("Can't detach process %lu (error %lu)"),
 		 current_event.dwProcessId, GetLastError ());
 	  detached = 0;
 	}
-      DebugSetProcessKillOnExit (FALSE);
+      kernel32_DebugSetProcessKillOnExit (FALSE);
     }
   if (detached && from_tty)
     {

             reply	other threads:[~2009-01-07 11:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07 11:24 Joel Brobecker [this message]
2009-01-07 16:57 ` Christopher Faylor
2009-01-08 12:53   ` Joel Brobecker
2009-01-09 10:42   ` Joel Brobecker
2009-01-14  6:23     ` Joel Brobecker
2009-01-14 15:08       ` Christopher Faylor

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=20090107112422.GB1751@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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