From 334cc82d44775325475752b1126a3257b51b2b0c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 15 Apr 2009 21:55:04 +0000 Subject: [PATCH] gdb * c-lang.c (evaluate_subexp_c): Correctly handle EVAL_SKIP. gdb/testsuite * gdb.base/charset.exp: Add regression test. --- gdb/ChangeLog | 4 ++++ gdb/c-lang.c | 10 +++++++++- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.base/charset.exp | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 480bf5a8968..8dfdfc8edf9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2009-04-15 Tom Tromey + + * c-lang.c (evaluate_subexp_c): Correctly handle EVAL_SKIP. + 2009-04-15 Eli Zaretskii * utils.c (parse_escape): Initialize target_char to pacify GCC. diff --git a/gdb/c-lang.c b/gdb/c-lang.c index e18f173ad1a..86de9334ce0 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -941,7 +941,15 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp, *pos += 2; if (noside == EVAL_SKIP) - return NULL; + { + /* Return a dummy value of the appropriate type. */ + if ((dest_type & C_CHAR) != 0) + result = allocate_value (type); + else + result = value_typed_string ("", 0, type); + do_cleanups (cleanup); + return result; + } if ((dest_type & C_CHAR) != 0) { diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 04e693cd407..ddac7cad2c1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-04-15 Tom Tromey + + * gdb.base/charset.exp: Add regression test. + 2009-04-14 Joel Brobecker * gdb.base/exe-lock.exp: New testcase. diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp index 1ce275db279..8c238489d70 100644 --- a/gdb/testsuite/gdb.base/charset.exp +++ b/gdb/testsuite/gdb.base/charset.exp @@ -604,4 +604,9 @@ if {$ucs2_ok && $ucs4_ok} { test_combination u UCS-2 U UCS-4 } +# Regression test for a cleanup bug in the charset code. +gdb_test "print 'a' == 'a' || 'b' == 'b'" \ + ".* = 1" \ + "EVAL_SKIP cleanup handling regression test" + gdb_exit -- 2.30.2