Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: gdb/go32-nat.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/go-valprint.c ('k') | gdb/gregset.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Native debugging support for Intel x86 running DJGPP. 1 /* Native debugging support for Intel x86 running DJGPP.
2 Copyright (C) 1997, 1999-2001, 2005-2012 Free Software Foundation, 2 Copyright (C) 1997, 1999-2001, 2005-2012 Free Software Foundation,
3 Inc. 3 Inc.
4 Written by Robert Hoehne. 4 Written by Robert Hoehne.
5 5
6 This file is part of GDB. 6 This file is part of GDB.
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or 10 the Free Software Foundation; either version 3 of the License, or
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 #define SOME_PID 42 232 #define SOME_PID 42
233 233
234 static int prog_has_started = 0; 234 static int prog_has_started = 0;
235 static void go32_open (char *name, int from_tty); 235 static void go32_open (char *name, int from_tty);
236 static void go32_close (int quitting); 236 static void go32_close (int quitting);
237 static void go32_attach (struct target_ops *ops, char *args, int from_tty); 237 static void go32_attach (struct target_ops *ops, char *args, int from_tty);
238 static void go32_detach (struct target_ops *ops, char *args, int from_tty); 238 static void go32_detach (struct target_ops *ops, char *args, int from_tty);
239 static void go32_resume (struct target_ops *ops, 239 static void go32_resume (struct target_ops *ops,
240 ptid_t ptid, int step, 240 ptid_t ptid, int step,
241 » » » enum target_signal siggnal); 241 » » » enum gdb_signal siggnal);
242 static void go32_fetch_registers (struct target_ops *ops, 242 static void go32_fetch_registers (struct target_ops *ops,
243 struct regcache *, int regno); 243 struct regcache *, int regno);
244 static void store_register (const struct regcache *, int regno); 244 static void store_register (const struct regcache *, int regno);
245 static void go32_store_registers (struct target_ops *ops, 245 static void go32_store_registers (struct target_ops *ops,
246 struct regcache *, int regno); 246 struct regcache *, int regno);
247 static void go32_prepare_to_store (struct regcache *); 247 static void go32_prepare_to_store (struct regcache *);
248 static int go32_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, 248 static int go32_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
249 int write, 249 int write,
250 struct mem_attrib *attrib, 250 struct mem_attrib *attrib,
251 struct target_ops *target); 251 struct target_ops *target);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 {16, 2}, /* last FP exception CS from npx */ 302 {16, 2}, /* last FP exception CS from npx */
303 {12, 4}, /* last FP exception EIP from npx */ 303 {12, 4}, /* last FP exception EIP from npx */
304 {24, 2}, /* last FP exception operand selector from npx */ 304 {24, 2}, /* last FP exception operand selector from npx */
305 {20, 4}, /* last FP exception operand offset from npx */ 305 {20, 4}, /* last FP exception operand offset from npx */
306 {18, 2} /* last FP opcode from npx */ 306 {18, 2} /* last FP opcode from npx */
307 }; 307 };
308 308
309 static struct 309 static struct
310 { 310 {
311 int go32_sig; 311 int go32_sig;
312 enum target_signal gdb_sig; 312 enum gdb_signal gdb_sig;
313 } 313 }
314 sig_map[] = 314 sig_map[] =
315 { 315 {
316 {0, TARGET_SIGNAL_FPE}, 316 {0, GDB_SIGNAL_FPE},
317 {1, TARGET_SIGNAL_TRAP}, 317 {1, GDB_SIGNAL_TRAP},
318 /* Exception 2 is triggered by the NMI. DJGPP handles it as SIGILL, 318 /* Exception 2 is triggered by the NMI. DJGPP handles it as SIGILL,
319 but I think SIGBUS is better, since the NMI is usually activated 319 but I think SIGBUS is better, since the NMI is usually activated
320 as a result of a memory parity check failure. */ 320 as a result of a memory parity check failure. */
321 {2, TARGET_SIGNAL_BUS}, 321 {2, GDB_SIGNAL_BUS},
322 {3, TARGET_SIGNAL_TRAP}, 322 {3, GDB_SIGNAL_TRAP},
323 {4, TARGET_SIGNAL_FPE}, 323 {4, GDB_SIGNAL_FPE},
324 {5, TARGET_SIGNAL_SEGV}, 324 {5, GDB_SIGNAL_SEGV},
325 {6, TARGET_SIGNAL_ILL}, 325 {6, GDB_SIGNAL_ILL},
326 {7, TARGET_SIGNAL_EMT},» /* no-coprocessor exception */ 326 {7, GDB_SIGNAL_EMT},» /* no-coprocessor exception */
327 {8, TARGET_SIGNAL_SEGV}, 327 {8, GDB_SIGNAL_SEGV},
328 {9, TARGET_SIGNAL_SEGV}, 328 {9, GDB_SIGNAL_SEGV},
329 {10, TARGET_SIGNAL_BUS}, 329 {10, GDB_SIGNAL_BUS},
330 {11, TARGET_SIGNAL_SEGV}, 330 {11, GDB_SIGNAL_SEGV},
331 {12, TARGET_SIGNAL_SEGV}, 331 {12, GDB_SIGNAL_SEGV},
332 {13, TARGET_SIGNAL_SEGV}, 332 {13, GDB_SIGNAL_SEGV},
333 {14, TARGET_SIGNAL_SEGV}, 333 {14, GDB_SIGNAL_SEGV},
334 {16, TARGET_SIGNAL_FPE}, 334 {16, GDB_SIGNAL_FPE},
335 {17, TARGET_SIGNAL_BUS}, 335 {17, GDB_SIGNAL_BUS},
336 {31, TARGET_SIGNAL_ILL}, 336 {31, GDB_SIGNAL_ILL},
337 {0x1b, TARGET_SIGNAL_INT}, 337 {0x1b, GDB_SIGNAL_INT},
338 {0x75, TARGET_SIGNAL_FPE}, 338 {0x75, GDB_SIGNAL_FPE},
339 {0x78, TARGET_SIGNAL_ALRM}, 339 {0x78, GDB_SIGNAL_ALRM},
340 {0x79, TARGET_SIGNAL_INT}, 340 {0x79, GDB_SIGNAL_INT},
341 {0x7a, TARGET_SIGNAL_QUIT}, 341 {0x7a, GDB_SIGNAL_QUIT},
342 {-1, TARGET_SIGNAL_LAST} 342 {-1, GDB_SIGNAL_LAST}
343 }; 343 };
344 344
345 static struct { 345 static struct {
346 enum target_signal gdb_sig; 346 enum gdb_signal gdb_sig;
347 int djgpp_excepno; 347 int djgpp_excepno;
348 } excepn_map[] = { 348 } excepn_map[] = {
349 {TARGET_SIGNAL_0, -1}, 349 {GDB_SIGNAL_0, -1},
350 {TARGET_SIGNAL_ILL, 6},» /* Invalid Opcode */ 350 {GDB_SIGNAL_ILL, 6},» /* Invalid Opcode */
351 {TARGET_SIGNAL_EMT, 7},» /* triggers SIGNOFP */ 351 {GDB_SIGNAL_EMT, 7},» /* triggers SIGNOFP */
352 {TARGET_SIGNAL_SEGV, 13},» /* GPF */ 352 {GDB_SIGNAL_SEGV, 13},» /* GPF */
353 {TARGET_SIGNAL_BUS, 17},» /* Alignment Check */ 353 {GDB_SIGNAL_BUS, 17},»/* Alignment Check */
354 /* The rest are fake exceptions, see dpmiexcp.c in djlsr*.zip for 354 /* The rest are fake exceptions, see dpmiexcp.c in djlsr*.zip for
355 details. */ 355 details. */
356 {TARGET_SIGNAL_TERM, 0x1b},» /* triggers Ctrl-Break type of SIGINT */ 356 {GDB_SIGNAL_TERM, 0x1b},» /* triggers Ctrl-Break type of SIGINT */
357 {TARGET_SIGNAL_FPE, 0x75}, 357 {GDB_SIGNAL_FPE, 0x75},
358 {TARGET_SIGNAL_INT, 0x79}, 358 {GDB_SIGNAL_INT, 0x79},
359 {TARGET_SIGNAL_QUIT, 0x7a}, 359 {GDB_SIGNAL_QUIT, 0x7a},
360 {TARGET_SIGNAL_ALRM, 0x78},» /* triggers SIGTIMR */ 360 {GDB_SIGNAL_ALRM, 0x78},» /* triggers SIGTIMR */
361 {TARGET_SIGNAL_PROF, 0x78}, 361 {GDB_SIGNAL_PROF, 0x78},
362 {TARGET_SIGNAL_LAST, -1} 362 {GDB_SIGNAL_LAST, -1}
363 }; 363 };
364 364
365 static void 365 static void
366 go32_open (char *name, int from_tty) 366 go32_open (char *name, int from_tty)
367 { 367 {
368 printf_unfiltered ("Done. Use the \"run\" command to run the program.\n"); 368 printf_unfiltered ("Done. Use the \"run\" command to run the program.\n");
369 } 369 }
370 370
371 static void 371 static void
372 go32_close (int quitting) 372 go32_close (int quitting)
(...skipping 11 matching lines...) Expand all
384 static void 384 static void
385 go32_detach (struct target_ops *ops, char *args, int from_tty) 385 go32_detach (struct target_ops *ops, char *args, int from_tty)
386 { 386 {
387 } 387 }
388 388
389 static int resume_is_step; 389 static int resume_is_step;
390 static int resume_signal = -1; 390 static int resume_signal = -1;
391 391
392 static void 392 static void
393 go32_resume (struct target_ops *ops, 393 go32_resume (struct target_ops *ops,
394 » ptid_t ptid, int step, enum target_signal siggnal) 394 » ptid_t ptid, int step, enum gdb_signal siggnal)
395 { 395 {
396 int i; 396 int i;
397 397
398 resume_is_step = step; 398 resume_is_step = step;
399 399
400 if (siggnal != TARGET_SIGNAL_0 && siggnal != TARGET_SIGNAL_TRAP) 400 if (siggnal != GDB_SIGNAL_0 && siggnal != GDB_SIGNAL_TRAP)
401 { 401 {
402 for (i = 0, resume_signal = -1; 402 for (i = 0, resume_signal = -1;
403 » excepn_map[i].gdb_sig != TARGET_SIGNAL_LAST; i++) 403 » excepn_map[i].gdb_sig != GDB_SIGNAL_LAST; i++)
404 if (excepn_map[i].gdb_sig == siggnal) 404 if (excepn_map[i].gdb_sig == siggnal)
405 { 405 {
406 resume_signal = excepn_map[i].djgpp_excepno; 406 resume_signal = excepn_map[i].djgpp_excepno;
407 break; 407 break;
408 } 408 }
409 if (resume_signal == -1) 409 if (resume_signal == -1)
410 printf_unfiltered ("Cannot deliver signal %s on this platform.\n", 410 printf_unfiltered ("Cannot deliver signal %s on this platform.\n",
411 » » » target_signal_to_name (siggnal)); 411 » » » gdb_signal_to_name (siggnal));
412 } 412 }
413 } 413 }
414 414
415 static char child_cwd[FILENAME_MAX]; 415 static char child_cwd[FILENAME_MAX];
416 416
417 static ptid_t 417 static ptid_t
418 go32_wait (struct target_ops *ops, 418 go32_wait (struct target_ops *ops,
419 ptid_t ptid, struct target_waitstatus *status, int options) 419 ptid_t ptid, struct target_waitstatus *status, int options)
420 { 420 {
421 int i; 421 int i;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 getcwd (child_cwd, sizeof (child_cwd)); /* in case it has changed */ 506 getcwd (child_cwd, sizeof (child_cwd)); /* in case it has changed */
507 chdir (current_directory); 507 chdir (current_directory);
508 508
509 if (a_tss.tss_irqn == 0x21) 509 if (a_tss.tss_irqn == 0x21)
510 { 510 {
511 status->kind = TARGET_WAITKIND_EXITED; 511 status->kind = TARGET_WAITKIND_EXITED;
512 status->value.integer = a_tss.tss_eax & 0xff; 512 status->value.integer = a_tss.tss_eax & 0xff;
513 } 513 }
514 else 514 else
515 { 515 {
516 status->value.sig = TARGET_SIGNAL_UNKNOWN; 516 status->value.sig = GDB_SIGNAL_UNKNOWN;
517 status->kind = TARGET_WAITKIND_STOPPED; 517 status->kind = TARGET_WAITKIND_STOPPED;
518 for (i = 0; sig_map[i].go32_sig != -1; i++) 518 for (i = 0; sig_map[i].go32_sig != -1; i++)
519 { 519 {
520 if (a_tss.tss_irqn == sig_map[i].go32_sig) 520 if (a_tss.tss_irqn == sig_map[i].go32_sig)
521 { 521 {
522 #if __DJGPP_MINOR__ < 3 522 #if __DJGPP_MINOR__ < 3
523 if ((status->value.sig = sig_map[i].gdb_sig) != 523 if ((status->value.sig = sig_map[i].gdb_sig) !=
524 » » TARGET_SIGNAL_TRAP) 524 » » GDB_SIGNAL_TRAP)
525 status->kind = TARGET_WAITKIND_SIGNALLED; 525 status->kind = TARGET_WAITKIND_SIGNALLED;
526 #else 526 #else
527 status->value.sig = sig_map[i].gdb_sig; 527 status->value.sig = sig_map[i].gdb_sig;
528 #endif 528 #endif
529 break; 529 break;
530 } 530 }
531 } 531 }
532 } 532 }
533 return pid_to_ptid (SOME_PID); 533 return pid_to_ptid (SOME_PID);
534 } 534 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 794
795 /* Get the value of the DR6 debug status register from the inferior. 795 /* Get the value of the DR6 debug status register from the inferior.
796 Here we just return the value stored in D_REGS, as we've got it 796 Here we just return the value stored in D_REGS, as we've got it
797 from the last go32_wait call. */ 797 from the last go32_wait call. */
798 static unsigned long 798 static unsigned long
799 go32_get_dr6 (void) 799 go32_get_dr6 (void)
800 { 800 {
801 return STATUS; 801 return STATUS;
802 } 802 }
803 803
804 /* Get the value of the DR7 debug status register from the inferior.
805 Here we just return the value stored in D_REGS, as we've got it
806 from the last go32_wait call. */
807
808 static unsigned long
809 go32_get_dr7 (void)
810 {
811 return CONTROL;
812 }
813
814 /* Get the value of the DR debug register I from the inferior. Here
815 we just return the value stored in D_REGS, as we've got it from the
816 last go32_wait call. */
817
818 static CORE_ADDR
819 go32_get_dr (int i)
820 {
821 if (i < 0 || i > 3)
822 internal_error (__FILE__, __LINE__,
823 _("Invalid register %d in go32_get_dr.\n"), i);
824 return D_REGS[i];
825 }
826
804 /* Put the device open on handle FD into either raw or cooked 827 /* Put the device open on handle FD into either raw or cooked
805 mode, return 1 if it was in raw mode, zero otherwise. */ 828 mode, return 1 if it was in raw mode, zero otherwise. */
806 829
807 static int 830 static int
808 device_mode (int fd, int raw_p) 831 device_mode (int fd, int raw_p)
809 { 832 {
810 int oldmode, newmode; 833 int oldmode, newmode;
811 __dpmi_regs regs; 834 __dpmi_regs regs;
812 835
813 regs.x.ax = 0x4400; 836 regs.x.ax = 0x4400;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 go32_ops.to_has_memory = default_child_has_memory; 1000 go32_ops.to_has_memory = default_child_has_memory;
978 go32_ops.to_has_stack = default_child_has_stack; 1001 go32_ops.to_has_stack = default_child_has_stack;
979 go32_ops.to_has_registers = default_child_has_registers; 1002 go32_ops.to_has_registers = default_child_has_registers;
980 go32_ops.to_has_execution = default_child_has_execution; 1003 go32_ops.to_has_execution = default_child_has_execution;
981 1004
982 i386_use_watchpoints (&go32_ops); 1005 i386_use_watchpoints (&go32_ops);
983 1006
984 1007
985 i386_dr_low.set_control = go32_set_dr7; 1008 i386_dr_low.set_control = go32_set_dr7;
986 i386_dr_low.set_addr = go32_set_dr; 1009 i386_dr_low.set_addr = go32_set_dr;
987 i386_dr_low.reset_addr = NULL;
988 i386_dr_low.get_status = go32_get_dr6; 1010 i386_dr_low.get_status = go32_get_dr6;
1011 i386_dr_low.get_control = go32_get_dr7;
1012 i386_dr_low.get_addr = go32_get_dr;
989 i386_set_debug_register_length (4); 1013 i386_set_debug_register_length (4);
990 1014
991 go32_ops.to_magic = OPS_MAGIC; 1015 go32_ops.to_magic = OPS_MAGIC;
992 1016
993 /* Initialize child's cwd as empty to be initialized when starting 1017 /* Initialize child's cwd as empty to be initialized when starting
994 the child. */ 1018 the child. */
995 *child_cwd = 0; 1019 *child_cwd = 0;
996 1020
997 /* Initialize child's command line storage. */ 1021 /* Initialize child's command line storage. */
998 if (redir_debug_init (&child_cmd) == -1) 1022 if (redir_debug_init (&child_cmd) == -1)
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 } 2153 }
2130 2154
2131 int 2155 int
2132 tcsetpgrp (int fd, pid_t pgid) 2156 tcsetpgrp (int fd, pid_t pgid)
2133 { 2157 {
2134 if (isatty (fd) && pgid == SOME_PID) 2158 if (isatty (fd) && pgid == SOME_PID)
2135 return 0; 2159 return 0;
2136 errno = pgid == SOME_PID ? ENOTTY : ENOSYS; 2160 errno = pgid == SOME_PID ? ENOTTY : ENOSYS;
2137 return -1; 2161 return -1;
2138 } 2162 }
OLDNEW
« no previous file with comments | « gdb/go-valprint.c ('k') | gdb/gregset.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698