Changeset 836 for trunk/debugtools


Ignore:
Timestamp:
Sep 15, 2007, 3:07:14 AM (18 years ago)
Author:
Steven Levine
Message:

Add options, sync with pdumpctl
Sync with current standards
fm2dump2.cmd obsoleted

Location:
trunk/debugtools
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debugtools/fm2dump.cmd

    r577 r836  
    11@echo off
    2 :: fm2dump - Prepare for fm/2 process dump
    32:: $Id$
    43
    5 :: Search for "EDITME" markers to find lines that may need edits
     4:: Prepare for fm/2 process dump
    65:: Run script as fm2dump ? for usage help
     6:: Cmd.exe compatible
     7:: Search for "Edit this" markers to find lines that may need site specific edits
    78
    8 :: Copyright (c) 2002, 2005 Steven Levine and Associates, Inc.
     9:: Copyright (c) 2002, 2007 Steven Levine and Associates, Inc.
    910:: All rights reserved.
    1011
     
    1920:: 11 Aug 05 SHL Comments
    2021:: 24 Mar 07 SHL Write dump file to %TMP%
     22:: 14 Jul 07 SHL Add options, sync with pdumpctl
     23:: 14 Sep 07 SHL Sync with current standards
     24
     25:: Version 0.3
    2126
    2227setlocal
    2328
    24 :: EDITME to name dump directory - directory must exist and drive must have sufficient free space
     29:: Edit this to point to existing directory on drive with sufficient free space
    2530set D=%TMP%
    2631
    27 :: Try to validate
     32:: Try to validate dump directory
    2833dir %D%\nul >nul 2>&1
    2934if not errorlevel 1 goto DirOK
    30   echo Directory %D% does not exist - check set D= statement
     35  echo Directory %D% does not exist - check set D= statement on line 26
    3136  goto end
    32 :DirOK
     37:dirok
    3338
    34 :: EDITME to name process to be dumped - .exe is optional
     39:: Edit this to name process to be dumped - .exe is optional
    3540set P=fm3
    3641
    37 :: Warn if not visible just by name - OK if in PATH
    38 if exist %P%.exe goto ExeOK
    39 if exist %P% goto ExeOK
    40   echo Warning: %P% not found
    41 :ExeOK
     42if "%1" == "" goto Help
    4243
    43 if not "%2" == "" goto Help
     44:next
     45
     46if "%1" == "a" goto All
     47if "%1" == "A" goto All
     48if "%1" == "c" goto Configure
     49if "%1" == "C" goto Configure
     50if "%1" == "f" goto Force
     51if "%1" == "F" goto Force
     52if "%1" == "n" goto TurnOn
     53if "%1" == "N" goto TurnOn
     54if "%1" == "q" goto Query
     55if "%1" == "Q" goto Query
    4456if "%1" == "o" goto TurnOff
    4557if "%1" == "O" goto TurnOff
    4658if "%1" == "r" goto Reset
    4759if "%1" == "R" goto Reset
    48 if "%1" == "" goto Configure
    49 goto Help
     60
     61if "%1" == "?" goto Help
     62
     63goto Usage
     64
     65:: Configure to dump all memory
     66
     67:All
     68  echo on
     69  pdumpusr reset
     70  @if errorlevel 1 pause
     71  pdumpusr paddr(all)
     72  @if errorlevel 1 pause
     73  :: Check
     74  procdump query
     75  @if errorlevel 1 pause
     76  @echo off
     77  echo Dump facility configured to dump all memory
     78  goto shift
     79
     80:: Configure optimal dump settings for mr/2 ice
     81
     82:Configure
     83  :: Turn on dump facility - set dump directory
     84  procdump on /l:%D%
     85  @if errorlevel 1 pause
     86  :: Configure settings
     87  procdump set /proc:%P% /pd:instance,private,shared,sysfs,sysio,sysldr,syssem,syssumm,systk,sysvm /pc:0
     88  @if errorlevel 1 pause
     89  @echo off
     90  echo.
     91  echo Dump facility configured to dump %P% to %D%
     92  goto shift
     93
     94:: Force dump with current settings
     95
     96:Force
     97  echo on
     98  procdump force /proc:%P%
     99  @echo off
     100  echo Forced dump for process %P%
     101  goto shift
     102
     103:: Query current settings
     104
     105:Query
     106  echo.
     107  echo on
     108  procdump query
     109  @if errorlevel 1 pause
     110  @echo off
     111  goto shift
    50112
    51113:: Reset to defaults
    52114
    53115:Reset
    54 echo on
    55 :: Reset directory and freespace limits to defaults
    56 procdump reset /f /l
    57 @if errorlevel 1 pause
    58 procdump reset /pid:all
    59 @if errorlevel 1 pause
     116  echo on
     117  procdump reset /f /l
     118  @if errorlevel 1 pause
     119  @echo off
     120  echo.
     121  echo Dump facility reset to default settings
     122  goto shift
    60123
    61 :: Configure fm/2 specific dump settings
    62 
    63 :Configure
     124:TurnOff
     125  echo on
     126  procdump reset /l
     127  @if errorlevel 1 pause
     128  procdump reset /pid:all
     129  @if errorlevel 1 pause
     130  procdump off
     131  @if errorlevel 1 pause
     132  @echo off
     133  echo.
     134  echo Dump facility turned off
     135  goto shift
    64136
    65137:: Turn on dump facility - set dump directory
    66 procdump on /l:%D%
    67 @if errorlevel 1 pause
    68 :: Configure fm/2 dump
    69 procdump set /proc:%P% /pd:instance,private,shared,sysfs,sysio,sysldr,syssem,syssumm,systk,sysvm /pc:0
    70 @if errorlevel 1 pause
    71 :: Check
    72 procdump query
    73 @if errorlevel 1 pause
    74 @echo off
    75 echo Dump facility configured to dump %P% to %D%
    76138
    77 goto end
     139:TurnOn
     140  echo on
     141  procdump on /l:%D%
     142  @if errorlevel 1 pause
     143  @echo off
     144  echo.
     145  echo Dump facility turned on
     146  goto shift
    78147
    79 :TurnOff
     148:shift
    80149
    81 echo on
    82 :: Reset to defaults
    83 procdump reset /f /l
    84 @if errorlevel 1 pause
    85 procdump reset /pid:all
    86 @if errorlevel 1 pause
    87 :: Turn off
    88 procdump off
    89 @if errorlevel 1 pause
    90 procdump query
    91 @if errorlevel 1 pause
    92 @echo off
    93 echo Dump facility turned off
    94 goto end
     150  shift
     151  if not "%1" == "" goto next
     152  goto end
     153
     154::=== Usese: Report usage error ===
     155
     156:Usage
     157  echo.
     158  echo Usage: fm2dump [a] [c] [f] [n] [o] [p] [q] [r]
     159  echo Use ? to get detailed help
     160  goto end
    95161
    96162::=== Help: Show usage help ===
     
    98164:Help
    99165  echo.
    100   echo Usage: fm2dump [o] [r]
     166  echo Simple Dump Facility controller for mr/2 ice
    101167  echo.
     168  echo Usage: fm2dump [a] [c] [f] [n] [o] [p] [q] [r]
     169  echo.
     170  echo   a     Configure to dump all memory
     171  echo   c     Configure optimally for mr/2 dump
     172  echo   f     Force dump using current settings
     173  echo   n     Turn on dump facility
    102174  echo   o     Turn off dump facility
    103   echo   r     Reset to defaults then configure
    104   echo   ?     This message`
     175  echo   q     Query current settings
     176  echo   r     Reset to default settings
     177  echo   q     Query current settings
     178  echo   ?     Display this message
    105179  echo.
    106   echo   Only one arg alllowed
    107   echo   Default is retain current settings and configure fm/2 specfic settings
     180  echo   Requests are processed left to right
     181  echo   Errors will pause script
     182  echo   Edit line 26 to match your system
     183  echo   Do not forget to turn off dump facility when done
     184  echo.  Typical use cases
     185  echo     fm2dump c
     186  echo     fm2dump c f o
     187  echo     fm2dump r o
    108188
    109189:end
Note: See TracChangeset for help on using the changeset viewer.