35 #include <sys/types.h>
42 #include <sys/cygwin.h>
43 #include <cygwin/version.h>
47 #include "filenames.h"
69 #define AdjustTokenPrivileges dyn_AdjustTokenPrivileges
70 #define DebugActiveProcessStop dyn_DebugActiveProcessStop
71 #define DebugBreakProcess dyn_DebugBreakProcess
72 #define DebugSetProcessKillOnExit dyn_DebugSetProcessKillOnExit
73 #define EnumProcessModules dyn_EnumProcessModules
74 #define GetModuleInformation dyn_GetModuleInformation
75 #define LookupPrivilegeValueA dyn_LookupPrivilegeValueA
76 #define OpenProcessToken dyn_OpenProcessToken
77 #define GetConsoleFontSize dyn_GetConsoleFontSize
78 #define GetCurrentConsoleFont dyn_GetCurrentConsoleFont
81 DWORD, PTOKEN_PRIVILEGES, PDWORD);
97 #undef GetModuleFileNameEx
100 # define __PMAX (MAX_PATH + 1)
102 # define STARTUPINFO STARTUPINFOA
103 # define CreateProcess CreateProcessA
104 # define GetModuleFileNameEx_name "GetModuleFileNameExA"
105 # define bad_GetModuleFileNameEx bad_GetModuleFileNameExA
107 # define __PMAX PATH_MAX
112 typedef wchar_t cygwin_buf_t;
115 # define STARTUPINFO STARTUPINFOW
116 # define CreateProcess CreateProcessW
117 # define GetModuleFileNameEx_name "GetModuleFileNameExW"
118 # define bad_GetModuleFileNameEx bad_GetModuleFileNameExW
129 #ifndef _GNU_H_WINDOWS_H
136 #ifndef CONTEXT_EXTENDED_REGISTERS
139 #define CONTEXT_EXTENDED_REGISTERS 0
142 #define CONTEXT_DEBUGGER_DR CONTEXT_FULL | CONTEXT_FLOATING_POINT \
143 | CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS \
144 | CONTEXT_EXTENDED_REGISTERS
146 static uintptr_t
dr[8];
151 #define DR6_CLEAR_VALUE 0xffff0ff0
155 #ifndef _CYGWIN_SIGNAL_STRING
156 #define _CYGWIN_SIGNAL_STRING "cYgSiGw00f"
159 #define CHECK(x) check (x, __FILE__,__LINE__)
160 #define DEBUG_EXEC(x) if (debug_exec) printf_unfiltered x
161 #define DEBUG_EVENTS(x) if (debug_events) printf_unfiltered x
162 #define DEBUG_MEM(x) if (debug_memory) printf_unfiltered x
163 #define DEBUG_EXCEPT(x) if (debug_exceptions) printf_unfiltered x
213 static int cygwin_exceptions = 0;
258 {EXCEPTION_ACCESS_VIOLATION, GDB_SIGNAL_SEGV},
259 {STATUS_STACK_OVERFLOW, GDB_SIGNAL_SEGV},
260 {EXCEPTION_BREAKPOINT, GDB_SIGNAL_TRAP},
261 {DBG_CONTROL_C, GDB_SIGNAL_INT},
262 {EXCEPTION_SINGLE_STEP, GDB_SIGNAL_TRAP},
263 {STATUS_FLOAT_DIVIDE_BY_ZERO, GDB_SIGNAL_FPE},
280 segment_register_p = fun;
288 (
unsigned) GetLastError ());
299 for (th = &thread_head; (th = th->
next) != NULL;)
304 if (get_context > 0 &&
id != current_event.dwThreadId)
306 if (SuspendThread (th->
h) == (DWORD) -1)
308 DWORD
err = GetLastError ();
316 if (err != ERROR_INVALID_HANDLE
317 && err != ERROR_ACCESS_DENIED)
318 warning (
_(
"SuspendThread (tid=0x%x) failed."
320 (
unsigned)
id, (
unsigned) err);
326 else if (get_context < 0)
355 thread_head.
next = th;
358 if (debug_registers_used)
361 th->
context.ContextFlags = CONTEXT_DEBUG_REGISTERS;
384 while (th->
next != NULL)
390 thread_head.
next = NULL;
411 for (th = &thread_head;
416 if (th->
next != NULL)
439 if (have_saved_context)
445 memcpy (¤t_thread->
context, &saved_context,
446 __COPY_CONTEXT_SIZE);
447 have_saved_context = 0;
458 if (!debug_registers_changed)
473 l = *((
long *) context_offset) & 0xffff;
478 l = (*((
long *) context_offset) >> 16) & ((1 << 11) - 1);
481 else if (segment_register_p (r))
486 l = *((
long *) context_offset) & 0xffff;
516 ((
char *) ¤t_thread->
context) + mappings[r]);
565 WIN32_FIND_DATA w32_fd;
566 HANDLE h = FindFirstFile(name, &w32_fd);
568 if (h == INVALID_HANDLE_VALUE)
574 if (GetCurrentDirectory (MAX_PATH + 1, cwd))
576 p = strrchr (buf,
'\\');
579 SetCurrentDirectory (buf);
580 GetFullPathName (w32_fd.cFileName, MAX_PATH, buf, &p);
581 SetCurrentDirectory (cwd);
584 if (strcasecmp (buf,
"ntdll.dll") == 0)
586 GetSystemDirectory (buf,
sizeof (buf));
587 strcat (buf,
"\\ntdll.dll");
593 if (access (name, F_OK) != 0)
595 if (strcasecmp (name,
"ntdll.dll") == 0)
598 GetSystemDirectoryW (buf,
sizeof (buf) /
sizeof (
wchar_t));
599 wcscat (buf,
L"\\ntdll.dll");
603 GetSystemDirectoryA (buf,
sizeof (buf) /
sizeof (
wchar_t));
604 strcat (buf,
"\\ntdll.dll");
617 cygwin_conv_path (CCP_WIN_W_TO_POSIX, buf, so->
so_name,
621 char *rname = realpath (name, NULL);
628 error (
_(
"dll path too long"));
631 p = strchr (so->
so_name,
'\0') - (
sizeof (
"/cygwin1.dll") - 1);
632 if (p >= so->
so_name && strcasecmp (p,
"/cygwin1.dll") == 0)
635 asection *text = NULL;
643 if (bfd_check_format (abfd, bfd_object))
644 text = bfd_get_section_by_name (abfd,
".text");
655 cygwin_load_start = (
CORE_ADDR) (uintptr_t) ((
char *)
657 cygwin_load_end = cygwin_load_start + bfd_section_size (abfd, text);
672 static char buf[(2 *
__PMAX) + 1];
674 DWORD
size = unicode ?
sizeof (WCHAR) :
sizeof (
char);
688 if (!ReadProcessMemory (h, address, &address_ptr,
689 sizeof (address_ptr), &done)
690 || done !=
sizeof (address_ptr) || !address_ptr)
694 while (ReadProcessMemory (h, address_ptr + len++ * size, &b, size, &done)
695 && (b[0] != 0 || b[size - 1] != 0) && done == size)
699 ReadProcessMemory (h, address_ptr, buf, len, &done);
702 WCHAR *unicode_address = (WCHAR *) alloca (len *
sizeof (WCHAR));
703 ReadProcessMemory (h, address_ptr, unicode_address, len *
sizeof (WCHAR),
706 wcstombs (buf, unicode_address,
__PMAX);
708 WideCharToMultiByte (CP_ACP, 0, unicode_address, len, buf,
sizeof buf,
726 LOAD_DLL_DEBUG_INFO *
event = ¤t_event.u.LoadDll;
735 event->lpImageName, event->fUnicode);
740 solib_end = solib_end->
next;
767 LPVOID lpBaseOfDll = current_event.u.UnloadDll.lpBaseOfDll;
770 for (so = &solib_start; so->
next != NULL; so = so->
next)
801 solib_start.next = NULL;
802 solib_end = &solib_start;
815 ((
CORE_ADDR) (uintptr_t) current_event.u.DebugString.lpDebugStringData,
825 char *p = strchr (s,
'\0');
827 if (p > s && *--p ==
'\n')
853 retval = strtoul (p, &p, 0);
856 else if ((x = (LPCVOID) (uintptr_t) strtoull (p, NULL, 0))
857 && ReadProcessMemory (current_process_handle, x,
859 __COPY_CONTEXT_SIZE, &n)
860 && n == __COPY_CONTEXT_SIZE)
861 have_saved_context = 1;
875 if (GetThreadSelectorEntry (thread, sel, &info))
879 if (!info.HighWord.Bits.Pres)
884 base = (info.HighWord.Bits.BaseHi << 24) +
885 (info.HighWord.Bits.BaseMid << 16)
887 limit = (info.HighWord.Bits.LimitHi << 16) + info.LimitLow;
888 if (info.HighWord.Bits.Granularity)
889 limit = (limit << 12) | 0xfff;
891 if (info.HighWord.Bits.Default_Big)
895 switch ((info.HighWord.Bits.Type & 0xf) >> 1)
924 if ((info.HighWord.Bits.Type & 0x1) == 0)
927 if ((info.HighWord.Bits.Type & 0x10) == 0)
930 if (info.HighWord.Bits.Granularity)
938 DWORD
err = GetLastError ();
939 if (err == ERROR_NOT_SUPPORTED)
960 current_thread->
context.SegCs);
963 current_thread->
context.SegDs);
966 current_thread->
context.SegEs);
969 current_thread->
context.SegSs);
972 current_thread->
context.SegFs);
975 current_thread->
context.SegGs);
986 #define DEBUG_EXCEPTION_SIMPLE(x) if (debug_exceptions) \
987 printf_unfiltered ("gdb: Target exception %s at %s\n", x, \
988 host_address_to_string (\
989 current_event.u.Exception.ExceptionRecord.ExceptionAddress))
995 DWORD
code = current_event.u.Exception.ExceptionRecord.ExceptionCode;
1000 th =
thread_rec (current_event.dwThreadId, -1);
1004 case EXCEPTION_ACCESS_VIOLATION:
1006 ourstatus->
value.
sig = GDB_SIGNAL_SEGV;
1019 current_event.u.Exception.ExceptionRecord.ExceptionAddress;
1021 if ((!cygwin_exceptions && (addr >= cygwin_load_start
1022 && addr < cygwin_load_end))
1029 case STATUS_STACK_OVERFLOW:
1031 ourstatus->
value.
sig = GDB_SIGNAL_SEGV;
1033 case STATUS_FLOAT_DENORMAL_OPERAND:
1035 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1037 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
1039 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1041 case STATUS_FLOAT_INEXACT_RESULT:
1043 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1045 case STATUS_FLOAT_INVALID_OPERATION:
1047 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1049 case STATUS_FLOAT_OVERFLOW:
1051 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1053 case STATUS_FLOAT_STACK_CHECK:
1055 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1057 case STATUS_FLOAT_UNDERFLOW:
1059 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1061 case STATUS_FLOAT_DIVIDE_BY_ZERO:
1063 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1065 case STATUS_INTEGER_DIVIDE_BY_ZERO:
1067 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1069 case STATUS_INTEGER_OVERFLOW:
1071 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1073 case EXCEPTION_BREAKPOINT:
1075 ourstatus->
value.
sig = GDB_SIGNAL_TRAP;
1079 ourstatus->
value.
sig = GDB_SIGNAL_INT;
1081 case DBG_CONTROL_BREAK:
1083 ourstatus->
value.
sig = GDB_SIGNAL_INT;
1085 case EXCEPTION_SINGLE_STEP:
1087 ourstatus->
value.
sig = GDB_SIGNAL_TRAP;
1089 case EXCEPTION_ILLEGAL_INSTRUCTION:
1091 ourstatus->
value.
sig = GDB_SIGNAL_ILL;
1093 case EXCEPTION_PRIV_INSTRUCTION:
1095 ourstatus->
value.
sig = GDB_SIGNAL_ILL;
1097 case EXCEPTION_NONCONTINUABLE_EXCEPTION:
1099 ourstatus->
value.
sig = GDB_SIGNAL_ILL;
1103 if (current_event.u.Exception.dwFirstChance)
1106 (
unsigned) current_event.u.Exception.ExceptionRecord.ExceptionCode,
1108 current_event.u.Exception.ExceptionRecord.ExceptionAddress));
1109 ourstatus->
value.
sig = GDB_SIGNAL_UNKNOWN;
1128 DEBUG_EVENTS ((
"ContinueDebugEvent (cpid=%d, ctid=0x%x, %s);\n",
1129 (
unsigned) current_event.dwProcessId,
1130 (
unsigned) current_event.dwThreadId,
1131 continue_status == DBG_CONTINUE ?
1132 "DBG_CONTINUE" :
"DBG_EXCEPTION_NOT_HANDLED"));
1134 for (th = &thread_head; (th = th->
next) != NULL;)
1135 if ((
id == -1 ||
id == (
int) th->
id)
1138 if (debug_registers_changed)
1140 th->
context.ContextFlags |= CONTEXT_DEBUG_REGISTERS;
1152 if (GetExitCodeThread (th->
h, &ec)
1153 && ec == STILL_ACTIVE)
1163 (void) ResumeThread (th->
h);
1167 res = ContinueDebugEvent (current_event.dwProcessId,
1168 current_event.dwThreadId,
1172 error (
_(
"Failed to resume program execution"
1173 " (ContinueDebugEvent failed, error %u)"),
1174 (
unsigned int) GetLastError ());
1176 debug_registers_changed = 0;
1185 current_process_handle = OpenProcess (PROCESS_ALL_ACCESS, FALSE,
1186 current_event.dwProcessId);
1187 if (current_process_handle != NULL)
1188 open_process_used = 1;
1191 error (
_(
"OpenProcess call failed, GetLastError = %u"),
1192 (
unsigned) GetLastError ());
1195 main_thread_id = current_event.dwThreadId;
1198 current_event.dwThreadId),
1199 current_event.u.CreateThread.hThread,
1200 current_event.u.CreateThread.lpThreadLocalBase);
1209 DWORD continue_status = DBG_CONTINUE;
1219 if (sig != GDB_SIGNAL_0)
1221 if (current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT)
1223 DEBUG_EXCEPT((
"Cannot continue with signal %d here.\n",sig));
1225 else if (sig == last_sig)
1226 continue_status = DBG_EXCEPTION_NOT_HANDLED;
1235 for (i = 0; xlate[i].
them != -1; i++)
1236 if (xlate[i].us == sig)
1238 current_event.u.Exception.ExceptionRecord.ExceptionCode
1240 continue_status = DBG_EXCEPTION_NOT_HANDLED;
1243 if (continue_status == DBG_CONTINUE)
1245 DEBUG_EXCEPT((
"Cannot continue with signal %d.\n",sig));
1249 DEBUG_EXCEPT((
"Can only continue with received signal %d.\n",
1253 last_sig = GDB_SIGNAL_0;
1255 DEBUG_EXEC ((
"gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
1274 if (debug_registers_changed)
1307 if (event_type != CTRL_C_EVENT && event_type != CTRL_BREAK_EVENT)
1312 if (!new_console && !attach_flag)
1316 warning (
_(
"Could not interrupt program. "
1317 "Press Ctrl-c in the program console."));
1330 DWORD continue_status, event_code;
1333 DWORD thread_id = 0;
1335 last_sig = GDB_SIGNAL_0;
1337 if (!(debug_event = WaitForDebugEvent (¤t_event, 1000)))
1341 continue_status = DBG_CONTINUE;
1343 event_code = current_event.dwDebugEventCode;
1346 have_saved_context = 0;
1350 case CREATE_THREAD_DEBUG_EVENT:
1351 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1352 (
unsigned) current_event.dwProcessId,
1353 (
unsigned) current_event.dwThreadId,
1354 "CREATE_THREAD_DEBUG_EVENT"));
1355 if (saw_create != 1)
1371 thread_id = current_event.dwThreadId;
1373 current_event.dwThreadId),
1374 current_event.u.CreateThread.hThread,
1375 current_event.u.CreateThread.lpThreadLocalBase);
1379 case EXIT_THREAD_DEBUG_EVENT:
1380 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1381 (
unsigned) current_event.dwProcessId,
1382 (
unsigned) current_event.dwThreadId,
1383 "EXIT_THREAD_DEBUG_EVENT"));
1385 if (current_event.dwThreadId != main_thread_id)
1388 current_event.dwThreadId),
1389 current_event.u.ExitThread.dwExitCode);
1390 th = &dummy_thread_info;
1394 case CREATE_PROCESS_DEBUG_EVENT:
1395 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1396 (
unsigned) current_event.dwProcessId,
1397 (
unsigned) current_event.dwThreadId,
1398 "CREATE_PROCESS_DEBUG_EVENT"));
1399 CloseHandle (current_event.u.CreateProcessInfo.hFile);
1400 if (++saw_create != 1)
1403 current_process_handle = current_event.u.CreateProcessInfo.hProcess;
1408 main_thread_id = current_event.dwThreadId;
1411 current_event.dwThreadId),
1412 current_event.u.CreateProcessInfo.hThread,
1413 current_event.u.CreateProcessInfo.lpThreadLocalBase);
1414 thread_id = current_event.dwThreadId;
1417 case EXIT_PROCESS_DEBUG_EVENT:
1418 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1419 (
unsigned) current_event.dwProcessId,
1420 (
unsigned) current_event.dwThreadId,
1421 "EXIT_PROCESS_DEBUG_EVENT"));
1422 if (!windows_initialization_done)
1426 error (
_(
"During startup program exited with code 0x%x."),
1427 (
unsigned int) current_event.u.ExitProcess.dwExitCode);
1429 else if (saw_create == 1)
1432 ourstatus->
value.
integer = current_event.u.ExitProcess.dwExitCode;
1437 case LOAD_DLL_DEBUG_EVENT:
1438 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1439 (
unsigned) current_event.dwProcessId,
1440 (
unsigned) current_event.dwThreadId,
1441 "LOAD_DLL_DEBUG_EVENT"));
1442 CloseHandle (current_event.u.LoadDll.hFile);
1443 if (saw_create != 1 || ! windows_initialization_done)
1451 case UNLOAD_DLL_DEBUG_EVENT:
1452 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1453 (
unsigned) current_event.dwProcessId,
1454 (
unsigned) current_event.dwThreadId,
1455 "UNLOAD_DLL_DEBUG_EVENT"));
1456 if (saw_create != 1 || ! windows_initialization_done)
1464 case EXCEPTION_DEBUG_EVENT:
1465 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1466 (
unsigned) current_event.dwProcessId,
1467 (
unsigned) current_event.dwThreadId,
1468 "EXCEPTION_DEBUG_EVENT"));
1469 if (saw_create != 1)
1474 continue_status = DBG_EXCEPTION_NOT_HANDLED;
1477 thread_id = current_event.dwThreadId;
1481 continue_status = -1;
1486 case OUTPUT_DEBUG_STRING_EVENT:
1487 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1488 (
unsigned) current_event.dwProcessId,
1489 (
unsigned) current_event.dwThreadId,
1490 "OUTPUT_DEBUG_STRING_EVENT"));
1491 if (saw_create != 1)
1497 if (saw_create != 1)
1500 (
unsigned) current_event.dwProcessId,
1501 (
unsigned) current_event.dwThreadId);
1503 (
unsigned) current_event.dwDebugEventCode);
1507 if (!thread_id || saw_create != 1)
1509 if (continue_status == -1)
1518 current_thread = th;
1519 if (!current_thread)
1520 current_thread =
thread_rec (thread_id, TRUE);
1577 return ptid_build (current_event.dwProcessId, 0, retval);
1598 HMODULE dummy_hmodule;
1604 sizeof (HMODULE), &cb_needed) == 0)
1610 hmodules = (HMODULE *) alloca (cb_needed);
1612 cb_needed, &cb_needed) == 0)
1615 for (i = 1; i < (
int) (cb_needed /
sizeof (HMODULE)); i++)
1619 wchar_t dll_name[
__PMAX];
1626 &mi,
sizeof (mi)) == 0)
1629 dll_name,
sizeof (dll_name)) == 0)
1632 wcstombs (name, dll_name,
__PMAX);
1638 solib_end = solib_end->
next;
1650 last_sig = GDB_SIGNAL_0;
1652 exception_count = 0;
1653 open_process_used = 0;
1654 debug_registers_changed = 0;
1655 debug_registers_used = 0;
1656 for (i = 0; i <
sizeof (
dr) /
sizeof (dr[0]); i++)
1659 cygwin_load_start = cygwin_load_end = 0;
1661 current_event.dwProcessId =
pid;
1662 memset (¤t_event, 0,
sizeof (current_event));
1683 windows_initialization_done = 0;
1687 stop_after_trap = 1;
1713 windows_initialization_done = 1;
1715 stop_after_trap = 0;
1728 HANDLE token_hdl = NULL;
1730 TOKEN_PRIVILEGES new_priv, orig_priv;
1735 TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
1742 new_priv.PrivilegeCount = 1;
1743 new_priv.Privileges[0].Luid = restore_priv;
1744 new_priv.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0;
1747 sizeof orig_priv, &orig_priv, &size))
1755 if (enable && GetLastError () == ERROR_NOT_ALL_ASSIGNED)
1759 ret = orig_priv.Privileges[0].Attributes == SE_PRIVILEGE_ENABLED ? 1 : 0;
1763 CloseHandle (token_hdl);
1781 "fail on Windows NT/2K/XP\n");
1785 ok = DebugActiveProcess (pid);
1792 pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
1795 ok = DebugActiveProcess (pid);
1800 error (
_(
"Can't attach to process."));
1832 error (
_(
"Can't detach process %u (error %u)"),
1833 (
unsigned) current_event.dwProcessId, (
unsigned) GetLastError ());
1838 if (detached && from_tty)
1844 (
unsigned) current_event.dwProcessId);
1874 sizeof (HMODULE), &cbNeeded) || !cbNeeded)
1885 cygwin_buf_t *pathbuf = alloca (exe_name_max_len *
sizeof (cygwin_buf_t));
1888 dh_buf, pathbuf, exe_name_max_len);
1890 error (
_(
"Error getting executable filename: %u."),
1891 (
unsigned) GetLastError ());
1892 if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, pathbuf, exe_name_ret,
1893 exe_name_max_len) < 0)
1894 error (
_(
"Error converting executable filename to POSIX: %d."), errno);
1898 dh_buf, exe_name_ret, exe_name_max_len);
1900 error (
_(
"Error getting executable filename: %u."),
1901 (
unsigned) GetLastError ());
1912 static char path[
__PMAX];
1916 char procexe[
sizeof (
"/proc/4294967295/exe")];
1918 xsnprintf (procexe,
sizeof (procexe),
"/proc/%u/exe", pid);
1919 nchars = readlink (procexe, path,
sizeof(path));
1920 if (nchars > 0 && nchars <
sizeof (path))
1922 path[nchars] =
'\0';
1963 HANDLE hconsole = CreateFile (
"CONOUT$", GENERIC_READ | GENERIC_WRITE,
1964 FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
1966 if (hconsole != INVALID_HANDLE_VALUE)
1968 CONSOLE_SCREEN_BUFFER_INFO sbinfo;
1970 CONSOLE_FONT_INFO cfi;
1974 GetConsoleScreenBufferInfo(hconsole, &sbinfo);
1975 si->dwXSize = sbinfo.srWindow.Right - sbinfo.srWindow.Left + 1;
1976 si->dwYSize = sbinfo.srWindow.Bottom - sbinfo.srWindow.Top + 1;
1978 si->dwXSize *= font_size.X;
1982 si->dwYSize *= font_size.Y;
1985 si->dwXCountChars = sbinfo.dwSize.X;
1986 si->dwYCountChars = sbinfo.dwSize.Y;
1987 si->dwFlags |= STARTF_USESIZE | STARTF_USECOUNTCHARS;
1989 *flags |= CREATE_NEW_CONSOLE;
1998 const char **p = (
const char **) a;
1999 const char **q = (
const char **) b;
2000 return strcasecmp (*p, *q);
2006 clear_win32_environment (
char **env)
2010 wchar_t *copy = NULL, *equalpos;
2012 for (i = 0; env[i] && *env[i]; i++)
2014 len = mbstowcs (NULL, env[i], 0) + 1;
2015 copy = (
wchar_t *)
xrealloc (copy, len *
sizeof (
wchar_t));
2016 mbstowcs (copy, env[i], len);
2017 equalpos = wcschr (copy,
L'=');
2020 SetEnvironmentVariableW (copy, NULL);
2033 char *allargs,
char **in_env,
int from_tty)
2037 cygwin_buf_t real_path[
__PMAX];
2038 cygwin_buf_t shell[
__PMAX];
2040 cygwin_buf_t *toexec;
2041 cygwin_buf_t *cygallargs;
2043 char **old_env = NULL;
2047 int ostdin, ostdout, ostderr;
2062 PROCESS_INFORMATION pi;
2068 error (
_(
"No executable specified, use `target exec'."));
2070 memset (&si, 0,
sizeof (si));
2071 si.cb =
sizeof (si);
2074 flags |= CREATE_NEW_PROCESS_GROUP;
2082 flags |= DEBUG_ONLY_THIS_PROCESS;
2083 if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, exec_file, real_path,
2084 __PMAX *
sizeof (cygwin_buf_t)) < 0)
2085 error (
_(
"Error starting executable: %d"), errno);
2088 len = mbstowcs (NULL, allargs, 0) + 1;
2089 if (len == (
size_t) -1)
2090 error (
_(
"Error starting executable: %d"), errno);
2091 cygallargs = (
wchar_t *) alloca (len *
sizeof (
wchar_t));
2092 mbstowcs (cygallargs, allargs, len);
2094 cygallargs = allargs;
2099 sh = getenv (
"SHELL");
2102 if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, sh, shell,
__PMAX) < 0)
2103 error (
_(
"Error starting executable via shell: %d"), errno);
2105 len =
sizeof (
L" -c 'exec '") + mbstowcs (NULL, exec_file, 0)
2106 + mbstowcs (NULL, allargs, 0) + 2;
2107 cygallargs = (
wchar_t *) alloca (len *
sizeof (
wchar_t));
2108 swprintf (cygallargs, len,
L" -c 'exec %s %s'", exec_file, allargs);
2110 len = (
sizeof (
" -c 'exec '") + strlen (exec_file)
2111 + strlen (allargs) + 2);
2112 cygallargs = (
char *) alloca (len);
2113 xsnprintf (cygallargs, len,
" -c 'exec %s %s'", exec_file, allargs);
2116 flags |= DEBUG_PROCESS;
2120 args = (cygwin_buf_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
2121 *
sizeof (wchar_t));
2122 wcscpy (args, toexec);
2123 wcscat (args,
L" ");
2124 wcscat (args, cygallargs);
2126 args = (cygwin_buf_t *) alloca (strlen (toexec) + strlen (cygallargs) + 2);
2127 strcpy (args, toexec);
2129 strcat (args, cygallargs);
2132 #ifdef CW_CVT_ENV_TO_WINENV
2134 w32_env = (PWCHAR) cygwin_internal (CW_CVT_ENV_TO_WINENV, in_env);
2135 if (w32_env != (PWCHAR) -1)
2136 flags |= CREATE_UNICODE_ENVIRONMENT;
2142 clear_win32_environment (
environ);
2146 cygwin_internal (CW_SYNC_WINENV);
2150 if (!inferior_io_terminal)
2151 tty = ostdin = ostdout = ostderr = -1;
2154 tty = open (inferior_io_terminal, O_RDWR |
O_NOCTTY);
2158 ostdin = ostdout = ostderr = -1;
2188 clear_win32_environment (in_env);
2191 cygwin_internal (CW_SYNC_WINENV);
2210 args_len = strlen (toexec) + 2 + strlen (allargs) + 2;
2211 args = alloca (args_len);
2212 xsnprintf (args, args_len,
"\"%s\" %s", toexec, allargs);
2214 flags |= DEBUG_ONLY_THIS_PROCESS;
2216 if (!inferior_io_terminal)
2217 tty = INVALID_HANDLE_VALUE;
2220 SECURITY_ATTRIBUTES sa;
2221 sa.nLength =
sizeof(sa);
2222 sa.lpSecurityDescriptor = 0;
2223 sa.bInheritHandle = TRUE;
2224 tty = CreateFileA (inferior_io_terminal, GENERIC_READ | GENERIC_WRITE,
2225 0, &sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
2226 if (tty == INVALID_HANDLE_VALUE)
2227 warning (
_(
"Warning: Failed to open TTY %s, error %#x."),
2228 inferior_io_terminal, (
unsigned) GetLastError ());
2232 si.hStdOutput = tty;
2234 si.dwFlags |= STARTF_USESTDHANDLES;
2242 for (envlen = 0, i = 0; in_env[i] && *in_env[i]; i++)
2243 envlen += strlen (in_env[i]) + 1;
2245 envsize =
sizeof (in_env[0]) * (i + 1);
2246 env = (
char **) alloca (envsize);
2247 memcpy (env, in_env, envsize);
2251 w32env = alloca (envlen + 1);
2254 for (temp = w32env, i = 0; env[i] && *env[i]; i++)
2256 strcpy (temp, env[i]);
2257 temp += strlen (temp) + 1;
2264 ret = CreateProcessA (0,
2274 if (tty != INVALID_HANDLE_VALUE)
2279 error (
_(
"Error creating process %s, (error %u)."),
2280 exec_file, (
unsigned) GetLastError ());
2282 CloseHandle (pi.hThread);
2283 CloseHandle (pi.hProcess);
2285 if (useshell && shell[0] !=
'\0')
2300 if (open_process_used)
2302 CHECK (CloseHandle (current_process_handle));
2303 open_process_used = 0;
2314 DEBUG_EVENTS ((
"gdb: GenerateConsoleCtrlEvent (CTRLC_EVENT, 0)\n"));
2315 CHECK (GenerateConsoleCtrlEvent (CTRL_C_EVENT, current_event.dwProcessId));
2328 DWORD lasterror = 0;
2330 if (writebuf != NULL)
2332 DEBUG_MEM ((
"gdb: write target memory, %s bytes at %s\n",
2334 success = WriteProcessMemory (current_process_handle,
2335 (LPVOID) (uintptr_t) memaddr, writebuf,
2338 lasterror = GetLastError ();
2339 FlushInstructionCache (current_process_handle,
2340 (LPCVOID) (uintptr_t) memaddr, len);
2344 DEBUG_MEM ((
"gdb: read target memory, %s bytes at %s\n",
2346 success = ReadProcessMemory (current_process_handle,
2347 (LPCVOID) (uintptr_t) memaddr, readbuf,
2350 lasterror = GetLastError ();
2353 if (!success && lasterror == ERROR_PARTIAL_COPY && done > 0)
2362 CHECK (TerminateProcess (current_process_handle, 0));
2368 if (!WaitForDebugEvent (¤t_event, INFINITE))
2370 if (current_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
2380 DEBUG_EVENTS ((
"gdb: windows_close, inferior_ptid=%d\n",
2388 static char buf[80];
2392 snprintf (buf,
sizeof (buf),
"Thread %d.0x%lx",
2407 struct obstack obstack;
2415 obstack_init (&obstack);
2417 for (so = solib_start.
next; so; so = so->
next)
2423 buf = obstack_finish (&obstack);
2424 len_avail = strlen (buf);
2425 if (offset >= len_avail)
2429 if (len > len_avail - offset)
2430 len = len_avail -
offset;
2431 memcpy (readbuf, buf + offset, len);
2434 obstack_free (&obstack, NULL);
2441 const char *annex,
gdb_byte *readbuf,
2452 writebuf, offset, len, xfered_len);
2456 readbuf, writebuf, offset, len,
2539 cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
2544 Set use of shell to start subprocess."),
_(
"\
2545 Show use of shell to start subprocess."), NULL,
2551 &cygwin_exceptions,
_(
"\
2552 Break when an exception is detected in the Cygwin DLL itself."),
_(
"\
2553 Show whether gdb breaks on exceptions in the Cygwin DLL itself."), NULL,
2560 Set creation of new console when creating child process."),
_(
"\
2561 Show creation of new console when creating child process."), NULL,
2567 Set creation of new group when creating child process."),
_(
"\
2568 Show creation of new group when creating child process."), NULL,
2574 Set whether to display execution in child process."),
_(
"\
2575 Show whether to display execution in child process."), NULL,
2581 Set whether to display kernel events in child process."),
_(
"\
2582 Show whether to display kernel events in child process."), NULL,
2588 Set whether to display memory accesses in child process."),
_(
"\
2589 Show whether to display memory accesses in child process."), NULL,
2595 &debug_exceptions,
_(
"\
2596 Set whether to display kernel exceptions in child process."),
_(
"\
2597 Show whether to display kernel exceptions in child process."), NULL,
2605 _(
"Display selectors infos."),
2619 _(
"Invalid register %d in cygwin_set_dr.\n"), i);
2621 debug_registers_changed = 1;
2622 debug_registers_used = 1;
2632 debug_registers_changed = 1;
2633 debug_registers_used = 1;
2647 static unsigned long
2650 return (
unsigned long) dr[6];
2657 static unsigned long
2660 return (
unsigned long) dr[7];
2674 return WaitForSingleObject (
thread_rec (tid, FALSE)->h, 0) == WAIT_OBJECT_0
2688 homedir = getenv (
"HOME");
2692 char *oldini = (
char *) alloca (strlen (homedir) +
2693 sizeof (
"/gdb.ini"));
2694 strcpy (oldini, homedir);
2695 p = strchr (oldini,
'\0');
2696 if (p > oldini && !IS_DIR_SEPARATOR (p[-1]))
2698 strcpy (p,
"gdb.ini");
2699 if (access (oldini, 0) == 0)
2701 int len = strlen (oldini);
2702 char *newini = alloca (len + 1);
2704 xsnprintf (newini, len + 1,
"%.*s.gdbinit",
2705 (
int) (len - (
sizeof (
"gdb.ini") - 1)), oldini);
2706 warning (
_(
"obsolete '%s' found. Rename to '%s'."), oldini, newini);
2736 bad_GetModuleFileNameExW (HANDLE w, HMODULE x, LPWSTR y, DWORD z)
2786 hm = LoadLibrary (
"kernel32.dll");
2790 GetProcAddress (hm,
"DebugActiveProcessStop");
2792 GetProcAddress (hm,
"DebugBreakProcess");
2794 GetProcAddress (hm,
"DebugSetProcessKillOnExit");
2796 GetProcAddress (hm,
"GetConsoleFontSize");
2798 GetProcAddress (hm,
"GetCurrentConsoleFont");
2817 hm = LoadLibrary (
"psapi.dll");
2821 GetProcAddress (hm,
"EnumProcessModules");
2823 GetProcAddress (hm,
"GetModuleInformation");
2838 cannot automatically find executable file or library to read symbols.\n\
2839 Use \"file\" or \"dll\" command to load executable/libraries directly."));
2842 hm = LoadLibrary (
"advapi32.dll");
2847 GetProcAddress (hm,
"LookupPrivilegeValueA");
2849 GetProcAddress (hm,
"AdjustTokenPrivileges");
struct gdbarch * target_gdbarch(void)
void add_target(struct target_ops *t)
void target_terminal_ours(void)
static void windows_set_console_info(STARTUPINFO *si, DWORD *flags)
struct thread_info * add_thread(ptid_t ptid)
#define I387_FOP_REGNUM(tdep)
static void do_windows_fetch_inferior_registers(struct regcache *regcache, int r)
#define GetCurrentConsoleFont
static enum target_xfer_status windows_xfer_partial(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
static ptid_t windows_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *ourstatus, int options)
static int set_process_privilege(const char *privilege, BOOL enable)
static void windows_add_all_dlls(void)
int ptid_equal(ptid_t ptid1, ptid_t ptid2)
static windows_thread_info thread_head
static struct target_ops * windows_target(void)
void delete_thread(ptid_t)
static BOOL WINAPI bad_EnumProcessModules(HANDLE w, HMODULE *x, DWORD y, LPDWORD z)
static DWORD WINAPI bad_GetModuleFileNameExA(HANDLE w, HMODULE x, LPSTR y, DWORD z)
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
#define context_offset(x)
static int windows_get_exec_module_filename(char *exe_name_ret, size_t exe_name_max_len)
void warning(const char *fmt,...)
char *(* to_pid_to_str)(struct target_ops *, ptid_t) TARGET_DEFAULT_FUNC(default_pid_to_str)
static segment_register_p_ftype * segment_register_p
void init_wait_for_inferior(void)
#define DebugBreakProcess
static DWORD WINAPI(* GetModuleFileNameEx)(HANDLE, HMODULE, LPSTR, DWORD)
void push_target(struct target_ops *t)
struct ui_file * gdb_stdout
void internal_error(const char *file, int line, const char *fmt,...)
struct thread_info * inferior_thread(void)
void print_sys_errmsg(const char *string, int errcode)
static BOOL WINAPI bad_DebugBreakProcess(HANDLE w)
static BOOL windows_continue(DWORD continue_status, int id, int killed)
void(* to_close)(struct target_ops *)
static char * windows_pid_to_exec_file(struct target_ops *self, int pid)
#define GetConsoleFontSize
static void windows_clear_solib(void)
int catch_errors(catch_errors_ftype *func, void *func_args, char *errstring, return_mask mask)
static enum target_xfer_status windows_xfer_shared_libraries(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
#define SO_NAME_MAX_PATH_SIZE
int gdbarch_num_regs(struct gdbarch *gdbarch)
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_NORETURN(noprocess())
char * target_pid_to_str(ptid_t ptid)
static int windows_get_tib_address(struct target_ops *self, ptid_t ptid, CORE_ADDR *addr)
enum gdb_signal stop_signal
void(* set_control)(unsigned long)
static BOOL WINAPI bad_DebugActiveProcessStop(DWORD w)
struct bfd * gdb_bfd_open(const char *name, const char *target, int fd)
struct x86_dr_low_type x86_dr_low
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
void inf_child_maybe_unpush_target(struct target_ops *ops)
int gdbarch_ps_regnum(struct gdbarch *gdbarch)
#define EnumProcessModules
CORE_ADDR(* get_addr)(int)
struct regcache * get_current_regcache(void)
void windows_set_context_register_offsets(const int *offsets)
static void windows_init_thread_list(void)
void printf_filtered(const char *format,...)
static int windows_thread_alive(struct target_ops *, ptid_t)
ptid_t ptid_build(int pid, long lwp, long tid)
static unsigned long cygwin_get_dr6(void)
static CORE_ADDR cygwin_get_dr(int i)
void(* to_files_info)(struct target_ops *) TARGET_DEFAULT_IGNORE()
static int exception_count
static int handle_output_debug_string(struct target_waitstatus *ourstatus)
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
static void display_selectors(char *args, int from_tty)
CORE_ADDR thread_local_base
struct cmd_list_element * setlist
static BOOL WINAPI bad_GetCurrentConsoleFont(HANDLE w, BOOL bMaxWindow, CONSOLE_FONT_INFO *f)
void(* set_addr)(int, CORE_ADDR)
#define DebugSetProcessKillOnExit
static void cygwin_set_dr(int i, CORE_ADDR addr)
static void windows_create_inferior(struct target_ops *ops, char *exec_file, char *allargs, char **in_env, int from_tty)
static char * get_image_name(HANDLE h, void *address, int unicode)
static void windows_attach(struct target_ops *ops, const char *args, int from_tty)
#define GetModuleFileNameEx_name
static void windows_free_so(struct so_list *so)
const char * get_inferior_io_terminal(void)
void gdb_bfd_unref(struct bfd *abfd)
void initialize_file_ftype(void)
static void windows_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal sig)
unsigned long(* get_status)(void)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t err
int( segment_register_p_ftype)(int regnum)
static void windows_files_info(struct target_ops *ignore)
static DWORD fake_create_process(void)
void target_terminal_inferior(void)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
void(* to_resume)(struct target_ops *, ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
static BOOL WINAPI bad_GetModuleInformation(HANDLE w, HMODULE x, LPMODULEINFO y, DWORD z)
struct cmd_list_element * showlist
static BOOL WINAPI bad_OpenProcessToken(HANDLE w, DWORD x, PHANDLE y)
static void windows_mourn_inferior(struct target_ops *ops)
struct inferior_control_state control
void puts_filtered(const char *string)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
#define GetModuleInformation
char so_original_name[SO_NAME_MAX_PATH_SIZE]
ptid_t pid_to_ptid(int pid)
#define I387_FISEG_REGNUM(tdep)
void complaint(struct complaints **complaints, const char *fmt,...)
union target_waitstatus::@161 value
static int display_selector(HANDLE thread, DWORD sel)
char * pulongest(ULONGEST u)
struct inferior * find_inferior_pid(int pid)
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
#define DebugActiveProcessStop
char so_name[SO_NAME_MAX_PATH_SIZE]
struct cmd_list_element * info_w32_cmdlist
enum gdb_signal gdb_signal_from_host(int)
static HANDLE current_process_handle
#define bad_GetModuleFileNameEx
void target_mourn_inferior(void)
static CONTEXT saved_context
static int startswith(const char *string, const char *pattern)
void disable_breakpoints_in_shlibs(void)
static int have_saved_context
enum target_xfer_status(* to_xfer_partial)(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) TARGET_DEFAULT_RETURN(TARGET_XFER_E_IO)
static void do_initial_windows_stuff(struct target_ops *ops, DWORD pid, int attaching)
static DWORD main_thread_id
static struct so_list * windows_make_so(const char *name, LPVOID load_addr)
static void do_windows_store_inferior_registers(const struct regcache *regcache, int r)
void printf_unfiltered(const char *format,...)
int(* to_get_tib_address)(struct target_ops *, ptid_t ptid, CORE_ADDR *addr) TARGET_DEFAULT_NORETURN(tcomplain())
static void windows_kill_inferior(struct target_ops *)
void(* to_detach)(struct target_ops *ops, const char *, int) TARGET_DEFAULT_IGNORE()
initialize_file_ftype _initialize_loadable
void inf_child_mourn_inferior(struct target_ops *ops)
unsigned long(* get_control)(void)
static int handle_unload_dll(void *dummy)
static BOOL WINAPI ctrl_c_handler(DWORD event_type)
char *(* to_pid_to_exec_file)(struct target_ops *, int pid) TARGET_DEFAULT_RETURN(NULL)
int target_is_pushed(struct target_ops *t)
char * normal_pid_to_str(ptid_t ptid)
int ptid_get_pid(ptid_t ptid)
static int envvar_cmp(const void *a, const void *b)
static const int * mappings
#define AdjustTokenPrivileges
static unsigned long cygwin_get_dr7(void)
PTR xrealloc(PTR ptr, size_t size)
static ptid_t windows_get_ada_task_ptid(struct target_ops *self, long lwp, long thread)
void target_terminal_init(void)
static int debug_registers_changed
const char const char int
struct target_ops * inf_child_target(void)
static int windows_initialization_done
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
long ptid_get_tid(ptid_t ptid)
void(* to_mourn_inferior)(struct target_ops *) TARGET_DEFAULT_FUNC(default_mourn_inferior)
struct windows_thread_info_struct * next
static enum target_xfer_status windows_xfer_memory(gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
void(* to_stop)(struct target_ops *, ptid_t) TARGET_DEFAULT_IGNORE()
static void windows_detach(struct target_ops *ops, const char *args, int from_tty)
static void check(BOOL ok, const char *file, int line)
int xsnprintf(char *str, size_t size, const char *format,...)
void clear_proceed_status(int step)
enum target_waitkind kind
void(* to_kill)(struct target_ops *) TARGET_DEFAULT_NORETURN(noprocess())
#define _CYGWIN_SIGNAL_STRING
struct complaints * symfile_complaints
static int debug_exceptions
static DEBUG_EVENT current_event
void detach_inferior(int pid)
static char * windows_pid_to_str(struct target_ops *ops, ptid_t ptid)
static void windows_delete_thread(ptid_t ptid, DWORD exit_code)
const char * host_address_to_string(const void *addr)
static enum gdb_signal last_sig
static int open_process_used
void registers_changed(void)
static int handle_load_dll(void *dummy)
static windows_thread_info * windows_add_thread(ptid_t ptid, HANDLE h, void *tlb)
void(* to_create_inferior)(struct target_ops *, char *, char *, char **, int)
#define obstack_grow_str(OBSTACK, STRING)
struct thread_suspend_state suspend
int parse_pid_to_attach(const char *args)
static void windows_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int r)
initialize_file_ftype _initialize_windows_nat
static void windows_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int r)
struct inferior * current_inferior(void)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
char * get_exec_file(int err)
unsigned long long ULONGEST
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static void windows_close(struct target_ops *self)
struct section_addr_info * addrs
void resume(enum gdb_signal sig)
#define obstack_grow_str0(OBSTACK, STRING)
const char * core_addr_to_string(const CORE_ADDR addr)
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
#define DEBUG_EXCEPTION_SIMPLE(x)
void x86_use_watchpoints(struct target_ops *t)
static windows_thread_info * thread_rec(DWORD id, int get_context)
void wait_for_inferior(void)
int(* to_thread_alive)(struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN(0)
#define CONTEXT_DEBUGGER_DR
void(* to_attach)(struct target_ops *ops, const char *, int)
struct windows_thread_info_struct windows_thread_info
void gdb_flush(struct ui_file *file)
static void windows_stop(struct target_ops *self, ptid_t)
static windows_thread_info * current_thread
void x86_cleanup_dregs(void)
static struct so_list solib_start * solib_end
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
static int handle_exception(struct target_waitstatus *ourstatus)
initialize_file_ftype _initialize_check_for_gdb_ini
ptid_t(* to_get_ada_task_ptid)(struct target_ops *, long lwp, long thread) TARGET_DEFAULT_FUNC(default_get_ada_task_ptid)
int target_read_string(CORE_ADDR memaddr, char **string, int len, int *errnop)
static int get_windows_debug_event(struct target_ops *ops, int pid, struct target_waitstatus *ourstatus)
void error(const char *fmt,...)
static void cygwin_set_dr7(unsigned long val)
void init_w32_command_list(void)
static int debug_registers_used
static COORD WINAPI bad_GetConsoleFontSize(HANDLE w, DWORD nFont)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int int rusage_t pid_t pid
static BOOL WINAPI bad_DebugSetProcessKillOnExit(BOOL w)
struct target_ops * beneath
void windows_xfer_shared_library(const char *so_name, CORE_ADDR load_addr, struct gdbarch *gdbarch, struct obstack *obstack)
void inferior_appeared(struct inferior *inf, int pid)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
int(* deprecated_ui_loop_hook)(int signo)
void windows_set_segment_register_p(segment_register_p_ftype *fun)
void init_thread_list(void)
const ULONGEST const LONGEST len
#define LookupPrivilegeValueA
LONGEST parse_and_eval_long(const char *exp)