Bug 476424 - [breakpoints] Adding BP via "Add function Breakpoint (C/C++)" is not reflected in vertical ruler
Summary: [breakpoints] Adding BP via "Add function Breakpoint (C/C++)" is not reflecte...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.6.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-02 07:21 EDT by Stanislav Perepelitsa CLA
Modified: 2020-09-04 15:25 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Perepelitsa CLA 2015-09-02 07:21:34 EDT
This bug is similar to Bug 474179.

How to reproduce: 
1. Create a project with function foo()
2. Build the project.
3. Debug the project.
4. Open breakpoint views.
5. Select “View Menu” button via triangle icon in breakpoint views.
6. Select Add Function Breakpoint (C/C++)…
7. Enter “foo" to Function name field in common tab.

Observed behavior: No BP mark displays in source editor ruler.
Expected behavior: The BP mark is displayed in source editor ruler.
Comment 1 Stanislav Perepelitsa CLA 2015-09-02 07:34:58 EDT
Some experiments shows that Eclipse adds BP by executing "-break-insert" GDB/mi command:

|756,665 223-break-insert --thread-group i1 -f foo
|756,671 223^done,
|bkpt={number="8",type="breakpoint",disp="keep",enabled="y",
|addr="0x015030bc",func="foo",
|file="../src/MPC57xx__Interrupt_Init.c",
|fullname="E:\\Win_S32DS_E200_1.0.0_MasterDebugEnvTB\\runtime-S32DS\\aaa_Z4_3\\src\\MPC57xx__Interrupt_Init.c",line="160",thread-groups=["i1"],times="0",original-location="foo"}

after that BP appears in Breakpoint View, but no mark at ruler, while being added by using "break" GDB command everything just fine:

|851,886 232-interpreter-exec console "break foo"
|851,891 ~"Breakpoint 12 at 0x15030bc: file ../src/MPC57xx__Interrupt_Init.c, |line 160.\n"
|851,892 =breakpoint-created,
|bkpt={number="12",type="breakpoint",disp="keep",enabled="y",
|addr="0x015030bc",func="foo",file="../src/MPC57xx__Interrupt_Init.c",
|fullname="E:\\Win_S32DS_E200_1.0.0_MasterDebugEnvTB\\runtime-S32DS\\aaa_Z4_3\\src\\MPC57xx__Interrupt_Init.c",line="160",
|thread-groups=["i1"],times="0",original-location="foo"}
|851,892 232^done

Probably, notification "=breakpoint-created" is a reason.
Comment 2 Stanislav Perepelitsa CLA 2015-09-02 07:44:45 EDT
It is also noticed, GDB/mi command "-break-insert" typed in console adds BP only to GDB. This BP appears nether in Breakpoint view nor in vertical ruler.
Comment 3 Marc Khouzam CLA 2015-09-09 10:11:01 EDT
(In reply to Stanislav Perepelitsa from comment #0)
> This bug is similar to Bug 474179.
>
> Observed behavior: No BP mark displays in source editor ruler.
> Expected behavior: The BP mark is displayed in source editor ruler.

I can see this too. I'll have to look deeper at when the editor marker gets created and why it is not in this case.

As a workaround, you can put your cursor inside the method and then use the Run menu and choose "Toogle Method Breakpoint"


(In reply to Stanislav Perepelitsa from comment #2)
> It is also noticed, GDB/mi command "-break-insert" typed in console adds BP
> only to GDB. This BP appears nether in Breakpoint view nor in vertical ruler.

Right, when using the console, it is the =breakpoint-created event that tells eclipse to add it to the bp view and editor.  GDB does not issue that event when a bp is created using the MI command -break-insert; the idea is that if the bp is created using an MI command eclipse is the one that sent the command and already knows about the bp.
Comment 4 Marc Khouzam CLA 2015-09-09 11:43:16 EDT
I don't think this ever worked, although I'm not 100% sure.

When using "Add Function Breakpoint (C/C++)" from the bp view, the dialog pops-up before creating the marker, and once the user fills in the info, the marker is created in

CBreakpointPreferenceStore.save()

however, there is no attempt to extract the IResource from the dialog info, and the resource used is the worskpace itself.  This is why the marker is not shown.  We can see the IResource being specified in 

AbstractToggleBreakpointAdapter.createFunctionBreakpointInteractive() which calls AbstractToggleBreakpointAdapter.createFunctionBreakpoint() 
with parameter "ResourcesPlugin.getWorkspace().getRoot()"

To fix this, I believe we need to enhance CBreakpointPreferenceStore.getResource() to be able to figure out the resource based on the info available in the dialog.  This method does this for a line bp but not for other types of breakpoints.