23 #include "gdb/fileio.h" 39 #include <sys/cygwin.h> 42 #define OUTMSG(X) do { printf X; fflush (stderr); } while (0) 55 #define _T(x) TEXT (x) 59 #define COUNTOF(STR) (sizeof (STR) / sizeof ((STR)[0])) 63 # define GETPROCADDRESS(DLL, PROC) \ 64 ((winapi_ ## PROC) GetProcAddress (DLL, TEXT (#PROC))) 66 # define GETPROCADDRESS(DLL, PROC) \ 67 ((winapi_ ## PROC) GetProcAddress (DLL, #PROC)) 77 static enum gdb_signal
last_sig = GDB_SIGNAL_0;
97 #define NUM_REGS (the_low_target.num_regs) 123 return ptid_build (event->dwProcessId, event->dwThreadId, 0);
134 memcpy (&th->base_context, &th->
context, sizeof (CONTEXT));
154 if (memcmp (&th->
context, &th->base_context, sizeof (CONTEXT)) != 0)
156 SetThreadContext (th->
h, &th->
context);
173 if (th->
context.ContextFlags == 0)
177 if (SuspendThread (th->
h) == (DWORD) -1)
179 DWORD err = GetLastError ();
180 OUTMSG ((
"warning: SuspendThread failed in thread_rec, " 181 "(error %d): %s\n", (
int) err,
strwinerror (err)));
314 uintptr_t addr = (uintptr_t) memaddr;
319 (LPCVOID) our, len, &done);
321 lasterror = GetLastError ();
327 (LPVOID) our, len, &done);
329 lasterror = GetLastError ();
331 if (!success && lasterror == ERROR_PARTIAL_COPY && done > 0)
334 return success ? done : -1;
379 struct target_waitstatus status;
384 if (status.kind != TARGET_WAITKIND_LOADED)
394 resume.kind = resume_continue;
430 if (thread_id == -1 || thread_id == th->
tid)
442 if (ResumeThread (th->
h) == (DWORD) -1)
444 DWORD err = GetLastError ();
445 OUTMSG ((
"warning: ResumeThread failed in continue_one_thread, " 446 "(error %d): %s\n", (
int) err,
strwinerror (err)));
481 for (regno = 0; regno < r; regno++)
492 if (r == -1 || r == 0 || r >
NUM_REGS)
495 for (regno = 0; regno < r; regno++)
512 static char buf[1024];
514 DWORD lasterr = GetLastError ();
515 DWORD chars = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
516 | FORMAT_MESSAGE_ALLOCATE_BUFFER,
527 && msgbuf[chars - 2] ==
'\r' 528 && msgbuf[chars - 1] ==
'\n')
534 if (chars > ((
COUNTOF (buf)) - 1))
541 wcstombs (buf, msgbuf, chars + 1);
543 strncpy (buf, msgbuf, chars + 1);
548 sprintf (buf,
"unknown win32 error (%u)", (
unsigned)
error);
550 SetLastError (lasterr);
556 DWORD flags, PROCESS_INFORMATION *pi)
563 wchar_t *p, *wprogram, *wargs, *wcwd = NULL;
566 wprogram =
alloca ((strlen (program) + 1) *
sizeof (
wchar_t));
567 mbstowcs (wprogram, program, strlen (program) + 1);
569 for (p = wprogram; *p; ++p)
573 argslen = strlen (args);
574 wargs =
alloca ((argslen + 1) *
sizeof (
wchar_t));
575 mbstowcs (wargs, args, argslen + 1);
577 if (inferior_cwd != NULL)
579 std::replace (expanded_infcwd.begin (), expanded_infcwd.end (),
581 wcwd =
alloca ((expanded_infcwd.size () + 1) *
sizeof (
wchar_t));
582 if (mbstowcs (wcwd, expanded_infcwd.c_str (),
583 expanded_infcwd.size () + 1) == NULL)
586 Could not convert the expanded inferior cwd to wide-char."));
590 ret = CreateProcessW (wprogram,
601 STARTUPINFOA si = {
sizeof (STARTUPINFOA) };
603 ret = CreateProcessA (program,
610 expanded_infcwd.c_str (),
628 char real_path[PATH_MAX];
629 char *orig_path, *new_path, *path_ptr;
635 PROCESS_INFORMATION pi;
638 char *args = (
char *) str_program_args.c_str ();
644 error (
"No executable specified, specify executable to debug.\n");
646 flags = DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS;
650 path_ptr = getenv (
"PATH");
653 int size = cygwin_conv_path_list (CCP_POSIX_TO_WIN_A, path_ptr, NULL, 0);
654 orig_path = (
char *)
alloca (strlen (path_ptr) + 1);
655 new_path = (
char *)
alloca (size);
656 strcpy (orig_path, path_ptr);
657 cygwin_conv_path_list (CCP_POSIX_TO_WIN_A, path_ptr, new_path, size);
658 setenv (
"PATH", new_path, 1);
660 cygwin_conv_path (CCP_POSIX_TO_WIN_A, program, real_path, PATH_MAX);
664 OUTMSG2 ((
"Command line is \"%s\"\n", args));
666 #ifdef CREATE_NEW_PROCESS_GROUP 667 flags |= CREATE_NEW_PROCESS_GROUP;
671 err = GetLastError ();
672 if (!ret && err == ERROR_FILE_NOT_FOUND)
674 char *exename = (
char *)
alloca (strlen (program) + 5);
675 strcat (strcpy (exename, program),
".exe");
677 err = GetLastError ();
682 setenv (
"PATH", orig_path, 1);
687 error (
"Error creating process \"%s%s\", (error %d): %s\n",
692 OUTMSG2 ((
"Process created: %s\n", (
char *) args));
699 CloseHandle (pi.hThread);
717 HMODULE dll = GetModuleHandle (
_T(
"COREDLL.DLL"));
719 HMODULE dll = GetModuleHandle (
_T(
"KERNEL32.DLL"));
721 DebugSetProcessKillOnExit =
GETPROCADDRESS (dll, DebugSetProcessKillOnExit);
723 h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
726 if (DebugActiveProcess (pid))
728 if (DebugSetProcessKillOnExit != NULL)
729 DebugSetProcessKillOnExit (FALSE);
740 err = GetLastError ();
741 error (
"Attach to process failed (error %d): %s\n",
749 #define READ_BUFFER_LEN 1024 752 DWORD nbytes =
current_event.u.DebugString.nDebugStringLength;
769 wcstombs (s,
buffer, (nbytes + 1) /
sizeof (WCHAR));
787 #undef READ_BUFFER_LEN 816 if (
current_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
818 else if (
current_event.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT)
837 HMODULE dll = GetModuleHandle (
_T(
"COREDLL.DLL"));
839 HMODULE dll = GetModuleHandle (
_T(
"KERNEL32.DLL"));
841 DebugActiveProcessStop =
GETPROCADDRESS (dll, DebugActiveProcessStop);
842 DebugSetProcessKillOnExit =
GETPROCADDRESS (dll, DebugSetProcessKillOnExit);
844 if (DebugSetProcessKillOnExit == NULL
845 || DebugActiveProcessStop == NULL)
851 resume.kind = resume_continue;
859 DebugSetProcessKillOnExit (FALSE);
877 HANDLE h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
880 WaitForSingleObject (h, INFINITE);
903 DWORD continue_status = DBG_CONTINUE;
921 step = resume_info[0].
kind == resume_step;
929 if (
sig != GDB_SIGNAL_0)
933 OUTMSG ((
"Cannot continue with signal %s here.\n",
937 continue_status = DBG_EXCEPTION_NOT_HANDLED;
939 OUTMSG ((
"Can only continue with received signal %s.\n",
963 error (
"Single stepping is not supported " 964 "in this configuration.\n");
981 char buf[MAX_PATH + 1];
982 char buf2[MAX_PATH + 1];
985 WIN32_FIND_DATA w32_fd;
986 WCHAR wname[MAX_PATH + 1];
987 mbstowcs (wname,
name, MAX_PATH);
988 HANDLE h = FindFirstFile (wname, &w32_fd);
990 WIN32_FIND_DATAA w32_fd;
991 HANDLE h = FindFirstFileA (
name, &w32_fd);
999 if (h == INVALID_HANDLE_VALUE)
1007 char cwd[MAX_PATH + 1];
1009 if (GetCurrentDirectoryA (MAX_PATH + 1, cwd))
1011 p = strrchr (buf,
'\\');
1014 SetCurrentDirectoryA (buf);
1015 GetFullPathNameA (w32_fd.cFileName, MAX_PATH, buf, &p);
1016 SetCurrentDirectoryA (cwd);
1023 if (strcasecmp (buf,
"ntdll.dll") == 0)
1025 GetSystemDirectoryA (buf,
sizeof (buf));
1026 strcat (buf,
"\\ntdll.dll");
1031 cygwin_conv_path (CCP_WIN_A_TO_POSIX, buf, buf2,
sizeof (buf2));
1042 static char buf[(2 * MAX_PATH) + 1];
1043 DWORD size = unicode ?
sizeof (WCHAR) :
sizeof (
char);
1052 if (address == NULL)
1058 address_ptr = address;
1062 if (!ReadProcessMemory (h, address, &address_ptr,
1063 sizeof (address_ptr), &done)
1064 || done !=
sizeof (address_ptr)
1070 while (ReadProcessMemory (h, address_ptr + len++ * size, &b, size, &done)
1071 && (b[0] != 0 || b[size - 1] != 0) && done == size)
1075 ReadProcessMemory (h, address_ptr, buf, len, &done);
1078 WCHAR *unicode_address = XALLOCAVEC (WCHAR, len);
1079 ReadProcessMemory (h, address_ptr, unicode_address, len *
sizeof (WCHAR),
1082 WideCharToMultiByte (CP_ACP, 0, unicode_address, len, buf, len, 0, 0);
1091 LPMODULEINFO, DWORD);
1102 static int psapi_loaded = 0;
1103 static HMODULE dll = NULL;
1108 dll = LoadLibrary (TEXT(
"psapi.dll"));
1134 HMODULE *DllHandle = dh_buf;
1147 if (!ok || !cbNeeded)
1150 DllHandle = (HMODULE *)
alloca (cbNeeded);
1161 for (i = 1; i < ((size_t) cbNeeded /
sizeof (HMODULE)); i++)
1164 char dll_name[MAX_PATH];
1199 event->lpImageName, event->fUnicode);
1222 load_addr += 0x1000;
1229 DWORD code =
current_event.u.Exception.ExceptionRecord.ExceptionCode;
1231 ourstatus->kind = TARGET_WAITKIND_STOPPED;
1235 case EXCEPTION_ACCESS_VIOLATION:
1236 OUTMSG2 ((
"EXCEPTION_ACCESS_VIOLATION"));
1237 ourstatus->value.sig = GDB_SIGNAL_SEGV;
1239 case STATUS_STACK_OVERFLOW:
1240 OUTMSG2 ((
"STATUS_STACK_OVERFLOW"));
1241 ourstatus->value.sig = GDB_SIGNAL_SEGV;
1243 case STATUS_FLOAT_DENORMAL_OPERAND:
1244 OUTMSG2 ((
"STATUS_FLOAT_DENORMAL_OPERAND"));
1245 ourstatus->value.sig = GDB_SIGNAL_FPE;
1247 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
1248 OUTMSG2 ((
"EXCEPTION_ARRAY_BOUNDS_EXCEEDED"));
1249 ourstatus->value.sig = GDB_SIGNAL_FPE;
1251 case STATUS_FLOAT_INEXACT_RESULT:
1252 OUTMSG2 ((
"STATUS_FLOAT_INEXACT_RESULT"));
1253 ourstatus->value.sig = GDB_SIGNAL_FPE;
1255 case STATUS_FLOAT_INVALID_OPERATION:
1256 OUTMSG2 ((
"STATUS_FLOAT_INVALID_OPERATION"));
1257 ourstatus->value.sig = GDB_SIGNAL_FPE;
1259 case STATUS_FLOAT_OVERFLOW:
1260 OUTMSG2 ((
"STATUS_FLOAT_OVERFLOW"));
1261 ourstatus->value.sig = GDB_SIGNAL_FPE;
1263 case STATUS_FLOAT_STACK_CHECK:
1264 OUTMSG2 ((
"STATUS_FLOAT_STACK_CHECK"));
1265 ourstatus->value.sig = GDB_SIGNAL_FPE;
1267 case STATUS_FLOAT_UNDERFLOW:
1268 OUTMSG2 ((
"STATUS_FLOAT_UNDERFLOW"));
1269 ourstatus->value.sig = GDB_SIGNAL_FPE;
1271 case STATUS_FLOAT_DIVIDE_BY_ZERO:
1272 OUTMSG2 ((
"STATUS_FLOAT_DIVIDE_BY_ZERO"));
1273 ourstatus->value.sig = GDB_SIGNAL_FPE;
1275 case STATUS_INTEGER_DIVIDE_BY_ZERO:
1276 OUTMSG2 ((
"STATUS_INTEGER_DIVIDE_BY_ZERO"));
1277 ourstatus->value.sig = GDB_SIGNAL_FPE;
1279 case STATUS_INTEGER_OVERFLOW:
1280 OUTMSG2 ((
"STATUS_INTEGER_OVERFLOW"));
1281 ourstatus->value.sig = GDB_SIGNAL_FPE;
1283 case EXCEPTION_BREAKPOINT:
1284 OUTMSG2 ((
"EXCEPTION_BREAKPOINT"));
1285 ourstatus->value.sig = GDB_SIGNAL_TRAP;
1289 .u.Exception.ExceptionRecord.ExceptionAddress);
1294 ourstatus->value.sig = GDB_SIGNAL_INT;
1296 case DBG_CONTROL_BREAK:
1297 OUTMSG2 ((
"DBG_CONTROL_BREAK"));
1298 ourstatus->value.sig = GDB_SIGNAL_INT;
1300 case EXCEPTION_SINGLE_STEP:
1301 OUTMSG2 ((
"EXCEPTION_SINGLE_STEP"));
1302 ourstatus->value.sig = GDB_SIGNAL_TRAP;
1304 case EXCEPTION_ILLEGAL_INSTRUCTION:
1305 OUTMSG2 ((
"EXCEPTION_ILLEGAL_INSTRUCTION"));
1306 ourstatus->value.sig = GDB_SIGNAL_ILL;
1308 case EXCEPTION_PRIV_INSTRUCTION:
1309 OUTMSG2 ((
"EXCEPTION_PRIV_INSTRUCTION"));
1310 ourstatus->value.sig = GDB_SIGNAL_ILL;
1312 case EXCEPTION_NONCONTINUABLE_EXCEPTION:
1313 OUTMSG2 ((
"EXCEPTION_NONCONTINUABLE_EXCEPTION"));
1314 ourstatus->value.sig = GDB_SIGNAL_ILL;
1319 ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
1322 OUTMSG2 ((
"gdbserver: unknown target exception 0x%08x at 0x%s",
1323 (
unsigned)
current_event.u.Exception.ExceptionRecord.ExceptionCode,
1325 ExceptionAddress, sizeof (uintptr_t))));
1326 ourstatus->value.sig = GDB_SIGNAL_UNKNOWN;
1341 if (SuspendThread (th->
h) == (DWORD) -1)
1343 DWORD err = GetLastError ();
1344 OUTMSG ((
"warning: SuspendThread failed in suspend_one_thread, " 1345 "(error %d): %s\n", (
int) err,
strwinerror (err)));
1355 OUTMSG2((
"fake_breakpoint_event\n"));
1363 = EXCEPTION_BREAKPOINT;
1370 auto_delete_breakpoint (
CORE_ADDR stop_pc)
1384 ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
1418 OUTMSG2((
"no attach events left\n"));
1423 OUTMSG2((
"got attach event\n"));
1433 DWORD e = GetLastError();
1435 if (e == ERROR_PIPE_NOT_CONNECTED)
1441 ourstatus->kind = TARGET_WAITKIND_EXITED;
1442 ourstatus->value.integer = 1;
1454 case CREATE_THREAD_DEBUG_EVENT:
1455 OUTMSG2 ((
"gdbserver: kernel event CREATE_THREAD_DEBUG_EVENT " 1456 "for pid=%u tid=%x)\n",
1467 case EXIT_THREAD_DEBUG_EVENT:
1468 OUTMSG2 ((
"gdbserver: kernel event EXIT_THREAD_DEBUG_EVENT " 1469 "for pid=%u tid=%x\n",
1478 case CREATE_PROCESS_DEBUG_EVENT:
1479 OUTMSG2 ((
"gdbserver: kernel event CREATE_PROCESS_DEBUG_EVENT " 1480 "for pid=%u tid=%x\n",
1502 .CreateProcessInfo.lpStartAddress,
1503 auto_delete_breakpoint);
1508 case EXIT_PROCESS_DEBUG_EVENT:
1509 OUTMSG2 ((
"gdbserver: kernel event EXIT_PROCESS_DEBUG_EVENT " 1510 "for pid=%u tid=%x\n",
1513 ourstatus->kind = TARGET_WAITKIND_EXITED;
1514 ourstatus->value.integer =
current_event.u.ExitProcess.dwExitCode;
1520 case LOAD_DLL_DEBUG_EVENT:
1521 OUTMSG2 ((
"gdbserver: kernel event LOAD_DLL_DEBUG_EVENT " 1522 "for pid=%u tid=%x\n",
1530 ourstatus->kind = TARGET_WAITKIND_LOADED;
1531 ourstatus->value.sig = GDB_SIGNAL_TRAP;
1534 case UNLOAD_DLL_DEBUG_EVENT:
1535 OUTMSG2 ((
"gdbserver: kernel event UNLOAD_DLL_DEBUG_EVENT " 1536 "for pid=%u tid=%x\n",
1542 ourstatus->kind = TARGET_WAITKIND_LOADED;
1543 ourstatus->value.sig = GDB_SIGNAL_TRAP;
1546 case EXCEPTION_DEBUG_EVENT:
1547 OUTMSG2 ((
"gdbserver: kernel event EXCEPTION_DEBUG_EVENT " 1548 "for pid=%u tid=%x\n",
1554 case OUTPUT_DEBUG_STRING_EVENT:
1556 OUTMSG2 ((
"gdbserver: kernel event OUTPUT_DEBUG_STRING_EVENT " 1557 "for pid=%u tid=%x\n",
1564 OUTMSG2 ((
"gdbserver: kernel event unknown " 1565 "for pid=%u tid=%x code=%x\n",
1601 switch (ourstatus->kind)
1603 case TARGET_WAITKIND_EXITED:
1604 OUTMSG2 ((
"Child exited with retcode = %x\n",
1605 ourstatus->value.integer));
1608 case TARGET_WAITKIND_STOPPED:
1609 case TARGET_WAITKIND_LOADED:
1610 OUTMSG2 ((
"Child Stopped with signal = %d \n",
1611 ourstatus->value.sig));
1617 OUTMSG ((
"Ignoring unknown internal event, %d\n", ourstatus->kind));
1619 case TARGET_WAITKIND_SPURIOUS:
1671 HMODULE dll = GetModuleHandle (
_T(
"COREDLL.DLL"));
1673 HMODULE dll = GetModuleHandle (
_T(
"KERNEL32.DLL"));
1676 GenerateConsoleCtrlEvent =
GETPROCADDRESS (dll, GenerateConsoleCtrlEvent);
1678 if (GenerateConsoleCtrlEvent != NULL
1689 if (DebugBreakProcess != NULL
1699 win32_error_to_fileio_error (DWORD err)
1703 case ERROR_BAD_PATHNAME:
1704 case ERROR_FILE_NOT_FOUND:
1705 case ERROR_INVALID_NAME:
1706 case ERROR_PATH_NOT_FOUND:
1707 return FILEIO_ENOENT;
1709 case ERROR_IO_DEVICE:
1710 case ERROR_OPEN_FAILED:
1712 case ERROR_INVALID_HANDLE:
1713 return FILEIO_EBADF;
1714 case ERROR_ACCESS_DENIED:
1715 case ERROR_SHARING_VIOLATION:
1716 return FILEIO_EACCES;
1717 case ERROR_NOACCESS:
1718 return FILEIO_EFAULT;
1720 return FILEIO_EBUSY;
1721 case ERROR_ALREADY_EXISTS:
1722 case ERROR_FILE_EXISTS:
1723 return FILEIO_EEXIST;
1724 case ERROR_BAD_DEVICE:
1725 return FILEIO_ENODEV;
1726 case ERROR_DIRECTORY:
1727 return FILEIO_ENOTDIR;
1728 case ERROR_FILENAME_EXCED_RANGE:
1729 case ERROR_INVALID_DATA:
1730 case ERROR_INVALID_PARAMETER:
1731 case ERROR_NEGATIVE_SEEK:
1732 return FILEIO_EINVAL;
1733 case ERROR_TOO_MANY_OPEN_FILES:
1734 return FILEIO_EMFILE;
1735 case ERROR_HANDLE_DISK_FULL:
1736 case ERROR_DISK_FULL:
1737 return FILEIO_ENOSPC;
1738 case ERROR_WRITE_PROTECT:
1739 return FILEIO_EROFS;
1740 case ERROR_NOT_SUPPORTED:
1741 return FILEIO_ENOSYS;
1744 return FILEIO_EUNKNOWN;
1748 wince_hostio_last_error (
char *buf)
1750 DWORD winerr = GetLastError ();
1751 int fileio_err = win32_error_to_fileio_error (winerr);
1752 sprintf (buf,
"F-1,%x", fileio_err);
1813 wince_hostio_last_error,
static winapi_GetModuleInformation win32_GetModuleInformation
static int win32_detach(int pid)
struct thread_info * current_thread
int target_can_do_hardware_single_step(void)
static DEBUG_EVENT current_event
void monitor_output(const char *msg)
struct process_info * add_process(int pid, int attached)
struct thread_info * find_thread_ptid(ptid_t ptid)
static void win32_add_all_dlls(void)
CORE_ADDR thread_local_base
static ptid_t debug_event_ptid(DEBUG_EVENT *event)
std::string stringify_argv(const std::vector< char *> &args)
int(* supports_z_point_type)(char z_type)
static void child_delete_thread(DWORD pid, DWORD tid)
static void win32_request_interrupt(void)
static void win32_store_inferior_registers(struct regcache *regcache, int regno)
void * memset(T *s, int c, size_t n)=delete
static void suspend_one_thread(thread_info *thread)
char * strwinerror(DWORD error)
static BOOL load_psapi(void)
static void handle_exception(struct target_waitstatus *ourstatus)
static char * get_image_name(HANDLE h, void *address, int unicode)
static DWORD current_process_id
static int win32_write_inferior_memory(CORE_ADDR memaddr, const unsigned char *myaddr, int len)
BOOL(WINAPI * winapi_Module32Next)(HANDLE, LPMODULEENTRY32)
HANDLE(WINAPI * winapi_CreateToolhelp32Snapshot)(DWORD, DWORD)
static void win32_clear_inferiors(void)
int(* stopped_by_watchpoint)(void)
struct linux_target_ops the_low_target
static int soft_interrupt_requested
static void for_each_thread(Func func)
static int child_initialization_done
static void win32_fetch_inferior_registers(struct regcache *regcache, int regno)
static void win32_prepare_to_resume(win32_thread_info *th)
const struct target_desc * tdesc
void win32_require_context(win32_thread_info *th)
static void fake_breakpoint_event(void)
ptid_t ptid_build(int pid, long lwp, long tid)
static void handle_load_dll(void)
static void child_fetch_inferior_registers(struct regcache *regcache, int r)
static int faked_breakpoint
BOOL(WINAPI * winapi_Module32First)(HANDLE, LPMODULEENTRY32)
static int win32_attach(unsigned long pid)
BOOL(WINAPI * winapi_GenerateConsoleCtrlEvent)(DWORD, DWORD)
static void handle_unload_dll(void)
static void delete_thread_info(thread_info *thread)
void * thread_target_data(struct thread_info *thread)
BOOL(WINAPI * winapi_DebugSetProcessKillOnExit)(BOOL KillOnExit)
void regcache_invalidate(void)
void initialize_low(void)
process_info * find_process_pid(int pid)
static winapi_EnumProcessModules win32_EnumProcessModules
static void win32_get_thread_context(win32_thread_info *th)
int read_inferior_memory(CORE_ADDR memaddr, unsigned char *myaddr, int len)
static void handle_output_debug_string(void)
ptid_t pid_to_ptid(int pid)
static void win32_set_thread_context(win32_thread_info *th)
static int win32_remove_point(enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
enum gdb_signal gdb_signal_from_host(int)
void unloaded_dll(const char *name, CORE_ADDR base_addr)
static int child_xfer_memory(CORE_ADDR memaddr, char *our, int len, int write, struct target_ops *target)
static int win32_supports_z_point_type(char z_type)
static int win32_read_inferior_memory(CORE_ADDR memaddr, unsigned char *myaddr, int len)
static int startswith(const char *string, const char *pattern)
CORE_ADDR(* stopped_data_address)(void)
void check_breakpoints(CORE_ADDR stop_pc)
void remove_process(struct process_info *process)
void set_target_ops(struct target_ops *target)
static win32_thread_info * thread_rec(ptid_t ptid, int get_context)
static ptid_t win32_wait(ptid_t ptid, struct target_waitstatus *ourstatus, int options)
BOOL(WINAPI * winapi_GetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD)
static ptid_t current_thread_ptid(void)
DWORD(WINAPI * winapi_GetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, DWORD)
static void child_init_thread_list(void)
static struct target_waitstatus cached_status
static BOOL create_process(const char *program, char *args, DWORD flags, PROCESS_INFORMATION *pi)
static int win32_insert_point(enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
int(* insert_point)(enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
static int win32_kill(int pid)
struct thread_info * get_first_thread(void)
int(* remove_point)(enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
#define GETPROCADDRESS(DLL, PROC)
static int win32_create_inferior(const char *program, const std::vector< char *> &program_args)
static int win32_thread_alive(ptid_t ptid)
void(* prepare_to_resume)(struct lwp_info *)
static enum gdb_signal last_sig
static winapi_GetModuleFileNameExA win32_GetModuleFileNameExA
static int win32_stopped_by_watchpoint(void)
static void do_initial_child_stuff(HANDLE proch, DWORD pid, int attached)
char * phex_nz(ULONGEST l, int sizeof_l)
static CORE_ADDR win32_stopped_data_address(void)
std::list< thread_info * > all_threads
static void win32_mourn(struct process_info *process)
static void resume(struct thread_resume *actions, size_t n)
static int get_child_debug_event(struct target_waitstatus *ourstatus)
static win32_thread_info * child_add_thread(DWORD pid, DWORD tid, HANDLE h, void *tlb)
static DWORD main_thread_id
BOOL(WINAPI * winapi_EnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD)
std::string gdb_tilde_expand(const char *dir)
void hostio_last_error_from_errno(char *buf)
const struct target_desc * win32_tdesc
struct regcache * get_thread_regcache(struct thread_info *thread, int fetch)
void remove_thread(struct thread_info *thread)
static void win32_add_one_solib(const char *name, CORE_ADDR load_addr)
int ptid_equal(const ptid_t &ptid1, const ptid_t &ptid2)
const char * get_inferior_cwd()
struct breakpoint * set_breakpoint_at(CORE_ADDR where, int(*handler)(CORE_ADDR))
const char * gdb_signal_to_string(enum gdb_signal)
static void win32_resume(struct thread_resume *resume_info, size_t n)
void loaded_dll(const char *name, CORE_ADDR base_addr)
static const gdb_byte * win32_sw_breakpoint_from_kind(int kind, int *size)
static std::vector< char * > program_args
void check_remote_input_interrupt_request(void)
struct thread_info * add_thread(ptid_t ptid, void *target_data)
BOOL(WINAPI * winapi_DebugActiveProcessStop)(DWORD dwProcessId)
void clear_inferiors(void)
static void win32_join(int pid)
void error(const char *fmt,...)
static HANDLE current_process_handle
static void child_store_inferior_registers(struct regcache *regcache, int r)
BOOL(WINAPI * winapi_DebugBreakProcess)(HANDLE)
static void continue_one_thread(thread_info *thread, int thread_id)
static BOOL child_continue(DWORD continue_status, int thread_id)
static int win32_get_tib_address(ptid_t ptid, CORE_ADDR *addr)