diff options
author | Tom Tromey <tromey@adacore.com> | 2023-05-24 14:24:13 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-06-22 09:46:23 -0600 |
commit | 32594d975aa9d886face03ee146fe82aa34a3145 (patch) | |
tree | 7a918975c04a6203d92a80e1d562124d613222c1 /gdb | |
parent | 596c507f5ddb6d143f103e371eda8c0008f15254 (diff) | |
download | gdb-32594d975aa9d886face03ee146fe82aa34a3145.zip gdb-32594d975aa9d886face03ee146fe82aa34a3145.tar.gz gdb-32594d975aa9d886face03ee146fe82aa34a3145.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/python/lib/gdb/dap/breakpoint.py | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dap/cond-bp.exp | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py index 20e65aa..2cb8db6 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 376db4b..6369b6f 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] |