From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3739 invoked by alias); 2 May 2012 00:01:38 -0000 Received: (qmail 3727 invoked by uid 22791); 2 May 2012 00:01:35 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_NO,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 May 2012 00:01:23 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 759E41C6951; Tue, 1 May 2012 20:01:22 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9amgVQ2b8U2p; Tue, 1 May 2012 20:01:22 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 423EA1C6949; Tue, 1 May 2012 20:01:22 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id C1651145616; Tue, 1 May 2012 17:01:13 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Joel Brobecker Subject: [RFA 3/2(+)] Test size of x86/x86_64 segment registers Date: Wed, 02 May 2012 00:01:00 -0000 Message-Id: <1335916870-5161-1-git-send-email-brobecker@adacore.com> In-Reply-To: <1335913461-1628-1-git-send-email-brobecker@adacore.com> References: <1335913461-1628-1-git-send-email-brobecker@adacore.com> 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 X-SW-Source: 2012-05/txt/msg00009.txt.bz2 (forgot to write a testcase) Rather than verifying the value of the segment registers, which I think would be tricky, one way to regression-test the problem is to verify that the size of the segment registers is 2 bytes, rather than 4. gdb/testsuite/ChangeLog: * gdb.arch/i386-segregs.c, gdb.arch/i386-segregs.exp: New files. Tested on x86_64-linux. --- gdb/testsuite/gdb.arch/i386-segregs.c | 22 +++++++++++++++++ gdb/testsuite/gdb.arch/i386-segregs.exp | 39 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.arch/i386-segregs.c create mode 100644 gdb/testsuite/gdb.arch/i386-segregs.exp diff --git a/gdb/testsuite/gdb.arch/i386-segregs.c b/gdb/testsuite/gdb.arch/i386-segregs.c new file mode 100644 index 0000000..6fdc6f8 --- /dev/null +++ b/gdb/testsuite/gdb.arch/i386-segregs.c @@ -0,0 +1,22 @@ +/* Copyright 2012 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int +main (void) +{ + return 0; +} diff --git a/gdb/testsuite/gdb.arch/i386-segregs.exp b/gdb/testsuite/gdb.arch/i386-segregs.exp new file mode 100644 index 0000000..58d1b13 --- /dev/null +++ b/gdb/testsuite/gdb.arch/i386-segregs.exp @@ -0,0 +1,39 @@ +# Copyright 2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This testcase is going to verify the handling of the x86/x86_64 +# segment registers. Skip this test if the target CPU does not match. +if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { + return 0 +} + +set testfile "i386-segregs" +set srcfile ${testfile}.c + +if [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug $additional_flags}] { + untested "failed to compile ${testfile}" + return -1 +} + +if ![runto_main] then { + untested "could not run to main" + return -1 +} + +# Print the size of all segment registers. It should always be 2. +foreach reg_name {"cs" "ss" "ds" "es" "fs" "gs"} { + gdb_test "print sizeof \$$reg_name" "= 2" +} + -- 1.7.1