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

Side by Side Diff: gdb/ia64-linux-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/ia64-libunwind-tdep.c ('k') | gdb/ia64-tdep.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 /* Functions specific to running gdb native on IA-64 running 1 /* Functions specific to running gdb native on IA-64 running
2 GNU/Linux. 2 GNU/Linux.
3 3
4 Copyright (C) 1999-2012 Free Software Foundation, Inc. 4 Copyright (C) 1999-2012 Free Software Foundation, Inc.
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 -1, -1, -1, 265 -1, -1, -1,
266 PT_AR_UNAT, 266 PT_AR_UNAT,
267 -1, -1, -1, 267 -1, -1, -1,
268 PT_AR_FPSR, 268 PT_AR_FPSR,
269 -1, -1, -1, 269 -1, -1, -1,
270 -1, /* Not available: ITC */ 270 -1, /* Not available: ITC */
271 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 271 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
272 -1, -1, -1, -1, -1, -1, -1, -1, -1, 272 -1, -1, -1, -1, -1, -1, -1, -1, -1,
273 PT_AR_PFS, 273 PT_AR_PFS,
274 PT_AR_LC, 274 PT_AR_LC,
275 -1,»» /* Not available: EC, the Epilog Count register. */ 275 PT_AR_EC,
276 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 276 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
277 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 277 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
278 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 278 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
279 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 279 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
280 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 280 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
281 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 281 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
282 -1, 282 -1,
283 /* nat bits - not fetched directly; instead we obtain these bits from 283 /* nat bits - not fetched directly; instead we obtain these bits from
284 either rnat or unat or from memory. */ 284 either rnat or unat or from memory. */
285 -1, -1, -1, -1, -1, -1, -1, -1, 285 -1, -1, -1, -1, -1, -1, -1, -1,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 /* Given a pointer to a floating point register set in /proc format 441 /* Given a pointer to a floating point register set in /proc format
442 (fpregset_t *), unpack the register contents and supply them as gdb's 442 (fpregset_t *), unpack the register contents and supply them as gdb's
443 idea of the current floating point register values. */ 443 idea of the current floating point register values. */
444 444
445 void 445 void
446 supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp) 446 supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
447 { 447 {
448 int regi; 448 int regi;
449 const char *from; 449 const char *from;
450 const gdb_byte f_zero[16] = { 0 };
451 const gdb_byte f_one[16] =
452 { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
450 453
451 for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++) 454 /* Kernel generated cores have fr1==0 instead of 1.0. Older GDBs
455 did the same. So ignore whatever might be recorded in fpregset_t
456 for fr0/fr1 and always supply their expected values. */
457
458 /* fr0 is always read as zero. */
459 regcache_raw_supply (regcache, IA64_FR0_REGNUM, f_zero);
460 /* fr1 is always read as one (1.0). */
461 regcache_raw_supply (regcache, IA64_FR1_REGNUM, f_one);
462
463 for (regi = IA64_FR2_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
452 { 464 {
453 from = (const char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]); 465 from = (const char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]);
454 regcache_raw_supply (regcache, regi, from); 466 regcache_raw_supply (regcache, regi, from);
455 } 467 }
456 } 468 }
457 469
458 /* Given a pointer to a floating point register set in /proc format 470 /* Given a pointer to a floating point register set in /proc format
459 (fpregset_t *), update the register specified by REGNO from gdb's idea 471 (fpregset_t *), update the register specified by REGNO from gdb's idea
460 of the current floating point register set. If REGNO is -1, update 472 of the current floating point register set. If REGNO is -1, update
461 them all. */ 473 them all. */
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 ALL_LWPS (lp) 622 ALL_LWPS (lp)
611 store_debug_register_pair (lp->ptid, idx, &dbr_addr, &dbr_mask); 623 store_debug_register_pair (lp->ptid, idx, &dbr_addr, &dbr_mask);
612 624
613 return 0; 625 return 0;
614 } 626 }
615 } 627 }
616 return -1; 628 return -1;
617 } 629 }
618 630
619 static void 631 static void
620 ia64_linux_new_thread (ptid_t ptid) 632 ia64_linux_new_thread (struct lwp_info *lp)
621 { 633 {
622 int i, any; 634 int i, any;
623 635
624 any = 0; 636 any = 0;
625 for (i = 0; i < 8; i++) 637 for (i = 0; i < 8; i++)
626 { 638 {
627 if (debug_registers[i] != 0) 639 if (debug_registers[i] != 0)
628 any = 1; 640 any = 1;
629 store_debug_register (ptid, i, debug_registers[i]); 641 store_debug_register (lp->ptid, i, debug_registers[i]);
630 } 642 }
631 643
632 if (any) 644 if (any)
633 enable_watchpoints_in_psr (ptid); 645 enable_watchpoints_in_psr (lp->ptid);
634 } 646 }
635 647
636 static int 648 static int
637 ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) 649 ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
638 { 650 {
639 CORE_ADDR psr; 651 CORE_ADDR psr;
640 struct siginfo *siginfo_p; 652 siginfo_t siginfo;
641 struct regcache *regcache = get_current_regcache (); 653 struct regcache *regcache = get_current_regcache ();
642 654
643 siginfo_p = linux_nat_get_siginfo (inferior_ptid); 655 if (!linux_nat_get_siginfo (inferior_ptid, &siginfo))
656 return 0;
644 657
645 if (siginfo_p->si_signo != SIGTRAP 658 if (siginfo.si_signo != SIGTRAP
646 || (siginfo_p->si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */) 659 || (siginfo.si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */)
647 return 0; 660 return 0;
648 661
649 regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr); 662 regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);
650 psr |= IA64_PSR_DD; /* Set the dd bit - this will disable the watchpoint 663 psr |= IA64_PSR_DD; /* Set the dd bit - this will disable the watchpoint
651 for the next instruction. */ 664 for the next instruction. */
652 regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr); 665 regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr);
653 666
654 *addr_p = (CORE_ADDR)siginfo_p->si_addr; 667 *addr_p = (CORE_ADDR) siginfo.si_addr;
655 return 1; 668 return 1;
656 } 669 }
657 670
658 static int 671 static int
659 ia64_linux_stopped_by_watchpoint (void) 672 ia64_linux_stopped_by_watchpoint (void)
660 { 673 {
661 CORE_ADDR addr; 674 CORE_ADDR addr;
662 return ia64_linux_stopped_data_address (&current_target, &addr); 675 return ia64_linux_stopped_data_address (&current_target, &addr);
663 } 676 }
664 677
665 static int 678 static int
666 ia64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype) 679 ia64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype)
667 { 680 {
668 return 1; 681 return 1;
669 } 682 }
670 683
671 684
672 /* Fetch register REGNUM from the inferior. */ 685 /* Fetch register REGNUM from the inferior. */
673 686
674 static void 687 static void
675 ia64_linux_fetch_register (struct regcache *regcache, int regnum) 688 ia64_linux_fetch_register (struct regcache *regcache, int regnum)
676 { 689 {
677 struct gdbarch *gdbarch = get_regcache_arch (regcache); 690 struct gdbarch *gdbarch = get_regcache_arch (regcache);
678 CORE_ADDR addr; 691 CORE_ADDR addr;
679 size_t size; 692 size_t size;
680 PTRACE_TYPE_RET *buf; 693 PTRACE_TYPE_RET *buf;
681 int pid, i; 694 int pid, i;
682 695
696 /* r0 cannot be fetched but is always zero. */
697 if (regnum == IA64_GR0_REGNUM)
698 {
699 const gdb_byte zero[8] = { 0 };
700
701 gdb_assert (sizeof (zero) == register_size (gdbarch, regnum));
702 regcache_raw_supply (regcache, regnum, zero);
703 return;
704 }
705
706 /* fr0 cannot be fetched but is always zero. */
707 if (regnum == IA64_FR0_REGNUM)
708 {
709 const gdb_byte f_zero[16] = { 0 };
710
711 gdb_assert (sizeof (f_zero) == register_size (gdbarch, regnum));
712 regcache_raw_supply (regcache, regnum, f_zero);
713 return;
714 }
715
716 /* fr1 cannot be fetched but is always one (1.0). */
717 if (regnum == IA64_FR1_REGNUM)
718 {
719 const gdb_byte f_one[16] =
720 { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
721
722 gdb_assert (sizeof (f_one) == register_size (gdbarch, regnum));
723 regcache_raw_supply (regcache, regnum, f_one);
724 return;
725 }
726
683 if (ia64_cannot_fetch_register (gdbarch, regnum)) 727 if (ia64_cannot_fetch_register (gdbarch, regnum))
684 { 728 {
685 regcache_raw_supply (regcache, regnum, NULL); 729 regcache_raw_supply (regcache, regnum, NULL);
686 return; 730 return;
687 } 731 }
688 732
689 /* Cater for systems like GNU/Linux, that implement threads as 733 /* Cater for systems like GNU/Linux, that implement threads as
690 separate processes. */ 734 separate processes. */
691 pid = ptid_get_lwp (inferior_ptid); 735 pid = ptid_get_lwp (inferior_ptid);
692 if (pid == 0) 736 if (pid == 0)
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 t->to_stopped_by_watchpoint = ia64_linux_stopped_by_watchpoint; 897 t->to_stopped_by_watchpoint = ia64_linux_stopped_by_watchpoint;
854 t->to_stopped_data_address = ia64_linux_stopped_data_address; 898 t->to_stopped_data_address = ia64_linux_stopped_data_address;
855 t->to_insert_watchpoint = ia64_linux_insert_watchpoint; 899 t->to_insert_watchpoint = ia64_linux_insert_watchpoint;
856 t->to_remove_watchpoint = ia64_linux_remove_watchpoint; 900 t->to_remove_watchpoint = ia64_linux_remove_watchpoint;
857 901
858 /* Register the target. */ 902 /* Register the target. */
859 linux_nat_add_target (t); 903 linux_nat_add_target (t);
860 linux_nat_set_new_thread (t, ia64_linux_new_thread); 904 linux_nat_set_new_thread (t, ia64_linux_new_thread);
861 linux_nat_set_status_is_event (t, ia64_linux_status_is_event); 905 linux_nat_set_status_is_event (t, ia64_linux_status_is_event);
862 } 906 }
OLDNEW
« no previous file with comments | « gdb/ia64-libunwind-tdep.c ('k') | gdb/ia64-tdep.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698