From: Tom Tromey Date: Wed, 24 May 2023 20:24:13 +0000 (-0600) Subject: Fix type of DAP hitCondition X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32594d975aa9d886face03ee146fe82aa34a3145;p=binutils-gdb.git Fix type of DAP hitCondition DAP specifies a breakpoint's hitCondition as a string, meaning it is an expression to be evaluated. However, gdb implemented this as if it were an integer instead. This patch fixes this oversight. --- diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py index 20e65aa0e61..2cb8db68907 100644 --- a/gdb/python/lib/gdb/dap/breakpoint.py +++ b/gdb/python/lib/gdb/dap/breakpoint.py @@ -95,10 +95,13 @@ def _set_breakpoints_callback(kind, specs, creator): # FIXME handle exceptions here bp = creator(**spec) - if condition is not None: - bp.condition = condition - if hit_condition is not None: - bp.ignore_count = hit_condition + bp.condition = condition + if hit_condition is None: + bp.ignore_count = 0 + else: + bp.ignore_count = int( + gdb.parse_and_eval(hit_condition, global_context=True) + ) breakpoint_map[kind][keyspec] = bp result.append(breakpoint_descriptor(bp)) diff --git a/gdb/testsuite/gdb.dap/cond-bp.exp b/gdb/testsuite/gdb.dap/cond-bp.exp index 376db4b3548..6369b6f579c 100644 --- a/gdb/testsuite/gdb.dap/cond-bp.exp +++ b/gdb/testsuite/gdb.dap/cond-bp.exp @@ -35,7 +35,7 @@ set obj [dap_check_request_and_response "set conditional breakpoint" \ [format {o source [o path [%s]] \ breakpoints [a [o line [i %d] \ condition [s "i == 3"] \ - hitCondition [i 3]]]} \ + hitCondition [s 3]]]} \ [list s $srcfile] $line]] set fn_bpno [dap_get_breakpoint_number $obj]