Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to put error marker for breakpoint at invalid address in disassembly view

Hi Shiva,

I am glad I could help you in the right direction.

Your questions are a whole bigger topic - it is the many times restarted topic in CDT, but never fully resolved task of multi-process breakpoints. There used to be a CDT working group that worked on this, you can browse the obsolete parts of the Wiki for what the state was, as a starting point you can see

One the debug sessions are launched, breakpoints have a filter that can be used.

So, I don't have a good answer for you on this. What it needs is some proposals and someone to follow through and implement the solution (e.g. persisting breakpoint filtering).


Jonah Graham
Kichwa Coders

On Tue, 25 May 2021 at 07:24, Shiva Sharma <SHIVA.SHARMA@xxxxxxxxxxxx> wrote:

Hi Jonah,


Thanks for the guidance, I am working on implementing same and will create a Bugzilla once done.


Additional questions, if you could please answer:

  1. I see that address breakpoints are common between multiple debug sessions of Eclipse. So if I put a breakpoint on address 0x3c (e.g.) which is invalid for session-1 but valid for session-2, then I want to show the error marker only for the session-1. I have not yet fully implemented the error marker feature but with breakpoint marker, I could see that it is same in both debug sessions. Do you foresee same behaviour with the error markers ? If yes, then what can I do to add error marker particular to debug session ?
  2. This question is about a different functionality I wish to add. As soon as debug session is launched, I wish to show an indicator against all invalid addresses in disassembly view, so that user is pre-informed. I extended "org.eclipse.cdt.debug.ui.disassemblyRulerColumns" and implemented a vertical ruler class and implemented following API. See below:
    1. With this I do see an ‘x’ (i.e. like a cross) against invalid addresses. But the problem here too is that this is shared between debug sessions and for debug sessions where this address is valid, still sees a cross. Please guide if there is any solution to this.


Thanks & Best Regards,

Shiva Sharma..


From: Jonah Graham <jonah@xxxxxxxxxxxxxxxx>
Sent: 16 May 2021 03:27
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
Cc: Shiva Sharma <shsharma@xxxxxxxxxxxx>
Subject: Re: [cdt-dev] How to put error marker for breakpoint at invalid address in disassembly view




This sounds like a nice feature to add to CDT's disassembly view!


There are two things that will need to be implemented. I think you have already identified this, I am just restating so that we are on the same page and I can provide my direction:


1. In org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager.addBreakpointProblemMarker(ICBreakpoint, String, int) the case of address breakpoints need to be handled so that the problemMarker created contains the address information.*

2. In the Disassembly view you need to process markers based on their type and address to display them. You could start by showing the markers for line breakpoints, and then extend to address breakpoints?


For 1, I suspect all you need is something like this:


diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml
index 16958692c9..0adc31464c 100644
--- a/debug/org.eclipse.cdt.debug.core/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.core/plugin.xml
@@ -252,6 +252,9 @@
       <attribute name="externalLocation"/>
+      <attribute
+            name="address">
+      </attribute>
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/
index 3483711262..d870a8fbc0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/
@@ -776,6 +776,10 @@ public class MIBreakpointsManager extends AbstractDsfService
                                                if (sourceHandle != null) {
                                                        problemMarker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, sourceHandle);
+                                               String address = lineBreakpoint.getAddress();
+                                               if (address != null) {
+                                                       problemMarker.setAttribute("address", address); // TODO place this string constant in the "correct" place
+                                               }
                                                // And save the baby
                                                fBreakpointMarkerProblems.put(breakpoint, problemMarker);


For 2, You need to create an annotation model that processes breakpoint problem markers. See org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart.attachBreakpointsAnnotationModel() and org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart.attachExtendedPCAnnotationModel() for the existing annotation models on the disassembly viewer for a starting point. 


I would appreciate this being contributed back to CDT. Please create a bugzilla and let me know if you need help with any of the process. See for some getting started info.


* At the moment, AFAICT in your case the problem marker will be created for the address breakpoint, but because there is no resource/line information, it won't be visible anywhere. You can see such markers in the "Markers" view in the "C/C++ Breakpoint Problem" category.


PS. The forums are for end user help, the cdt-dev mailing list is for developing and extending CDT, so this is the best place to ask this type of question.





Jonah Graham
Kichwa Coders



On Thu, 6 May 2021 at 07:08, Shiva Sharma via cdt-dev <cdt-dev@xxxxxxxxxxx> wrote:

Hello Team,



The situation is that I have a list of address where there is either a delay slot or something else due to which hardware breakpoint cannot be put at these locations. If an error(…) is returned by GDB to Eclipse, then the error marker is correctly created by CDT (10.2) in C/C++ Source Editor but when breakpoint is put in disassembly view then there is no error marker created.


Issue is probably a bug in CDT code. The issue is that the address breakpoint user puts in disassembly window is instance of CAddressBreakpoint which in turn is instance of ICLineBreakpoint and therefore the following ‘if’ condition becomes true for address breakpoint as well:

if (breakpoint instanceof ICLineBreakpoint)) {...}

But the code inside the if condition will not create a correct error marker in disassembly window because it uses line number for position. I tried using address from the breakpoint object for position attribute but that did not help either.

Code I tried just above the above mentioned if condition is as following:


        if (breakpoint instanceof ICAddressBreakpoint) {

                IMarker marker = fBreakpointMarkerProblems.remove(breakpoint);

                if (marker != null) {

                        try {


                        } catch (CoreException e) { }



                CAddressBreakpoint addressBreakpoint = (CAddressBreakpoint) breakpoint;

                try {

                        IMarker breakpointMarker = addressBreakpoint.getMarker();

                        breakpointMarker.setAttribute(IMarker.MESSAGE,     description);

                        breakpointMarker.setAttribute(IMarker.SEVERITY,    severity);




                 } catch (CoreException e) { }

        } else if (breakpoint instanceof ICLineBreakpoint)) {...}

This works but it does not add a new error marker BUT edits the message in the breakpoint marker itself. Please guide on inserting a new error marker for an address in disassembly view!


Thanks & Best Regards,

Shiva Sharma..




cdt-dev mailing list
To unsubscribe from this list, visit

Back to the top