API: added methods for querying source directories
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 09 Mar 2018 12:38:44 +0000
changeset 114 be5bdaecb9b3
parent 113 c4f07d0e7b7a
child 115 efb49f057011
API: added methods for querying source directories This is an API equivalent of `show directories` command.
GDBCmdParamChangedEvent.st
GDBDebugger.st
Make.proto
Make.spec
abbrev.stc
bc.mak
jv_libgdbs.st
libInit.cc
tests/GDBDebuggerTestsR.st
--- a/GDBCmdParamChangedEvent.st	Fri Mar 09 11:01:06 2018 +0000
+++ b/GDBCmdParamChangedEvent.st	Fri Mar 09 12:38:44 2018 +0000
@@ -52,7 +52,19 @@
 
 !GDBCmdParamChangedEvent methodsFor:'accessing'!
 
+name
+    ^ properties at: 'param'
+
+    "Created: / 09-03-2018 / 12:11:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 type
 	^  'cmd-param-changed'
+!
+
+value
+    ^ properties at: 'value'
+
+    "Created: / 09-03-2018 / 12:11:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/GDBDebugger.st	Fri Mar 09 11:01:06 2018 +0000
+++ b/GDBDebugger.st	Fri Mar 09 12:38:44 2018 +0000
@@ -24,7 +24,7 @@
 	instanceVariableNames:'connection commandSequenceNumber inferiorStateSequenceNumber
 		inferiors breakpoints selectedInferior selectedThread
 		selectedFrame prettyPrintingEnabled frameFiltersEnabled
-		finalizationRegistry debuggerFeatures targetFeatures'
+		finalizationRegistry debuggerFeatures targetFeatures directories'
 	classVariableNames:''
 	poolDictionaries:'GDBCommandStatus GDBFeatures'
 	category:'GDB-Core'
@@ -98,6 +98,21 @@
     "Modified: / 02-06-2017 / 23:13:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+directories
+    "Return a list of directories where GDB looks for source code and an Array.
+     Variables such as $cdir and $cwd are NOT expanded.
+    "
+    | result |
+
+    directories isNil ifTrue:[
+        result := self send: (GDBMI_gdb_show arguments: #('directories')).
+        directories := ((result propertyAt: #value) tokensBasedOn:$:) asArray
+    ].
+    ^ directories
+
+    "Created: / 09-03-2018 / 12:05:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 features
     "Return a list of features supported ty this version og GDB.
      See 
@@ -668,6 +683,14 @@
     "Modified: / 15-01-2018 / 23:11:52 / jv"
 !
 
+onCmdParamChangedEvent: aGDBCmdParamChangedEvent
+    (aGDBCmdParamChangedEvent name = 'directories') ifTrue:[ 
+        directories := nil.
+    ].
+
+    "Created: / 09-03-2018 / 12:12:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 onCommandEvent:aGDBCommandEvent 
     connection send:aGDBCommandEvent command.
 
@@ -859,10 +882,12 @@
 
         when: GDBBreakpointCreatedEvent     send: #onBreakpointCreatedEvent:  to: self;
         when: GDBBreakpointModifiedEvent    send: #onBreakpointModifiedEvent: to: self;
-        when: GDBBreakpointDeletedEvent     send: #onBreakpointDeletedEvent:  to: self.
+        when: GDBBreakpointDeletedEvent     send: #onBreakpointDeletedEvent:  to: self;
+
+        when: GDBCmdParamChangedEvent       send: #onCmdParamChangedEvent:    to: self.
 
     "Created: / 20-06-2014 / 22:07:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 06-07-2017 / 16:08:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-03-2018 / 12:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 unsubscribe
--- a/Make.proto	Fri Mar 09 11:01:06 2018 +0000
+++ b/Make.proto	Fri Mar 09 12:38:44 2018 +0000
@@ -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,
@@ -140,7 +140,6 @@
 $(OUTDIR)GDBMAPropertyAccessor.$(O) GDBMAPropertyAccessor.$(C) GDBMAPropertyAccessor.$(H): GDBMAPropertyAccessor.st $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAAccessor.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAObject.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBMIPrinter.$(O) GDBMIPrinter.$(C) GDBMIPrinter.$(H): GDBMIPrinter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBMITrace.$(O) GDBMITrace.$(C) GDBMITrace.$(H): GDBMITrace.st $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/OrderedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(STCHDR)
-$(OUTDIR)GDBMITraceViewer.$(O) GDBMITraceViewer.$(C) GDBMITraceViewer.$(H): GDBMITraceViewer.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
 $(OUTDIR)GDBObject.$(O) GDBObject.$(C) GDBObject.$(H): GDBObject.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBOutputFormat.$(O) GDBOutputFormat.$(C) GDBOutputFormat.$(H): GDBOutputFormat.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBOutputFormats.$(O) GDBOutputFormats.$(C) GDBOutputFormats.$(H): GDBOutputFormats.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
--- a/Make.spec	Fri Mar 09 11:01:06 2018 +0000
+++ b/Make.spec	Fri Mar 09 12:38:44 2018 +0000
@@ -64,7 +64,6 @@
 	GDBMAPropertyAccessor \
 	GDBMIPrinter \
 	GDBMITrace \
-	GDBMITraceViewer \
 	GDBObject \
 	GDBOutputFormat \
 	GDBOutputFormats \
@@ -264,7 +263,6 @@
     $(OUTDIR)GDBMAPropertyAccessor.$(O) \
     $(OUTDIR)GDBMIPrinter.$(O) \
     $(OUTDIR)GDBMITrace.$(O) \
-    $(OUTDIR)GDBMITraceViewer.$(O) \
     $(OUTDIR)GDBObject.$(O) \
     $(OUTDIR)GDBOutputFormat.$(O) \
     $(OUTDIR)GDBOutputFormats.$(O) \
--- a/abbrev.stc	Fri Mar 09 11:01:06 2018 +0000
+++ b/abbrev.stc	Fri Mar 09 12:38:44 2018 +0000
@@ -14,7 +14,6 @@
 GDBMAPropertyAccessor GDBMAPropertyAccessor jv:libgdbs 'GDB-Support' 0
 GDBMIPrinter GDBMIPrinter jv:libgdbs 'GDB-Private' 0
 GDBMITrace GDBMITrace jv:libgdbs 'GDB-Private-MI Trace' 0
-GDBMITraceViewer GDBMITraceViewer jv:libgdbs 'GDB-Private-MI Trace' 2
 GDBObject GDBObject jv:libgdbs 'GDB-Core' 0
 GDBOutputFormat GDBOutputFormat jv:libgdbs 'GDB-Private' 0
 GDBOutputFormats GDBOutputFormats jv:libgdbs 'GDB-Core' 0
@@ -196,5 +195,5 @@
 GDBThreadGroupAddedEvent GDBThreadGroupAddedEvent jv:libgdbs 'GDB-Core-Events' 0
 GDBThreadGroupExitedEvent GDBThreadGroupExitedEvent jv:libgdbs 'GDB-Core-Events' 0
 GDBThreadGroupStartedEvent GDBThreadGroupStartedEvent jv:libgdbs 'GDB-Core-Events' 0
+GDBMITraceViewer GDBMITraceViewer jv:libgdbs 'GDB-Private-MI Trace' 2
 GDBSimulatorResource GDBSimulatorResource jv:libgdbs 'GDB-Resources' 1
-GDBMITraceViewer GDBMITraceViewer jv:libgdbs 'GDB-Private-MI Trace' 2
--- a/bc.mak	Fri Mar 09 11:01:06 2018 +0000
+++ b/bc.mak	Fri Mar 09 12:38:44 2018 +0000
@@ -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)
@@ -87,7 +87,6 @@
 $(OUTDIR)GDBMAPropertyAccessor.$(O) GDBMAPropertyAccessor.$(C) GDBMAPropertyAccessor.$(H): GDBMAPropertyAccessor.st $(INCLUDE_TOP)\stx\goodies\magritte\Magritte__MAAccessor.$(H) $(INCLUDE_TOP)\stx\goodies\magritte\Magritte__MAObject.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBMIPrinter.$(O) GDBMIPrinter.$(C) GDBMIPrinter.$(H): GDBMIPrinter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBMITrace.$(O) GDBMITrace.$(C) GDBMITrace.$(H): GDBMITrace.st $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\OrderedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(STCHDR)
-$(OUTDIR)GDBMITraceViewer.$(O) GDBMITraceViewer.$(C) GDBMITraceViewer.$(H): GDBMITraceViewer.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
 $(OUTDIR)GDBObject.$(O) GDBObject.$(C) GDBObject.$(H): GDBObject.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBOutputFormat.$(O) GDBOutputFormat.$(C) GDBOutputFormat.$(H): GDBOutputFormat.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBOutputFormats.$(O) GDBOutputFormats.$(C) GDBOutputFormats.$(H): GDBOutputFormats.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
--- a/jv_libgdbs.st	Fri Mar 09 11:01:06 2018 +0000
+++ b/jv_libgdbs.st	Fri Mar 09 12:38:44 2018 +0000
@@ -89,7 +89,6 @@
      Please also take a look at the #mandatoryPreRequisites method"
 
     ^ #(
-        #'stx:goodies/sunit'    "TestAsserter - superclass of GDBSimulatorResource"
         #'stx:libbasic2'    "List - referenced by GDBDebugger>>breakpoints"
         #'stx:libtool'    "Tools::Inspector2Tab - referenced by GDBBreakpoint>>inspector2TabCondition"
         #'stx:libview2'    "ApplicationModel - referenced by GDBEventSubscription class>>blockFor:withSelector:"
@@ -130,7 +129,6 @@
         GDBMAPropertyAccessor
         GDBMIPrinter
         GDBMITrace
-        GDBMITraceViewer
         GDBObject
         GDBOutputFormat
         GDBOutputFormats
@@ -312,8 +310,8 @@
         GDBThreadGroupAddedEvent
         GDBThreadGroupExitedEvent
         GDBThreadGroupStartedEvent
+        (GDBMITraceViewer autoload)
         (GDBSimulatorResource autoload)
-        (GDBMITraceViewer autoload)
     )
 !
 
--- a/libInit.cc	Fri Mar 09 11:01:06 2018 +0000
+++ b/libInit.cc	Fri Mar 09 12:38:44 2018 +0000
@@ -29,7 +29,6 @@
 extern void _GDBMAPropertyAccessor_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBMIPrinter_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBMITrace_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
-extern void _GDBMITraceViewer_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBObject_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBOutputFormat_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBOutputFormats_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
@@ -238,7 +237,6 @@
     _GDBMAPropertyAccessor_Init(pass,__pRT__,snd);
     _GDBMIPrinter_Init(pass,__pRT__,snd);
     _GDBMITrace_Init(pass,__pRT__,snd);
-    _GDBMITraceViewer_Init(pass,__pRT__,snd);
     _GDBObject_Init(pass,__pRT__,snd);
     _GDBOutputFormat_Init(pass,__pRT__,snd);
     _GDBOutputFormats_Init(pass,__pRT__,snd);
--- a/tests/GDBDebuggerTestsR.st	Fri Mar 09 11:01:06 2018 +0000
+++ b/tests/GDBDebuggerTestsR.st	Fri Mar 09 12:38:44 2018 +0000
@@ -335,6 +335,24 @@
     "Modified (format): / 11-07-2017 / 23:31:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+test_directories
+    | directories |
+
+    debugger := GDBDebugger new.
+    self assert: debugger isConnected.
+
+    directories := debugger directories.
+    self assert: directories isArray.
+    self assert: directories notEmpty.
+
+    debugger send: ('set directories "%1"' bindWith: Filename currentDirectory pathName).
+    directories := debugger directories.
+    self assert: directories isArray.
+    self assert:(directories includes: Filename currentDirectory pathName).
+
+    "Created: / 09-03-2018 / 12:28:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 test_features
 
     debugger := GDBDebugger new.