Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFC] s390-tdep.c: Define address class functions for s390x
Date: Mon, 27 Jan 2003 23:26:00 -0000	[thread overview]
Message-ID: <1030127232625.ZM2026@localhost.localdomain> (raw)

The default pointer size for s390x is 64 bits.  The patch below causes
32-bit pointer types obtained from (dwarf2) debug info to be stored as
a separate type and to be qualified (in gdb's ptype output) as
"@mode32".  [Patches to gdbtypes.[hc] and dwarf2read.c which implement
address class support have already been committed.  They need to be
revisited, however, because in the course of testing out this patch, I
found a bug.  More on that later...]

Comments?

	* s390-tdep.c (s390_address_class_type_flags)
	(s390_address_class_type_flags_to_name)
	(s390_address_class_name_to_type_flags): New functions.
	(s390_gdbarch_init): Define ADDRESS_CLASS_TYPE_FLAGS_TO_NAME,
	ADDRESS_CLASS_NAME_TO_TYPE_FLAGS, and ADDRESS_CLASS_TYPE_FLAGS.

Index: s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.70
diff -u -p -r1.70 s390-tdep.c
--- s390-tdep.c	8 Jan 2003 17:21:29 -0000	1.70
+++ s390-tdep.c	27 Jan 2003 23:03:28 -0000
@@ -1748,6 +1748,37 @@ s390_push_return_address (CORE_ADDR pc, 
   return sp;
 }
 
+static int
+s390_address_class_type_flags (int byte_size, int dwarf2_addr_class)
+{
+  if (byte_size == 4)
+    return TYPE_FLAG_ADDRESS_CLASS_1;
+  else
+    return 0;
+}
+
+static const char *
+s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
+{
+  if (type_flags & TYPE_FLAG_ADDRESS_CLASS_1)
+    return "mode32";
+  else
+    return NULL;
+}
+
+int
+s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name,
+				       int *type_flags_ptr)
+{
+  if (strcmp (name, "mode32") == 0)
+    {
+      *type_flags_ptr = TYPE_FLAG_ADDRESS_CLASS_1;
+      return 1;
+    }
+  else
+    return 0;
+}
+
 struct gdbarch *
 s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -1869,6 +1900,12 @@ s390_gdbarch_init (struct gdbarch_info i
       set_gdbarch_long_long_bit (gdbarch, 64);
       set_gdbarch_ptr_bit (gdbarch, 64);
       set_gdbarch_register_bytes (gdbarch, S390X_REGISTER_BYTES);
+      set_gdbarch_address_class_type_flags (gdbarch,
+                                            s390_address_class_type_flags);
+      set_gdbarch_address_class_type_flags_to_name (gdbarch,
+                                                    s390_address_class_type_flags_to_name);
+      set_gdbarch_address_class_name_to_type_flags (gdbarch,
+                                                    s390_address_class_name_to_type_flags);
       break;
     }
 


             reply	other threads:[~2003-01-27 23:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-27 23:26 Kevin Buettner [this message]
2003-01-31 20:19 ` Jim Blandy
2003-01-31 21:07   ` Kevin Buettner
2003-02-03 20:46 ` Kevin Buettner

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=1030127232625.ZM2026@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.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