Added pool `GDBStopReasons` with constants for (know) reasons
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 01 Sep 2018 00:16:15 +0100
changeset 135 6efae6456f14
parent 134 3abcf54431c1
child 136 213e436320fe
Added pool `GDBStopReasons` with constants for (know) reasons ...that come in `reason` property of `GDBStoppedEvent`.
GDBArchitecture.st
GDBStopReasons.st
GDBStoppedEvent.st
Make.proto
Make.spec
abbrev.stc
bc.mak
jv_libgdbs.st
libInit.cc
tests/bc.mak
--- a/GDBArchitecture.st	Fri Aug 31 08:04:05 2018 +0100
+++ b/GDBArchitecture.st	Sat Sep 01 00:16:15 2018 +0100
@@ -78,9 +78,10 @@
 
     "/ please change as required (and remove this comment)
 
-    Architectures := Dictionary new.
-    Architectures at: 'i386'        put: (GDBArch_x86 new setMode: 32; yourself).
-    Architectures at: 'i386:x86-64' put: (GDBArch_x86 new setMode: 64; yourself).
+    Architectures := Dictionary new
+			at: 'i386'        put: (GDBArch_x86 new setMode: 32; yourself);
+			at: 'i386:x86-64' put: (GDBArch_x86 new setMode: 64; yourself);
+			yourself.
 
     "Modified: / 16-08-2018 / 11:12:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -88,6 +89,7 @@
 !GDBArchitecture class methodsFor:'instance creation'!
 
 named: aString
+    Architectures isEmptyOrNil ifTrue:[self initialize].
     ^ Architectures 
         at: aString 
         ifAbsentPut:[GDBArch_unknown new setName: aString ].
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDBStopReasons.st	Sat Sep 01 00:16:15 2018 +0100
@@ -0,0 +1,69 @@
+"
+jv:libgdbs - GNU Debugger Interface Library
+Copyright (C) 2015-now Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License. 
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+"{ Package: 'jv:libgdbs' }"
+
+"{ NameSpace: Smalltalk }"
+
+SharedPool subclass:#GDBStopReasons
+	instanceVariableNames:''
+	classVariableNames:'SignalReceived BreakpointHit WatchpointTrigger EndSteppingRange'
+	poolDictionaries:''
+	category:'GDB-Core'
+!
+
+!GDBStopReasons class methodsFor:'documentation'!
+
+copyright
+"
+jv:libgdbs - GNU Debugger Interface Library
+Copyright (C) 2015-now Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License. 
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+! !
+
+!GDBStopReasons class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    "/ please change as required (and remove this comment)
+
+    SignalReceived := 'signal-received'.
+    BreakpointHit := 'breakpoint-hit'.
+    WatchpointTrigger := 'watchpoint-trigger'.
+    EndSteppingRange := 'end-stepping-range'.
+
+    "Modified: / 31-08-2018 / 23:18:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+
+GDBStopReasons initialize!
--- a/GDBStoppedEvent.st	Fri Aug 31 08:04:05 2018 +0100
+++ b/GDBStoppedEvent.st	Sat Sep 01 00:16:15 2018 +0100
@@ -21,7 +21,7 @@
 "{ NameSpace: Smalltalk }"
 
 GDBExecutionEvent subclass:#GDBStoppedEvent
-	instanceVariableNames:'stopped_threads'
+	instanceVariableNames:'frame reason stopped_threads'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'GDB-Core-Events'
@@ -56,14 +56,31 @@
     ^ (super description)
         define:#'thread-id' as:Integer;
         define:#'stopped-threads' as:String;
+        define:#'frame' as: GDBFrame;
+        define:#'reason' as: String;
         yourself
 
     "Created: / 08-09-2014 / 22:13:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 22-09-2014 / 23:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 31-08-2018 / 14:15:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GDBStoppedEvent methodsFor:'accessing'!
 
+frame
+    ^ frame
+!
+
+reason
+    "Return stop reason as reported by the GDB.
+
+     See GDBStopReasons for list of common reasons. Note, that
+     that list os not exhaustive."
+
+    ^ reason
+
+    "Modified (comment): / 31-08-2018 / 23:20:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 stoppedThread
     thread_id isNil ifTrue:[ ^ nil ].
     ^ threads detect:[:thread | thread id = thread_id ]
@@ -91,6 +108,23 @@
 	^  'stopped'
 ! !
 
+!GDBStoppedEvent methodsFor:'initialization'!
+
+reason: aString
+    GDBStopReasons classVarNames do:[:name | 
+        | value |
+
+        value := GDBStopReasons classVarNamed: name.
+        aString = value ifTrue:[ 
+            reason := value.
+            ^ self.
+        ].
+    ].
+    reason := aString
+
+    "Created: / 31-08-2018 / 23:23:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !GDBStoppedEvent class methodsFor:'documentation'!
 
 version_HG
--- a/Make.proto	Fri Aug 31 08:04:05 2018 +0100
+++ b/Make.proto	Sat Sep 01 00:16:15 2018 +0100
@@ -34,7 +34,7 @@
 # add the path(es) here:,
 # ********** OPTIONAL: MODIFY the next lines ***
 # LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/announcements -I$(INCLUDE_TOP)/stx/goodies/magritte -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic2 -I$(INCLUDE_TOP)/stx/libtool -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/announcements -I$(INCLUDE_TOP)/stx/goodies/magritte -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic2 -I$(INCLUDE_TOP)/stx/libtool -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg
 
 
 # if you need any additional defines for embedded C code,
@@ -149,6 +149,7 @@
 $(OUTDIR)GDBOutputFormats.$(O) GDBOutputFormats.$(C) GDBOutputFormats.$(H): GDBOutputFormats.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
 $(OUTDIR)GDBPTY.$(O) GDBPTY.$(C) GDBPTY.$(H): GDBPTY.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/TTYConstants.$(H) $(STCHDR)
 $(OUTDIR)GDBProcess.$(O) GDBProcess.$(C) GDBProcess.$(H): GDBProcess.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)GDBStopReasons.$(O) GDBStopReasons.$(C) GDBStopReasons.$(H): GDBStopReasons.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
 $(OUTDIR)GDBThreadGroupType.$(O) GDBThreadGroupType.$(C) GDBThreadGroupType.$(H): GDBThreadGroupType.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBThreadState.$(O) GDBThreadState.$(C) GDBThreadState.$(H): GDBThreadState.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBTransientDataHolder.$(O) GDBTransientDataHolder.$(C) GDBTransientDataHolder.$(H): GDBTransientDataHolder.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/Make.spec	Fri Aug 31 08:04:05 2018 +0100
+++ b/Make.spec	Sat Sep 01 00:16:15 2018 +0100
@@ -73,6 +73,7 @@
 	GDBOutputFormats \
 	GDBPTY \
 	GDBProcess \
+	GDBStopReasons \
 	GDBThreadGroupType \
 	GDBThreadState \
 	GDBTransientDataHolder \
@@ -280,6 +281,7 @@
     $(OUTDIR)GDBOutputFormats.$(O) \
     $(OUTDIR)GDBPTY.$(O) \
     $(OUTDIR)GDBProcess.$(O) \
+    $(OUTDIR)GDBStopReasons.$(O) \
     $(OUTDIR)GDBThreadGroupType.$(O) \
     $(OUTDIR)GDBThreadState.$(O) \
     $(OUTDIR)GDBTransientDataHolder.$(O) \
--- a/abbrev.stc	Fri Aug 31 08:04:05 2018 +0100
+++ b/abbrev.stc	Sat Sep 01 00:16:15 2018 +0100
@@ -23,6 +23,7 @@
 GDBOutputFormats GDBOutputFormats jv:libgdbs 'GDB-Core' 0
 GDBPTY GDBPTY jv:libgdbs 'GDB-Private' 0
 GDBProcess GDBProcess jv:libgdbs 'GDB-Private' 0
+GDBStopReasons GDBStopReasons jv:libgdbs 'GDB-Core' 0
 GDBThreadGroupType GDBThreadGroupType jv:libgdbs 'GDB-Core' 1
 GDBThreadState GDBThreadState jv:libgdbs 'GDB-Core' 1
 GDBTransientDataHolder GDBTransientDataHolder jv:libgdbs 'GDB-Private' 0
--- a/bc.mak	Fri Aug 31 08:04:05 2018 +0100
+++ b/bc.mak	Sat Sep 01 00:16:15 2018 +0100
@@ -35,7 +35,7 @@
 
 
 
-LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\announcements -I$(INCLUDE_TOP)\stx\goodies\magritte -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic2 -I$(INCLUDE_TOP)\stx\libtool -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\announcements -I$(INCLUDE_TOP)\stx\goodies\magritte -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic2 -I$(INCLUDE_TOP)\stx\libtool -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg
 LOCALDEFINES=
 
 STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES)  -varPrefix=$(LIBNAME)
@@ -65,7 +65,7 @@
 
 
 
-test: $(TOP)\goodies\builder\reports\NUL
+test: $(TOP)\goodies\builder\reports
 	pushd $(TOP)\goodies\builder\reports & $(MAKE_BAT)
 	$(TOP)\goodies\builder\reports\report-runner.bat -D . -r Builder::TestReport -p $(PACKAGE)
         
@@ -96,6 +96,7 @@
 $(OUTDIR)GDBOutputFormats.$(O) GDBOutputFormats.$(C) GDBOutputFormats.$(H): GDBOutputFormats.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
 $(OUTDIR)GDBPTY.$(O) GDBPTY.$(C) GDBPTY.$(H): GDBPTY.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\TTYConstants.$(H) $(STCHDR)
 $(OUTDIR)GDBProcess.$(O) GDBProcess.$(C) GDBProcess.$(H): GDBProcess.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)GDBStopReasons.$(O) GDBStopReasons.$(C) GDBStopReasons.$(H): GDBStopReasons.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
 $(OUTDIR)GDBThreadGroupType.$(O) GDBThreadGroupType.$(C) GDBThreadGroupType.$(H): GDBThreadGroupType.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBThreadState.$(O) GDBThreadState.$(C) GDBThreadState.$(H): GDBThreadState.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBTransientDataHolder.$(O) GDBTransientDataHolder.$(C) GDBTransientDataHolder.$(H): GDBTransientDataHolder.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/jv_libgdbs.st	Fri Aug 31 08:04:05 2018 +0100
+++ b/jv_libgdbs.st	Sat Sep 01 00:16:15 2018 +0100
@@ -89,14 +89,11 @@
      Please also take a look at the #mandatoryPreRequisites method"
 
     ^ #(
-        #'stx:goodies/sunit'    "TestAsserter - superclass of GDBSimulatorResource"
         #'stx:libbasic2'    "CacheDictionary - referenced by GDBInstructionsAndSourceLine class>>initialize"
         #'stx:libtool'    "Tools::Inspector2Tab - referenced by GDBBreakpoint>>inspector2TabCondition"
         #'stx:libview2'    "ApplicationModel - referenced by GDBEventSubscription class>>blockFor:withSelector:"
         #'stx:libwidg'    "EditTextView - referenced by GDBBreakpoint>>inspector2TabCondition"
     )
-
-    "Modified: / 20-08-2018 / 07:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 subProjects
@@ -141,6 +138,7 @@
         GDBOutputFormats
         GDBPTY
         GDBProcess
+        GDBStopReasons
         GDBThreadGroupType
         GDBThreadState
         GDBTransientDataHolder
--- a/libInit.cc	Fri Aug 31 08:04:05 2018 +0100
+++ b/libInit.cc	Sat Sep 01 00:16:15 2018 +0100
@@ -38,6 +38,7 @@
 extern void _GDBOutputFormats_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBPTY_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBProcess_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _GDBStopReasons_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBThreadGroupType_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBThreadState_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBTransientDataHolder_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
@@ -254,6 +255,7 @@
     _GDBOutputFormats_Init(pass,__pRT__,snd);
     _GDBPTY_Init(pass,__pRT__,snd);
     _GDBProcess_Init(pass,__pRT__,snd);
+    _GDBStopReasons_Init(pass,__pRT__,snd);
     _GDBThreadGroupType_Init(pass,__pRT__,snd);
     _GDBThreadState_Init(pass,__pRT__,snd);
     _GDBTransientDataHolder_Init(pass,__pRT__,snd);
--- a/tests/bc.mak	Fri Aug 31 08:04:05 2018 +0100
+++ b/tests/bc.mak	Sat Sep 01 00:16:15 2018 +0100
@@ -76,7 +76,7 @@
 
 
 
-test: $(TOP)\goodies\builder\reports\NUL
+test: $(TOP)\goodies\builder\reports
 	pushd $(TOP)\goodies\builder\reports & $(MAKE_BAT)
 	$(TOP)\goodies\builder\reports\report-runner.bat -D . -r Builder::TestReport -p $(PACKAGE)