Fix regression introduced by 6c659fc2c7cd2da6d2b9a3d7c38597ad3821832a

Message ID CAGyQ6gwhzpzy6bVtMaj7NOqtXnKQDzOG2OdqesJUkya4bpAF9Q@mail.gmail.com
State New, archived
Headers

Commit Message

Siva Chandra Reddy Nov. 29, 2014, 6:08 p.m. UTC
  The regression was pointed out here:
https://sourceware.org/ml/gdb-patches/2014-11/msg00728.html

It was introduced by my patch which was pushed as
6c659fc2c7cd2da6d2b9a3d7c38597ad3821832a. What my patch did was to
make evaluate_subexp non re-entrant. As in, if evaluate_subexp is
called with *pos == 0 while a top level expression is under
evaluation, then it will crash with symptoms similar to those reported
above. The attached patch fixes this problem and hence the regression.
Jan Kratochvil has kindly tested it for me and confirmed that it
indeed fixes the regression and does not introduce any new ones.

gdb/ChangeLog:

2014-11-29  Siva Chandra Reddy  <sivachandra@google.com>

        * eval.c (evaluate_subexp): Check that thread stack temporaries
        are not already enabled before enabling them.
  

Comments

Siva Chandra Reddy Nov. 29, 2014, 11:51 p.m. UTC | #1
On Sat, Nov 29, 2014 at 1:27 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
>> 2014-11-29  Siva Chandra Reddy  <sivachandra@google.com>
>>
>>         * eval.c (evaluate_subexp): Check that thread stack temporaries
>>         are not already enabled before enabling them.
>
> This is OK.  Good catch!

Thank you. I have now pushed it as 18ac6ffc9b119c8d55a1cd0339d47998076faf2b.
  

Patch

diff --git a/gdb/eval.c b/gdb/eval.c
index a13793c..c2ab879 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -69,7 +69,8 @@  evaluate_subexp (struct type *expect_type, struct expression *exp,
   int cleanup_temps = 0;
 
   if (*pos == 0 && target_has_execution
-      && exp->language_defn->la_language == language_cplus)
+      && exp->language_defn->la_language == language_cplus
+      && !thread_stack_temporaries_enabled_p (inferior_ptid))
     {
       cleanups = enable_thread_stack_temporaries (inferior_ptid);
       cleanup_temps = 1;