This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Current GDB crashes when it sources Emacs's .gdbinit


>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> I found another crash through further testing.
Tom> I'll send the final patch plus test case after the regression tests
Tom> are done.

Here's the fix and the test case.  The one test exercises both bugs.

Built and regtested on x86-64 (compile farm).
I also reproduced both bugs here and verified the fix manually.

Jan, this is needed for Fedora.  Sorry about that.

Tom

2009-04-15  Tom Tromey  <tromey@redhat.com>

	* c-lang.c (evaluate_subexp_c): Correctly handle EVAL_SKIP.

2009-04-15  Tom Tromey  <tromey@redhat.com>

	* gdb.base/charset.exp: Add regression test.

Index: c-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.64
diff -u -r1.64 c-lang.c
--- c-lang.c	14 Apr 2009 21:54:33 -0000	1.64
+++ c-lang.c	15 Apr 2009 21:46:55 -0000
@@ -941,7 +941,15 @@
 	*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)
 	  {
Index: testsuite/gdb.base/charset.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/charset.exp,v
retrieving revision 1.13
diff -u -r1.13 charset.exp
--- testsuite/gdb.base/charset.exp	25 Mar 2009 19:25:49 -0000	1.13
+++ testsuite/gdb.base/charset.exp	15 Apr 2009 21:46:57 -0000
@@ -604,4 +604,9 @@
     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 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]