| Summary: | CLI command "hbreak" creates a hardware watchpoint | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Abeer Bagul <abeerbagul> | ||||||||||
| Component: | cdt-debug | Assignee: | Marc Khouzam <marc.khouzam> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | Ken Ryall <ken.ryall> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | cdtdoug, john, marc.khouzam, nobody, pawel.1.piech, pmac | ||||||||||
| Version: | 8.0 | Flags: | nobody:
review+
|
||||||||||
| Target Milestone: | 8.0 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Windows XP | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
Created attachment 187801 [details]
This patch creates a watchpoint only if the type description contains string "watchpoint".
Do you have some MI output that shows what a hardware watchpoint looks like in the -break-insert command? Do you want this in 7.2 or HEAD is enough? MI output for a hardware watchpoint:
[1,296,449,998,740] 20-interpreter-exec console "watch argc"
[1,296,449,998,740] ~"Hardware watchpoint 2: argc\n"
[1,296,449,998,740] 20^done
[1,296,449,998,740] (gdb)
[1,296,449,998,755] 21-break-list
[1,296,449,998,755] 21^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="7",alignment="-1",\
col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4"\
,alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="\
Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_nam\
e="what",colhdr="What"}],body=[bkpt={number="2",type="hw watchpoint",disp="keep",enabled="y",addr=""\
,what="argc",times="0"}]}
[1,296,449,998,755] (gdb)
It is okay to get the patch in HEAD, since we will be based on Indigo for our product release.
Created attachment 188109 [details]
Patch committed to HEAD
I added the copyright notice at the top of both files as:
"Abeer Bagul (Tensilica) - Differentiate between hw breakpoint and watchpoint"
I committed the patch to HEAD.
Mikhail, can you review? Abeer, thanks for the contribution! *** cdt cvs genie on behalf of mkhouzam *** Bug 335648: Differentiate between hw breakpoint and watchpoint [*] MIBreakpoint.java 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java?root=Tools_Project&r1=1.6&r2=1.7 [*] MIBreakpoint.java 1.14 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java?root=Tools_Project&r1=1.13&r2=1.14 Looks good to me. A trivial addition to this bug: There is a method MIBreakpoint.setHardware(boolean hd) which is currently not in use. This method mistakenly marks the given breakpoint as a "watchpoint". There exists another method MIBreakpoint.setWatchpoint() which the client can call if it wants to mark the breakpoint as a "hw watchpoint". Example client code to mark a "hw breakpoint" (today): ((MIBreakpoint)bp).setHardware(true); ((MIBreakpoint)bp).setWatchpoint(false); The client code should be (after patch): ((MIBreakpoint)bp).setHardware(true); Then client code to set a "hw watchpoint" will be: ((MIBreakpoint)bp).setHardware(true); ((MIBreakpoint)bp).setWatchpoint(true); Sorry for missing out this bug in the original bug report. Created attachment 188738 [details]
If client sets the "hw" attribute to true, do not automatically set the "watchpoint" attribute
Created attachment 188998 [details]
Second fix for HEAD
I committed this patch to HEAD. It is Abeer's change and the same change for DSF-GDB.
(In reply to comment #9) > Created attachment 188738 [details] > If client sets the "hw" attribute to true, do not automatically set the > "watchpoint" attribute Thanks Abeer. *** cdt cvs genie on behalf of mkhouzam *** Bug 335648: Differentiate between hw breakpoint and watchpoint [*] MIBreakpoint.java 1.15 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java?root=Tools_Project&r1=1.14&r2=1.15 [*] MIBreakpoint.java 1.8 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java?root=Tools_Project&r1=1.7&r2=1.8 |
Build Identifier: I20101208-1300 When user types the CLI command "hbreak" in the gdb console, gdb inserts a hardware breakpoint. CDT then sends a command "-break-list" to get the updated list of breakpoints and watchpoints installed in the target. In the reponse, gdb reports the breakpoint inserted thru hbreak as type "hw breakpoint". Example interaction between CDT and gdb: [1,293,012,542,777] 177-interpreter-exec console hbreak [1,293,012,542,792] ~"Hardware assisted breakpoint 4 at 0x60000aa4: file/ build/tree/RD-2010.0-beta4\ _kuma/tools/swtools-MSWin32-x86/xtensa-elf/src/xtos/crt1-sim.S, line 234.\n" [1,293,012,542,792] 177^done [1,293,012,542,792] (gdb) [1,293,012,542,792] 178-break-list [1,293,012,542,792] 178^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="7",alignment="-1"\ ,col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4\ ",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr=\ "Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_na\ me="what",colhdr="What"}],body=[bkpt={number="4",type="hw breakpoint",disp="keep",enabled="y",addr="\ 0x60000aa4",file="/build/tree/RD-2010.0-beta4_kuma/tools/swtools-MSWin32-x86/xtensa-elf/src/xtos/crt\ 1-sim.S",line="234",times="0"}]} [1,293,012,542,792] (gdb) In the method, MIBreakpoint.parse(...), any breakpoint whose typename starts with "hw" is treated as a watchpoint. Only those breakpoints whose typename is "hw watchpoint" should be treated as watchpoint. Reproducible: Always Steps to Reproduce: 1. Start a debug launch. 2. In the gdb console in Console view, type the command "hbreak". 3. Check that CDT mistakenly creates a hardware watchpoint instead of hardware breakpoint.