• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisãoa1bf24956370142803e3204fb64f5cbd5c69c750 (tree)
Hora2012-03-06 22:19:13
AutorPedro Alves <palves@redh...>
CommiterPedro Alves

Mensagem de Log

2012-03-06 Pedro Alves <palves@redhat.com>

PR gdb/13766

* i387-tdep.c (i387_supply_xsave): If we have an xsave buffer, and
the register state is clear, supply explicit zero, instead of
marking the register unavailable.

Mudança Sumário

Diff

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
1+2012-03-06 Pedro Alves <palves@redhat.com>
2+
3+ PR gdb/13766
4+
5+ * i387-tdep.c (i387_supply_xsave): If we have an xsave buffer, and
6+ the register state is clear, supply explicit zero, instead of
7+ marking the register unavailable.
8+
19 2011-10-20 Aleksandar Ristovski <aristovski@qnx.com>
210
311 * cp-namespace.c (cp_scan_for_anonymous_namespaces): Changed function
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -726,6 +726,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
726726 const gdb_byte *regs = xsave;
727727 int i;
728728 unsigned int clear_bv;
729+ static const gdb_byte zero[MAX_REGISTER_SIZE] = { 0 };
729730 const gdb_byte *p;
730731 enum
731732 {
@@ -765,6 +766,19 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
765766 else
766767 clear_bv = I386_XSTATE_AVX_MASK;
767768
769+ /* With the delayed xsave mechanism, in between the program
770+ starting, and the program accessing the vector registers for the
771+ first time, the register's values are invalid. The kernel
772+ initializes register states to zero when they are set the first
773+ time in a program. This means that from the user-space programs'
774+ perspective, it's the same as if the registers have always been
775+ zero from the start of the program. Therefore, the debugger
776+ should provide the same illusion to the user.
777+
778+ Note however, the case when REGS is NULL is a different case.
779+ That case means we do not have access to the x87 states, so we
780+ should mark the registers as unavailable (by supplying NULL). */
781+
768782 switch (regclass)
769783 {
770784 case none:
@@ -772,26 +786,26 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
772786
773787 case avxh:
774788 if ((clear_bv & I386_XSTATE_AVX))
775- p = NULL;
789+ regcache_raw_supply (regcache, regnum, regs == NULL ? NULL : zero);
776790 else
777- p = XSAVE_AVXH_ADDR (tdep, regs, regnum);
778- regcache_raw_supply (regcache, regnum, p);
791+ regcache_raw_supply (regcache, regnum,
792+ XSAVE_AVXH_ADDR (tdep, regs, regnum));
779793 return;
780794
781795 case sse:
782796 if ((clear_bv & I386_XSTATE_SSE))
783- p = NULL;
797+ regcache_raw_supply (regcache, regnum, regs == NULL ? NULL : zero);
784798 else
785- p = FXSAVE_ADDR (tdep, regs, regnum);
786- regcache_raw_supply (regcache, regnum, p);
799+ regcache_raw_supply (regcache, regnum,
800+ FXSAVE_ADDR (tdep, regs, regnum));
787801 return;
788802
789803 case x87:
790804 if ((clear_bv & I386_XSTATE_X87))
791- p = NULL;
805+ regcache_raw_supply (regcache, regnum, regs == NULL ? NULL : zero);
792806 else
793- p = FXSAVE_ADDR (tdep, regs, regnum);
794- regcache_raw_supply (regcache, regnum, p);
807+ regcache_raw_supply (regcache, regnum,
808+ FXSAVE_ADDR (tdep, regs, regnum));
795809 return;
796810
797811 case all:
@@ -799,16 +813,19 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
799813 if ((tdep->xcr0 & I386_XSTATE_AVX))
800814 {
801815 if ((clear_bv & I386_XSTATE_AVX))
802- p = NULL;
816+ {
817+ for (i = I387_YMM0H_REGNUM (tdep);
818+ i < I387_YMMENDH_REGNUM (tdep);
819+ i++)
820+ regcache_raw_supply (regcache, i, regs == NULL ? NULL : zero);
821+ }
803822 else
804- p = regs;
805-
806- for (i = I387_YMM0H_REGNUM (tdep);
807- i < I387_YMMENDH_REGNUM (tdep); i++)
808823 {
809- if (p != NULL)
810- p = XSAVE_AVXH_ADDR (tdep, regs, i);
811- regcache_raw_supply (regcache, i, p);
824+ for (i = I387_YMM0H_REGNUM (tdep);
825+ i < I387_YMMENDH_REGNUM (tdep);
826+ i++)
827+ regcache_raw_supply (regcache, i,
828+ XSAVE_AVXH_ADDR (tdep, regs, i));
812829 }
813830 }
814831
@@ -816,16 +833,18 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
816833 if ((tdep->xcr0 & I386_XSTATE_SSE))
817834 {
818835 if ((clear_bv & I386_XSTATE_SSE))
819- p = NULL;
836+ {
837+ for (i = I387_XMM0_REGNUM (tdep);
838+ i < I387_MXCSR_REGNUM (tdep);
839+ i++)
840+ regcache_raw_supply (regcache, i, regs == NULL ? NULL : zero);
841+ }
820842 else
821- p = regs;
822-
823- for (i = I387_XMM0_REGNUM (tdep);
824- i < I387_MXCSR_REGNUM (tdep); i++)
825843 {
826- if (p != NULL)
827- p = FXSAVE_ADDR (tdep, regs, i);
828- regcache_raw_supply (regcache, i, p);
844+ for (i = I387_XMM0_REGNUM (tdep);
845+ i < I387_MXCSR_REGNUM (tdep); i++)
846+ regcache_raw_supply (regcache, i,
847+ FXSAVE_ADDR (tdep, regs, i));
829848 }
830849 }
831850
@@ -833,16 +852,18 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
833852 if ((tdep->xcr0 & I386_XSTATE_X87))
834853 {
835854 if ((clear_bv & I386_XSTATE_X87))
836- p = NULL;
855+ {
856+ for (i = I387_ST0_REGNUM (tdep);
857+ i < I387_FCTRL_REGNUM (tdep);
858+ i++)
859+ regcache_raw_supply (regcache, i, regs == NULL ? NULL : zero);
860+ }
837861 else
838- p = regs;
839-
840- for (i = I387_ST0_REGNUM (tdep);
841- i < I387_FCTRL_REGNUM (tdep); i++)
842862 {
843- if (p != NULL)
844- p = FXSAVE_ADDR (tdep, regs, i);
845- regcache_raw_supply (regcache, i, p);
863+ for (i = I387_ST0_REGNUM (tdep);
864+ i < I387_FCTRL_REGNUM (tdep);
865+ i++)
866+ regcache_raw_supply (regcache, i, FXSAVE_ADDR (tdep, regs, i));
846867 }
847868 }
848869 break;