[RFA/win32] Avoid a couple of name collisions in win32-nat.c

Joel Brobecker
2009-01-07T11:24:39Z

[-- 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)
{