From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29665 invoked by alias); 27 Jan 2003 23:26: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 29654 invoked from network); 27 Jan 2003 23:26:32 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 27 Jan 2003 23:26:32 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h0RMvIf08093 for ; Mon, 27 Jan 2003 17:57:18 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0RNQWa09558 for ; Mon, 27 Jan 2003 18:26:32 -0500 Received: from localhost.localdomain (vpn50-39.rdu.redhat.com [172.16.50.39]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0RNQVt26557 for ; Mon, 27 Jan 2003 18:26:31 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h0RNQQE02027 for gdb-patches@sources.redhat.com; Mon, 27 Jan 2003 16:26:26 -0700 Date: Mon, 27 Jan 2003 23:26:00 -0000 From: Kevin Buettner Message-Id: <1030127232625.ZM2026@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [RFC] s390-tdep.c: Define address class functions for s390x MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-01/txt/msg00748.txt.bz2 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; }