From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113413 invoked by alias); 3 Nov 2015 13:43:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 113388 invoked by uid 89); 3 Nov 2015 13:43:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f170.google.com Received: from mail-wi0-f170.google.com (HELO mail-wi0-f170.google.com) (209.85.212.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 03 Nov 2015 13:43:51 +0000 Received: by wicfx6 with SMTP id fx6so69639178wic.1 for ; Tue, 03 Nov 2015 05:43:48 -0800 (PST) X-Received: by 10.194.8.227 with SMTP id u3mr29728940wja.38.1446558228113; Tue, 03 Nov 2015 05:43:48 -0800 (PST) Received: from bigtime.com ([87.111.149.167]) by smtp.gmail.com with ESMTPSA id r13sm23442566wmg.12.2015.11.03.05.43.47 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Nov 2015 05:43:47 -0800 (PST) From: Richard Henderson To: gdb-patches@gcc.gnu.org Subject: [PATCH 3/3] Segment support for x86_64, part 1 Date: Tue, 03 Nov 2015 13:44:00 -0000 Message-Id: <1446558190-13482-4-git-send-email-rth@redhat.com> In-Reply-To: <1446558190-13482-1-git-send-email-rth@redhat.com> References: <1446558190-13482-1-git-send-email-rth@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00079.txt.bz2 * amd64-tdep.c (amd64_address_class_type_flags): New. (amd64_address_class_type_flags_to_name): New. (amd64_address_class_name_to_type_flags): New. (amd64_init_abi): Register them. --- gdb/amd64-tdep.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 6867a06..3f12796 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -2890,7 +2890,55 @@ const struct regset amd64_fpregset = NULL, amd64_supply_fpregset, amd64_collect_fpregset }; +/* Address classes. */ +static int +amd64_address_class_type_flags (int byte_size, int dwarf2_addr_class) +{ + switch (dwarf2_addr_class) + { + case 1: /* __seg_fs */ + return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; + case 2: /* __seg_gs */ + return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2; + default: + return 0; + } +} + +static const char * +amd64_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) +{ + if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) + return "__seg_fs"; + if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2) + return "__seg_gs"; + return NULL; +} + +static int +amd64_address_class_name_to_type_flags (struct gdbarch *gdbarch, + const char *name, + int *type_flags_ptr) +{ + if (strcmp (name, "__seg_fs") == 0) + { + *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; + return 1; + } + if (strcmp (name, "__seg_gs") == 0) + { + *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2; + return 1; + } + return 0; +} + +/* ??? We ought to fill in address_to_pointer and pointer_to_address, + except that these hooks do not have access to the thread, or a + regcache for the thread. */ + + /* Figure out where the longjmp will land. Slurp the jmp_buf out of %rdi. We expect its value to be a pointer to the jmp_buf structure from which we extract the address that we will land at. This @@ -3093,6 +3141,14 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_insn_is_call (gdbarch, amd64_insn_is_call); set_gdbarch_insn_is_ret (gdbarch, amd64_insn_is_ret); set_gdbarch_insn_is_jump (gdbarch, amd64_insn_is_jump); + + /* Address handling. */ + set_gdbarch_address_class_type_flags + (gdbarch, amd64_address_class_type_flags); + set_gdbarch_address_class_type_flags_to_name + (gdbarch, amd64_address_class_type_flags_to_name); + set_gdbarch_address_class_name_to_type_flags + (gdbarch, amd64_address_class_name_to_type_flags); } -- 2.4.3