UI: add GDB executable configuration to settings dialog
Also add *File* -> *Preferences* menu option to main debugger window.
and a new command line option `--gdb` to specify GDB on a command
line.
--- a/VDBDebuggerApplication.st Wed Oct 03 15:52:44 2018 +0100
+++ b/VDBDebuggerApplication.st Thu Oct 04 10:51:17 2018 +0100
@@ -523,6 +523,14 @@
isVisible: true
)
(MenuItem
+ label: 'Preferences'
+ itemValue: doOpenPreferences
+ isVisible: true
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
label: 'Quit'
itemValue: doQuit
isVisible: true
@@ -1221,6 +1229,16 @@
"Modified (format): / 08-03-2015 / 15:49:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+doOpenPreferences
+ | pathAndClass |
+
+ pathAndClass := AbstractLauncherApplication allSettingsList
+ detect:[:pair | pair second = VDBSettingsApplication name ].
+ AbstractLauncherApplication openSettingsAndSelect: pathAndClass first
+
+ "Modified: / 04-10-2018 / 10:34:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
doOpenToolDIsassembly
| application |
--- a/VDBSettingsApplication.st Wed Oct 03 15:52:44 2018 +0100
+++ b/VDBSettingsApplication.st Thu Oct 04 10:51:17 2018 +0100
@@ -11,7 +11,8 @@
"{ NameSpace: Smalltalk }"
AbstractSettingsApplication subclass:#VDBSettingsApplication
- instanceVariableNames:'infoPanel vdbPrettyPrintingEnabled vdbFrameFiltersEnabled'
+ instanceVariableNames:'infoPanel vdbPrettyPrintingEnabled vdbFrameFiltersEnabled
+ gdbExecutable'
classVariableNames:''
poolDictionaries:''
category:'VDB-UI-Others'
@@ -50,6 +51,29 @@
"Modified: / 10-04-2018 / 16:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!VDBSettingsApplication class methodsFor:'help specs'!
+
+helpSpec
+ "This resource specification was automatically generated
+ by the UIHelpTool of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIHelpTool may not be able to read the specification."
+
+ "
+ UIHelpTool openOnClass:VDBSettingsApplication
+ "
+
+ <resource: #help>
+
+ ^ super helpSpec addPairsFrom:#(
+
+#ExecutableLabel
+'Path to GDB executable. If left empty, system GDB is used.'
+
+)
+! !
+
!VDBSettingsApplication class methodsFor:'interface specs'!
windowSpec
@@ -70,7 +94,7 @@
^
#(FullSpec
name: windowSpec
- uuid: '10c0dbf0-3cd7-11e8-882f-0021ccd5e3d3'
+ uuid: '92aa9d90-c756-11e8-8f9c-0021ccd5e3d3'
window:
(WindowSpec
label: 'Java Settings'
@@ -124,6 +148,48 @@
component:
(SpecCollection
collection: (
+ (ViewSpec
+ name: 'Panel1'
+ uuid: '7628c0d0-c755-11e8-8f9c-0021ccd5e3d3'
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'GDB executable:'
+ name: 'ExecutableLabel'
+ layout: (LayoutFrame 5 0 0 0 130 0 25 0)
+ activeHelpKey: ExecutableLabel
+ uuid: '7628c0d1-c755-11e8-8f9c-0021ccd5e3d3'
+ translateLabel: true
+ adjust: left
+ )
+ (FilenameInputFieldSpec
+ name: 'Executable'
+ layout: (LayoutFrame 135 0 0 0 -100 1 0 1)
+ uuid: '7628c0d2-c755-11e8-8f9c-0021ccd5e3d3'
+ model: gdbExecutable
+ immediateAccept: true
+ acceptOnPointerLeave: true
+ emptyFieldReplacementText: 'Autodetect'
+ )
+ (ActionButtonSpec
+ label: 'Browse'
+ name: 'BrowseButton'
+ layout: (LayoutFrame -100 1 0 0 -8 1 0 1)
+ uuid: '7628c0d3-c755-11e8-8f9c-0021ccd5e3d3'
+ translateLabel: true
+ model: doSelectExecutable
+ )
+ )
+
+ )
+ extent: (Point 695 25)
+ )
+ (ViewSpec
+ name: 'Spacer'
+ uuid: '7628c0d4-c755-11e8-8f9c-0021ccd5e3d3'
+ extent: (Point 695 15)
+ )
(CheckBoxSpec
label: 'Enable Pretty Printers'
name: 'EnablePrettyPrinters'
@@ -150,12 +216,63 @@
)
! !
+!VDBSettingsApplication methodsFor:'actions'!
+
+doSelectExecutable
+ | guess executable |
+
+ guess := self gdbExecutable value asNilIfEmpty.
+ guess isNil ifTrue:[
+ guess := GDBProcess gdbExecutable
+ ].
+ [ guess notNil and:[ (guess := guess asFilename) exists not ] ] whileTrue:[
+ | p |
+
+ p := guess directory.
+ (p notNil and:[ p pathName = guess pathName ]) ifTrue:[
+ p := nil.
+ ].
+ guess := p.
+ ].
+ guess isNil ifTrue:[
+ guess := GDBProcess gdbExecutable
+ ].
+ executable := Dialog requestFileName:(resources string:'Select GDB executable') default: guess ifFail:[ ^ self ].
+ self infoPanel hide.
+ (executable includes: Character space) ifTrue:[
+ executable := '"' , executable , '"'.
+ ].
+ self gdbExecutable value: executable
+
+ "Created: / 03-10-2018 / 22:46:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!VDBSettingsApplication methodsFor:'aspects'!
aspects
- ^ #(vdbPrettyPrintingEnabled vdbFrameFiltersEnabled)
+ ^ #(gdbExecutable vdbPrettyPrintingEnabled vdbFrameFiltersEnabled)
"Created: / 10-04-2018 / 16:53:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-10-2018 / 22:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+gdbExecutable
+ <resource: #uiAspect>
+
+ "automatically generated by UIPainter ..."
+
+ "*** the code below creates a default model when invoked."
+ "*** (which may not be the one you wanted)"
+ "*** Please change as required and accept it in the browser."
+ "*** (and replace this comment by something more useful ;-)"
+
+ gdbExecutable isNil ifTrue:[
+ gdbExecutable := ValueHolder new.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/ gdbExecutable addDependent:self.
+"/ gdbExecutable onChangeSend:#gdbExecutableChanged to:self.
+ ].
+ ^ gdbExecutable.
!
infoPanel
@@ -209,5 +326,23 @@
"Modified: / 10-04-2018 / 16:53:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!VDBSettingsApplication methodsFor:'protocol'!
+
+basicSaveSettings
+ self gdbExecutable value = '' ifTrue:[
+ self gdbExecutable setValue: nil
+ ].
+ super basicSaveSettings.
+
+ "Created: / 04-10-2018 / 09:46:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBSettingsApplication class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
VDBSettingsApplication initialize!
--- a/VDBStartup.st Wed Oct 03 15:52:44 2018 +0100
+++ b/VDBStartup.st Thu Oct 04 10:51:17 2018 +0100
@@ -6,7 +6,7 @@
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
-"{ Package: 'jv:vdb/application' }"
+"{ Package: 'jv:vdb' }"
"{ NameSpace: Smalltalk }"
@@ -90,7 +90,7 @@
main:argv
"Application entry point. `argv` is the array of command arguments (as Array of Strings)"
- | optparser positional settingsFile settingsSuppressed replay
+ | optparser positional settingsFile settingsSuppressed gdb replay
programExecutable programArgs programPid attach
debugger debuggerApp |
@@ -122,6 +122,15 @@
on: #('--replay') do:[
replay := true
];
+ on: #('--gdb') do:[ :path |
+ gdb := path asFilename.
+ gdb exists ifFalse:[
+ self error: 'No such file: ', gdb pathName
+ ].
+ gdb isExecutable ifFalse:[
+ self error: 'Not an executable program: ', gdb pathName
+ ].
+ ];
yourself.
[
positional := optparser parse:argv.
@@ -151,6 +160,10 @@
UserPreferences setCurrent: settings.
].
+ gdb notNil ifTrue:[
+ GDBProcess gdbExecutable: gdb.
+ ].
+
replay ifTrue:[
OperatingSystem isLinuxLike ifFalse:[
self error: 'replay not supported on this platform'.
@@ -228,7 +241,7 @@
VDBStartup main: #('/bin/ls' '/tmp')
"
- "Modified: / 29-07-2018 / 08:51:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-10-2018 / 15:40:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
usage
@@ -238,6 +251,8 @@
Stdout nextPutLine:'
options:
--replay ..................... replay last rr record
+ --gdb GDB .................... use GDB instead if default one (overrides
+ preferences)
--preference FILE ............ read user settings from FILE
--no-preferences ............. do not read user settings at all
--help ....................... output this message
@@ -245,7 +260,7 @@
Smalltalk exitIfStandalone: 0.
- "Modified: / 29-07-2018 / 08:55:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-10-2018 / 15:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBStartup class methodsFor:'documentation'!
--- a/application/Make.proto Wed Oct 03 15:52:44 2018 +0100
+++ b/application/Make.proto Thu Oct 04 10:51:17 2018 +0100
@@ -69,6 +69,7 @@
libstx_libview \
libstx_libui \
libstx_libview2 \
+ libstx_goodies_sunit \
libstx_libwidg \
libstx_goodies_magritte \
libstx_libhtml \
@@ -91,6 +92,7 @@
$(TOP)/libview/libstx_libview$(O_EXT) \
$(TOP)/libui/libstx_libui$(O_EXT) \
$(TOP)/libview2/libstx_libview2$(O_EXT) \
+ $(TOP)/goodies/sunit/libstx_goodies_sunit$(O_EXT) \
$(TOP)/libwidg/libstx_libwidg$(O_EXT) \
$(TOP)/goodies/magritte/libstx_goodies_magritte$(O_EXT) \
$(TOP)/libhtml/libstx_libhtml$(O_EXT) \
@@ -113,6 +115,7 @@
libstx_libview$(O_EXT) \
libstx_libui$(O_EXT) \
libstx_libview2$(O_EXT) \
+ libstx_goodies_sunit$(O_EXT) \
libstx_libwidg$(O_EXT) \
libstx_goodies_magritte$(O_EXT) \
libstx_libhtml$(O_EXT) \
@@ -437,6 +440,19 @@
$(TOP)/libview2/makefile: $(TOP)/libview2/Make.proto
$(TOP)/rules/stmkmf --cd $(TOP)/libview2
+libstx_goodies_sunit.so: $(TOP)/goodies/sunit/libstx_goodies_sunit.so
+ ln -sf $(TOP)/goodies/sunit/libstx_goodies_sunit.so .
+
+$(TOP)/goodies/sunit/libstx_goodies_sunit.so: $(TOP)/goodies/sunit/makefile $(FORCE)
+ @if [ -f "$(TOP)/goodies/sunit/.NOSOURCE" ]; then \
+ echo "skip make in $(TOP)/goodies/sunit (no source)"; \
+ else \
+ cd $(TOP)/goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES) "; \
+ fi
+
+$(TOP)/goodies/sunit/makefile: $(TOP)/goodies/sunit/Make.proto
+ $(TOP)/rules/stmkmf --cd $(TOP)/goodies/sunit
+
libstx_libwidg.so: $(TOP)/libwidg/libstx_libwidg.so
ln -sf $(TOP)/libwidg/libstx_libwidg.so .
--- a/application/bc.mak Wed Oct 03 15:52:44 2018 +0100
+++ b/application/bc.mak Thu Oct 04 10:51:17 2018 +0100
@@ -96,6 +96,7 @@
libstx_libview.dll \
libstx_libui.dll \
libstx_libview2.dll \
+ libstx_goodies_sunit.dll \
libstx_libwidg.dll \
libstx_goodies_magritte.dll \
libstx_libhtml.dll \
@@ -366,6 +367,12 @@
..\..\..\stx\libview2\$(OBJDIR)\libstx_libview2.dll: $(FORCE)
pushd ..\..\..\stx\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+libstx_goodies_sunit.dll: ..\..\..\stx\goodies\sunit\$(OBJDIR)\libstx_goodies_sunit.dll
+ copy ..\..\..\stx\goodies\sunit\$(OBJDIR)\libstx_goodies_sunit.dll *.*
+
+..\..\..\stx\goodies\sunit\$(OBJDIR)\libstx_goodies_sunit.dll: $(FORCE)
+ pushd ..\..\..\stx\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+
libstx_libwidg.dll: ..\..\..\stx\libwidg\$(OBJDIR)\libstx_libwidg.dll
copy ..\..\..\stx\libwidg\$(OBJDIR)\libstx_libwidg.dll *.*
--- a/application/builder/baseline.rbspec Wed Oct 03 15:52:44 2018 +0100
+++ b/application/builder/baseline.rbspec Thu Oct 04 10:51:17 2018 +0100
@@ -24,6 +24,7 @@
package "stx:libview"
package "stx:libui"
package "stx:libview2"
+ package "stx:goodies/sunit"
package "stx:libwidg"
package "stx:goodies/magritte"
package "stx:libhtml"
--- a/application/builder/package.deps.rake Wed Oct 03 15:52:44 2018 +0100
+++ b/application/builder/package.deps.rake Thu Oct 04 10:51:17 2018 +0100
@@ -22,6 +22,9 @@
task "stx:goodies/regex" => "stx:libbasic"
+task "stx:goodies/sunit" => "stx:libbasic"
+task "stx:goodies/sunit" => "stx:libview2"
+
task "stx:goodies/xml/vw" => "stx:libbasic"
@@ -85,6 +88,7 @@
task "jv:vdb/application" => "stx:goodies/magritte"
task "jv:vdb/application" => "stx:goodies/refactoryBrowser/parser"
task "jv:vdb/application" => "stx:goodies/regex"
+task "jv:vdb/application" => "stx:goodies/sunit"
task "jv:vdb/application" => "stx:goodies/xml/vw"
task "jv:vdb/application" => "stx:libbasic"
task "jv:vdb/application" => "stx:libbasic2"
--- a/application/modules.stx Wed Oct 03 15:52:44 2018 +0100
+++ b/application/modules.stx Thu Oct 04 10:51:17 2018 +0100
@@ -25,6 +25,7 @@
libstx_libview
libstx_libui
libstx_libview2
+libstx_goodies_sunit
libstx_libwidg
libstx_goodies_magritte
libstx_libhtml
--- a/jv_vdb.st Wed Oct 03 15:52:44 2018 +0100
+++ b/jv_vdb.st Thu Oct 04 10:51:17 2018 +0100
@@ -161,6 +161,8 @@
UserPreferences vdbPrettyPrintingEnabled:
GDBDebugger targetConnectRR:
GDBDebugger onRRExitEvent:
+ UserPreferences vdbDebuggerLayout
+ UserPreferences vdbDebuggerLayout:
)
! !
--- a/tests/Make.proto Wed Oct 03 15:52:44 2018 +0100
+++ b/tests/Make.proto Thu Oct 04 10:51:17 2018 +0100
@@ -34,7 +34,7 @@
# add the path(es) here:,
# ********** OPTIONAL: MODIFY the next lines ***
# LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/jv/libgdbs -I$(INCLUDE_TOP)/jv/libgdbs/tests -I$(INCLUDE_TOP)/jv/vdb -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3
+LOCALINCLUDES= -I$(INCLUDE_TOP)/jv/libgdbs -I$(INCLUDE_TOP)/jv/libgdbs/tests -I$(INCLUDE_TOP)/jv/vdb -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3 -I$(INCLUDE_TOP)/stx/libview2
# if you need any additional defines for embedded C code,
--- a/tests/bc.mak Wed Oct 03 15:52:44 2018 +0100
+++ b/tests/bc.mak Thu Oct 04 10:51:17 2018 +0100
@@ -35,7 +35,7 @@
-LOCALINCLUDES= -I$(INCLUDE_TOP)\jv\libgdbs -I$(INCLUDE_TOP)\jv\libgdbs\tests -I$(INCLUDE_TOP)\jv\vdb -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3
+LOCALINCLUDES= -I$(INCLUDE_TOP)\jv\libgdbs -I$(INCLUDE_TOP)\jv\libgdbs\tests -I$(INCLUDE_TOP)\jv\vdb -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3 -I$(INCLUDE_TOP)\stx\libview2
LOCALDEFINES=
STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -varPrefix=$(LIBNAME)
--- a/tests/jv_vdb_tests.st Wed Oct 03 15:52:44 2018 +0100
+++ b/tests/jv_vdb_tests.st Thu Oct 04 10:51:17 2018 +0100
@@ -68,10 +68,11 @@
Please also take a look at the #mandatoryPreRequisites method"
^ #(
- #'jv:libgdbs' "GDBDebugger - referenced by VDBInstructionListApplicationTests>>test_01"
+ #'jv:libgdbs' "GDBDebugger - referenced by VDBInstructionListApplicationTests>>test_01a"
#'jv:libgdbs/tests' "GDBDebuggeesResource - referenced by VDBAbstractApplicationTests class>>resources"
- #'jv:vdb' "VDBInstructionListApplication - referenced by VDBInstructionListApplicationTests>>test_01"
+ #'jv:vdb' "VDBInstructionListApplication - referenced by VDBInstructionListApplicationTests>>test_01a"
#'stx:libbasic3' "MessageTracer - referenced by VDBAbstractApplicationTests>>setUp"
+ #'stx:libview2' "ValueHolder - referenced by VDBInstructionListApplicationTests>>test_01a"
)
!