[v3,4/5,dap,&,linetable] : Add breakpointLocations request
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
fail
|
Testing failed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
Commit Message
This adds the breakpointLocations request.
Testing might strictly not be possible for this feature. Users are going
to have wildly varying compilers and compiler versions that outputs
wildly different debug symbol information. So unless we can restrain the
tests to some specific toolchain that I can handroll the tests for, this
will not be useful (and handrolling for a specific compiler defeats the
purpose - as one can just use the eyes then to verify).
v2:
Fixed type check issue
Forgot the obligatory **args at the end of breakpoint_locations
v3:
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31271
---
gdb/python/lib/gdb/dap/breakpoint.py | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
Comments
>>>>> "Simon" == Simon Farre <simon.farre.cx@gmail.com> writes:
Simon> Testing might strictly not be possible for this feature. Users are going
Simon> to have wildly varying compilers and compiler versions that outputs
Simon> wildly different debug symbol information. So unless we can restrain the
Simon> tests to some specific toolchain that I can handroll the tests for, this
Simon> will not be useful (and handrolling for a specific compiler defeats the
Simon> purpose - as one can just use the eyes then to verify).
It may be possible to write a custom test case using the "DWARF
assembler".
Simon> +@request("breakpointLocations")
Simon> +@capability("supportsBreakpointLocationsRequest")
This already exists in locations.py.
I'll send a patch to make sure that double-registration is impossible.
Tom
@@ -437,3 +437,30 @@ def set_exception_breakpoints(
return {
"breakpoints": _set_exception_catchpoints(options),
}
+
+
+@in_gdb_thread
+def _get_logical_bp_locations(name: str, line: int):
+ linetable = gdb.lookup_linetable(name)
+ if linetable is not None:
+ return [
+ {"line": lte.line, "column": lte.column} for lte in linetable.line(line)
+ ]
+ else:
+ return []
+
+
+@request("breakpointLocations")
+@capability("supportsBreakpointLocationsRequest")
+def breakpoint_locations(
+ *,
+ # This is a Source but we don't type-check it.
+ source,
+ line: int,
+ column: Optional[int],
+ endLine: Optional[int],
+ endColumn: Optional[int],
+ **args,
+):
+ # for now we don't support column, endLine, endColumn. We just return per line
+ return {"breakpoints": _get_logical_bp_locations(source["path"], line)}