| OLD | NEW |
| 1 /* Target-vector operations for controlling windows child processes, for GDB. | 1 /* Target-vector operations for controlling windows child processes, for GDB. |
| 2 | 2 |
| 3 Copyright (C) 1995-2012 Free Software Foundation, Inc. | 3 Copyright (C) 1995-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 Contributed by Cygnus Solutions, A Red Hat Company. | 5 Contributed by Cygnus Solutions, A Red Hat Company. |
| 6 | 6 |
| 7 This file is part of GDB. | 7 This file is part of GDB. |
| 8 | 8 |
| 9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
| 10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 #define DEBUG_EVENTS(x) if (debug_events) printf_unfiltered x | 165 #define DEBUG_EVENTS(x) if (debug_events) printf_unfiltered x |
| 166 #define DEBUG_MEM(x) if (debug_memory) printf_unfiltered x | 166 #define DEBUG_MEM(x) if (debug_memory) printf_unfiltered x |
| 167 #define DEBUG_EXCEPT(x) if (debug_exceptions) printf_unfiltered x | 167 #define DEBUG_EXCEPT(x) if (debug_exceptions) printf_unfiltered x |
| 168 | 168 |
| 169 static void windows_stop (ptid_t); | 169 static void windows_stop (ptid_t); |
| 170 static int windows_thread_alive (struct target_ops *, ptid_t); | 170 static int windows_thread_alive (struct target_ops *, ptid_t); |
| 171 static void windows_kill_inferior (struct target_ops *); | 171 static void windows_kill_inferior (struct target_ops *); |
| 172 | 172 |
| 173 static void cygwin_set_dr (int i, CORE_ADDR addr); | 173 static void cygwin_set_dr (int i, CORE_ADDR addr); |
| 174 static void cygwin_set_dr7 (unsigned long val); | 174 static void cygwin_set_dr7 (unsigned long val); |
| 175 static CORE_ADDR cygwin_get_dr (int i); |
| 175 static unsigned long cygwin_get_dr6 (void); | 176 static unsigned long cygwin_get_dr6 (void); |
| 177 static unsigned long cygwin_get_dr7 (void); |
| 176 | 178 |
| 177 static enum target_signal last_sig = TARGET_SIGNAL_0; | 179 static enum gdb_signal last_sig = GDB_SIGNAL_0; |
| 178 /* Set if a signal was received from the debugged process. */ | 180 /* Set if a signal was received from the debugged process. */ |
| 179 | 181 |
| 180 /* Thread information structure used to track information that is | 182 /* Thread information structure used to track information that is |
| 181 not available in gdb's thread structure. */ | 183 not available in gdb's thread structure. */ |
| 182 typedef struct thread_info_struct | 184 typedef struct thread_info_struct |
| 183 { | 185 { |
| 184 struct thread_info_struct *next; | 186 struct thread_info_struct *next; |
| 185 DWORD id; | 187 DWORD id; |
| 186 HANDLE h; | 188 HANDLE h; |
| 187 CORE_ADDR thread_local_base; | 189 CORE_ADDR thread_local_base; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 One day we could read a reg, we could inspect the context we | 236 One day we could read a reg, we could inspect the context we |
| 235 already have loaded, if it doesn't have the bit set that we need, | 237 already have loaded, if it doesn't have the bit set that we need, |
| 236 we read that set of registers in using GetThreadContext. If the | 238 we read that set of registers in using GetThreadContext. If the |
| 237 context already contains what we need, we just unpack it. Then to | 239 context already contains what we need, we just unpack it. Then to |
| 238 write a register, first we have to ensure that the context contains | 240 write a register, first we have to ensure that the context contains |
| 239 the other regs of the group, and then we copy the info in and set | 241 the other regs of the group, and then we copy the info in and set |
| 240 out bit. */ | 242 out bit. */ |
| 241 | 243 |
| 242 static const int *mappings; | 244 static const int *mappings; |
| 243 | 245 |
| 246 /* The function to use in order to determine whether a register is |
| 247 a segment register or not. */ |
| 248 static segment_register_p_ftype *segment_register_p; |
| 249 |
| 244 /* This vector maps the target's idea of an exception (extracted | 250 /* This vector maps the target's idea of an exception (extracted |
| 245 from the DEBUG_EVENT structure) to GDB's idea. */ | 251 from the DEBUG_EVENT structure) to GDB's idea. */ |
| 246 | 252 |
| 247 struct xlate_exception | 253 struct xlate_exception |
| 248 { | 254 { |
| 249 int them; | 255 int them; |
| 250 enum target_signal us; | 256 enum gdb_signal us; |
| 251 }; | 257 }; |
| 252 | 258 |
| 253 static const struct xlate_exception | 259 static const struct xlate_exception |
| 254 xlate[] = | 260 xlate[] = |
| 255 { | 261 { |
| 256 {EXCEPTION_ACCESS_VIOLATION, TARGET_SIGNAL_SEGV}, | 262 {EXCEPTION_ACCESS_VIOLATION, GDB_SIGNAL_SEGV}, |
| 257 {STATUS_STACK_OVERFLOW, TARGET_SIGNAL_SEGV}, | 263 {STATUS_STACK_OVERFLOW, GDB_SIGNAL_SEGV}, |
| 258 {EXCEPTION_BREAKPOINT, TARGET_SIGNAL_TRAP}, | 264 {EXCEPTION_BREAKPOINT, GDB_SIGNAL_TRAP}, |
| 259 {DBG_CONTROL_C, TARGET_SIGNAL_INT}, | 265 {DBG_CONTROL_C, GDB_SIGNAL_INT}, |
| 260 {EXCEPTION_SINGLE_STEP, TARGET_SIGNAL_TRAP}, | 266 {EXCEPTION_SINGLE_STEP, GDB_SIGNAL_TRAP}, |
| 261 {STATUS_FLOAT_DIVIDE_BY_ZERO, TARGET_SIGNAL_FPE}, | 267 {STATUS_FLOAT_DIVIDE_BY_ZERO, GDB_SIGNAL_FPE}, |
| 262 {-1, -1}}; | 268 {-1, -1}}; |
| 263 | 269 |
| 264 /* Set the MAPPINGS static global to OFFSETS. | 270 /* Set the MAPPINGS static global to OFFSETS. |
| 265 See the description of MAPPINGS for more details. */ | 271 See the description of MAPPINGS for more details. */ |
| 266 | 272 |
| 267 void | 273 void |
| 268 windows_set_context_register_offsets (const int *offsets) | 274 windows_set_context_register_offsets (const int *offsets) |
| 269 { | 275 { |
| 270 mappings = offsets; | 276 mappings = offsets; |
| 271 } | 277 } |
| 272 | 278 |
| 279 /* See windows-nat.h. */ |
| 280 |
| 281 void |
| 282 windows_set_segment_register_p (segment_register_p_ftype *fun) |
| 283 { |
| 284 segment_register_p = fun; |
| 285 } |
| 286 |
| 273 static void | 287 static void |
| 274 check (BOOL ok, const char *file, int line) | 288 check (BOOL ok, const char *file, int line) |
| 275 { | 289 { |
| 276 if (!ok) | 290 if (!ok) |
| 277 printf_filtered ("error return %s:%d was %lu\n", file, line, | 291 printf_filtered ("error return %s:%d was %lu\n", file, line, |
| 278 GetLastError ()); | 292 GetLastError ()); |
| 279 } | 293 } |
| 280 | 294 |
| 281 /* Find a thread record given a thread id. If GET_CONTEXT is not 0, | 295 /* Find a thread record given a thread id. If GET_CONTEXT is not 0, |
| 282 then also retrieve the context for this thread. If GET_CONTEXT is | 296 then also retrieve the context for this thread. If GET_CONTEXT is |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 if (r == I387_FISEG_REGNUM (tdep)) | 461 if (r == I387_FISEG_REGNUM (tdep)) |
| 448 { | 462 { |
| 449 l = *((long *) context_offset) & 0xffff; | 463 l = *((long *) context_offset) & 0xffff; |
| 450 regcache_raw_supply (regcache, r, (char *) &l); | 464 regcache_raw_supply (regcache, r, (char *) &l); |
| 451 } | 465 } |
| 452 else if (r == I387_FOP_REGNUM (tdep)) | 466 else if (r == I387_FOP_REGNUM (tdep)) |
| 453 { | 467 { |
| 454 l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1); | 468 l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1); |
| 455 regcache_raw_supply (regcache, r, (char *) &l); | 469 regcache_raw_supply (regcache, r, (char *) &l); |
| 456 } | 470 } |
| 471 else if (segment_register_p (r)) |
| 472 { |
| 473 /* GDB treats segment registers as 32bit registers, but they are |
| 474 in fact only 16 bits long. Make sure we do not read extra |
| 475 bits from our source buffer. */ |
| 476 l = *((long *) context_offset) & 0xffff; |
| 477 regcache_raw_supply (regcache, r, (char *) &l); |
| 478 } |
| 457 else if (r >= 0) | 479 else if (r >= 0) |
| 458 regcache_raw_supply (regcache, r, context_offset); | 480 regcache_raw_supply (regcache, r, context_offset); |
| 459 else | 481 else |
| 460 { | 482 { |
| 461 for (r = 0; r < gdbarch_num_regs (gdbarch); r++) | 483 for (r = 0; r < gdbarch_num_regs (gdbarch); r++) |
| 462 do_windows_fetch_inferior_registers (regcache, r); | 484 do_windows_fetch_inferior_registers (regcache, r); |
| 463 } | 485 } |
| 464 } | 486 } |
| 465 | 487 |
| 466 static void | 488 static void |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 | 904 |
| 883 /* Clear list of loaded DLLs. */ | 905 /* Clear list of loaded DLLs. */ |
| 884 static void | 906 static void |
| 885 windows_clear_solib (void) | 907 windows_clear_solib (void) |
| 886 { | 908 { |
| 887 solib_start.next = NULL; | 909 solib_start.next = NULL; |
| 888 solib_end = &solib_start; | 910 solib_end = &solib_start; |
| 889 } | 911 } |
| 890 | 912 |
| 891 /* Load DLL symbol info. */ | 913 /* Load DLL symbol info. */ |
| 892 void | 914 static void |
| 893 dll_symbol_command (char *args, int from_tty) | 915 dll_symbol_command (char *args, int from_tty) |
| 894 { | 916 { |
| 895 int n; | 917 int n; |
| 896 dont_repeat (); | 918 dont_repeat (); |
| 897 | 919 |
| 898 if (args == NULL) | 920 if (args == NULL) |
| 899 error (_("dll-symbols requires a file name")); | 921 error (_("dll-symbols requires a file name")); |
| 900 | 922 |
| 901 n = strlen (args); | 923 n = strlen (args); |
| 902 if (n > 4 && strcasecmp (args + n - 4, ".dll") != 0) | 924 if (n > 4 && strcasecmp (args + n - 4, ".dll") != 0) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 { | 959 { |
| 938 /* Got a cygwin signal marker. A cygwin signal is followed by | 960 /* Got a cygwin signal marker. A cygwin signal is followed by |
| 939 the signal number itself and then optionally followed by the | 961 the signal number itself and then optionally followed by the |
| 940 thread id and address to saved context within the DLL. If | 962 thread id and address to saved context within the DLL. If |
| 941 these are supplied, then the given thread is assumed to have | 963 these are supplied, then the given thread is assumed to have |
| 942 issued the signal and the context from the thread is assumed | 964 issued the signal and the context from the thread is assumed |
| 943 to be stored at the given address in the inferior. Tell gdb | 965 to be stored at the given address in the inferior. Tell gdb |
| 944 to treat this like a real signal. */ | 966 to treat this like a real signal. */ |
| 945 char *p; | 967 char *p; |
| 946 int sig = strtol (s + sizeof (_CYGWIN_SIGNAL_STRING) - 1, &p, 0); | 968 int sig = strtol (s + sizeof (_CYGWIN_SIGNAL_STRING) - 1, &p, 0); |
| 947 int gotasig = target_signal_from_host (sig); | 969 int gotasig = gdb_signal_from_host (sig); |
| 948 ourstatus->value.sig = gotasig; | 970 ourstatus->value.sig = gotasig; |
| 949 if (gotasig) | 971 if (gotasig) |
| 950 { | 972 { |
| 951 LPCVOID x; | 973 LPCVOID x; |
| 952 DWORD n; | 974 DWORD n; |
| 953 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 975 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 954 retval = strtoul (p, &p, 0); | 976 retval = strtoul (p, &p, 0); |
| 955 if (!retval) | 977 if (!retval) |
| 956 retval = main_thread_id; | 978 retval = main_thread_id; |
| 957 else if ((x = (LPCVOID) strtoul (p, &p, 0)) | 979 else if ((x = (LPCVOID) strtoul (p, &p, 0)) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 | 1120 |
| 1099 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 1121 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 1100 | 1122 |
| 1101 /* Record the context of the current thread. */ | 1123 /* Record the context of the current thread. */ |
| 1102 th = thread_rec (current_event.dwThreadId, -1); | 1124 th = thread_rec (current_event.dwThreadId, -1); |
| 1103 | 1125 |
| 1104 switch (code) | 1126 switch (code) |
| 1105 { | 1127 { |
| 1106 case EXCEPTION_ACCESS_VIOLATION: | 1128 case EXCEPTION_ACCESS_VIOLATION: |
| 1107 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ACCESS_VIOLATION"); | 1129 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ACCESS_VIOLATION"); |
| 1108 ourstatus->value.sig = TARGET_SIGNAL_SEGV; | 1130 ourstatus->value.sig = GDB_SIGNAL_SEGV; |
| 1109 #ifdef __CYGWIN__ | 1131 #ifdef __CYGWIN__ |
| 1110 { | 1132 { |
| 1111 /* See if the access violation happened within the cygwin DLL | 1133 /* See if the access violation happened within the cygwin DLL |
| 1112 itself. Cygwin uses a kind of exception handling to deal | 1134 itself. Cygwin uses a kind of exception handling to deal |
| 1113 with passed-in invalid addresses. gdb should not treat | 1135 with passed-in invalid addresses. gdb should not treat |
| 1114 these as real SEGVs since they will be silently handled by | 1136 these as real SEGVs since they will be silently handled by |
| 1115 cygwin. A real SEGV will (theoretically) be caught by | 1137 cygwin. A real SEGV will (theoretically) be caught by |
| 1116 cygwin later in the process and will be sent as a | 1138 cygwin later in the process and will be sent as a |
| 1117 cygwin-specific-signal. So, ignore SEGVs if they show up | 1139 cygwin-specific-signal. So, ignore SEGVs if they show up |
| 1118 within the text segment of the DLL itself. */ | 1140 within the text segment of the DLL itself. */ |
| 1119 » char *fn; | 1141 » const char *fn; |
| 1120 CORE_ADDR addr = (CORE_ADDR) (uintptr_t) | 1142 CORE_ADDR addr = (CORE_ADDR) (uintptr_t) |
| 1121 current_event.u.Exception.ExceptionRecord.ExceptionAddress; | 1143 current_event.u.Exception.ExceptionRecord.ExceptionAddress; |
| 1122 | 1144 |
| 1123 if ((!cygwin_exceptions && (addr >= cygwin_load_start | 1145 if ((!cygwin_exceptions && (addr >= cygwin_load_start |
| 1124 && addr < cygwin_load_end)) | 1146 && addr < cygwin_load_end)) |
| 1125 || (find_pc_partial_function (addr, &fn, NULL, NULL) | 1147 || (find_pc_partial_function (addr, &fn, NULL, NULL) |
| 1126 && strncmp (fn, "KERNEL32!IsBad", | 1148 && strncmp (fn, "KERNEL32!IsBad", |
| 1127 strlen ("KERNEL32!IsBad")) == 0)) | 1149 strlen ("KERNEL32!IsBad")) == 0)) |
| 1128 return 0; | 1150 return 0; |
| 1129 } | 1151 } |
| 1130 #endif | 1152 #endif |
| 1131 break; | 1153 break; |
| 1132 case STATUS_STACK_OVERFLOW: | 1154 case STATUS_STACK_OVERFLOW: |
| 1133 DEBUG_EXCEPTION_SIMPLE ("STATUS_STACK_OVERFLOW"); | 1155 DEBUG_EXCEPTION_SIMPLE ("STATUS_STACK_OVERFLOW"); |
| 1134 ourstatus->value.sig = TARGET_SIGNAL_SEGV; | 1156 ourstatus->value.sig = GDB_SIGNAL_SEGV; |
| 1135 break; | 1157 break; |
| 1136 case STATUS_FLOAT_DENORMAL_OPERAND: | 1158 case STATUS_FLOAT_DENORMAL_OPERAND: |
| 1137 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_DENORMAL_OPERAND"); | 1159 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_DENORMAL_OPERAND"); |
| 1138 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1160 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1139 break; | 1161 break; |
| 1140 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: | 1162 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: |
| 1141 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); | 1163 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); |
| 1142 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1164 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1143 break; | 1165 break; |
| 1144 case STATUS_FLOAT_INEXACT_RESULT: | 1166 case STATUS_FLOAT_INEXACT_RESULT: |
| 1145 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_INEXACT_RESULT"); | 1167 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_INEXACT_RESULT"); |
| 1146 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1168 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1147 break; | 1169 break; |
| 1148 case STATUS_FLOAT_INVALID_OPERATION: | 1170 case STATUS_FLOAT_INVALID_OPERATION: |
| 1149 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_INVALID_OPERATION"); | 1171 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_INVALID_OPERATION"); |
| 1150 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1172 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1151 break; | 1173 break; |
| 1152 case STATUS_FLOAT_OVERFLOW: | 1174 case STATUS_FLOAT_OVERFLOW: |
| 1153 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_OVERFLOW"); | 1175 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_OVERFLOW"); |
| 1154 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1176 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1155 break; | 1177 break; |
| 1156 case STATUS_FLOAT_STACK_CHECK: | 1178 case STATUS_FLOAT_STACK_CHECK: |
| 1157 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_STACK_CHECK"); | 1179 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_STACK_CHECK"); |
| 1158 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1180 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1159 break; | 1181 break; |
| 1160 case STATUS_FLOAT_UNDERFLOW: | 1182 case STATUS_FLOAT_UNDERFLOW: |
| 1161 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_UNDERFLOW"); | 1183 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_UNDERFLOW"); |
| 1162 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1184 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1163 break; | 1185 break; |
| 1164 case STATUS_FLOAT_DIVIDE_BY_ZERO: | 1186 case STATUS_FLOAT_DIVIDE_BY_ZERO: |
| 1165 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_DIVIDE_BY_ZERO"); | 1187 DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_DIVIDE_BY_ZERO"); |
| 1166 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1188 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1167 break; | 1189 break; |
| 1168 case STATUS_INTEGER_DIVIDE_BY_ZERO: | 1190 case STATUS_INTEGER_DIVIDE_BY_ZERO: |
| 1169 DEBUG_EXCEPTION_SIMPLE ("STATUS_INTEGER_DIVIDE_BY_ZERO"); | 1191 DEBUG_EXCEPTION_SIMPLE ("STATUS_INTEGER_DIVIDE_BY_ZERO"); |
| 1170 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1192 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1171 break; | 1193 break; |
| 1172 case STATUS_INTEGER_OVERFLOW: | 1194 case STATUS_INTEGER_OVERFLOW: |
| 1173 DEBUG_EXCEPTION_SIMPLE ("STATUS_INTEGER_OVERFLOW"); | 1195 DEBUG_EXCEPTION_SIMPLE ("STATUS_INTEGER_OVERFLOW"); |
| 1174 ourstatus->value.sig = TARGET_SIGNAL_FPE; | 1196 ourstatus->value.sig = GDB_SIGNAL_FPE; |
| 1175 break; | 1197 break; |
| 1176 case EXCEPTION_BREAKPOINT: | 1198 case EXCEPTION_BREAKPOINT: |
| 1177 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT"); | 1199 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT"); |
| 1178 ourstatus->value.sig = TARGET_SIGNAL_TRAP; | 1200 ourstatus->value.sig = GDB_SIGNAL_TRAP; |
| 1179 break; | 1201 break; |
| 1180 case DBG_CONTROL_C: | 1202 case DBG_CONTROL_C: |
| 1181 DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_C"); | 1203 DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_C"); |
| 1182 ourstatus->value.sig = TARGET_SIGNAL_INT; | 1204 ourstatus->value.sig = GDB_SIGNAL_INT; |
| 1183 break; | 1205 break; |
| 1184 case DBG_CONTROL_BREAK: | 1206 case DBG_CONTROL_BREAK: |
| 1185 DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_BREAK"); | 1207 DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_BREAK"); |
| 1186 ourstatus->value.sig = TARGET_SIGNAL_INT; | 1208 ourstatus->value.sig = GDB_SIGNAL_INT; |
| 1187 break; | 1209 break; |
| 1188 case EXCEPTION_SINGLE_STEP: | 1210 case EXCEPTION_SINGLE_STEP: |
| 1189 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_SINGLE_STEP"); | 1211 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_SINGLE_STEP"); |
| 1190 ourstatus->value.sig = TARGET_SIGNAL_TRAP; | 1212 ourstatus->value.sig = GDB_SIGNAL_TRAP; |
| 1191 break; | 1213 break; |
| 1192 case EXCEPTION_ILLEGAL_INSTRUCTION: | 1214 case EXCEPTION_ILLEGAL_INSTRUCTION: |
| 1193 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ILLEGAL_INSTRUCTION"); | 1215 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ILLEGAL_INSTRUCTION"); |
| 1194 ourstatus->value.sig = TARGET_SIGNAL_ILL; | 1216 ourstatus->value.sig = GDB_SIGNAL_ILL; |
| 1195 break; | 1217 break; |
| 1196 case EXCEPTION_PRIV_INSTRUCTION: | 1218 case EXCEPTION_PRIV_INSTRUCTION: |
| 1197 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_PRIV_INSTRUCTION"); | 1219 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_PRIV_INSTRUCTION"); |
| 1198 ourstatus->value.sig = TARGET_SIGNAL_ILL; | 1220 ourstatus->value.sig = GDB_SIGNAL_ILL; |
| 1199 break; | 1221 break; |
| 1200 case EXCEPTION_NONCONTINUABLE_EXCEPTION: | 1222 case EXCEPTION_NONCONTINUABLE_EXCEPTION: |
| 1201 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_NONCONTINUABLE_EXCEPTION"); | 1223 DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_NONCONTINUABLE_EXCEPTION"); |
| 1202 ourstatus->value.sig = TARGET_SIGNAL_ILL; | 1224 ourstatus->value.sig = GDB_SIGNAL_ILL; |
| 1203 break; | 1225 break; |
| 1204 default: | 1226 default: |
| 1205 /* Treat unhandled first chance exceptions specially. */ | 1227 /* Treat unhandled first chance exceptions specially. */ |
| 1206 if (current_event.u.Exception.dwFirstChance) | 1228 if (current_event.u.Exception.dwFirstChance) |
| 1207 return -1; | 1229 return -1; |
| 1208 printf_unfiltered ("gdb: unknown target exception 0x%08lx at %s\n", | 1230 printf_unfiltered ("gdb: unknown target exception 0x%08lx at %s\n", |
| 1209 current_event.u.Exception.ExceptionRecord.ExceptionCode, | 1231 current_event.u.Exception.ExceptionRecord.ExceptionCode, |
| 1210 host_address_to_string ( | 1232 host_address_to_string ( |
| 1211 current_event.u.Exception.ExceptionRecord.ExceptionAddress)); | 1233 current_event.u.Exception.ExceptionRecord.ExceptionAddress)); |
| 1212 ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; | 1234 ourstatus->value.sig = GDB_SIGNAL_UNKNOWN; |
| 1213 break; | 1235 break; |
| 1214 } | 1236 } |
| 1215 exception_count++; | 1237 exception_count++; |
| 1216 last_sig = ourstatus->value.sig; | 1238 last_sig = ourstatus->value.sig; |
| 1217 return 1; | 1239 return 1; |
| 1218 } | 1240 } |
| 1219 | 1241 |
| 1220 /* Resume all artificially suspended threads if we are continuing | 1242 /* Resume all artificially suspended threads if we are continuing |
| 1221 execution. */ | 1243 execution. */ |
| 1222 static BOOL | 1244 static BOOL |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 current_thread = windows_add_thread ( | 1304 current_thread = windows_add_thread ( |
| 1283 ptid_build (current_event.dwProcessId, 0, | 1305 ptid_build (current_event.dwProcessId, 0, |
| 1284 current_event.dwThreadId), | 1306 current_event.dwThreadId), |
| 1285 current_event.u.CreateThread.hThread, | 1307 current_event.u.CreateThread.hThread, |
| 1286 current_event.u.CreateThread.lpThreadLocalBase); | 1308 current_event.u.CreateThread.lpThreadLocalBase); |
| 1287 return main_thread_id; | 1309 return main_thread_id; |
| 1288 } | 1310 } |
| 1289 | 1311 |
| 1290 static void | 1312 static void |
| 1291 windows_resume (struct target_ops *ops, | 1313 windows_resume (struct target_ops *ops, |
| 1292 » » ptid_t ptid, int step, enum target_signal sig) | 1314 » » ptid_t ptid, int step, enum gdb_signal sig) |
| 1293 { | 1315 { |
| 1294 thread_info *th; | 1316 thread_info *th; |
| 1295 DWORD continue_status = DBG_CONTINUE; | 1317 DWORD continue_status = DBG_CONTINUE; |
| 1296 | 1318 |
| 1297 /* A specific PTID means `step only this thread id'. */ | 1319 /* A specific PTID means `step only this thread id'. */ |
| 1298 int resume_all = ptid_equal (ptid, minus_one_ptid); | 1320 int resume_all = ptid_equal (ptid, minus_one_ptid); |
| 1299 | 1321 |
| 1300 /* If we're continuing all threads, it's the current inferior that | 1322 /* If we're continuing all threads, it's the current inferior that |
| 1301 should be handled specially. */ | 1323 should be handled specially. */ |
| 1302 if (resume_all) | 1324 if (resume_all) |
| 1303 ptid = inferior_ptid; | 1325 ptid = inferior_ptid; |
| 1304 | 1326 |
| 1305 if (sig != TARGET_SIGNAL_0) | 1327 if (sig != GDB_SIGNAL_0) |
| 1306 { | 1328 { |
| 1307 if (current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) | 1329 if (current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) |
| 1308 { | 1330 { |
| 1309 DEBUG_EXCEPT(("Cannot continue with signal %d here.\n",sig)); | 1331 DEBUG_EXCEPT(("Cannot continue with signal %d here.\n",sig)); |
| 1310 } | 1332 } |
| 1311 else if (sig == last_sig) | 1333 else if (sig == last_sig) |
| 1312 continue_status = DBG_EXCEPTION_NOT_HANDLED; | 1334 continue_status = DBG_EXCEPTION_NOT_HANDLED; |
| 1313 else | 1335 else |
| 1314 #if 0 | 1336 #if 0 |
| 1315 /* This code does not seem to work, because | 1337 /* This code does not seem to work, because |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1329 if (continue_status == DBG_CONTINUE) | 1351 if (continue_status == DBG_CONTINUE) |
| 1330 { | 1352 { |
| 1331 DEBUG_EXCEPT(("Cannot continue with signal %d.\n",sig)); | 1353 DEBUG_EXCEPT(("Cannot continue with signal %d.\n",sig)); |
| 1332 } | 1354 } |
| 1333 } | 1355 } |
| 1334 #endif | 1356 #endif |
| 1335 DEBUG_EXCEPT(("Can only continue with recieved signal %d.\n", | 1357 DEBUG_EXCEPT(("Can only continue with recieved signal %d.\n", |
| 1336 last_sig)); | 1358 last_sig)); |
| 1337 } | 1359 } |
| 1338 | 1360 |
| 1339 last_sig = TARGET_SIGNAL_0; | 1361 last_sig = GDB_SIGNAL_0; |
| 1340 | 1362 |
| 1341 DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n", | 1363 DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n", |
| 1342 ptid_get_pid (ptid), ptid_get_tid (ptid), step, sig)); | 1364 ptid_get_pid (ptid), ptid_get_tid (ptid), step, sig)); |
| 1343 | 1365 |
| 1344 /* Get context for currently selected thread. */ | 1366 /* Get context for currently selected thread. */ |
| 1345 th = thread_rec (ptid_get_tid (inferior_ptid), FALSE); | 1367 th = thread_rec (ptid_get_tid (inferior_ptid), FALSE); |
| 1346 if (th) | 1368 if (th) |
| 1347 { | 1369 { |
| 1348 if (step) | 1370 if (step) |
| 1349 { | 1371 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1377 if (resume_all) | 1399 if (resume_all) |
| 1378 windows_continue (continue_status, -1); | 1400 windows_continue (continue_status, -1); |
| 1379 else | 1401 else |
| 1380 windows_continue (continue_status, ptid_get_tid (ptid)); | 1402 windows_continue (continue_status, ptid_get_tid (ptid)); |
| 1381 } | 1403 } |
| 1382 | 1404 |
| 1383 /* Ctrl-C handler used when the inferior is not run in the same console. The | 1405 /* Ctrl-C handler used when the inferior is not run in the same console. The |
| 1384 handler is in charge of interrupting the inferior using DebugBreakProcess. | 1406 handler is in charge of interrupting the inferior using DebugBreakProcess. |
| 1385 Note that this function is not available prior to Windows XP. In this case | 1407 Note that this function is not available prior to Windows XP. In this case |
| 1386 we emit a warning. */ | 1408 we emit a warning. */ |
| 1387 BOOL WINAPI | 1409 static BOOL WINAPI |
| 1388 ctrl_c_handler (DWORD event_type) | 1410 ctrl_c_handler (DWORD event_type) |
| 1389 { | 1411 { |
| 1390 const int attach_flag = current_inferior ()->attach_flag; | 1412 const int attach_flag = current_inferior ()->attach_flag; |
| 1391 | 1413 |
| 1392 /* Only handle Ctrl-C and Ctrl-Break events. Ignore others. */ | 1414 /* Only handle Ctrl-C and Ctrl-Break events. Ignore others. */ |
| 1393 if (event_type != CTRL_C_EVENT && event_type != CTRL_BREAK_EVENT) | 1415 if (event_type != CTRL_C_EVENT && event_type != CTRL_BREAK_EVENT) |
| 1394 return FALSE; | 1416 return FALSE; |
| 1395 | 1417 |
| 1396 /* If the inferior and the debugger share the same console, do nothing as | 1418 /* If the inferior and the debugger share the same console, do nothing as |
| 1397 the inferior has also received the Ctrl-C event. */ | 1419 the inferior has also received the Ctrl-C event. */ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1411 static int | 1433 static int |
| 1412 get_windows_debug_event (struct target_ops *ops, | 1434 get_windows_debug_event (struct target_ops *ops, |
| 1413 int pid, struct target_waitstatus *ourstatus) | 1435 int pid, struct target_waitstatus *ourstatus) |
| 1414 { | 1436 { |
| 1415 BOOL debug_event; | 1437 BOOL debug_event; |
| 1416 DWORD continue_status, event_code; | 1438 DWORD continue_status, event_code; |
| 1417 thread_info *th; | 1439 thread_info *th; |
| 1418 static thread_info dummy_thread_info; | 1440 static thread_info dummy_thread_info; |
| 1419 int retval = 0; | 1441 int retval = 0; |
| 1420 | 1442 |
| 1421 last_sig = TARGET_SIGNAL_0; | 1443 last_sig = GDB_SIGNAL_0; |
| 1422 | 1444 |
| 1423 if (!(debug_event = WaitForDebugEvent (¤t_event, 1000))) | 1445 if (!(debug_event = WaitForDebugEvent (¤t_event, 1000))) |
| 1424 goto out; | 1446 goto out; |
| 1425 | 1447 |
| 1426 event_count++; | 1448 event_count++; |
| 1427 continue_status = DBG_CONTINUE; | 1449 continue_status = DBG_CONTINUE; |
| 1428 | 1450 |
| 1429 event_code = current_event.dwDebugEventCode; | 1451 event_code = current_event.dwDebugEventCode; |
| 1430 ourstatus->kind = TARGET_WAITKIND_SPURIOUS; | 1452 ourstatus->kind = TARGET_WAITKIND_SPURIOUS; |
| 1431 th = NULL; | 1453 th = NULL; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 } | 1693 } |
| 1672 | 1694 |
| 1673 static void | 1695 static void |
| 1674 do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching) | 1696 do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching) |
| 1675 { | 1697 { |
| 1676 extern int stop_after_trap; | 1698 extern int stop_after_trap; |
| 1677 int i; | 1699 int i; |
| 1678 struct inferior *inf; | 1700 struct inferior *inf; |
| 1679 struct thread_info *tp; | 1701 struct thread_info *tp; |
| 1680 | 1702 |
| 1681 last_sig = TARGET_SIGNAL_0; | 1703 last_sig = GDB_SIGNAL_0; |
| 1682 event_count = 0; | 1704 event_count = 0; |
| 1683 exception_count = 0; | 1705 exception_count = 0; |
| 1684 open_process_used = 0; | 1706 open_process_used = 0; |
| 1685 debug_registers_changed = 0; | 1707 debug_registers_changed = 0; |
| 1686 debug_registers_used = 0; | 1708 debug_registers_used = 0; |
| 1687 for (i = 0; i < sizeof (dr) / sizeof (dr[0]); i++) | 1709 for (i = 0; i < sizeof (dr) / sizeof (dr[0]); i++) |
| 1688 dr[i] = 0; | 1710 dr[i] = 0; |
| 1689 #ifdef __CYGWIN__ | 1711 #ifdef __CYGWIN__ |
| 1690 cygwin_load_start = cygwin_load_end = 0; | 1712 cygwin_load_start = cygwin_load_end = 0; |
| 1691 #endif | 1713 #endif |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1710 terminal_init_inferior_with_pgrp (pid); | 1732 terminal_init_inferior_with_pgrp (pid); |
| 1711 target_terminal_inferior (); | 1733 target_terminal_inferior (); |
| 1712 | 1734 |
| 1713 windows_initialization_done = 0; | 1735 windows_initialization_done = 0; |
| 1714 inf->control.stop_soon = STOP_QUIETLY; | 1736 inf->control.stop_soon = STOP_QUIETLY; |
| 1715 while (1) | 1737 while (1) |
| 1716 { | 1738 { |
| 1717 stop_after_trap = 1; | 1739 stop_after_trap = 1; |
| 1718 wait_for_inferior (); | 1740 wait_for_inferior (); |
| 1719 tp = inferior_thread (); | 1741 tp = inferior_thread (); |
| 1720 if (tp->suspend.stop_signal != TARGET_SIGNAL_TRAP) | 1742 if (tp->suspend.stop_signal != GDB_SIGNAL_TRAP) |
| 1721 resume (0, tp->suspend.stop_signal); | 1743 resume (0, tp->suspend.stop_signal); |
| 1722 else | 1744 else |
| 1723 break; | 1745 break; |
| 1724 } | 1746 } |
| 1725 | 1747 |
| 1726 windows_initialization_done = 1; | 1748 windows_initialization_done = 1; |
| 1727 inf->control.stop_soon = NO_STOP_QUIETLY; | 1749 inf->control.stop_soon = NO_STOP_QUIETLY; |
| 1728 stop_after_trap = 0; | 1750 stop_after_trap = 0; |
| 1729 return; | 1751 return; |
| 1730 } | 1752 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 do_initial_windows_stuff (ops, pid, 1); | 1853 do_initial_windows_stuff (ops, pid, 1); |
| 1832 target_terminal_ours (); | 1854 target_terminal_ours (); |
| 1833 } | 1855 } |
| 1834 | 1856 |
| 1835 static void | 1857 static void |
| 1836 windows_detach (struct target_ops *ops, char *args, int from_tty) | 1858 windows_detach (struct target_ops *ops, char *args, int from_tty) |
| 1837 { | 1859 { |
| 1838 int detached = 1; | 1860 int detached = 1; |
| 1839 | 1861 |
| 1840 ptid_t ptid = {-1}; | 1862 ptid_t ptid = {-1}; |
| 1841 windows_resume (ops, ptid, 0, TARGET_SIGNAL_0); | 1863 windows_resume (ops, ptid, 0, GDB_SIGNAL_0); |
| 1842 | 1864 |
| 1843 if (!DebugActiveProcessStop (current_event.dwProcessId)) | 1865 if (!DebugActiveProcessStop (current_event.dwProcessId)) |
| 1844 { | 1866 { |
| 1845 error (_("Can't detach process %lu (error %lu)"), | 1867 error (_("Can't detach process %lu (error %lu)"), |
| 1846 current_event.dwProcessId, GetLastError ()); | 1868 current_event.dwProcessId, GetLastError ()); |
| 1847 detached = 0; | 1869 detached = 0; |
| 1848 } | 1870 } |
| 1849 DebugSetProcessKillOnExit (FALSE); | 1871 DebugSetProcessKillOnExit (FALSE); |
| 1850 | 1872 |
| 1851 if (detached && from_tty) | 1873 if (detached && from_tty) |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2486 windows_ops.to_has_registers = default_child_has_registers; | 2508 windows_ops.to_has_registers = default_child_has_registers; |
| 2487 windows_ops.to_has_execution = default_child_has_execution; | 2509 windows_ops.to_has_execution = default_child_has_execution; |
| 2488 windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file; | 2510 windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file; |
| 2489 windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid; | 2511 windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid; |
| 2490 windows_ops.to_get_tib_address = windows_get_tib_address; | 2512 windows_ops.to_get_tib_address = windows_get_tib_address; |
| 2491 | 2513 |
| 2492 i386_use_watchpoints (&windows_ops); | 2514 i386_use_watchpoints (&windows_ops); |
| 2493 | 2515 |
| 2494 i386_dr_low.set_control = cygwin_set_dr7; | 2516 i386_dr_low.set_control = cygwin_set_dr7; |
| 2495 i386_dr_low.set_addr = cygwin_set_dr; | 2517 i386_dr_low.set_addr = cygwin_set_dr; |
| 2496 i386_dr_low.reset_addr = NULL; | 2518 i386_dr_low.get_addr = cygwin_get_dr; |
| 2497 i386_dr_low.get_status = cygwin_get_dr6; | 2519 i386_dr_low.get_status = cygwin_get_dr6; |
| 2520 i386_dr_low.get_control = cygwin_get_dr7; |
| 2498 | 2521 |
| 2499 /* i386_dr_low.debug_register_length field is set by | 2522 /* i386_dr_low.debug_register_length field is set by |
| 2500 calling i386_set_debug_register_length function | 2523 calling i386_set_debug_register_length function |
| 2501 in processor windows specific native file. */ | 2524 in processor windows specific native file. */ |
| 2502 | 2525 |
| 2503 windows_ops.to_magic = OPS_MAGIC; | 2526 windows_ops.to_magic = OPS_MAGIC; |
| 2504 } | 2527 } |
| 2505 | 2528 |
| 2506 static void | 2529 static void |
| 2507 set_windows_aliases (char *argv0) | 2530 set_windows_aliases (char *argv0) |
| 2508 { | 2531 { |
| 2509 add_info_alias ("dll", "sharedlibrary", 1); | 2532 add_info_alias ("dll", "sharedlibrary", 1); |
| 2510 } | 2533 } |
| 2511 | 2534 |
| 2535 /* -Wmissing-prototypes */ |
| 2536 extern initialize_file_ftype _initialize_windows_nat; |
| 2537 |
| 2512 void | 2538 void |
| 2513 _initialize_windows_nat (void) | 2539 _initialize_windows_nat (void) |
| 2514 { | 2540 { |
| 2515 struct cmd_list_element *c; | 2541 struct cmd_list_element *c; |
| 2516 | 2542 |
| 2517 init_windows_ops (); | 2543 init_windows_ops (); |
| 2518 | 2544 |
| 2519 #ifdef __CYGWIN__ | 2545 #ifdef __CYGWIN__ |
| 2520 cygwin_internal (CW_SET_DOS_FILE_WARNING, 0); | 2546 cygwin_internal (CW_SET_DOS_FILE_WARNING, 0); |
| 2521 #endif | 2547 #endif |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2619 register. Here we just store the address in D_REGS, the watchpoint | 2645 register. Here we just store the address in D_REGS, the watchpoint |
| 2620 will be actually set up in windows_wait. */ | 2646 will be actually set up in windows_wait. */ |
| 2621 static void | 2647 static void |
| 2622 cygwin_set_dr7 (unsigned long val) | 2648 cygwin_set_dr7 (unsigned long val) |
| 2623 { | 2649 { |
| 2624 dr[7] = (CORE_ADDR) val; | 2650 dr[7] = (CORE_ADDR) val; |
| 2625 debug_registers_changed = 1; | 2651 debug_registers_changed = 1; |
| 2626 debug_registers_used = 1; | 2652 debug_registers_used = 1; |
| 2627 } | 2653 } |
| 2628 | 2654 |
| 2655 /* Get the value of debug register I from the inferior. */ |
| 2656 |
| 2657 static CORE_ADDR |
| 2658 cygwin_get_dr (int i) |
| 2659 { |
| 2660 return dr[i]; |
| 2661 } |
| 2662 |
| 2629 /* Get the value of the DR6 debug status register from the inferior. | 2663 /* Get the value of the DR6 debug status register from the inferior. |
| 2630 Here we just return the value stored in dr[6] | 2664 Here we just return the value stored in dr[6] |
| 2631 by the last call to thread_rec for current_event.dwThreadId id. */ | 2665 by the last call to thread_rec for current_event.dwThreadId id. */ |
| 2632 static unsigned long | 2666 static unsigned long |
| 2633 cygwin_get_dr6 (void) | 2667 cygwin_get_dr6 (void) |
| 2634 { | 2668 { |
| 2635 return (unsigned long) dr[6]; | 2669 return (unsigned long) dr[6]; |
| 2636 } | 2670 } |
| 2637 | 2671 |
| 2672 /* Get the value of the DR7 debug status register from the inferior. |
| 2673 Here we just return the value stored in dr[7] by the last call to |
| 2674 thread_rec for current_event.dwThreadId id. */ |
| 2675 |
| 2676 static unsigned long |
| 2677 cygwin_get_dr7 (void) |
| 2678 { |
| 2679 return (unsigned long) dr[7]; |
| 2680 } |
| 2681 |
| 2638 /* Determine if the thread referenced by "ptid" is alive | 2682 /* Determine if the thread referenced by "ptid" is alive |
| 2639 by "polling" it. If WaitForSingleObject returns WAIT_OBJECT_0 | 2683 by "polling" it. If WaitForSingleObject returns WAIT_OBJECT_0 |
| 2640 it means that the thread has died. Otherwise it is assumed to be alive. */ | 2684 it means that the thread has died. Otherwise it is assumed to be alive. */ |
| 2641 static int | 2685 static int |
| 2642 windows_thread_alive (struct target_ops *ops, ptid_t ptid) | 2686 windows_thread_alive (struct target_ops *ops, ptid_t ptid) |
| 2643 { | 2687 { |
| 2644 int tid; | 2688 int tid; |
| 2645 | 2689 |
| 2646 gdb_assert (ptid_get_tid (ptid) != 0); | 2690 gdb_assert (ptid_get_tid (ptid) != 0); |
| 2647 tid = ptid_get_tid (ptid); | 2691 tid = ptid_get_tid (ptid); |
| 2648 | 2692 |
| 2649 return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) == WAIT_OBJECT_0 | 2693 return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) == WAIT_OBJECT_0 |
| 2650 ? FALSE : TRUE; | 2694 ? FALSE : TRUE; |
| 2651 } | 2695 } |
| 2652 | 2696 |
| 2697 /* -Wmissing-prototypes */ |
| 2698 extern initialize_file_ftype _initialize_check_for_gdb_ini; |
| 2699 |
| 2653 void | 2700 void |
| 2654 _initialize_check_for_gdb_ini (void) | 2701 _initialize_check_for_gdb_ini (void) |
| 2655 { | 2702 { |
| 2656 char *homedir; | 2703 char *homedir; |
| 2657 if (inhibit_gdbinit) | 2704 if (inhibit_gdbinit) |
| 2658 return; | 2705 return; |
| 2659 | 2706 |
| 2660 homedir = getenv ("HOME"); | 2707 homedir = getenv ("HOME"); |
| 2661 if (homedir) | 2708 if (homedir) |
| 2662 { | 2709 { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2736 } | 2783 } |
| 2737 static COORD WINAPI | 2784 static COORD WINAPI |
| 2738 bad_GetConsoleFontSize (HANDLE w, DWORD nFont) | 2785 bad_GetConsoleFontSize (HANDLE w, DWORD nFont) |
| 2739 { | 2786 { |
| 2740 COORD size; | 2787 COORD size; |
| 2741 size.X = 8; | 2788 size.X = 8; |
| 2742 size.Y = 12; | 2789 size.Y = 12; |
| 2743 return size; | 2790 return size; |
| 2744 } | 2791 } |
| 2745 | 2792 |
| 2793 /* -Wmissing-prototypes */ |
| 2794 extern initialize_file_ftype _initialize_loadable; |
| 2795 |
| 2746 /* Load any functions which may not be available in ancient versions | 2796 /* Load any functions which may not be available in ancient versions |
| 2747 of Windows. */ | 2797 of Windows. */ |
| 2798 |
| 2748 void | 2799 void |
| 2749 _initialize_loadable (void) | 2800 _initialize_loadable (void) |
| 2750 { | 2801 { |
| 2751 HMODULE hm = NULL; | 2802 HMODULE hm = NULL; |
| 2752 | 2803 |
| 2753 hm = LoadLibrary ("kernel32.dll"); | 2804 hm = LoadLibrary ("kernel32.dll"); |
| 2754 if (hm) | 2805 if (hm) |
| 2755 { | 2806 { |
| 2756 DebugActiveProcessStop = (void *) | 2807 DebugActiveProcessStop = (void *) |
| 2757 GetProcAddress (hm, "DebugActiveProcessStop"); | 2808 GetProcAddress (hm, "DebugActiveProcessStop"); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2814 GetProcAddress (hm, "LookupPrivilegeValueA"); | 2865 GetProcAddress (hm, "LookupPrivilegeValueA"); |
| 2815 AdjustTokenPrivileges = (void *) | 2866 AdjustTokenPrivileges = (void *) |
| 2816 GetProcAddress (hm, "AdjustTokenPrivileges"); | 2867 GetProcAddress (hm, "AdjustTokenPrivileges"); |
| 2817 /* Only need to set one of these since if OpenProcessToken fails nothing | 2868 /* Only need to set one of these since if OpenProcessToken fails nothing |
| 2818 else is needed. */ | 2869 else is needed. */ |
| 2819 if (!OpenProcessToken || !LookupPrivilegeValueA | 2870 if (!OpenProcessToken || !LookupPrivilegeValueA |
| 2820 || !AdjustTokenPrivileges) | 2871 || !AdjustTokenPrivileges) |
| 2821 OpenProcessToken = bad_OpenProcessToken; | 2872 OpenProcessToken = bad_OpenProcessToken; |
| 2822 } | 2873 } |
| 2823 } | 2874 } |
| OLD | NEW |