public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-tromey-python: 2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
@ 2008-11-08 0:41 ppluzhnikov
0 siblings, 0 replies; 3+ messages in thread
From: ppluzhnikov @ 2008-11-08 0:41 UTC (permalink / raw)
To: archer-commits
The branch, archer-tromey-python has been updated
via 1673e85f1048d7fc42cb3b75ed9e479450c520d0 (commit)
from 935ac21122a22e4875032f0522f7b2e15d03858e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 1673e85f1048d7fc42cb3b75ed9e479450c520d0
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Fri Nov 7 16:41:20 2008 -0800
2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
* python/python-type.c (typy_lookup_type): Fix "dangling" access.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 4 ++++
gdb/python/python-type.c | 15 ++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 41ba6ab..487e321 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,8 @@
2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * python/python-type.c (typy_lookup_type): Fix "dangling" access.
+
+2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
* python/python-function.c (fnpy_call): Fix syntax error
in last checkin.
diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index 77bb489..9e5e2c3 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -134,17 +134,22 @@ typy_lookup_type (struct demangle_component *demangled,
{
struct type *type;
char *type_name;
+ enum demangle_component_type demangled_type;
- if (demangled->type == DEMANGLE_COMPONENT_POINTER
- || demangled->type == DEMANGLE_COMPONENT_REFERENCE
- || demangled->type == DEMANGLE_COMPONENT_CONST
- || demangled->type == DEMANGLE_COMPONENT_VOLATILE)
+ /* Save the type: typy_lookup_type() may (indirectly) overwrite
+ memory pointed by demanged. */
+ demangled_type = demangled->type;
+
+ if (demangled_type == DEMANGLE_COMPONENT_POINTER
+ || demangled_type == DEMANGLE_COMPONENT_REFERENCE
+ || demangled_type == DEMANGLE_COMPONENT_CONST
+ || demangled_type == DEMANGLE_COMPONENT_VOLATILE)
{
type = typy_lookup_type (demangled->u.s_binary.left, block);
if (! type)
return NULL;
- switch (demangled->type)
+ switch (demangled_type)
{
case DEMANGLE_COMPONENT_REFERENCE:
return lookup_reference_type (type);
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [SCM] archer-tromey-python: 2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
@ 2008-11-07 21:07 ppluzhnikov
0 siblings, 0 replies; 3+ messages in thread
From: ppluzhnikov @ 2008-11-07 21:07 UTC (permalink / raw)
To: archer-commits
The branch, archer-tromey-python has been updated
via 2688bd68de27ded2d8520b4108d1b2cc9fa74e7c (commit)
from b2f7b66e72ecc20a08dbec1e867b16adcf7b4e97 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 2688bd68de27ded2d8520b4108d1b2cc9fa74e7c
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Fri Nov 7 13:07:23 2008 -0800
2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
* gdb.python/python-template.exp: Make failures clearer.
-----------------------------------------------------------------------
Summary of changes:
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.python/python-template.exp | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)
First 500 lines of diff:
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a3b1674..4678c3d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * gdb.python/python-template.exp: Make failures clearer.
+
2008-11-07 Daniel Jacobowitz <dan@codesourcery.com>
PR gdb/931
diff --git a/gdb/testsuite/gdb.python/python-template.exp b/gdb/testsuite/gdb.python/python-template.exp
index c2dacfc..c02e887 100644
--- a/gdb/testsuite/gdb.python/python-template.exp
+++ b/gdb/testsuite/gdb.python/python-template.exp
@@ -62,7 +62,7 @@ proc test_template_arg {type} {
# Replace '*' with '\*' in regex.
regsub -all {\*} $type {\*} t
- gdb_test "python print foo.type().template_argument(0)" $t
+ gdb_test "python print foo.type().template_argument(0)" $t $type
}
test_template_arg "const int"
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [SCM] archer-tromey-python: 2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
@ 2008-11-07 18:03 ppluzhnikov
0 siblings, 0 replies; 3+ messages in thread
From: ppluzhnikov @ 2008-11-07 18:03 UTC (permalink / raw)
To: archer-commits
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 <ppluzhnikov@google.com>
Date: Fri Nov 7 10:02:30 2008 -0800
2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
* 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 <http://www.gnu.org/licenses/>. */
+
+template <typename T>
+struct Foo {
+};
+
+#ifndef TYPE
+#define TYPE int
+#endif
+
+int main()
+{
+ Foo<TYPE> 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 <http://www.gnu.org/licenses/>.
+
+# 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-08 0:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-08 0:41 [SCM] archer-tromey-python: 2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com> ppluzhnikov
-- strict thread matches above, loose matches on Subject: below --
2008-11-07 21:07 ppluzhnikov
2008-11-07 18:03 ppluzhnikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).