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


>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

Eli> As far as I could see, it crashes when it reads this line of the
Eli> .gdbinit file supplied with Emacs:
Eli>   if $tem[0] == 'w' && $tem[1] == 'i' && $tem[2] == 'n' && $tem[3] == 'd'

Sorry about that.  I'm sending the appended fix throughq
regression testing.

Eli>   #0  0x00002ae92925956f in obstack_free () from /lib/libc.so.6
Eli>   #1  0x000000000044ce70 in do_my_cleanups (pmy_chain=0x8ee2b8,
Eli>       old_chain=0xa2e3f0) at utils.c:389
[...]
Eli> (in fact, the
Eli> whole `struct obstack' pointed to by h looks garbled, at least to me):

Eli> I tried to debug this, but as I'm not very familiar with that part of
Eli> GDB (evaluate_expression, evaluate_subexp_c, and friends), I ran out
Eli> of time before I could find the villain.  So I'm posting the
Eli> information here, in the hope that someone else could pick up where I
Eli> left off.

A situation where a cleanup is being called and the data is mangled
often means that some piece of code installed a cleanup referring to a
local variable and then forgot to manage the cleanup before a return.
That turned out to be the situation here.  If the cleanup function is
unusual enough, a breakpoint in make_cleanup is the easy way to find
the bad call.

Tom

diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 0c9e4f8..1fd83a4 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -941,7 +941,10 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp,
 	*pos += 2;
 
 	if (noside == EVAL_SKIP)
-	  return NULL;
+	  {
+	    do_cleanups (cleanup);
+	    return NULL;
+	  }
 
 	if ((dest_type & C_CHAR) != 0)
 	  {


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