From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7565 invoked by alias); 31 Jan 2003 20:19:32 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7558 invoked from network); 31 Jan 2003 20:19:31 -0000 Received: from unknown (HELO zenia.red-bean.com) (66.244.67.22) by 172.16.49.205 with SMTP; 31 Jan 2003 20:19:31 -0000 Received: from zenia.red-bean.com (localhost.localdomain [127.0.0.1]) by zenia.red-bean.com (8.12.5/8.12.5) with ESMTP id h0VKEC8A025025; Fri, 31 Jan 2003 15:14:12 -0500 Received: (from jimb@localhost) by zenia.red-bean.com (8.12.5/8.12.5/Submit) id h0VKEBap025017; Fri, 31 Jan 2003 15:14:11 -0500 To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC] s390-tdep.c: Define address class functions for s390x References: <1030127232625.ZM2026@localhost.localdomain> From: Jim Blandy Date: Fri, 31 Jan 2003 20:19:00 -0000 In-Reply-To: <1030127232625.ZM2026@localhost.localdomain> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.92 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-01/txt/msg00846.txt.bz2 This looks like a pretty straightforward definition of a new address class. Is that right? Since we only have one target using this facility at the moment, this might be premature, but I wonder if it would be worthwhile to provide standard, table-driven versions of *_address_class_type_flags_to_name, and *_address_class_name_to_type_flags, so that a target could simply say: static address_class_table s390_addr_classes[] = { { "mode32", TYPE_FLAG_ADDRESS_CLASS_1 }, { 0, 0 } }; ... use_address_class_table_in_gdbarch (gdbarch, s390_addr_classes); which would install the right methods. Or something like that. Maybe even s390_address_class_type_flags could be handled by the same table. I haven't thought it through. Kevin Buettner writes: > 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; > } >