Print this page
11581 'debug' loader option is a little obscure
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Rob Johnston <rob.johnston@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/boot/sys/boot/forth/menu-commands.4th.man.txt
          +++ new/usr/src/boot/sys/boot/forth/menu-commands.4th.man.txt
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14  INCLUDING, BUT NOT LIMITED TO, THE  IMPLIED WARRANTIES OF MERCHANTABILITY AND
  15   15  FITNESS FOR A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL THE
  16   16  AUTHOR OR CONTRIBUTORS BE LIABLE  FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17   17  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18   18  PROCUREMENT OF SUBSTITUTE GOODS  OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19   19  OR BUSINESS INTERRUPTION)  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20   20  WHETHER IN CONTRACT, STRICT  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21   21  OTHERWISE) ARISING IN ANY WAY  OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22   22  ADVISED OF THE POSSIBILITY OF  SUCH DAMAGE.   Copyright 2015 Toomas Soome
  23   23  <tsoome@me.com>  Copyright 2019 OmniOS Community Edition (OmniOSce)
  24      -Association.
       24 +Association.   Copyright 2019 Joyent, Inc.
  25   25  
  26   26  marker task-menu-commands.4th
  27   27  
  28   28  include /boot/forth/menusets.4th
  29   29  
  30   30  only forth definitions
  31   31  
  32   32  variable osconsole_state variable acpi_state variable kernel_state variable
  33      -root_state variable kmdb_state variable debug_state 0 kmdb_state !  0
  34      -debug_state !  0 osconsole_state !  0 acpi_state !  0 kernel_state !  0
  35      -root_state !
       33 +root_state variable kmdb_state variable drop_into_kmdb_state 0 kmdb_state !  0
       34 +drop_into_kmdb_state !  0 osconsole_state !  0 acpi_state !  0 kernel_state !
       35 +0 root_state !
  36   36  
  37   37  also menu-namespace also menu-command-helpers
  38   38  
  39   39   Boot
  40   40  
  41   41  : init_boot ( N -- N )   dup  s" smartos" getenv? if        s" set
  42   42  menu_keycode[N]=98"  base command to execute      else           s"
  43   43  boot_single" getenv -1 <> if            drop ( n n c-addr -- n n )  unused
  44   44                 toggle_menuitem ( n n -- n n )               s" set
  45   45  menu_keycode[N]=115"  base command to execute          else                s"
↓ open down ↓ 61 lines elided ↑ open up ↑
 107  107  
 108  108       TRUE  loop menu again ;
 109  109  
 110  110   kmdb
 111  111  
 112  112  : kmdb_enabled? ( -- flag )   s" boot_kmdb" getenv -1 <> dup if       swap
 113  113  drop ( c-addr flag -- flag )  then ;
 114  114  
 115  115  : kmdb_enable ( -- )     s" set boot_kmdb=YES" evaluate ;
 116  116  
 117      -: kmdb_disable ( -- )    s" boot_kmdb" unsetenv   s" boot_debug" unsetenv ;
      117 +: kmdb_disable ( -- )    s" boot_kmdb" unsetenv   s" boot_drop_into_kmdb"
      118 +unsetenv ;
 118  119  
 119  120  : init_kmdb ( N -- N )   dup kmdb_state !          store entry number for
 120      -kmdb+debug     kmdb_enabled? if         toggle_menuitem ( n -- n )    then ;
      121 +kmdb+drop_into_kmdb      kmdb_enabled? if         toggle_menuitem ( n -- n )
      122 +     then ;
 121  123  
 122  124  : toggle_kmdb ( N -- N TRUE )      toggle_menuitem     dup toggle_stateN @ 0=
 123      -if ( kmdb is not set )        debug_state @ if ( debug is set? )
 124      -               debug_state @ toggle_stateN @ if ( debug is enabled? )
 125      -                    debug_state @ toggle_menuitem drop                then
 126      -          then      then      menu-redraw
      125 +if ( kmdb is not set )        drop_into_kmdb_state @ if ( drop_into_kmdb is
      126 +set? )              drop_into_kmdb_state @ toggle_stateN @ if ( drop_into_kmdb
      127 +is enabled? )                 drop_into_kmdb_state @ toggle_menuitem drop
      128 +               then           then      then      menu-redraw
 127  129  
 128  130        Now we're going to make the change effective
 129  131  
 130  132       dup toggle_stateN @ 0= if          kmdb_disable   else
 131  133            kmdb_enable    then
 132  134  
 133  135       TRUE  loop menu again ;
 134  136  
 135      - kmdb + debug
      137 + drop into kmdb
 136  138  
 137      -: debug_disable ( -- )   s" boot_debug" unsetenv ;
      139 +: drop_into_kmdb_disable ( -- )    s" boot_drop_into_kmdb" unsetenv ;
 138  140  
 139      -: debug_enabled? ( -- flag )  \[u00A0]-d is only allowed with -k      s"
 140      -boot_debug" getenv -1 <> kmdb_enabled? and dup if           swap drop ( c-addr
 141      -flag -- flag )      else           debug_disable        make sure env is not
 142      -set  then ;
      141 +: drop_into_kmdb_enabled? ( -- flag )    -d is only allowed with -k   s"
      142 +boot_drop_into_kmdb" getenv -1 <> kmdb_enabled? and dup if       swap drop (
      143 +c-addr flag -- flag )    else           drop_into_kmdb_disable         make
      144 +sure env is not set      then ;
 143  145  
 144      -: debug_enable ( -- )    kmdb_enable    s" set boot_debug=YES" evaluate ;
      146 +: drop_into_kmdb_enable ( -- )     kmdb_enable    s" set
      147 +boot_drop_into_kmdb=YES" evaluate ;
 145  148  
 146      -: init_debug ( N -- N )  dup debug_state !         store entry number for kmdb
 147      -     kmdb_enabled? debug_enabled? and if          toggle_menuitem ( n -- n )
 148      -     then ;
      149 +: init_drop_into_kmdb ( N -- N )   dup drop_into_kmdb_state !          store
      150 +entry number for kmdb    kmdb_enabled? drop_into_kmdb_enabled? and if
      151 +          toggle_menuitem ( n -- n )    then ;
 149  152  
 150      -: toggle_debug ( N -- N TRUE )     toggle_menuitem     kmdb_enabled? 0= if
 151      -          kmdb_state @ toggle_menuitem drop  then      menu-redraw
      153 +: toggle_drop_into_kmdb ( N -- N TRUE )      toggle_menuitem     kmdb_enabled?
      154 +0= if          kmdb_state @ toggle_menuitem drop  then      menu-redraw
 152  155  
 153  156        Now we're going to make the change effective
 154  157  
 155      -     dup toggle_stateN @ 0= if          debug_disable  else
 156      -          debug_enable   then
      158 +     dup toggle_stateN @ 0= if          drop_into_kmdb_disable   else
      159 +          drop_into_kmdb_enable    then
 157  160  
 158  161       TRUE  loop menu again ;
 159  162  
 160  163   Reconfiguration boot
 161  164  
 162  165  : reconfigure_enabled? ( -- flag )      s" boot_reconfigure" getenv -1 <> dup
 163  166  if        swap drop ( c-addr flag -- flag )  then ;
 164  167  
 165  168  : reconfigure_enable ( -- )   s" set boot_reconfigure=YES" evaluate ;
 166  169  
↓ open down ↓ 112 lines elided ↑ open up ↑
 279  282  
 280  283   Menusets
 281  284  
 282  285  : goto_menu ( N M -- N TRUE )      menu-unset     menuset-loadsetnum ( n m --
 283  286  n )  menu-redraw    TRUE  Loop menu again ;
 284  287  
 285  288   Defaults
 286  289  
 287  290  : unset_boot_options     0 acpi_state !      s" acpi-user-options" unsetenv
 288  291       s" boot-args" unsetenv   s" boot_ask" unsetenv    singleuser_disable
 289      -     verbose_disable     kmdb_disable        \[u00A0]disables debug as well
 290      -     reconfigure_disable ;
      292 +     verbose_disable     kmdb_disable        \[u00A0]disables drop_into_kmdb
      293 +as well   reconfigure_disable ;
 291  294  
 292  295  : set_default_boot_options ( N -- N TRUE )   unset_boot_options  2 goto_menu ;
 293  296  
 294  297   Set boot environment defaults
 295  298  
 296  299  
 297  300  : init_bootenv ( -- )    s" set
 298  301  menu_caption[1]=${bemenu_current}${zfs_be_active}" evaluate      s" set
 299  302  ansi_caption[1]=${beansi_current}${zfs_be_active}" evaluate      s" set
 300  303  menu_caption[2]=${bemenu_bootfs}${currdev}" evaluate   s" set
↓ open down ↓ 54 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX