From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16046 invoked by alias); 7 Nov 2008 18:03:28 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 15993 invoked by uid 9766); 7 Nov 2008 18:03:28 -0000 Date: Fri, 07 Nov 2008 18:03:00 -0000 Message-ID: <20081107180328.15972.qmail@sourceware.org> From: ppluzhnikov@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: 2008-11-07 Paul Pluzhnikov X-Git-Refname: refs/heads/archer-tromey-python X-Git-Reftype: branch X-Git-Oldrev: 1e9b69a0f9de79f42992b4d7be1d70968d9af35f X-Git-Newrev: fec9620d4ece0e275113b47f9923876acfc7604f X-SW-Source: 2008-q4/txt/msg00079.txt.bz2 List-Id: The branch, archer-tromey-python has been updated via fec9620d4ece0e275113b47f9923876acfc7604f (commit) from 1e9b69a0f9de79f42992b4d7be1d70968d9af35f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit fec9620d4ece0e275113b47f9923876acfc7604f Author: Paul Pluzhnikov Date: Fri Nov 7 10:02:30 2008 -0800 2008-11-07 Paul Pluzhnikov * gdb.python/python-template.exp, gdb.python/python-template.cc: New test for const, volatile qualified pointer and reference template args. ----------------------------------------------------------------------- Summary of changes: gdb/testsuite/gdb.python/python-template.cc | 30 ++++++++++ gdb/testsuite/gdb.python/python-template.exp | 75 ++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.python/python-template.cc create mode 100644 gdb/testsuite/gdb.python/python-template.exp First 500 lines of diff: diff --git a/gdb/testsuite/gdb.python/python-template.cc b/gdb/testsuite/gdb.python/python-template.cc new file mode 100644 index 0000000..bd6a212 --- /dev/null +++ b/gdb/testsuite/gdb.python/python-template.cc @@ -0,0 +1,30 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008 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 . */ + +template +struct Foo { +}; + +#ifndef TYPE +#define TYPE int +#endif + +int main() +{ + Foo foo; + return 0; // break here +} diff --git a/gdb/testsuite/gdb.python/python-template.exp b/gdb/testsuite/gdb.python/python-template.exp new file mode 100644 index 0000000..c2dacfc --- /dev/null +++ b/gdb/testsuite/gdb.python/python-template.exp @@ -0,0 +1,75 @@ +# Copyright (C) 2008 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 file is part of the GDB testsuite. It tests the mechanism +# exposing values to Python. + +if $tracelevel then { + strace $tracelevel +} + +set testfile "python-template" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ + {debug c++}] != "" } { + untested "Couldn't compile ${srcfile}" + return -1 +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test_multiple "python print 23" "verify python support" { + -re "not supported.*$gdb_prompt $" { + unsupported "python support is disabled" + return -1 + } + -re "$gdb_prompt $" {} +} + +proc test_template_arg {type} { + global testfile srcdir subdir srcfile binfile + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable \ + [list debug c++ additional_flags="-DTYPE=$type"]] != "" } { + untested $type + return -1 + } + gdb_load ${binfile} + if ![runto_main ] then { + perror "couldn't run to breakpoint" + return + } + # There is no executable code in main(), so we are where we want to be + gdb_test "print foo" "" + gdb_test "python foo = gdb.get_value_from_history(0)" "" + + # Replace '*' with '\*' in regex. + regsub -all {\*} $type {\*} t + gdb_test "python print foo.type().template_argument(0)" $t +} + +test_template_arg "const int" +test_template_arg "volatile int" +test_template_arg "const int &" +test_template_arg "volatile int &" +test_template_arg "volatile int * const" +test_template_arg "volatile int * const *" +test_template_arg "const int * volatile" +test_template_arg "const int * volatile * const * volatile *" hooks/post-receive -- Repository for Project Archer.