Fix thinko on dtrace-probe.c:dtrace_process_dof_probe
authorSergio Durigan Junior <sergiodj@redhat.com>
Fri, 8 Dec 2017 20:33:55 +0000 (15:33 -0500)
committerSergio Durigan Junior <sergiodj@redhat.com>
Fri, 8 Dec 2017 20:33:55 +0000 (15:33 -0500)
While investigating PR gdb/22557 ("Regression:
gdb.base/dtrace-probe.exp"), I noticed that the code is wrongly
declaring a new "expression_up" variable inside the TRY block in
"dtrace_process_dof_probe".  This causes the outter "expr" variable to
be empty, which may have an impact later when evaluating the
expression.

This commit fixes that.  Unfortunately the script used to test DTrace
probes (gdb/testsuite/lib/pdtrace.in) is not very reliable so I cannot
say whether this commit fixes the PR mentioned above.  Nonetheless,
it's an obvious fix and should go in.

gdb/ChangeLog:
2017-12-08  Sergio Durigan Junior  <sergiodj@redhat.com>

* dtrace-probe.c (dtrace_process_dof_probe): Do not declare a new
"expression_up" inside the TRY block.

gdb/ChangeLog
gdb/dtrace-probe.c

index 7d061c807cb79b4c044a3c246813110408aa3327..26cf18edb893212dd1f4a187f7ef3517fa492040 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-08  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       * dtrace-probe.c (dtrace_process_dof_probe): Do not declare a new
+       "expression_up" inside the TRY block.
+
 2017-12-08  Yao Qi  <yao.qi@linaro.org>
 
        * breakpoint.c (update_watchpoint): Call
index 1c88f8905404c0b3d9561626a152f05bbaa9a09a..3314445f98a2a1d51a7e4bbb6557e67ad87b6710 100644 (file)
@@ -486,17 +486,16 @@ dtrace_process_dof_probe (struct objfile *objfile,
 
          TRY
            {
-             expression_up expr
-               = parse_expression_with_language (type_str.c_str (),
-                                                 language_c);
+             expr = parse_expression_with_language (type_str.c_str (),
+                                                    language_c);
            }
          CATCH (ex, RETURN_MASK_ERROR)
            {
            }
          END_CATCH
 
-         if (expr != NULL && expr->elts[0].opcode == OP_TYPE)
-           type = expr->elts[1].type;
+         if (expr != NULL && expr.get ()->elts[0].opcode == OP_TYPE)
+           type = expr.get ()->elts[1].type;
 
          args.emplace_back (type, std::move (type_str), std::move (expr));
        }
This page took 0.033872 seconds and 4 git commands to generate.