Move initialize_tdesc_mips* calls from mips-linux-nat.c to mips-linux-tdep.c
authorYao Qi <yao.qi@linaro.org>
Tue, 13 Jun 2017 08:05:04 +0000 (09:05 +0100)
committerYao Qi <yao.qi@linaro.org>
Tue, 13 Jun 2017 08:05:04 +0000 (09:05 +0100)
All target descriptions except mips initialization are called in -tdep.c,
instead of -nat.c, so this patch moves mips target descriptions
initialization to -tdep.c.  Secondly, I want to change the target
descriptions from pre-generated to dynamical creation, so I want to test
that these pre-generated target descriptions equal to these dynamically
created ones.  Move target descriptions initialization to -tdep.c files so
we can test them in any hosts (if they are still -nat.c, we can only test
them on mips-linux host.).

gdb:

2017-06-13  Yao Qi  <yao.qi@linaro.org>

* mips-linux-nat.c: Move include features/mips*-linux.c to
mips-linux-tdep.c.
(_initialize_mips_linux_nat): Move initialize_tdesc_mips* calls
to mips-linux-tdep.c.
* mips-linux-tdep.c: Include features/mips*-linux.c
(_initialize_mips_linux_tdep): Call initialize_tdesc_mips*
functions.
* mips-linux-tdep.h (tdesc_mips_linux): Declare.
(tdesc_mips_dsp_linux, tdesc_mips64_linux): Declare.
(tdesc_mips64_dsp_linux): Declare.

gdb/ChangeLog
gdb/mips-linux-nat.c
gdb/mips-linux-tdep.c
gdb/mips-linux-tdep.h

index 29568194c117f22810504e29f23cfecd141f5256..c2bceeb8a77477ba49385d13b3beb122fdf5bb1f 100644 (file)
@@ -1,3 +1,16 @@
+2017-06-13  Yao Qi  <yao.qi@linaro.org>
+
+       * mips-linux-nat.c: Move include features/mips*-linux.c to
+       mips-linux-tdep.c.
+       (_initialize_mips_linux_nat): Move initialize_tdesc_mips* calls
+       to mips-linux-tdep.c.
+       * mips-linux-tdep.c: Include features/mips*-linux.c
+       (_initialize_mips_linux_tdep): Call initialize_tdesc_mips*
+       functions.
+       * mips-linux-tdep.h (tdesc_mips_linux): Declare.
+       (tdesc_mips_dsp_linux, tdesc_mips64_linux): Declare.
+       (tdesc_mips64_dsp_linux): Declare.
+
 2017-06-12  Tom Tromey  <tom@tromey.com>
 
        * valprint.h (val_print_type_code_int): Remove.
index 8041d84be74a5f983ec891009dcf3ec91a9ec6f0..1fd33653319d2dcad39d82f438ddfe34d7c96409 100644 (file)
 
 #include "nat/mips-linux-watch.h"
 
-#include "features/mips-linux.c"
-#include "features/mips-dsp-linux.c"
-#include "features/mips64-linux.c"
-#include "features/mips64-dsp-linux.c"
-
 #ifndef PTRACE_GET_THREAD_AREA
 #define PTRACE_GET_THREAD_AREA 25
 #endif
@@ -803,10 +798,4 @@ triggers a breakpoint or watchpoint."),
 
   linux_nat_add_target (t);
   linux_nat_set_new_thread (t, mips_linux_new_thread);
-
-  /* Initialize the standard target descriptions.  */
-  initialize_tdesc_mips_linux ();
-  initialize_tdesc_mips_dsp_linux ();
-  initialize_tdesc_mips64_linux ();
-  initialize_tdesc_mips64_dsp_linux ();
 }
index ccfdcdf98bc1e528cd768efaaaffaa3405708f71..f144a2ef50fa31c0248b7abd1061bb3047d5940c 100644 (file)
 #include "xml-syscall.h"
 #include "gdb_signals.h"
 
+#include "features/mips-linux.c"
+#include "features/mips-dsp-linux.c"
+#include "features/mips64-linux.c"
+#include "features/mips64-dsp-linux.c"
+
 static struct target_so_ops mips_svr4_so_ops;
 
 /* This enum represents the signals' numbers on the MIPS
@@ -1739,4 +1744,10 @@ _initialize_mips_linux_tdep (void)
                              GDB_OSABI_LINUX,
                              mips_linux_init_abi);
     }
+
+  /* Initialize the standard target descriptions.  */
+  initialize_tdesc_mips_linux ();
+  initialize_tdesc_mips_dsp_linux ();
+  initialize_tdesc_mips64_linux ();
+  initialize_tdesc_mips64_dsp_linux ();
 }
index 407b5774a267039042381bccba82b71e8d37beda..cca4798b9140e2f2553cfaddba8cc1a6d8fd25da 100644 (file)
@@ -105,3 +105,9 @@ enum {
 /* Return 1 if MIPS_RESTART_REGNUM is usable.  */
 
 int mips_linux_restart_reg_p (struct gdbarch *gdbarch);
+
+/* Target descriptions.  */
+extern struct target_desc *tdesc_mips_linux;
+extern struct target_desc *tdesc_mips64_linux;
+extern struct target_desc *tdesc_mips_dsp_linux;
+extern struct target_desc *tdesc_mips64_dsp_linux;