From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123894 invoked by alias); 16 Jul 2015 18:51:46 -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 123688 invoked by uid 89); 16 Jul 2015 18:51:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 16 Jul 2015 18:51:41 +0000 Received: from EUSAAHC003.ericsson.se (Unknown_Domain [147.117.188.81]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 2C.63.07675.97597A55; Thu, 16 Jul 2015 13:28:57 +0200 (CEST) Received: from elxcz23q12-y4.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.81) with Microsoft SMTP Server (TLS) id 14.3.210.2; Thu, 16 Jul 2015 14:51:35 -0400 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 5/5] Add new test internalvar.exp Date: Thu, 16 Jul 2015 18:51:00 -0000 Message-ID: <1437072684-26565-5-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1437072684-26565-1-git-send-email-simon.marchi@ericsson.com> References: <1437072684-26565-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00483.txt.bz2 I wrote this test While doing the work that lead to the previous patch, so I thought I would contribute it upstream. From what I can see, there is no test currently to verify operations on internal variables (please point me to it if I'm wrong). gdb/testsuite/ChangeLog: * gdb.base/internalvar.exp: New file. * gdb.base/internalvar.c: New file. --- gdb/testsuite/gdb.base/internalvar.c | 45 ++++++++++++++++++++++++++++++++++ gdb/testsuite/gdb.base/internalvar.exp | 42 +++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 gdb/testsuite/gdb.base/internalvar.c create mode 100644 gdb/testsuite/gdb.base/internalvar.exp diff --git a/gdb/testsuite/gdb.base/internalvar.c b/gdb/testsuite/gdb.base/internalvar.c new file mode 100644 index 0000000..2aadc11 --- /dev/null +++ b/gdb/testsuite/gdb.base/internalvar.c @@ -0,0 +1,45 @@ +struct inner +{ + int a; + int b[2]; +}; + +struct outer +{ + int x; + int y; + + struct inner inner; + + int z[2]; +}; + +struct outer o; +struct inner i; + +void +break_here (void) +{ +} + +int +main (void) +{ + o.x = 0x1111; + o.y = 0x2222; + + o.inner.a = 0x3333; + o.inner.b[0] = 0x4444; + o.inner.b[1] = 0x5555; + + o.z[0] = 0x6666; + o.z[1] = 0x7777; + + i.a = 0x8888; + i.b[0] = 0x9999; + i.b[1] = 0xaaaa; + + break_here (); + + return 0; +} diff --git a/gdb/testsuite/gdb.base/internalvar.exp b/gdb/testsuite/gdb.base/internalvar.exp new file mode 100644 index 0000000..701cc16 --- /dev/null +++ b/gdb/testsuite/gdb.base/internalvar.exp @@ -0,0 +1,42 @@ +# Copyright 2015 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 . + +# +# Test operations on internal variables. +# + +standard_testfile + +if {[prepare_for_testing ${testfile}.exp ${testfile}]} { + return -1 +} + +runto break_here + +gdb_test_no_output "set \$a = 0x1234" +gdb_test "p/x \$a" " = 0x1234" + +gdb_test_no_output "set \$s = o" +gdb_test "p/x \$s" " = {x = 0x1111, y = 0x2222, inner = {a = 0x3333, b = \\{0x4444, 0x5555}}, z = \\{0x6666, 0x7777}}" +gdb_test "p/x \$s.inner" " = {a = 0x3333, b = \\{0x4444, 0x5555}}" +gdb_test "p/x \$s.inner.b\[1\]" " = 0x5555" + +gdb_test_no_output "set \$s.inner = i" +gdb_test "p/x \$s" " = {x = 0x1111, y = 0x2222, inner = {a = 0x8888, b = \\{0x9999, 0xaaaa}}, z = \\{0x6666, 0x7777}}" + +gdb_test_no_output "set \$s.x = 0xffff" +gdb_test_no_output "set \$s.inner.b\[1\] = 0xeeee" +gdb_test_no_output "set \$s.z\[1\] = 0xdddd" +gdb_test "p/x \$s" " = {x = 0xffff, y = 0x2222, inner = {a = 0x8888, b = \\{0x9999, 0xeeee}}, z = \\{0x6666, 0xdddd}}" -- 2.1.4