Маленькие хитрости «посмертной» отладки.

??? ?? ???????, ??? ? ?????? ?????????? ????????? ????????? ????????? ??? ????? cdb.exe:

aedebug_cdb

CDB – ??? ?????????? ?????? WinDbg, ??????? ? ???? ??????????? ? ???????? «???????????» ????????? (postmortem debugger).?????? ??? ???? ??????? ?????????? ?? ???????? ???????????? - ??????????? ??????? ????????? ?? ???? ?????. ?????? ?? ????????. ? ?????? ?? ??????, ?? ???? ?????????, ????????? ?????????? ????????? ? ????????????????? ???????? ? ????????? ??????, ?????????????? ? ??????? ??????????? ? ?????? ??????.

??? ????????? ?? ?????????? ??????? ? ????? ??????? ?????? ? ????, ??? ??? ??????????? ? ???????? «???????????» ????????? CDB ?????????? ????????? ??????:

aedebug_debugger

???????? ???????????? ?????? “%ld” ?????????? ?? PID ???????? ?????????????? ????????. ??? ?????? ???????????? ??????? ???-?? ?? ????? ???????:

-e Event
Signals the debugger that the specified event has occurred. This option is only used when starting the debugger programmatically.

?? ? ????? ??????, ??? ?? ????? ?????.

????? ??? ????????????? WinDbg ???????????? ????????? ???????. ????????? WinDbg/CDB ? ?????? ??????? ????? ? ??????? ????????? “–server”, ????????:

 cdb.exe –server npipe:pipe=debug notepad.exe

??? ??????? ????????? notepad.exe ? ????????? ? ????????? ?????????????? ? ?????? ????????, ????? ??????????? ????? «debug». ????????? ???????? ??????????? ? ???, ????? ?????? cdb.exe ??????? ??????, ??????? ?????????? ?????? ??? ??????? ????????? ?????? ? ?????????? ?????? ?????:

 @cdb.exe -server npipe:pipe=aedebug-%1 -p %1 -e %2 –g

?????? ?????????? ???????? ???????? Debugger ?? «c:\dbg\amd64\aedebug.cmd" %ld %ld» ? ??????:

aedebug_cmd

?????? ??? ????? ????? ????????? ????????? ??????? cdb.exe:

aedebug_server

?????? ????? ???????????? ? ????????? ?? ??? ??????????????????? ??????? ??????:

 windbg.exe –remote npipe:pipe=aedebug-2296,server=localhost

Cross-posted from blog.not-a-kernel-guy.com.