35 #include <sys/types.h> 42 #include <sys/cygwin.h> 43 #include <cygwin/version.h> 48 #include "filenames.h" 72 #define AdjustTokenPrivileges dyn_AdjustTokenPrivileges 73 #define DebugActiveProcessStop dyn_DebugActiveProcessStop 74 #define DebugBreakProcess dyn_DebugBreakProcess 75 #define DebugSetProcessKillOnExit dyn_DebugSetProcessKillOnExit 76 #define EnumProcessModules dyn_EnumProcessModules 77 #define GetModuleInformation dyn_GetModuleInformation 78 #define LookupPrivilegeValueA dyn_LookupPrivilegeValueA 79 #define OpenProcessToken dyn_OpenProcessToken 80 #define GetConsoleFontSize dyn_GetConsoleFontSize 81 #define GetCurrentConsoleFont dyn_GetCurrentConsoleFont 85 DWORD, PTOKEN_PRIVILEGES,
103 LPMODULEINFO, DWORD);
113 CONSOLE_FONT_INFO *);
121 #undef GetModuleFileNameEx 124 # define __PMAX (MAX_PATH + 1) 127 # define STARTUPINFO STARTUPINFOA 128 # define CreateProcess CreateProcessA 129 # define GetModuleFileNameEx_name "GetModuleFileNameExA" 130 # define bad_GetModuleFileNameEx bad_GetModuleFileNameExA 132 # define __PMAX PATH_MAX 137 typedef wchar_t cygwin_buf_t;
141 # define STARTUPINFO STARTUPINFOW 142 # define CreateProcess CreateProcessW 143 # define GetModuleFileNameEx_name "GetModuleFileNameExW" 144 # define bad_GetModuleFileNameEx bad_GetModuleFileNameExW 155 #ifndef _GNU_H_WINDOWS_H 162 #ifndef CONTEXT_EXTENDED_REGISTERS 165 #define CONTEXT_EXTENDED_REGISTERS 0 168 #define CONTEXT_DEBUGGER_DR CONTEXT_FULL | CONTEXT_FLOATING_POINT \ 169 | CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS \ 170 | CONTEXT_EXTENDED_REGISTERS 172 static uintptr_t
dr[8];
177 #define DR6_CLEAR_VALUE 0xffff0ff0 183 #define MS_VC_EXCEPTION 0x406d1388 194 #ifndef _CYGWIN_SIGNAL_STRING 195 #define _CYGWIN_SIGNAL_STRING "cYgSiGw00f" 198 #define CHECK(x) check (x, __FILE__,__LINE__) 199 #define DEBUG_EXEC(x) if (debug_exec) printf_unfiltered x 200 #define DEBUG_EVENTS(x) if (debug_events) printf_unfiltered x 201 #define DEBUG_MEM(x) if (debug_memory) printf_unfiltered x 202 #define DEBUG_EXCEPT(x) if (debug_exceptions) printf_unfiltered x 252 static int cygwin_exceptions = 0;
297 {EXCEPTION_ACCESS_VIOLATION, GDB_SIGNAL_SEGV},
298 {STATUS_STACK_OVERFLOW, GDB_SIGNAL_SEGV},
299 {EXCEPTION_BREAKPOINT, GDB_SIGNAL_TRAP},
300 {DBG_CONTROL_C, GDB_SIGNAL_INT},
301 {EXCEPTION_SINGLE_STEP, GDB_SIGNAL_TRAP},
302 {STATUS_FLOAT_DIVIDE_BY_ZERO, GDB_SIGNAL_FPE},
303 {-1, GDB_SIGNAL_UNKNOWN}};
327 (
unsigned) GetLastError ());
345 if (SuspendThread (th->
h) == (DWORD) -1)
347 DWORD
err = GetLastError ();
355 if (
err != ERROR_INVALID_HANDLE
356 &&
err != ERROR_ACCESS_DENIED)
357 warning (
_(
"SuspendThread (tid=0x%x) failed." 359 (
unsigned)
id, (
unsigned)
err);
365 else if (get_context < 0)
400 th->
context.ContextFlags = CONTEXT_DEBUG_REGISTERS;
423 while (th->
next != NULL)
455 if (th->
next != NULL)
483 __COPY_CONTEXT_SIZE);
605 WIN32_FIND_DATA w32_fd;
606 HANDLE h = FindFirstFile(
name, &w32_fd);
608 if (h == INVALID_HANDLE_VALUE)
614 if (GetCurrentDirectory (MAX_PATH + 1, cwd))
616 p = strrchr (buf,
'\\');
619 SetCurrentDirectory (buf);
620 GetFullPathName (w32_fd.cFileName, MAX_PATH, buf, &p);
621 SetCurrentDirectory (cwd);
624 if (strcasecmp (buf,
"ntdll.dll") == 0)
626 GetSystemDirectory (buf,
sizeof (buf));
627 strcat (buf,
"\\ntdll.dll");
633 if (access (
name, F_OK) != 0)
635 if (strcasecmp (
name,
"ntdll.dll") == 0)
638 GetSystemDirectoryW (buf,
sizeof (buf) /
sizeof (
wchar_t));
639 wcscat (buf,
L"\\ntdll.dll");
643 GetSystemDirectoryA (buf,
sizeof (buf) /
sizeof (
wchar_t));
644 strcat (buf,
"\\ntdll.dll");
658 cygwin_conv_path (CCP_WIN_W_TO_POSIX, buf, so->
so_name,
662 char *rname = realpath (
name, NULL);
669 error (
_(
"dll path too long"));
672 p = strchr (so->
so_name,
'\0') - (
sizeof (
"/cygwin1.dll") - 1);
673 if (p >= so->
so_name && strcasecmp (p,
"/cygwin1.dll") == 0)
675 asection *text = NULL;
683 if (bfd_check_format (
abfd.get (), bfd_object))
684 text = bfd_get_section_by_name (
abfd.get (),
".text");
692 cygwin_load_start = (
CORE_ADDR) (uintptr_t) ((
char *)
694 cygwin_load_end = cygwin_load_start + bfd_section_size (
abfd.get (),
708 static char buf[(2 *
__PMAX) + 1];
710 DWORD
size = unicode ?
sizeof (WCHAR) :
sizeof (
char);
724 if (!ReadProcessMemory (h, address, &address_ptr,
725 sizeof (address_ptr), &done)
726 || done !=
sizeof (address_ptr) || !address_ptr)
730 while (ReadProcessMemory (h, address_ptr + len++ *
size, &b,
size, &done)
731 && (b[0] != 0 || b[
size - 1] != 0) && done ==
size)
735 ReadProcessMemory (h, address_ptr, buf, len, &done);
738 WCHAR *unicode_address = (WCHAR *) alloca (len *
sizeof (WCHAR));
739 ReadProcessMemory (h, address_ptr, unicode_address, len *
sizeof (WCHAR),
742 wcstombs (buf, unicode_address,
__PMAX);
744 WideCharToMultiByte (CP_ACP, 0, unicode_address, len, buf,
sizeof buf,
771 event->lpImageName, event->fUnicode);
807 for (so = &solib_start; so->
next != NULL; so = so->
next)
857 solib_start.next = NULL;
864 uintptr_t event_id = 0;
865 char *endargs = NULL;
868 error (
_(
"signal-event requires an argument (integer event id)"));
870 event_id = strtoumax (args, &endargs, 10);
872 if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
873 ((HANDLE) event_id == INVALID_HANDLE_VALUE))
874 error (
_(
"Failed to convert `%s' to event id"), args);
876 SetEvent ((HANDLE) event_id);
877 CloseHandle ((HANDLE) event_id);
900 char *p = strchr (s,
'\0');
902 if (p > s && *--p ==
'\n')
928 retval = strtoul (p, &p, 0);
931 else if ((x = (LPCVOID) (uintptr_t) strtoull (p, NULL, 0))
934 __COPY_CONTEXT_SIZE, &n)
935 && n == __COPY_CONTEXT_SIZE)
950 if (GetThreadSelectorEntry (thread, sel, &info))
954 if (!info.HighWord.Bits.Pres)
959 base = (info.HighWord.Bits.BaseHi << 24) +
960 (info.HighWord.Bits.BaseMid << 16)
962 limit = (info.HighWord.Bits.LimitHi << 16) + info.LimitLow;
963 if (info.HighWord.Bits.Granularity)
964 limit = (limit << 12) | 0xfff;
966 if (info.HighWord.Bits.Default_Big)
970 switch ((info.HighWord.Bits.Type & 0xf) >> 1)
999 if ((info.HighWord.Bits.Type & 0x1) == 0)
1002 if ((info.HighWord.Bits.Type & 0x10) == 0)
1005 if (info.HighWord.Bits.Granularity)
1013 DWORD
err = GetLastError ();
1014 if (
err == ERROR_NOT_SUPPORTED)
1061 #define DEBUG_EXCEPTION_SIMPLE(x) if (debug_exceptions) \ 1062 printf_unfiltered ("gdb: Target exception %s at %s\n", x, \ 1063 host_address_to_string (\ 1064 current_event.u.Exception.ExceptionRecord.ExceptionAddress)) 1069 EXCEPTION_RECORD *rec = &
current_event.u.Exception.ExceptionRecord;
1070 DWORD
code = rec->ExceptionCode;
1080 case EXCEPTION_ACCESS_VIOLATION:
1082 ourstatus->
value.
sig = GDB_SIGNAL_SEGV;
1096 if ((!cygwin_exceptions && (addr >= cygwin_load_start
1097 && addr < cygwin_load_end))
1104 case STATUS_STACK_OVERFLOW:
1106 ourstatus->
value.
sig = GDB_SIGNAL_SEGV;
1108 case STATUS_FLOAT_DENORMAL_OPERAND:
1110 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1112 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
1114 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1116 case STATUS_FLOAT_INEXACT_RESULT:
1118 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1120 case STATUS_FLOAT_INVALID_OPERATION:
1122 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1124 case STATUS_FLOAT_OVERFLOW:
1126 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1128 case STATUS_FLOAT_STACK_CHECK:
1130 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1132 case STATUS_FLOAT_UNDERFLOW:
1134 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1136 case STATUS_FLOAT_DIVIDE_BY_ZERO:
1138 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1140 case STATUS_INTEGER_DIVIDE_BY_ZERO:
1142 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1144 case STATUS_INTEGER_OVERFLOW:
1146 ourstatus->
value.
sig = GDB_SIGNAL_FPE;
1148 case EXCEPTION_BREAKPOINT:
1150 ourstatus->
value.
sig = GDB_SIGNAL_TRAP;
1154 ourstatus->
value.
sig = GDB_SIGNAL_INT;
1156 case DBG_CONTROL_BREAK:
1158 ourstatus->
value.
sig = GDB_SIGNAL_INT;
1160 case EXCEPTION_SINGLE_STEP:
1162 ourstatus->
value.
sig = GDB_SIGNAL_TRAP;
1164 case EXCEPTION_ILLEGAL_INSTRUCTION:
1166 ourstatus->
value.
sig = GDB_SIGNAL_ILL;
1168 case EXCEPTION_PRIV_INSTRUCTION:
1170 ourstatus->
value.
sig = GDB_SIGNAL_ILL;
1172 case EXCEPTION_NONCONTINUABLE_EXCEPTION:
1174 ourstatus->
value.
sig = GDB_SIGNAL_ILL;
1177 if (rec->NumberParameters >= 3
1178 && (rec->ExceptionInformation[0] & 0xffffffff) == 0x1000)
1180 DWORD named_thread_id;
1186 thread_name_target = rec->ExceptionInformation[1];
1187 named_thread_id = (DWORD) (0xffffffff & rec->ExceptionInformation[2]);
1189 if (named_thread_id == (DWORD) -1)
1192 named_thread =
thread_rec (named_thread_id, 0);
1193 if (named_thread != NULL)
1195 int thread_name_len;
1199 &thread_name, 1025, NULL);
1200 if (thread_name_len > 0)
1202 thread_name[thread_name_len - 1] =
'\0';
1204 named_thread->
name = thread_name;
1207 xfree (thread_name);
1209 ourstatus->
value.
sig = GDB_SIGNAL_TRAP;
1219 (
unsigned)
current_event.u.Exception.ExceptionRecord.ExceptionCode,
1221 current_event.u.Exception.ExceptionRecord.ExceptionAddress));
1222 ourstatus->
value.
sig = GDB_SIGNAL_UNKNOWN;
1241 DEBUG_EVENTS ((
"ContinueDebugEvent (cpid=%d, ctid=0x%x, %s);\n",
1244 continue_status == DBG_CONTINUE ?
1245 "DBG_CONTINUE" :
"DBG_EXCEPTION_NOT_HANDLED"));
1248 if ((
id == -1 ||
id == (
int) th->
id)
1253 th->
context.ContextFlags |= CONTEXT_DEBUG_REGISTERS;
1265 if (GetExitCodeThread (th->
h, &ec)
1266 && ec == STILL_ACTIVE)
1276 (void) ResumeThread (th->
h);
1285 error (
_(
"Failed to resume program execution" 1286 " (ContinueDebugEvent failed, error %u)"),
1287 (
unsigned int) GetLastError ());
1304 error (
_(
"OpenProcess call failed, GetLastError = %u"),
1305 (
unsigned) GetLastError ());
1319 ptid_t ptid,
int step,
enum gdb_signal sig)
1322 DWORD continue_status = DBG_CONTINUE;
1332 if (sig != GDB_SIGNAL_0)
1334 if (
current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT)
1336 DEBUG_EXCEPT((
"Cannot continue with signal %d here.\n",sig));
1339 continue_status = DBG_EXCEPTION_NOT_HANDLED;
1349 if (
xlate[i].us == sig)
1353 continue_status = DBG_EXCEPTION_NOT_HANDLED;
1356 if (continue_status == DBG_CONTINUE)
1358 DEBUG_EXCEPT((
"Cannot continue with signal %d.\n",sig));
1362 DEBUG_EXCEPT((
"Can only continue with received signal %d.\n",
1368 DEBUG_EXEC ((
"gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
1420 if (event_type != CTRL_C_EVENT && event_type != CTRL_BREAK_EVENT)
1429 warning (
_(
"Could not interrupt program. " 1430 "Press Ctrl-c in the program console."));
1443 DWORD continue_status, event_code;
1446 DWORD thread_id = 0;
1450 if (!(debug_event = WaitForDebugEvent (&
current_event, 1000)))
1454 continue_status = DBG_CONTINUE;
1463 case CREATE_THREAD_DEBUG_EVENT:
1464 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1467 "CREATE_THREAD_DEBUG_EVENT"));
1492 case EXIT_THREAD_DEBUG_EVENT:
1493 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1496 "EXIT_THREAD_DEBUG_EVENT"));
1503 th = &dummy_thread_info;
1507 case CREATE_PROCESS_DEBUG_EVENT:
1508 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1511 "CREATE_PROCESS_DEBUG_EVENT"));
1530 case EXIT_PROCESS_DEBUG_EVENT:
1531 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1534 "EXIT_PROCESS_DEBUG_EVENT"));
1539 error (
_(
"During startup program exited with code 0x%x."),
1550 case LOAD_DLL_DEBUG_EVENT:
1551 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1554 "LOAD_DLL_DEBUG_EVENT"));
1564 case UNLOAD_DLL_DEBUG_EVENT:
1565 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1568 "UNLOAD_DLL_DEBUG_EVENT"));
1577 case EXCEPTION_DEBUG_EVENT:
1578 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1581 "EXCEPTION_DEBUG_EVENT"));
1588 continue_status = DBG_EXCEPTION_NOT_HANDLED;
1594 continue_status = DBG_CONTINUE;
1599 case OUTPUT_DEBUG_STRING_EVENT:
1600 DEBUG_EVENTS ((
"gdb: kernel event for pid=%u tid=0x%x code=%s)\n",
1603 "OUTPUT_DEBUG_STRING_EVENT"));
1708 HMODULE dummy_hmodule;
1714 sizeof (HMODULE), &cb_needed) == 0)
1720 hmodules = (HMODULE *) alloca (cb_needed);
1722 cb_needed, &cb_needed) == 0)
1725 for (i = 1; i < (int) (cb_needed /
sizeof (HMODULE)); i++)
1729 wchar_t dll_name[
__PMAX];
1736 &mi,
sizeof (mi)) == 0)
1739 dll_name,
sizeof (dll_name)) == 0)
1765 for (i = 0; i <
sizeof (
dr) /
sizeof (
dr[0]); i++)
1768 cygwin_load_start = cygwin_load_end = 0;
1781 inf->attach_flag = attaching;
1839 HANDLE token_hdl = NULL;
1841 TOKEN_PRIVILEGES new_priv, orig_priv;
1846 TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
1853 new_priv.PrivilegeCount = 1;
1854 new_priv.Privileges[0].Luid = restore_priv;
1855 new_priv.Privileges[0].Attributes =
enable ? SE_PRIVILEGE_ENABLED : 0;
1858 sizeof orig_priv, &orig_priv, &
size))
1866 if (
enable && GetLastError () == ERROR_NOT_ALL_ASSIGNED)
1870 ret = orig_priv.Privileges[0].Attributes == SE_PRIVILEGE_ENABLED ? 1 : 0;
1874 CloseHandle (token_hdl);
1892 "fail on Windows NT/2K/XP\n");
1896 ok = DebugActiveProcess (
pid);
1903 pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID,
pid);
1906 ok = DebugActiveProcess (
pid);
1911 error (
_(
"Can't attach to process."));
1943 error (
_(
"Can't detach process %u (error %u)"),
1944 (
unsigned)
current_event.dwProcessId, (
unsigned) GetLastError ());
1949 if (detached && from_tty)
1985 sizeof (HMODULE), &cbNeeded) || !cbNeeded)
1996 cygwin_buf_t *pathbuf = (cygwin_buf_t *) alloca (exe_name_max_len *
sizeof (cygwin_buf_t));
1999 dh_buf, pathbuf, exe_name_max_len);
2001 error (
_(
"Error getting executable filename: %u."),
2002 (
unsigned) GetLastError ());
2003 if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, pathbuf, exe_name_ret,
2004 exe_name_max_len) < 0)
2005 error (
_(
"Error converting executable filename to POSIX: %d."), errno);
2009 dh_buf, exe_name_ret, exe_name_max_len);
2011 error (
_(
"Error getting executable filename: %u."),
2012 (
unsigned) GetLastError ());
2023 static char path[
__PMAX];
2027 char procexe[
sizeof (
"/proc/4294967295/exe")];
2029 xsnprintf (procexe,
sizeof (procexe),
"/proc/%u/exe",
pid);
2030 nchars = readlink (procexe, path,
sizeof(path));
2031 if (nchars > 0 && nchars <
sizeof (path))
2033 path[nchars] =
'\0';
2054 inf->attach_flag ?
"attached" :
"child",
2074 HANDLE hconsole = CreateFile (
"CONOUT$", GENERIC_READ | GENERIC_WRITE,
2075 FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
2077 if (hconsole != INVALID_HANDLE_VALUE)
2079 CONSOLE_SCREEN_BUFFER_INFO sbinfo;
2081 CONSOLE_FONT_INFO cfi;
2085 GetConsoleScreenBufferInfo(hconsole, &sbinfo);
2086 si->dwXSize = sbinfo.srWindow.Right - sbinfo.srWindow.Left + 1;
2087 si->dwYSize = sbinfo.srWindow.Bottom - sbinfo.srWindow.Top + 1;
2089 si->dwXSize *= font_size.X;
2093 si->dwYSize *= font_size.Y;
2096 si->dwXCountChars = sbinfo.dwSize.X;
2097 si->dwYCountChars = sbinfo.dwSize.Y;
2098 si->dwFlags |= STARTF_USESIZE | STARTF_USECOUNTCHARS;
2100 *
flags |= CREATE_NEW_CONSOLE;
2109 const char **p = (
const char **) a;
2110 const char **q = (
const char **) b;
2111 return strcasecmp (*p, *q);
2117 clear_win32_environment (
char **env)
2121 wchar_t *copy = NULL, *equalpos;
2123 for (i = 0; env[i] && *env[i]; i++)
2125 len = mbstowcs (NULL, env[i], 0) + 1;
2126 copy = (
wchar_t *)
xrealloc (copy, len *
sizeof (
wchar_t));
2127 mbstowcs (copy, env[i], len);
2128 equalpos = wcschr (copy,
L'=');
2131 SetEnvironmentVariableW (copy, NULL);
2217 int *fd, ref_fd = -2;
2219 const char *fname = redir_string + 1;
2220 int rc = *redir_string;
2235 fd = (rc ==
'2') ?
err : out;
2236 mode = O_WRONLY | O_CREAT;
2249 if (*fname ==
'&' &&
'0' <= fname[1] && fname[1] <=
'9')
2253 ref_fd = (int) strtol (fname + 1, &fdtail, 10);
2254 if (fdtail > fname + 1 && *fdtail ==
'\0')
2257 if ((ref_fd == 0 && (fd == out || fd ==
err))
2258 || ((ref_fd == 1 || ref_fd == 2) && fd == inp))
2265 else if (ref_fd == 1)
2267 else if (ref_fd == 2)
2287 *fd = _open (fname, mode, _S_IREAD | _S_IWRITE);
2291 else if (ref_fd == -1)
2295 *fd = _dup (ref_fd);
2301 if ((mode & O_APPEND) != 0)
2302 _lseek (*fd, 0
L, SEEK_END);
2311 char buf[
__PMAX + 2 + 5];
2313 const char *start = s;
2317 if ((*start ==
'>' || *start ==
'1' || *start ==
'2')
2321 if (*s ==
'>' && *start !=
'>')
2324 else if (*start ==
'0' && *s ==
'<')
2329 while (isspace (*s))
2342 else if (*s == quote)
2350 else if (*s ==
'\\')
2356 else if (isspace (*s) && !quote)
2360 if (d - buf >=
sizeof (buf) - 1)
2362 errno = ENAMETOOLONG;
2371 if (d[-1] ==
'>' || d[-1] ==
'<')
2385 int *inp,
int *out,
int *
err)
2387 const char *s = cmd_orig;
2390 bool retval =
false;
2392 while (isspace (*s))
2401 else if (*s == quote)
2404 else if (*s ==
'\\')
2412 if (*s ==
'<' || *s ==
'>' 2413 || ((*s ==
'1' || *s ==
'2') && s[1] ==
'>')
2414 || (*s ==
'0' && s[1] ==
'<'))
2444 cygwin_buf_t real_path[
__PMAX];
2445 cygwin_buf_t shell[
__PMAX];
2446 cygwin_buf_t infcwd[
__PMAX];
2448 cygwin_buf_t *toexec;
2449 cygwin_buf_t *cygallargs;
2451 char **old_env = NULL;
2455 int ostdin, ostdout, ostderr;
2460 char *
args, *allargs_copy;
2461 size_t args_len, allargs_len;
2462 int fd_inp = -1, fd_out = -1, fd_err = -1;
2463 HANDLE tty = INVALID_HANDLE_VALUE;
2464 HANDLE inf_stdin = INVALID_HANDLE_VALUE;
2465 HANDLE inf_stdout = INVALID_HANDLE_VALUE;
2466 HANDLE inf_stderr = INVALID_HANDLE_VALUE;
2467 bool redirected =
false;
2475 const char *allargs = origallargs.c_str ();
2476 PROCESS_INFORMATION pi;
2482 error (
_(
"No executable specified, use `target exec'."));
2486 if (inferior_cwd != NULL)
2490 std::replace (expanded_infcwd.begin (), expanded_infcwd.end (),
2492 inferior_cwd = expanded_infcwd.c_str ();
2495 memset (&si, 0,
sizeof (si));
2496 si.cb =
sizeof (si);
2499 flags |= CREATE_NEW_PROCESS_GROUP;
2507 flags |= DEBUG_ONLY_THIS_PROCESS;
2508 if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, exec_file, real_path,
2509 __PMAX *
sizeof (cygwin_buf_t)) < 0)
2510 error (
_(
"Error starting executable: %d"), errno);
2513 len = mbstowcs (NULL, allargs, 0) + 1;
2514 if (len == (
size_t) -1)
2515 error (
_(
"Error starting executable: %d"), errno);
2516 cygallargs = (
wchar_t *) alloca (len *
sizeof (
wchar_t));
2517 mbstowcs (cygallargs, allargs, len);
2519 cygallargs = allargs;
2524 sh = getenv (
"SHELL");
2527 if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, sh, shell,
__PMAX) < 0)
2528 error (
_(
"Error starting executable via shell: %d"), errno);
2530 len =
sizeof (
L" -c 'exec '") + mbstowcs (NULL, exec_file, 0)
2531 + mbstowcs (NULL, allargs, 0) + 2;
2532 cygallargs = (
wchar_t *) alloca (len *
sizeof (
wchar_t));
2533 swprintf (cygallargs, len,
L" -c 'exec %s %s'", exec_file, allargs);
2535 len = (
sizeof (
" -c 'exec '") + strlen (exec_file)
2536 + strlen (allargs) + 2);
2537 cygallargs = (
char *) alloca (len);
2538 xsnprintf (cygallargs, len,
" -c 'exec %s %s'", exec_file, allargs);
2541 flags |= DEBUG_PROCESS;
2544 if (inferior_cwd != NULL
2545 && cygwin_conv_path (CCP_POSIX_TO_WIN_W, inferior_cwd,
2546 infcwd, strlen (inferior_cwd)) < 0)
2547 error (
_(
"Error converting inferior cwd: %d"), errno);
2550 args = (cygwin_buf_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
2551 *
sizeof (wchar_t));
2552 wcscpy (
args, toexec);
2553 wcscat (
args,
L" ");
2554 wcscat (
args, cygallargs);
2556 args = (cygwin_buf_t *) alloca (strlen (toexec) + strlen (cygallargs) + 2);
2557 strcpy (
args, toexec);
2559 strcat (
args, cygallargs);
2562 #ifdef CW_CVT_ENV_TO_WINENV 2564 w32_env = (PWCHAR) cygwin_internal (CW_CVT_ENV_TO_WINENV, in_env);
2565 if (w32_env != (PWCHAR) -1)
2566 flags |= CREATE_UNICODE_ENVIRONMENT;
2572 clear_win32_environment (
environ);
2576 cygwin_internal (CW_SYNC_WINENV);
2580 if (!inferior_io_terminal)
2581 tty = ostdin = ostdout = ostderr = -1;
2584 tty = open (inferior_io_terminal, O_RDWR |
O_NOCTTY);
2588 ostdin = ostdout = ostderr = -1;
2609 inferior_cwd != NULL ? infcwd : NULL,
2619 clear_win32_environment (in_env);
2622 cygwin_internal (CW_SYNC_WINENV);
2636 allargs_len = strlen (allargs);
2637 allargs_copy = strcpy ((
char *) alloca (allargs_len + 1), allargs);
2638 if (strpbrk (allargs_copy,
"<>") != NULL)
2644 &fd_inp, &fd_out, &fd_err);
2646 warning (
_(
"Error in redirection: %s."), strerror (errno));
2649 allargs_len = strlen (allargs_copy);
2653 if (inferior_io_terminal
2654 && !(fd_inp >= 0 && fd_out >= 0 && fd_err >= 0))
2656 SECURITY_ATTRIBUTES sa;
2657 sa.nLength =
sizeof(sa);
2658 sa.lpSecurityDescriptor = 0;
2659 sa.bInheritHandle = TRUE;
2660 tty = CreateFileA (inferior_io_terminal, GENERIC_READ | GENERIC_WRITE,
2661 0, &sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
2662 if (tty == INVALID_HANDLE_VALUE)
2663 warning (
_(
"Warning: Failed to open TTY %s, error %#x."),
2664 inferior_io_terminal, (
unsigned) GetLastError ());
2666 if (redirected || tty != INVALID_HANDLE_VALUE)
2669 si.hStdInput = (HANDLE) _get_osfhandle (fd_inp);
2670 else if (tty != INVALID_HANDLE_VALUE)
2673 si.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
2675 si.hStdOutput = (HANDLE) _get_osfhandle (fd_out);
2676 else if (tty != INVALID_HANDLE_VALUE)
2677 si.hStdOutput = tty;
2679 si.hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE);
2681 si.hStdError = (HANDLE) _get_osfhandle (fd_err);
2682 else if (tty != INVALID_HANDLE_VALUE)
2685 si.hStdError = GetStdHandle (STD_ERROR_HANDLE);
2686 si.dwFlags |= STARTF_USESTDHANDLES;
2694 args_len = strlen (toexec) + 2 + allargs_len + 2;
2695 args = (
char *) alloca (args_len);
2696 xsnprintf (
args, args_len,
"\"%s\" %s", toexec, allargs_copy);
2698 flags |= DEBUG_ONLY_THIS_PROCESS;
2704 for (envlen = 0, i = 0; in_env[i] && *in_env[i]; i++)
2705 envlen += strlen (in_env[i]) + 1;
2707 envsize =
sizeof (in_env[0]) * (i + 1);
2708 env = (
char **) alloca (envsize);
2709 memcpy (env, in_env, envsize);
2713 w32env = (
char *) alloca (envlen + 1);
2716 for (temp = w32env, i = 0; env[i] && *env[i]; i++)
2718 strcpy (temp, env[i]);
2719 temp += strlen (temp) + 1;
2726 ret = CreateProcessA (0,
2736 if (tty != INVALID_HANDLE_VALUE)
2747 error (
_(
"Error creating process %s, (error %u)."),
2748 exec_file, (
unsigned) GetLastError ());
2750 CloseHandle (pi.hThread);
2751 CloseHandle (pi.hProcess);
2782 DEBUG_EVENTS ((
"gdb: GenerateConsoleCtrlEvent (CTRLC_EVENT, 0)\n"));
2796 DWORD lasterror = 0;
2798 if (writebuf != NULL)
2800 DEBUG_MEM ((
"gdb: write target memory, %s bytes at %s\n",
2803 (LPVOID) (uintptr_t) memaddr, writebuf,
2806 lasterror = GetLastError ();
2808 (LPCVOID) (uintptr_t) memaddr, len);
2812 DEBUG_MEM ((
"gdb: read target memory, %s bytes at %s\n",
2815 (LPCVOID) (uintptr_t) memaddr, readbuf,
2818 lasterror = GetLastError ();
2821 if (!success && lasterror == ERROR_PARTIAL_COPY && done > 0)
2838 if (
current_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
2848 DEBUG_EVENTS ((
"gdb: windows_close, inferior_ptid=%d\n",
2856 static char buf[80];
2860 snprintf (buf,
sizeof (buf),
"Thread %d.0x%lx",
2875 struct obstack obstack;
2883 obstack_init (&obstack);
2885 for (so = solib_start.
next; so; so = so->
next)
2895 buf = (
const char *) obstack_finish (&obstack);
2896 len_avail = strlen (buf);
2901 if (len > len_avail -
offset)
2902 len = len_avail -
offset;
2903 memcpy (readbuf, buf +
offset, len);
2906 obstack_free (&obstack, NULL);
2913 const char *annex,
gdb_byte *readbuf,
2924 writebuf,
offset, len, xfered_len);
2928 readbuf, writebuf,
offset, len,
3017 cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
3021 Signal a crashed process with event ID, to allow its debugging.\n\ 3022 This command is needed in support of setting up GDB as JIT debugger on \ 3023 MS-Windows. The command should be invoked from the GDB command line using \ 3024 the '-ex' command-line option. The ID of the event that blocks the \ 3025 crashed process will be supplied by the Windows JIT debugging mechanism."));
3029 Set use of shell to start subprocess."),
_(
"\ 3030 Show use of shell to start subprocess."), NULL,
3036 &cygwin_exceptions,
_(
"\ 3037 Break when an exception is detected in the Cygwin DLL itself."),
_(
"\ 3038 Show whether gdb breaks on exceptions in the Cygwin DLL itself."), NULL,
3045 Set creation of new console when creating child process."),
_(
"\ 3046 Show creation of new console when creating child process."), NULL,
3052 Set creation of new group when creating child process."),
_(
"\ 3053 Show creation of new group when creating child process."), NULL,
3059 Set whether to display execution in child process."),
_(
"\ 3060 Show whether to display execution in child process."), NULL,
3066 Set whether to display kernel events in child process."),
_(
"\ 3067 Show whether to display kernel events in child process."), NULL,
3073 Set whether to display memory accesses in child process."),
_(
"\ 3074 Show whether to display memory accesses in child process."), NULL,
3081 Set whether to display kernel exceptions in child process."),
_(
"\ 3082 Show whether to display kernel exceptions in child process."), NULL,
3090 _(
"Display selectors infos."),
3104 _(
"Invalid register %d in cygwin_set_dr.\n"), i);
3132 static unsigned long 3135 return (
unsigned long)
dr[6];
3142 static unsigned long 3145 return (
unsigned long)
dr[7];
3159 return WaitForSingleObject (
thread_rec (
tid, FALSE)->h, 0) == WAIT_OBJECT_0
3170 homedir = getenv (
"HOME");
3174 char *oldini = (
char *) alloca (strlen (homedir) +
3175 sizeof (
"gdb.ini") + 1);
3176 strcpy (oldini, homedir);
3177 p = strchr (oldini,
'\0');
3178 if (p > oldini && !IS_DIR_SEPARATOR (p[-1]))
3180 strcpy (p,
"gdb.ini");
3181 if (access (oldini, 0) == 0)
3183 int len = strlen (oldini);
3184 char *newini = (
char *) alloca (len + 2);
3186 xsnprintf (newini, len + 2,
"%.*s.gdbinit",
3187 (
int) (len - (
sizeof (
"gdb.ini") - 1)), oldini);
3188 warning (
_(
"obsolete '%s' found. Rename to '%s'."), oldini, newini);
3218 bad_GetModuleFileNameExW (HANDLE w, HMODULE x, LPWSTR y, DWORD z)
3265 #define GPA(m, func) \ 3266 func = (func ## _ftype *) GetProcAddress (m, #func) 3268 hm = LoadLibrary (
"kernel32.dll");
3295 hm = LoadLibrary (
"psapi.dll");
3314 cannot automatically find executable file or library to read symbols.\n\ 3315 Use \"file\" or \"dll\" command to load executable/libraries directly."));
3318 hm = LoadLibrary (
"advapi32.dll");
BOOL WINAPI() GetModuleInformation_ftype(HANDLE, HMODULE, LPMODULEINFO, DWORD)
struct gdbarch * target_gdbarch(void)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t err
void add_target(struct target_ops *t)
static void windows_set_console_info(STARTUPINFO *si, DWORD *flags)
static constexpr ptid_t tid
struct thread_info * add_thread(ptid_t ptid)
#define I387_FOP_REGNUM(tdep)
#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 void handle_load_dll()
static int set_process_privilege(const char *privilege, BOOL enable)
static void windows_add_all_dlls(void)
static int redir_open(const char *redir_string, int *inp, int *out, int *err)
static windows_thread_info thread_head
int ptid_get_pid(const ptid_t &ptid)
static struct target_ops * windows_target(void)
void delete_thread(ptid_t)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
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)
#define context_offset(x)
static void do_windows_store_inferior_registers(const struct regcache *regcache, windows_thread_info *th, int r)
static int windows_get_exec_module_filename(char *exe_name_ret, size_t exe_name_max_len)
static handle_exception_result handle_exception(struct target_waitstatus *ourstatus)
void warning(const char *fmt,...)
static segment_register_p_ftype * segment_register_p
static void display_selectors(const char *args, int from_tty)
void init_wait_for_inferior(void)
#define DebugBreakProcess
void push_target(struct target_ops *t)
char * get_exec_file(int err)
ptid_t regcache_get_ptid(const struct regcache *regcache)
void * memset(T *s, int c, size_t n)=delete
void internal_error(const char *file, int line, const char *fmt,...)
void print_sys_errmsg(const char *string, int errcode)
static const char * windows_thread_name(struct target_ops *self, struct thread_info *thr)
static BOOL WINAPI bad_DebugBreakProcess(HANDLE w)
static void windows_create_inferior(struct target_ops *ops, const char *exec_file, const std::string &origallargs, char **in_env, int from_tty)
static BOOL windows_continue(DWORD continue_status, int id, int killed)
void(* to_close)(struct target_ops *)
const char *(* to_pid_to_str)(struct target_ops *, ptid_t) TARGET_DEFAULT_FUNC(default_pid_to_str)
union target_waitstatus::@174 value
static char * windows_pid_to_exec_file(struct target_ops *self, int pid)
static const char * windows_pid_to_str(struct target_ops *ops, ptid_t ptid)
#define GetConsoleFontSize
BOOL WINAPI() DebugBreakProcess_ftype(HANDLE)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
static void windows_clear_solib(void)
DWORD WINAPI() GetModuleFileNameEx_ftype(HANDLE, HMODULE, LPSTR, DWORD)
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)
static int windows_get_tib_address(struct target_ops *self, ptid_t ptid, CORE_ADDR *addr)
void(* set_control)(unsigned long)
static BOOL WINAPI bad_DebugActiveProcessStop(DWORD w)
struct x86_dr_low_type x86_dr_low
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
BOOL WINAPI() GetCurrentConsoleFont_ftype(HANDLE, BOOL, CONSOLE_FONT_INFO *)
void inf_child_maybe_unpush_target(struct target_ops *ops)
int gdbarch_ps_regnum(struct gdbarch *gdbarch)
#define EnumProcessModules
CORE_ADDR(* get_addr)(int)
static void catch_errors(void(*func)())
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)
#define host_address_to_string(ADDR)
ptid_t ptid_build(int pid, long lwp, long tid)
BOOL WINAPI() EnumProcessModules_ftype(HANDLE, HMODULE *, DWORD, LPDWORD)
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
COORD WINAPI() GetConsoleFontSize_ftype(HANDLE, DWORD)
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
const char * normal_pid_to_str(ptid_t ptid)
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
gdb_bfd_ref_ptr gdb_bfd_open(const char *name, const char *target, int fd)
static void cygwin_set_dr(int i, CORE_ADDR addr)
#define CATCH(EXCEPTION, MASK)
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)
BOOL WINAPI() DebugSetProcessKillOnExit_ftype(BOOL)
static void windows_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal sig)
unsigned long(* get_status)(void)
BOOL WINAPI() OpenProcessToken_ftype(HANDLE, DWORD, PHANDLE)
static void windows_files_info(struct target_ops *ignore)
long ptid_get_tid(const ptid_t &ptid)
void _initialize_loadable(void)
static DWORD fake_create_process(void)
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
void exception_print(struct ui_file *file, struct gdb_exception e)
static BOOL WINAPI bad_OpenProcessToken(HANDLE w, DWORD x, PHANDLE y)
static void windows_mourn_inferior(struct target_ops *ops)
void puts_filtered(const char *string)
#define GetModuleInformation
char so_original_name[SO_NAME_MAX_PATH_SIZE]
ptid_t pid_to_ptid(int pid)
#define I387_FISEG_REGNUM(tdep)
static GetModuleFileNameEx_ftype * GetModuleFileNameEx
static int display_selector(HANDLE thread, DWORD sel)
char * pulongest(ULONGEST u)
void _initialize_check_for_gdb_ini(void)
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(ptid_t ptid)
static CONTEXT saved_context
#define complaint(COMPLAINTS, FMT,...)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
static int startswith(const char *string, const char *pattern)
void disable_breakpoints_in_shlibs(void)
static int have_saved_context
int() segment_register_p_ftype(int regnum)
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)
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()
void inf_child_mourn_inferior(struct target_ops *ops)
unsigned long(* get_control)(void)
static BOOL WINAPI ctrl_c_handler(DWORD event_type)
void _initialize_windows_nat(void)
char *(* to_pid_to_exec_file)(struct target_ops *, int pid) TARGET_DEFAULT_RETURN(NULL)
int target_is_pushed(struct target_ops *t)
const char * get_inferior_cwd()
static int envvar_cmp(const void *a, const void *b)
static const int * mappings
#define AdjustTokenPrivileges
static unsigned long cygwin_get_dr7(void)
BOOL WINAPI() LookupPrivilegeValueA_ftype(LPCSTR, LPCSTR, PLUID)
PTR xrealloc(PTR ptr, size_t size)
static ptid_t windows_get_ada_task_ptid(struct target_ops *self, long lwp, long thread)
static int debug_registers_changed
static bool redirect_inferior_handles(const char *cmd_orig, char *cmd, int *inp, int *out, int *err)
struct target_ops * inf_child_target(void)
static int windows_initialization_done
BOOL WINAPI() AdjustTokenPrivileges_ftype(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
void(* to_mourn_inferior)(struct target_ops *) TARGET_DEFAULT_FUNC(default_mourn_inferior)
struct windows_thread_info_struct * next
static void do_windows_fetch_inferior_registers(struct regcache *regcache, windows_thread_info *th, int r)
static enum target_xfer_status windows_xfer_memory(gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
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,...)
static void signal_event_command(const char *args, int from_tty)
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 void handle_unload_dll()
static void windows_delete_thread(ptid_t ptid, DWORD exit_code)
static enum gdb_signal last_sig
const char * target_pid_to_str(ptid_t ptid)
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_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static int open_process_used
void registers_changed(void)
std::string gdb_tilde_expand(const char *dir)
static constexpr ptid_t lwp
static windows_thread_info * windows_add_thread(ptid_t ptid, HANDLE h, void *tlb)
#define obstack_grow_str(OBSTACK, STRING)
int parse_pid_to_attach(const char *args)
static void windows_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int r)
static const struct xlate_exception xlate[]
#define DEBUG_EXCEPTION_SIMPLE(x)
int ptid_equal(const ptid_t &ptid1, const ptid_t &ptid2)
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)
BOOL WINAPI() DebugActiveProcessStop_ftype(DWORD)
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
#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)
void(* to_interrupt)(struct target_ops *, ptid_t) TARGET_DEFAULT_IGNORE()
void x86_use_watchpoints(struct target_ops *t)
static windows_thread_info * thread_rec(DWORD id, int get_context)
void(* to_create_inferior)(struct target_ops *, const char *, const std::string &, char **, int)
int(* to_thread_alive)(struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN(0)
#define CONTEXT_DEBUGGER_DR
static int redir_set_redirection(const char *s, int *inp, int *out, int *err)
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 windows_thread_info * current_thread
void x86_cleanup_dregs(void)
static struct so_list solib_start * solib_end
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
static void windows_interrupt(struct target_ops *self, ptid_t)
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_FUNC(default_target_wait)
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)
const char *(* to_thread_name)(struct target_ops *, struct thread_info *) TARGET_DEFAULT_RETURN(NULL)
static int debug_registers_used
static COORD WINAPI bad_GetConsoleFontSize(HANDLE w, DWORD nFont)
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)
int(* deprecated_ui_loop_hook)(int signo)
void windows_set_segment_register_p(segment_register_p_ftype *fun)
void init_thread_list(void)
#define LookupPrivilegeValueA
LONGEST parse_and_eval_long(const char *exp)