The sx family of commands accept either the name of the exception/event, like av, the exception code or *.
The thing is that * catches all the unnamed exceptions. What if I want to execute a command when any exception happens, be it explicitly named or not?
For instance,
sxe -c "bla-bla-bla" -c2 "ku-ku-ku" av
sxe -c "bla-bla-bla" -c2 "ku-ku-ku" dz
sxe -c "bla-bla-bla" -c2 "ku-ku-ku" *
Instructs the debugger to:
- execute bla-bla-bla command on the first chance Access Violation
- execute ku-ku-ku command on the second chance Access Violation
- execute bla-bla-bla command on the first chance Division by Zero
- execute ku-ku-ku command on the second chance Division by Zero
- execute bla-bla-bla command on any unnamed first chance exception
- execute ku-ku-ku command on any unnamed second chance exception
But, there are about two dozens of the named exception and if I want these commands to be executed on each one of them I seem to be expected to repeat the same sxe statement for each of these exceptions, changing just the exception name.
Is there a better way to do it?
Thanks.
EDIT1
Here is the actual CDB script, where I use the commands:
as AdpDumpDir C:\Logs\Crash
!adplusext.adpextstart AdpDumpDir
as /c AdpProcID !adplusext.adpprocid
as /c AdpHostComputer !adplusext.adphostcomputer
as /c AdpTargetComputer !adplusext.adptargetcomputer
as /c AdpProcName !adplusext.adpprocname
.logopen /t ${AdpDumpDir}\${AdpProcName}.log
version
al
.symfix+ C:\Users\markk\AppData\Local\Temp\SymbolCache
.sympath
.reload
as ExcCode av
as ExcName AccessViolation
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode asrt
as ExcName AssertionFailure
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode aph
as ExcName ApplicationHang
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode eh
as ExcName C++EH
sxe -c "gn" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode clr
as ExcName CLR
sxe -c "gn" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode clrn
as ExcName CLRNotification
sxe -c "gn" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode dm
as ExcName DataMisaligned
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode gp
as ExcName GuardPageViolation
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode ii
as ExcName IllegalInstruction
sxe -c "gn" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode ip
as ExcName InPageIOError
sxe -c "gn" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode dz
as ExcName DivideByZero
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode iov
as ExcName IntegerOverflow
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode ch
as ExcName InvalidHandle
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode lsq
as ExcName InvalidLockSequence
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode isc
as ExcName InvalidSystemCall
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode 3c
as ExcName PortDisconnected
sxe -c "gn" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode svh
as ExcName ServiceHang
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode sov
as ExcName StackOverflow
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode vs
as ExcName VerifierStop
sxe -c @".dump /u /ma /c FirstChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_FirstChance_${ExcCode}_${ExcName}_.dmp;GN" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
as ExcCode vcpp
as ExcName VisualC++
sxe -c "gn" -c2 @".dump /u /ma /c SecondChance_${ExcCode}_${ExcName} ${AdpDumpDir}\MINIDUMP_${AdpProcName}_SecondChance_${ExcCode}_${ExcName}_.dmp;GN" ${ExcCode}
sxi bpe
sxi wob
sxi e06d7363
sxi e0434352
sxe -c "gn" -c2 @".dump /u /ma /c SecondChance ${AdpDumpDir}\MINIDUMP_SecondChance_${AdpProcName}_.dmp;GN" *
sx
g
.logclose
q
I am looking for ways to make it shorter and simpler, if possible.