-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support disable/enable hardware breakpoint #89
Conversation
Can one of the admins verify this patch? |
Hi @jonahgraham -san, Could you please help me review the code? I also commit code in repository cdt-gdb-adapter. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in eclipse-cdt-cloud/cdt-gdb-adapter#264 using a toggle for the new command is problematic as the initial state of hw breakpoint as set in launch.json is not taken into account here and leaves the UI commands in an inconsistent state.
I have serious concerns about the overall usability of this design and I hope that once you share the information in the below mentioned document I can understand the workflows.
For example, are you supposed to be able to change hw -> sw (or back) in the middle of a debug session?
Please see the document attached to ticket IDE-63527 for details.
Please provide required information in the open - this is an open source project so should not require access to private information to understand this.
async () => { | ||
const session = vscode.debug.activeDebugSession; | ||
if (session) { | ||
await vscode.commands.executeCommand( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you simplify this to a single context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution has been changed to use Toggle Breakpoint
'enableHardware', | ||
true | ||
); | ||
await session.customRequest( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please pass the desired state to the adapter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since using Toggle Breakpoint
, I think there is no need to send status in customRequest
package.json
Outdated
{ | ||
"command": "cdt.debug.enableHWBreakpoint", | ||
"group": "navigation", | ||
"when": "(!enableHardware && !disableHardware) || enableHardware" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having enableHardware
twice in this expression is unexpected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution has been changed to use Toggle Breakpoint
Hi @jonahgraham , I have some changes in the purpose of this PR compared to the original one. Below is the description of this PR: The purpose of this PR is to support toggle breakpoint being able to change the Hardware breakpoint -> Software breakpoint (or back) in the middle of a debug session. Case 1: If
Case 2: If
Could you please help me review it again? Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this PR is to support toggle breakpoint being able to change the Hardware breakpoint -> Software breakpoint (or back) in the middle of a debug session.
As you have implemented it now the toggle will apply to future breakpoints that are inserted by GDB - that intention is not obvious to the user. Was there an intention to change existing breakpoints from hw -> sw (or vice versa)?
Messages in the Debug Console are somewhat useful, but they can also be lost among lots of other output from the backend and it isn't visible if the Debug Console is not open.
VS Code has standard ways of notifying users. Please look at showInformationMessage and review UX guidelines on notifications.
However in this case there is another problem. The current implementation provides no way to show user the current setting, leading to the user having to toggle the setting twice and looking at Debug Console to know the current setting.
Perhaps using the status bar to show current state is useful? Or a checkmark next to a menu item?
The final problem I have with this solution is that there is no way to show users for already inserted breakpoints whether it is a hardware or software breakpoint - other than user typing >info break
or similar in the CLI.
Note that I can accept a solution that does not address every UX items I have described above as some of them are really hard and may require changes to VSCode too. However the current solution is simply too far away from an intuitive design for users.
package.json
Outdated
}, | ||
{ | ||
"command": "cdt.debug.toggleBreakpoint", | ||
"title": "Toggle Breakpoint" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Toggle breakpoint" implies that you are setting and unsetting a breakpoint at that line (when using context menu)
A better term would be "Use Hardware breakpoints" with a checkmark or something that indicates that this is command is related to hardware breakpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated name to "Use Hardware breakpoints"
package.json
Outdated
@@ -503,6 +508,12 @@ | |||
"group": "navigation", | |||
"when": "debugType == amalgamator" | |||
} | |||
], | |||
"editor/lineNumber/context": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By making this available (only or primarily) in the line number context it implies that the option applies to the line or the breakpoint on the line.
But that isn't what happens in your current implementation of the backend. The toggling means that future breakpoints that are inserted are hardware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the way it is displayed when the user uses "Use Hardware breakpoints". Switching from "editor/lineNumber/context" to using "editor/context".
src/breakpoint/ToggleBreakpoint.ts
Outdated
const session = vscode.debug.activeDebugSession; | ||
if (session) { | ||
await session.customRequest( | ||
'cdt-gdb-adapter/toggleBreakpoint' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you conclude that the front end really presents as a toggle, perhaps adding a get would be a good idea, then you can get current state and change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -16,13 +16,14 @@ | |||
"homepage": "https://github.com/eclipse-cdt-cloud/cdt-gdb-vscode#readme", | |||
"main": "./out/extension", | |||
"engines": { | |||
"vscode": "^1.76.0" | |||
"vscode": "^1.78.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally I would want version change like this to be split out - but since there is a dependency here on microsoft/vscode#175945 I think it is ok this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this version bump still needed since you aren't using new feature? Lets split out the version bump to a new PR.
Remove ToggleBreakpoint.ts to update new code
Update new class to getHWBreakpoint, setHWBreakpoint, and update status to Status Bar
Change the name accordingly
Change the name accordingly
I replaced the message at the Debug console to the one using VSCode's Notifications. |
I used the status bar to show the current state of the HW breakpoint. The state also updates properly when the user configures |
With current update user can change from HW breakpoint -> SW breakpoint and switch from SW breakpoint -> HW breakpoint |
Hi @jonahgraham ,
Could you please help me review it again? Thank you! |
Regarding this issue, I have investigated but I have no solution for this. |
Change the display when the user uses "Use Hardware breakpoints".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the language needs some additional thought - i.e differentiating between action and state. We can refine that once we agree on the high level UX issues like below.
The final problem I have with this solution is that there is no way to show users for already inserted breakpoints whether it is a hardware or software breakpoint - other than user typing
>info break
or similar in the CLI.Regarding this issue, I have investigated but I have no solution for this. Any ideas for this issue? or we will improve it in the future.
I need some more time to contemplate this aspect. It is related to other issues like preserving settings and setting expectations for users. Because there is no persistence and no way of identifying which type of breakpoint is used I fear we are giving users a false expectation.
Consider for example this flow:
- User sets use hw breakpoints in launch config
- User inserts some hardware breakpoints
- User starts debug session
- User toggles to use software breakpoints
- User inserts their software breakpoints
- User presses "Toggle Active Breakpoints" (twice)
- Now all breakpoints are software breakpoints
A similar situation:
- User sets use hw breakpoints in launch config
- User inserts some hardware breakpoints
- User starts debug session
- User toggles to use software breakpoints
- User inserts their software breakpoints
- User restarts their debug sessions
- Now all breakpoints are hardware breakpoints (and likely many are not successfully inserted due to limitation on number of hardware breakpoints)
@@ -16,13 +16,14 @@ | |||
"homepage": "https://github.com/eclipse-cdt-cloud/cdt-gdb-vscode#readme", | |||
"main": "./out/extension", | |||
"engines": { | |||
"vscode": "^1.76.0" | |||
"vscode": "^1.78.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this version bump still needed since you aren't using new feature? Lets split out the version bump to a new PR.
@@ -0,0 +1,23 @@ | |||
import { window, StatusBarAlignment, StatusBarItem } from 'vscode'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { window, StatusBarAlignment, StatusBarItem } from 'vscode'; | |
/********************************************************************* | |
* Copyright (c) 2023 Renesas Electronics Corporation and others | |
* | |
* This program and the accompanying materials are made | |
* available under the terms of the Eclipse Public License 2.0 | |
* which is available at https://www.eclipse.org/legal/epl-2.0/ | |
* | |
* SPDX-License-Identifier: EPL-2.0 | |
*********************************************************************/ | |
import { window, StatusBarAlignment, StatusBarItem } from 'vscode'; |
@@ -0,0 +1,78 @@ | |||
import { ExtensionContext, window } from 'vscode'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { ExtensionContext, window } from 'vscode'; | |
/********************************************************************* | |
* Copyright (c) 2023 Renesas Electronics Corporation and others | |
* | |
* This program and the accompanying materials are made | |
* available under the terms of the Eclipse Public License 2.0 | |
* which is available at https://www.eclipse.org/legal/epl-2.0/ | |
* | |
* SPDX-License-Identifier: EPL-2.0 | |
*********************************************************************/ | |
import { ExtensionContext, window } from 'vscode'; |
@@ -0,0 +1,23 @@ | |||
import { window, StatusBarAlignment, StatusBarItem } from 'vscode'; | |||
|
|||
export class BreakpointStatusBarItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this class? Why not use createStatusBarItem directly?
vscode.Uri.file(configPath) | ||
); | ||
const HWBreakpointParameter: boolean | undefined = | ||
config?.configurations[0]?.hardwareBreakpoint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to get the current status from the backend rather than trying to maintain duplicate logic in the frontend?
I'm sorry, I would like to close this request because there are some complex cases to cover, and it may cause inconvenience for users. Thank you for taking the time to review the code. |
Currently, enabling hardwareBreakpoint in launch.json argument allows the debugger to set hardware break-point or software break-point only ("hardwareBreakpoint": true). We need to support enabling/disabling setting SW and HW break-point simultaneously while debugging.