VDBStartup.st
changeset 116 d0d6da74ead3
parent 107 d98c11f9a7f5
child 119 be31a77e2d9c
--- 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'!