GDBDebugger.st
changeset 120 73877848ea7f
parent 119 258bf0b2317c
child 126 fb73b0af430b
--- a/GDBDebugger.st	Tue Apr 03 21:19:35 2018 +0100
+++ b/GDBDebugger.st	Wed May 23 10:22:36 2018 +0100
@@ -75,6 +75,19 @@
     "Created: / 02-06-2014 / 23:06:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+breakpointForId: id
+    self breakpoints do:[:bp |
+        bp number = id ifTrue:[ ^ bp ].
+        bp locations do: [ :loc |
+            loc number = id ifTrue:[ ^ loc ].
+        ].
+    ].
+    self error: ('No breakpoint with id ''%1'' found!!' bindWith: id)
+
+    "Created: / 18-05-2018 / 13:39:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-05-2018 / 15:03:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 breakpoints
     breakpoints isNil ifTrue:[ 
         breakpoints := List new.
@@ -644,42 +657,52 @@
 !GDBDebugger methodsFor:'event handling'!
 
 onBreakpointCreatedEvent: aGDBBreakpointCreatedEvent
+    | breakpoint |
 
     breakpoints isNil ifTrue:[ 
         breakpoints := List new.
     ].
-    aGDBBreakpointCreatedEvent breakpoints do:[:breakpoint |  
-        breakpoint setDebugger: self.
-        breakpoints add: breakpoint.
+
+    "/ Care for breakpoints with multiple locations. 
+    "/ 
+    "/.If the breakpoint created has multiple locations,
+    "/ the breakppints contains an instance of GDBBreakpoint
+    "/ for the top-level breakpoint, followed by a GDBBreakpoint
+    "/ for each location.
+
+    breakpoint := aGDBBreakpointCreatedEvent breakpoints first.
+    aGDBBreakpointCreatedEvent breakpoints size > 1 ifTrue:[ 
+        breakpoint locations: (aGDBBreakpointCreatedEvent breakpoints copyFrom: 2)
     ].
+    breakpoint setDebugger: self.    
+    breakpoints add: breakpoint.
 
     "Created: / 06-07-2017 / 16:08:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 12-11-2017 / 20:17:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-05-2018 / 14:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 onBreakpointDeletedEvent: aGDBBreakpointDeletedEvent
     | breakpoint |
 
-    breakpoint := breakpoints detect:[:e | e number == aGDBBreakpointDeletedEvent id ].
+    breakpoint := self breakpointForId: aGDBBreakpointDeletedEvent id.
     breakpoint setDebugger: nil.
     breakpoints remove: breakpoint.
 
     "Created: / 06-07-2017 / 16:26:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 07-07-2017 / 12:39:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-05-2018 / 14:58:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 onBreakpointModifiedEvent: aGDBBreakpointModifiedEvent
-
     aGDBBreakpointModifiedEvent breakpoints do:[:new | 
         | old |    
 
-        old := breakpoints detect:[:e | e number = new number ].
+        old := self breakpointForId: new number.
         old updateFrom: new.
     ].
 
     "Created: / 06-07-2017 / 16:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 12-11-2017 / 20:18:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 15-01-2018 / 23:11:52 / jv"
+    "Modified: / 18-05-2018 / 14:58:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 onCmdParamChangedEvent: aGDBCmdParamChangedEvent