* [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10
@ 2004-10-30 19:51 Mark Kettenis
2004-10-30 19:59 ` Joseph S. Myers
2004-10-30 20:53 ` Andrew Cagney
0 siblings, 2 replies; 8+ messages in thread
From: Mark Kettenis @ 2004-10-30 19:51 UTC (permalink / raw)
To: gdb-patches
Including a .c file is perhaps a bit unorthodox, but this really is
the most elegant way I can think of to solve the issue with the
upcoming 64-bit Solaris 10.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* i386-sol2-nat.c: New file.
* Makefile.in (ALLDEPFILES): Add i386-sol2-nat.c and
i386-sol2-tdep.c.
(i386-sol2-nat.o): Update dependencies.
* config/i386/i386sol2.mh (NATDEPFILES): Remove i386v4.o, add
i386-sol2-nat.o.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.645
diff -u -p -r1.645 Makefile.in
--- Makefile.in 30 Oct 2004 14:31:19 -0000 1.645
+++ Makefile.in 30 Oct 2004 19:41:40 -0000
@@ -1379,6 +1379,7 @@ ALLDEPFILES = \
i386nbsd-nat.c i386nbsd-tdep.c i386obsd-nat.c i386obsd-tdep.c \
i387-tdep.c \
i386-linux-tdep.c i386-nat.c \
+ i386-sol2-nat.c i386-sol2-tdep.c \
i386gnu-nat.c i386gnu-tdep.c \
ia64-linux-nat.c ia64-linux-tdep.c ia64-tdep.c \
infptrace.c inftarg.c irix4-nat.c irix5-nat.c \
@@ -2033,6 +2034,8 @@ i386obsd-tdep.o: i386obsd-tdep.c $(defs_
$(gdbcore_h) $(regcache_h) $(regset_h) $(symtab_h) $(objfiles_h) \
$(osabi_h) $(target_h) $(gdb_assert_h) $(gdb_string_h) \
$(i386_tdep_h) $(i387_tdep_h) $(solib_svr4_h)
+i386-sol2-nat.o: i386-sol2-nat.c $(defs_h) $(regcache_h) $(gregset_h) \
+ i386v4-nat.c
i386-sol2-tdep.o: i386-sol2-tdep.c $(defs_h) $(value_h) $(osabi_h) \
$(gdb_string_h) $(i386_tdep_h) $(solib_svr4_h)
i386-stub.o: i386-stub.c
Index: i386-sol2-nat.c
===================================================================
RCS file: i386-sol2-nat.c
diff -N i386-sol2-nat.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ i386-sol2-nat.c 30 Oct 2004 19:41:40 -0000
@@ -0,0 +1,78 @@
+/* Native-dependent code for Solaris x86.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "regcache.h"
+
+#include <sys/procfs.h>
+#include "gregset.h"
+
+/* This file provids the (temporary) glue between the Solaris x86
+ target dependent code and the machine independent SVR4 /proc
+ support. */
+
+/* Solaris 10 (Solaris 2.10, SunOS 5.10) and up support two process
+ data models, the traditional 32-bit data model (ILP32) and the
+ 64-bit data model (LP64). The format of /proc depends on the data
+ model of the observer (the controlling process, GDB in our case).
+ The Solaris header files conveniently define PR_MODEL_NATIVE to the
+ data model of the controlling process. If its value is
+ PR_MODEL_LP64, we know that GDB is being compiled as a 64-bit
+ program.
+
+ Note that a 32-bit GDB won't be able to debug a 64-bit target
+ process using /proc on Solaris. */
+
+#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
+
+#include "amd64-nat.h"
+#include "amd64-tdep.h"
+
+void
+supply_gregset (prgregset_t *gregs)
+{
+ amd64_supply_native_gregset (current_regcache, -1, gregs);
+}
+
+void
+supply_fpregset (prfpregset_t *fpregs)
+{
+ amd64_supply_fxsave (current_regcache, -1, fpregs);
+}
+
+void
+fill_gregset (prgregset_t *gregs, int regnum)
+{
+ amd64_collect_native_gregset (current_regcache, regnum, gregs);
+}
+
+void
+fill_fpregset (prfpregset_t *fpregs, int regnum)
+{
+ amd64_collect_fxsave (current_regcache, regnum, fpregs);
+}
+
+#else
+
+/* 32-bit Solaris x86 is very similar to SVR4. */
+#include "i386v4-nat.c"
+
+#endif
Index: config/i386/i386sol2.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/i386sol2.mh,v
retrieving revision 1.9
diff -u -p -r1.9 i386sol2.mh
--- config/i386/i386sol2.mh 29 Jul 2004 20:04:20 -0000 1.9
+++ config/i386/i386sol2.mh 30 Oct 2004 19:41:40 -0000
@@ -1,4 +1,4 @@
# Host: Solaris x86
-NATDEPFILES= fork-child.o i386v4-nat.o \
+NATDEPFILES= fork-child.o i386-sol2-nat.o \
procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o
NAT_FILE= nm-i386sol2.h
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 2004-10-30 19:51 [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 Mark Kettenis @ 2004-10-30 19:59 ` Joseph S. Myers 2004-10-30 20:53 ` Andrew Cagney 1 sibling, 0 replies; 8+ messages in thread From: Joseph S. Myers @ 2004-10-30 19:59 UTC (permalink / raw) To: Mark Kettenis; +Cc: gdb-patches On Sat, 30 Oct 2004, Mark Kettenis wrote: > Including a .c file is perhaps a bit unorthodox, but this really is > the most elegant way I can think of to solve the issue with the > upcoming 64-bit Solaris 10. I had considered such an approach but decided against it on the grounds of lack of any precedent in GDB for one .c file to include another. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 2004-10-30 19:51 [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 Mark Kettenis 2004-10-30 19:59 ` Joseph S. Myers @ 2004-10-30 20:53 ` Andrew Cagney 2004-10-30 21:13 ` Mark Kettenis 1 sibling, 1 reply; 8+ messages in thread From: Andrew Cagney @ 2004-10-30 20:53 UTC (permalink / raw) To: Mark Kettenis; +Cc: gdb-patches Mark Kettenis wrote: > Including a .c file is perhaps a bit unorthodox, but this really is > the most elegant way I can think of to solve the issue with the > upcoming 64-bit Solaris 10. Why not have 368-sol2-nat inherit i386v4-nat's target vector? Andrew > Index: Makefile.in > =================================================================== > RCS file: /cvs/src/src/gdb/Makefile.in,v > retrieving revision 1.645 > diff -u -p -r1.645 Makefile.in > --- Makefile.in 30 Oct 2004 14:31:19 -0000 1.645 > +++ Makefile.in 30 Oct 2004 19:41:40 -0000 > @@ -1379,6 +1379,7 @@ ALLDEPFILES = \ > i386nbsd-nat.c i386nbsd-tdep.c i386obsd-nat.c i386obsd-tdep.c \ > i387-tdep.c \ > i386-linux-tdep.c i386-nat.c \ > + i386-sol2-nat.c i386-sol2-tdep.c \ > i386gnu-nat.c i386gnu-tdep.c \ > ia64-linux-nat.c ia64-linux-tdep.c ia64-tdep.c \ > infptrace.c inftarg.c irix4-nat.c irix5-nat.c \ > @@ -2033,6 +2034,8 @@ i386obsd-tdep.o: i386obsd-tdep.c $(defs_ > $(gdbcore_h) $(regcache_h) $(regset_h) $(symtab_h) $(objfiles_h) \ > $(osabi_h) $(target_h) $(gdb_assert_h) $(gdb_string_h) \ > $(i386_tdep_h) $(i387_tdep_h) $(solib_svr4_h) > +i386-sol2-nat.o: i386-sol2-nat.c $(defs_h) $(regcache_h) $(gregset_h) \ > + i386v4-nat.c > i386-sol2-tdep.o: i386-sol2-tdep.c $(defs_h) $(value_h) $(osabi_h) \ > $(gdb_string_h) $(i386_tdep_h) $(solib_svr4_h) > i386-stub.o: i386-stub.c > Index: i386-sol2-nat.c > =================================================================== > RCS file: i386-sol2-nat.c > diff -N i386-sol2-nat.c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ i386-sol2-nat.c 30 Oct 2004 19:41:40 -0000 > @@ -0,0 +1,78 @@ > +/* Native-dependent code for Solaris x86. > + > + Copyright 2004 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 2 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program; if not, write to the Free Software > + Foundation, Inc., 59 Temple Place - Suite 330, > + Boston, MA 02111-1307, USA. */ > + > +#include "defs.h" > +#include "regcache.h" > + > +#include <sys/procfs.h> > +#include "gregset.h" > + > +/* This file provids the (temporary) glue between the Solaris x86 > + target dependent code and the machine independent SVR4 /proc > + support. */ > + > +/* Solaris 10 (Solaris 2.10, SunOS 5.10) and up support two process > + data models, the traditional 32-bit data model (ILP32) and the > + 64-bit data model (LP64). The format of /proc depends on the data > + model of the observer (the controlling process, GDB in our case). > + The Solaris header files conveniently define PR_MODEL_NATIVE to the > + data model of the controlling process. If its value is > + PR_MODEL_LP64, we know that GDB is being compiled as a 64-bit > + program. > + > + Note that a 32-bit GDB won't be able to debug a 64-bit target > + process using /proc on Solaris. */ > + > +#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64) > + > +#include "amd64-nat.h" > +#include "amd64-tdep.h" > + > +void > +supply_gregset (prgregset_t *gregs) > +{ > + amd64_supply_native_gregset (current_regcache, -1, gregs); > +} > + > +void > +supply_fpregset (prfpregset_t *fpregs) > +{ > + amd64_supply_fxsave (current_regcache, -1, fpregs); > +} > + > +void > +fill_gregset (prgregset_t *gregs, int regnum) > +{ > + amd64_collect_native_gregset (current_regcache, regnum, gregs); > +} > + > +void > +fill_fpregset (prfpregset_t *fpregs, int regnum) > +{ > + amd64_collect_fxsave (current_regcache, regnum, fpregs); > +} > + > +#else > + > +/* 32-bit Solaris x86 is very similar to SVR4. */ > +#include "i386v4-nat.c" > + > +#endif > Index: config/i386/i386sol2.mh > =================================================================== > RCS file: /cvs/src/src/gdb/config/i386/i386sol2.mh,v > retrieving revision 1.9 > diff -u -p -r1.9 i386sol2.mh > --- config/i386/i386sol2.mh 29 Jul 2004 20:04:20 -0000 1.9 > +++ config/i386/i386sol2.mh 30 Oct 2004 19:41:40 -0000 > @@ -1,4 +1,4 @@ > # Host: Solaris x86 > -NATDEPFILES= fork-child.o i386v4-nat.o \ > +NATDEPFILES= fork-child.o i386-sol2-nat.o \ > procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o > NAT_FILE= nm-i386sol2.h > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 2004-10-30 20:53 ` Andrew Cagney @ 2004-10-30 21:13 ` Mark Kettenis 2004-10-30 21:59 ` Andrew Cagney 0 siblings, 1 reply; 8+ messages in thread From: Mark Kettenis @ 2004-10-30 21:13 UTC (permalink / raw) To: cagney; +Cc: gdb-patches Date: Sat, 30 Oct 2004 15:52:58 -0400 From: Andrew Cagney <cagney@gnu.org> Mark Kettenis wrote: > Including a .c file is perhaps a bit unorthodox, but this really is > the most elegant way I can think of to solve the issue with the > upcoming 64-bit Solaris 10. Why not have 368-sol2-nat inherit i386v4-nat's target vector? There's nothing there to inherit :-(. I'm still thinking about the proper way to regset-ize fill_gregset(), fill_fpregset(), supply_gregset() and supply_fpregset() in relation to the SVR4-like /proc filesystem. Oh, and I'm slowly beating the /proc support into shape such that I can it can be inherited. Will take some time though before this becomes reality. Cheers, Mark ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 2004-10-30 21:13 ` Mark Kettenis @ 2004-10-30 21:59 ` Andrew Cagney 2004-10-31 15:35 ` Mark Kettenis 0 siblings, 1 reply; 8+ messages in thread From: Andrew Cagney @ 2004-10-30 21:59 UTC (permalink / raw) To: Mark Kettenis, Joseph S. Myers; +Cc: gdb-patches Mark Kettenis wrote: > Date: Sat, 30 Oct 2004 15:52:58 -0400 > From: Andrew Cagney <cagney@gnu.org> > > Mark Kettenis wrote: > > Including a .c file is perhaps a bit unorthodox, but this really is > > the most elegant way I can think of to solve the issue with the > > upcoming 64-bit Solaris 10. > > Why not have 368-sol2-nat inherit i386v4-nat's target vector? > > There's nothing there to inherit :-(. I'm still thinking about the > proper way to regset-ize fill_gregset(), fill_fpregset(), > supply_gregset() and supply_fpregset() in relation to the SVR4-like > /proc filesystem. > > Oh, and I'm slowly beating the /proc support into shape such that I > can it can be inherited. Will take some time though before this > becomes reality. Sounds like something Joseph could help with. He's the one with the immediate desire to get sol10/amd64 supported. What we're not going to add is screwed up #include inheritance, can you revert that? Andrew ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 2004-10-30 21:59 ` Andrew Cagney @ 2004-10-31 15:35 ` Mark Kettenis 2004-10-31 15:58 ` Andrew Cagney 2004-10-31 21:24 ` Joseph S. Myers 0 siblings, 2 replies; 8+ messages in thread From: Mark Kettenis @ 2004-10-31 15:35 UTC (permalink / raw) To: cagney; +Cc: joseph, gdb-patches Date: Sat, 30 Oct 2004 16:59:28 -0400 From: Andrew Cagney <cagney@gnu.org> What we're not going to add is screwed up #include inheritance, can you revert that? Damn. I'd hoped I could get away with that. Well, here's a different approach. Spreads the logic over two files so it becomes a bit more difficult to keep things in synch. Committed, Mark Index: ChangeLog from Mark Kettenis <kettenis@gnu.org> * i386v4-nat.c (supply_gregset, supply_fpregset, fill_gregset) (fill_fpregset): Do not compile for 64-bit systems. * i386-sol2-nat.c: Don't include "i386v4-nat.c". * Makefile.in (i386-sol2-nat.o): Update dependencies. * config/i386/i386sol2.mh (NATDEPFILES): Add back i386v4-nat.c. Index: i386v4-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386v4-nat.c,v retrieving revision 1.14 diff -u -p -r1.14 i386v4-nat.c --- i386v4-nat.c 27 Jun 2004 21:52:21 -0000 1.14 +++ i386v4-nat.c 31 Oct 2004 15:32:18 -0000 @@ -37,7 +37,9 @@ #include <sys/procfs.h> -/* Prototypes for supply_gregset etc. */ +/* We must not compile this code for 64-bit Solaris x86. */ +#if !defined (PR_MODEL_NATIVE) || (PR_MODEL_NATIVE == PR_MODEL_ILP32) + #include "gregset.h" /* The `/proc' interface divides the target machine's register set up @@ -158,4 +160,6 @@ fill_fpregset (fpregset_t *fpregsetp, in #endif /* HAVE_FPREGSET_T */ +#endif /* not 64-bit. */ + #endif /* HAVE_SYS_PROCFS_H */ Index: i386-sol2-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386-sol2-nat.c,v retrieving revision 1.1 diff -u -p -r1.1 i386-sol2-nat.c --- i386-sol2-nat.c 30 Oct 2004 19:49:37 -0000 1.1 +++ i386-sol2-nat.c 31 Oct 2004 15:32:18 -0000 @@ -72,7 +72,6 @@ fill_fpregset (prfpregset_t *fpregs, int #else -/* 32-bit Solaris x86 is very similar to SVR4. */ -#include "i386v4-nat.c" +/* For 32-bit Solaris x86, we use the Unix SVR4 code in i386v4-nat.c. */ #endif Index: config/i386/i386sol2.mh =================================================================== RCS file: /cvs/src/src/gdb/config/i386/i386sol2.mh,v retrieving revision 1.10 diff -u -p -r1.10 i386sol2.mh --- config/i386/i386sol2.mh 30 Oct 2004 19:49:41 -0000 1.10 +++ config/i386/i386sol2.mh 31 Oct 2004 15:32:18 -0000 @@ -1,4 +1,4 @@ # Host: Solaris x86 -NATDEPFILES= fork-child.o i386-sol2-nat.o \ +NATDEPFILES= fork-child.o i386v4-nat.o i386-sol2-nat.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o NAT_FILE= nm-i386sol2.h ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 2004-10-31 15:35 ` Mark Kettenis @ 2004-10-31 15:58 ` Andrew Cagney 2004-10-31 21:24 ` Joseph S. Myers 1 sibling, 0 replies; 8+ messages in thread From: Andrew Cagney @ 2004-10-31 15:58 UTC (permalink / raw) To: Mark Kettenis; +Cc: joseph, gdb-patches Mark Kettenis wrote: > Date: Sat, 30 Oct 2004 16:59:28 -0400 > From: Andrew Cagney <cagney@gnu.org> > > What we're not going to add is screwed up #include inheritance, can you > revert that? > > Damn. I'd hoped I could get away with that. Well, here's a different > approach. Spreads the logic over two files so it becomes a bit more > difficult to keep things in synch. What ever. I'd recommend the strategy I took for inf-ptrace, cut your losses and start again. Create inf-procfs and from there inf-svr4 and finally the solaris stuff you need. Andrew ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 2004-10-31 15:35 ` Mark Kettenis 2004-10-31 15:58 ` Andrew Cagney @ 2004-10-31 21:24 ` Joseph S. Myers 1 sibling, 0 replies; 8+ messages in thread From: Joseph S. Myers @ 2004-10-31 21:24 UTC (permalink / raw) To: Mark Kettenis; +Cc: gdb-patches On Sun, 31 Oct 2004, Mark Kettenis wrote: > Index: ChangeLog > from Mark Kettenis <kettenis@gnu.org> > > * i386v4-nat.c (supply_gregset, supply_fpregset, fill_gregset) > (fill_fpregset): Do not compile for 64-bit systems. > * i386-sol2-nat.c: Don't include "i386v4-nat.c". > * Makefile.in (i386-sol2-nat.o): Update dependencies. > * config/i386/i386sol2.mh (NATDEPFILES): Add back i386v4-nat.c. Based on the latest CVS version after this patch, here is another version of the AMD64 Solaris 10 patch. It is still based on the existing IA32 Solaris configuration, and on the principle of not mixing different changes it does not attempt to address any pre-existing conditions associated with that configuration. I think it will in fact be straightforward to get rid of use of i386v4-nat.c on Solaris, using the functions from i386-tdep.c (i386_supply_gregset, i386_collect_gregset) instead; I also think doing so is independent of this patch (and I can only test on Solaris 10 prerelease, not previous releases of IA32 Solaris which are supported by GDB). -- Joseph S. Myers joseph@codesourcery.com 2004-10-31 Joseph S. Myers <joseph@codesourcery.com> * Makefile.in (ALLDEPFILES): Add amd64-sol2-tdep.c. (amd64-sol2-tdep.o): Add dependencies. * amd64-sol2-tdep.c, config/i386/sol2-64.mh, config/i386/sol2-64.mt: New files. * i386-sol2-nat.c (amd64_sol2_gregset64_reg_offset, amd64_sol2_gregset32_reg_offset, _initialize_amd64_sol2_nat): New. (supply_gregset): Correct order of arguments to amd64_supply_native_gregset. (fill_gregset): Correct order of arguments to amd64_collect_native_gregset. * configure.host (i[34567]86-*-solaris2.1[0-9]*): Add new case. * configure.tgt (i[34567]86-*-solaris2.1[0-9]*): Likewise. * configure.in (*-*-solaris2.[[6789]]): Add *-*-solaris2.1[[0-9]] for definition of NEW_PROC_API. * configure: Regenerate. diff -rupN gdb/Makefile.in gdb-new/Makefile.in --- gdb/Makefile.in 2004-10-31 10:13:00.000000000 +0000 +++ gdb-new/Makefile.in 2004-10-31 20:17:27.000000000 +0000 @@ -1360,6 +1360,7 @@ ALLDEPFILES = \ amd64nbsd-nat.c amd64nbsd-tdep.c \ amd64obsd-nat.c amd64obsd-tdep.c \ amd64-linux-nat.c amd64-linux-tdep.c \ + amd64-sol2-tdep.c \ arm-linux-nat.c arm-linux-tdep.c arm-tdep.c \ armnbsd-nat.c armnbsd-tdep.c \ avr-tdep.c \ @@ -1694,6 +1695,9 @@ amd64obsd-tdep.o: amd64obsd-tdep.c $(def $(symtab_h) $(objfiles_h) $(osabi_h) $(regset_h) $(target_h) \ $(gdb_assert_h) $(gdb_string_h) $(amd64_tdep_h) $(i387_tdep_h) \ $(solib_svr4_h) +amd64-sol2-tdep.o: amd64-sol2-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \ + $(regcache_h) $(osabi_h) $(symtab_h) $(gdb_string_h) $(amd64_tdep_h) \ + $(solib_svr4_h) amd64-tdep.o: amd64-tdep.c $(defs_h) $(arch_utils_h) $(block_h) \ $(dummy_frame_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ $(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(regcache_h) \ diff -rupN gdb/amd64-sol2-tdep.c gdb-new/amd64-sol2-tdep.c --- gdb/amd64-sol2-tdep.c 1970-01-01 00:00:00.000000000 +0000 +++ gdb-new/amd64-sol2-tdep.c 2004-10-26 18:43:26.000000000 +0000 @@ -0,0 +1,126 @@ +/* Target-dependent code for AMD64 Solaris. + + Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Contributed by Joseph Myers, CodeSourcery, LLC. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "frame.h" +#include "gdbcore.h" +#include "regcache.h" +#include "osabi.h" +#include "symtab.h" + +#include "gdb_string.h" + +#include "amd64-tdep.h" +#include "solib-svr4.h" + +/* Mapping between the general-purpose registers in gregset_t format + and GDB's register cache layout. */ + +/* From <sys/regset.h>. */ +static int amd64_sol2_gregset_reg_offset[] = +{ + 14 * 8, /* %rax */ + 11 * 8, /* %rbx */ + 13 * 8, /* %rcx */ + 12 * 8, /* %rdx */ + 9 * 8, /* %rsi */ + 8 * 8, /* %rdi */ + 10 * 8, /* %rbp */ + 20 * 8, /* %rsp */ + 7 * 8, /* %r8 ... */ + 6 * 8, + 5 * 8, + 4 * 8, + 3 * 8, + 2 * 8, + 1 * 8, + 0 * 8, /* ... %r15 */ + 17 * 8, /* %rip */ + 16 * 8, /* %eflags */ + 18 * 8, /* %cs */ + 21 * 8, /* %ss */ + 25 * 8, /* %ds */ + 24 * 8, /* %es */ + 22 * 8, /* %fs */ + 23 * 8 /* %gs */ +}; +\f + +/* Return whether the frame preceding NEXT_FRAME corresponds to a + Solaris sigtramp routine. */ + +static int +amd64_sol2_sigtramp_p (struct frame_info *next_frame) +{ + CORE_ADDR pc = frame_pc_unwind (next_frame); + char *name; + + find_pc_partial_function (pc, &name, NULL, NULL); + return (name && (strcmp ("sigacthandler", name) == 0 + || strcmp (name, "ucbsigvechandler") == 0)); +} + +/* Solaris doesn't have a 'struct sigcontext', but it does have a + 'mcontext_t' that contains the saved set of machine registers. */ + +static CORE_ADDR +amd64_sol2_mcontext_addr (struct frame_info *next_frame) +{ + CORE_ADDR sp, ucontext_addr; + + sp = frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM); + ucontext_addr = get_frame_memory_unsigned (next_frame, sp + 8, 8); + + return ucontext_addr + 72; +} + +static void +amd64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + tdep->gregset_reg_offset = amd64_sol2_gregset_reg_offset; + tdep->gregset_num_regs = ARRAY_SIZE (amd64_sol2_gregset_reg_offset); + tdep->sizeof_gregset = 28 * 8; + + amd64_init_abi (info, gdbarch); + + tdep->sigtramp_p = amd64_sol2_sigtramp_p; + tdep->sigcontext_addr = amd64_sol2_mcontext_addr; + tdep->sc_reg_offset = tdep->gregset_reg_offset; + tdep->sc_num_regs = tdep->gregset_num_regs; + + /* Solaris uses SVR4-style shared libraries. */ + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_lp64_fetch_link_map_offsets); +} +\f + +/* Provide a prototype to silence -Wmissing-prototypes. */ +extern void _initialize_amd64_sol2_tdep (void); + +void +_initialize_amd64_sol2_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, + GDB_OSABI_SOLARIS, amd64_sol2_init_abi); +} diff -rupN gdb/config/i386/sol2-64.mh gdb-new/config/i386/sol2-64.mh --- gdb/config/i386/sol2-64.mh 1970-01-01 00:00:00.000000000 +0000 +++ gdb-new/config/i386/sol2-64.mh 2004-10-31 20:18:47.000000000 +0000 @@ -0,0 +1,4 @@ +# Host: Solaris x86_64 +NATDEPFILES= fork-child.o amd64-nat.o i386v4-nat.o i386-sol2-nat.o \ + procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o +NAT_FILE= nm-i386sol2.h diff -rupN gdb/config/i386/sol2-64.mt gdb-new/config/i386/sol2-64.mt --- gdb/config/i386/sol2-64.mt 1970-01-01 00:00:00.000000000 +0000 +++ gdb-new/config/i386/sol2-64.mt 2004-10-22 14:54:21.000000000 +0000 @@ -0,0 +1,4 @@ +# Target: Solaris x86_64 +TDEPFILES= i386-tdep.o i387-tdep.o amd64-tdep.o amd64-sol2-tdep.o \ + i386-sol2-tdep.o corelow.o solib.o solib-svr4.o +DEPRECATED_TM_FILE= tm-i386sol2.h diff -rupN gdb/configure.host gdb-new/configure.host --- gdb/configure.host 2004-10-24 00:03:16.000000000 +0000 +++ gdb-new/configure.host 2004-10-31 20:19:23.000000000 +0000 @@ -77,6 +77,7 @@ i[34567]86-*-openbsd*) gdb_host=obsd ;; i[34567]86-*-sco3.2v5*) gdb_host=i386sco5 ;; i[34567]86-*-sco3.2v4*) gdb_host=i386sco4 ;; i[34567]86-*-sco*) gdb_host=i386sco ;; +i[34567]86-*-solaris2.1[0-9]*) gdb_host=sol2-64 ;; i[34567]86-*-solaris*) gdb_host=i386sol2 ;; i[34567]86-*-sysv4.2*) gdb_host=i386v42mp ;; i[34567]86-*-sysv4*) gdb_host=i386v4 ;; diff -rupN gdb/configure.in gdb-new/configure.in --- gdb/configure.in 2004-10-11 08:48:32.000000000 +0000 +++ gdb-new/configure.in 2004-10-31 20:19:23.000000000 +0000 @@ -725,7 +725,7 @@ if test "${target}" = "${host}"; then *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* ) AC_DEFINE(NEW_PROC_API) ;; - *-*-solaris2.[[6789]]) + *-*-solaris2.[[6789]] | *-*-solaris2.1[[0-9]]) AC_DEFINE(NEW_PROC_API) ;; mips-sgi-irix5*) diff -rupN gdb/configure.tgt gdb-new/configure.tgt --- gdb/configure.tgt 2004-10-24 00:03:16.000000000 +0000 +++ gdb-new/configure.tgt 2004-10-31 20:19:23.000000000 +0000 @@ -89,6 +89,7 @@ i[34567]86-*-netbsd* | i[34567]86-*-knet i[34567]86-*-openbsd*) gdb_target=obsd ;; i[34567]86-*-nto*) gdb_target=nto ;; i[34567]86-*-lynxos*) gdb_target=i386lynx ;; +i[34567]86-*-solaris2.1[0-9]*) gdb_target=sol2-64 ;; i[34567]86-*-solaris*) gdb_target=i386sol2 ;; i[34567]86-*-linux*) gdb_target=linux build_gdbserver=yes diff -rupN gdb/i386-sol2-nat.c gdb-new/i386-sol2-nat.c --- gdb/i386-sol2-nat.c 2004-10-31 20:05:01.000000000 +0000 +++ gdb-new/i386-sol2-nat.c 2004-10-31 21:10:57.000000000 +0000 @@ -46,10 +46,64 @@ #include "amd64-nat.h" #include "amd64-tdep.h" +/* Mapping between the general-purpose registers in gregset_t format + and GDB's register cache layout. */ + +/* From <sys/regset.h>. */ +static int amd64_sol2_gregset64_reg_offset[] = +{ + 14 * 8, /* %rax */ + 11 * 8, /* %rbx */ + 13 * 8, /* %rcx */ + 12 * 8, /* %rdx */ + 9 * 8, /* %rsi */ + 8 * 8, /* %rdi */ + 10 * 8, /* %rbp */ + 20 * 8, /* %rsp */ + 7 * 8, /* %r8 ... */ + 6 * 8, + 5 * 8, + 4 * 8, + 3 * 8, + 2 * 8, + 1 * 8, + 0 * 8, /* ... %r15 */ + 17 * 8, /* %rip */ + 16 * 8, /* %eflags */ + 18 * 8, /* %cs */ + 21 * 8, /* %ss */ + 25 * 8, /* %ds */ + 24 * 8, /* %es */ + 22 * 8, /* %fs */ + 23 * 8 /* %gs */ +}; + +/* 32-bit registers are provided by Solaris in 64-bit format, so just + give a subset of the list above. */ +static int amd64_sol2_gregset32_reg_offset[] = +{ + 14 * 8, /* %eax */ + 13 * 8, /* %ecx */ + 12 * 8, /* %edx */ + 11 * 8, /* %ebx */ + 20 * 8, /* %esp */ + 10 * 8, /* %ebp */ + 9 * 8, /* %esi */ + 8 * 8, /* %edi */ + 17 * 8, /* %eip */ + 16 * 8, /* %eflags */ + 18 * 8, /* %cs */ + 21 * 8, /* %ss */ + 25 * 8, /* %ds */ + 24 * 8, /* %es */ + 22 * 8, /* %fs */ + 23 * 8 /* %gs */ +}; + void supply_gregset (prgregset_t *gregs) { - amd64_supply_native_gregset (current_regcache, -1, gregs); + amd64_supply_native_gregset (current_regcache, gregs, -1); } void @@ -61,7 +115,7 @@ supply_fpregset (prfpregset_t *fpregs) void fill_gregset (prgregset_t *gregs, int regnum) { - amd64_collect_native_gregset (current_regcache, regnum, gregs); + amd64_collect_native_gregset (current_regcache, gregs, regnum); } void @@ -75,3 +129,17 @@ fill_fpregset (prfpregset_t *fpregs, int /* For 32-bit Solaris x86, we use the Unix SVR4 code in i386v4-nat.c. */ #endif + +/* Provide a prototype to silence -Wmissing-prototypes. */ +extern void _initialize_amd64_sol2_nat (void); + +void +_initialize_amd64_sol2_nat (void) +{ +#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64) + amd64_native_gregset32_reg_offset = amd64_sol2_gregset32_reg_offset; + amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64_sol2_gregset32_reg_offset); + amd64_native_gregset64_reg_offset = amd64_sol2_gregset64_reg_offset; + amd64_native_gregset64_num_regs = ARRAY_SIZE (amd64_sol2_gregset64_reg_offset); +#endif +} ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-10-31 21:24 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-10-30 19:51 [COMMIT] Prepare Solaris x86 for 64-bit Solaris 10 Mark Kettenis 2004-10-30 19:59 ` Joseph S. Myers 2004-10-30 20:53 ` Andrew Cagney 2004-10-30 21:13 ` Mark Kettenis 2004-10-30 21:59 ` Andrew Cagney 2004-10-31 15:35 ` Mark Kettenis 2004-10-31 15:58 ` Andrew Cagney 2004-10-31 21:24 ` Joseph S. Myers
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox