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
  • From: Shiva Sharma <SHIVA.SHARMA@xxxxxxxxxxxx>
  • Date: Tue, 25 May 2021 11:24:15 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w0V6BSt9SEOZ2CkwETVfN1kvz6/YF7a5xnYif9OjuFU=; b=emsBKy/buy9c6ITkdd6MxE9LyIojc+mDsyFQ6HC7pOlZLQBYJCINHajjuUz8+JP54r93jkglqBXQIV1v/qA7HmI8v8P6fYq0sthGfnKOwGtqdF9ZHESkYgYberhPYSILSUksUSir6PtUKB0jobEE5t9KTwQJXFz24V8xXitBwJXhfvRbyMJ0pC/puqSBseeNtTSS6qzrzaQtxOO9jsNGQAka0eqwQ6HJG+oWnTVW+nzRqfAvhjRbjqSJjSmEcQpzRXMr1DPQgcPuNEe1fjKJ7XpBNhs8gMIhyc3Um/XwspbP3IvPqc6QxO4pRquJBHS0icjQxzpC+dkTKHQTG5qQ7g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GymYP78Q/GypHeCHSDaBpQazJ5m12e449NR6aEJS1HBMEt4swkbog9pTiu8hflb07lLU1e0Bny8PFM9P3yWushoBlTShIgzm7cRT5iVKjEjN8BcTUVWof3r4aaUAh3OTKJKvddph210fZDrwyq12ZveTCcgrCIRI+LI9CaNgCLFFHHKO6DoggrNymXBopTKpr34E4K176cStlx7e1CreRVF5RwDSvWxWkz5SJPGmv4HLBPJp8JtMdZhPGtZSHZnWoC+lk32V+xmCIVnhWvaWvxFifPMsR4hOneXRkI1M1OcO+2IEM5xHRfAHZO1sj4qQY3AK3cCchjNCCSjIB1kuJA==
  • Delivered-to: cdt-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/cdt-dev/>
  • List-help: <mailto:cdt-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AddCUq0GMQ+ojMA3THe0lz9JnT9sNwAFVU+QAdtLGIAB3T0HIA==
  • Thread-topic: [cdt-dev] How to put error marker for breakpoint at invalid address in disassembly view

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

 

Hello,

 

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 @@
             value="false">
       </persistent>
       <attribute name="externalLocation"/>
+      <attribute
+            name="address">
+      </attribute>
    </extension>
    <extension
          point="org.eclipse.debug.core.breakpoints">
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
index 3483711262..d870a8fbc0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
@@ -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 https://wiki.eclipse.org/CDT/contributing 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

 

 


~~~
Jonah Graham
Kichwa Coders
www.kichwacoders.com

 

 

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.

Can you please guide on HOW TO CREATE ERROR MARKER IN DISASSEMBLY WINDOW ?
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 {

                                marker.delete();

                        } catch (CoreException e) { }

                }

 

                CAddressBreakpoint addressBreakpoint = (CAddressBreakpoint) breakpoint;

                try {

                        IMarker breakpointMarker = addressBreakpoint.getMarker();

                        breakpointMarker.setAttribute(IMarker.MESSAGE,     description);

                        breakpointMarker.setAttribute(IMarker.SEVERITY,    severity);

 

                        addressBreakpoint.setMarker(breakpointMarker);

                        addressBreakpoint.setEnabled(false);

                 } 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
cdt-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdt-dev


Back to the top