public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Philipp Rudo <prudo@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Andreas Arnez <arnez@linux.vnet.ibm.com>,
	       Ulrich Weigand <uweigand@de.ibm.com>
Subject: [PATCH v2 09/11] s390: Clean up s390-linux-tdep.c
Date: Tue, 05 Dec 2017 12:29:00 -0000	[thread overview]
Message-ID: <20171205122859.2919-10-prudo@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171205122859.2919-1-prudo@linux.vnet.ibm.com>

After moving big parts of the code to the new s390-tdep.c file
s390-linux-tdep.c now contains many includes it doesn't need any more.
Further more the code for record-replay is disrupted by some code that does
not belong to the feature.

So clean up the include list and move the code disrupting record-replay to
places where it makes more sense.  Also remove some superfluous newlines.

gdb/ChangeLog
	* s390-linux-tdep.c: Reorder code.
	Remove unneeded includes and order alphabetically.
---
 gdb/s390-linux-tdep.c | 167 ++++++++++++++++++++++----------------------------
 1 file changed, 73 insertions(+), 94 deletions(-)

diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index c0283db3b4..497f02303b 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -21,46 +21,27 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include "arch-utils.h"
-#include "frame.h"
-#include "inferior.h"
-#include "infrun.h"
-#include "symtab.h"
-#include "target.h"
+
+#include "auxv.h"
+#include "elf/common.h"
+#include "frame-base.h"
+#include "frame-unwind.h"
+#include "gdbarch.h"
 #include "gdbcore.h"
-#include "gdbcmd.h"
+#include "linux-record.h"
+#include "linux-tdep.h"
 #include "objfiles.h"
 #include "osabi.h"
 #include "regcache.h"
-#include "trad-frame.h"
-#include "frame-base.h"
-#include "frame-unwind.h"
-#include "dwarf2-frame.h"
-#include "reggroups.h"
+#include "record-full.h"
 #include "regset.h"
-#include "value.h"
-#include "dis-asm.h"
-#include "solib-svr4.h"
-#include "prologue-value.h"
-#include "linux-tdep.h"
 #include "s390-tdep.h"
 #include "s390-linux-tdep.h"
-#include "linux-record.h"
-#include "record-full.h"
-#include "auxv.h"
+#include "solib-svr4.h"
+#include "target.h"
+#include "trad-frame.h"
 #include "xml-syscall.h"
 
-#include "stap-probe.h"
-#include "ax.h"
-#include "ax-gdb.h"
-#include "user-regs.h"
-#include "cli/cli-utils.h"
-#include <ctype.h>
-#include "elf/common.h"
-#include "elf/s390.h"
-#include "elf-bfd.h"
-#include <algorithm>
-
 #include "features/s390-linux32.c"
 #include "features/s390-linux32v1.c"
 #include "features/s390-linux32v2.c"
@@ -433,7 +414,6 @@ s390_trad_frame_prev_register (struct frame_info *this_frame,
     return s390_unwind_pseudo_register (this_frame, regnum);
 }
 
-
 /* Normal stack frames.  */
 
 struct s390_unwind_cache {
@@ -529,7 +509,6 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
 	}
     }
 
-
   /* OK, we've found valid prologue data.  */
   size = -sp->k;
 
@@ -754,7 +733,6 @@ static const struct frame_unwind s390_frame_unwind = {
   default_frame_sniffer
 };
 
-
 /* Code stubs and their stack frames.  For things like PLTs and NULL
    function calls (where there is no true frame and the return address
    is in the RETADDR register).  */
@@ -837,7 +815,6 @@ static const struct frame_unwind s390_stub_frame_unwind = {
   s390_stub_frame_sniffer
 };
 
-
 /* Signal trampoline stack frames.  */
 
 struct s390_sigtramp_unwind_cache {
@@ -1002,6 +979,33 @@ static const struct frame_unwind s390_sigtramp_frame_unwind = {
   s390_sigtramp_frame_sniffer
 };
 
+/* Frame base handling.  */
+
+static CORE_ADDR
+s390_frame_base_address (struct frame_info *this_frame, void **this_cache)
+{
+  struct s390_unwind_cache *info
+    = s390_frame_unwind_cache (this_frame, this_cache);
+  return info->frame_base;
+}
+
+static CORE_ADDR
+s390_local_base_address (struct frame_info *this_frame, void **this_cache)
+{
+  struct s390_unwind_cache *info
+    = s390_frame_unwind_cache (this_frame, this_cache);
+  return info->local_base;
+}
+
+static const struct frame_base s390_frame_base = {
+  &s390_frame_unwind,
+  s390_frame_base_address,
+  s390_local_base_address,
+  s390_local_base_address
+};
+
+/* Syscall handling.  */
+
 /* Retrieve the syscall number at a ptrace syscall-stop.  Return -1
    upon error. */
 
@@ -1328,65 +1332,6 @@ s390_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
   return 0;
 }
 
-/* Frame base handling.  */
-
-static CORE_ADDR
-s390_frame_base_address (struct frame_info *this_frame, void **this_cache)
-{
-  struct s390_unwind_cache *info
-    = s390_frame_unwind_cache (this_frame, this_cache);
-  return info->frame_base;
-}
-
-static CORE_ADDR
-s390_local_base_address (struct frame_info *this_frame, void **this_cache)
-{
-  struct s390_unwind_cache *info
-    = s390_frame_unwind_cache (this_frame, this_cache);
-  return info->local_base;
-}
-
-static const struct frame_base s390_frame_base = {
-  &s390_frame_unwind,
-  s390_frame_base_address,
-  s390_local_base_address,
-  s390_local_base_address
-};
-
-/* Implement gdbarch_gcc_target_options.  GCC does not know "-m32" or
-   "-mcmodel=large".  */
-
-static char *
-s390_gcc_target_options (struct gdbarch *gdbarch)
-{
-  return xstrdup (gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31");
-}
-
-/* Implement gdbarch_gnu_triplet_regexp.  Target triplets are "s390-*"
-   for 31-bit and "s390x-*" for 64-bit, while the BFD arch name is
-   always "s390".  Note that an s390x compiler supports "-m31" as
-   well.  */
-
-static const char *
-s390_gnu_triplet_regexp (struct gdbarch *gdbarch)
-{
-  return "s390x?";
-}
-
-/* Implementation of `gdbarch_stap_is_single_operand', as defined in
-   gdbarch.h.  */
-
-static int
-s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
-{
-  return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
-							  or indirection.  */
-	  || *s == '%' /* Register access.  */
-	  || isdigit (*s)); /* Literal number.  */
-}
-
-/* Process record and replay helpers.  */
-
 /* Takes the intermediate sum of address calculations and masks off upper
    bits according to current addressing mode.  */
 
@@ -5558,6 +5503,40 @@ s390_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
   record_tdep->ioctl_FIOQSIZE = 0x545e;
 }
 
+/* Miscellaneous.  */
+
+/* Implement gdbarch_gcc_target_options.  GCC does not know "-m32" or
+   "-mcmodel=large".  */
+
+static char *
+s390_gcc_target_options (struct gdbarch *gdbarch)
+{
+  return xstrdup (gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31");
+}
+
+/* Implement gdbarch_gnu_triplet_regexp.  Target triplets are "s390-*"
+   for 31-bit and "s390x-*" for 64-bit, while the BFD arch name is
+   always "s390".  Note that an s390x compiler supports "-m31" as
+   well.  */
+
+static const char *
+s390_gnu_triplet_regexp (struct gdbarch *gdbarch)
+{
+  return "s390x?";
+}
+
+/* Implementation of `gdbarch_stap_is_single_operand', as defined in
+   gdbarch.h.  */
+
+static int
+s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
+{
+  return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
+							  or indirection.  */
+	  || *s == '%' /* Register access.  */
+	  || isdigit (*s)); /* Literal number.  */
+}
+
 /* Initialize OSABI common for GNU/Linux on 31- and 64-bit systems.  */
 
 static void
-- 
2.13.5

  parent reply	other threads:[~2017-12-05 12:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05 12:29 [PATCH v2 00/11] Split " Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 04/11] s390: gdbarch_tdep add field tdesc Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 02/11] s390: Allocate gdbarch & tdep at start of gdbarch init Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 05/11] s390: Move tdesc validation to separate function Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 06/11] s390: if -> gdb_assert for tdesc_has_registers check Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 07/11] s390: Hook s390 into OSABI mechanism Philipp Rudo
2017-12-05 13:21   ` Ulrich Weigand
2017-12-05 17:06     ` Philipp Rudo
2017-12-05 17:44       ` Ulrich Weigand
2017-12-06 11:39         ` Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 01/11] s390: Remove duplicate checks for cached gdbarch at init Philipp Rudo
2017-12-05 16:16   ` Yao Qi
2017-12-06  9:56     ` Philipp Rudo
2017-12-06 10:28       ` [PATCH v2 01/11] s390: Remove duplicate checks for cached gdbarch@init Ulrich Weigand
2017-12-07  9:18         ` Philipp Rudo
2017-12-07  9:59           ` Yao Qi
2017-12-05 12:29 ` [PATCH v2 08/11] s390: Split up s390-linux-tdep.c into two files Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 10/11] s390: Add comments to uncommented functions in s390-tdep.c Philipp Rudo
2017-12-05 12:29 ` Philipp Rudo [this message]
2017-12-05 12:29 ` [PATCH v2 11/11] s390: Add comments to uncommented functions in s390-linux-tdep.c Philipp Rudo
2017-12-05 12:29 ` [PATCH v2 03/11] s390: gdbarch_tdep.have_* int -> bool Philipp Rudo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171205122859.2919-10-prudo@linux.vnet.ibm.com \
    --to=prudo@linux.vnet.ibm.com \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).