windbg 命令输出到log文件

windbg的log功能,可以记录你在调试程序时输入的每一条命令以及其对应的输出。

 

用法如下:

第一步:开启日志记录

.logopen d:\dbglog.txt

第二步:用命令或通过菜单输入调试命令,观察输出结果

kb

第三步:关闭日志记录

.logclose

之后,就可以去查看log文件了,也可以用命令打开.logfile 。

======================================

  dd 0ca172e8 cache->blcok
  dt cache_block 08a16d40
  
  dt tr_cache 03996bd8
  
  dd /c 10 0ca172e8 L170
  
bp ztBtModule!tr_cacheWriteBlock
083137bb e88021feff      call    ztBtModule!tr_ptrArrayInsert
bp ztBtModule!tr_cacheWriteBlock+0xa3


.for(r $t0=0;@$t0<poi(@esi+4);r $t0=@$t0+1){.printf "tr_cacheWriteBlock:%d cache_block:%8X, tr_torrent:%8X, magicNumber:%8X\n", poi(@esi+4),poi(poi(@esi)+@$t0*4), poi(poi(poi(@esi)+@$t0*4)), poi(poi(poi(poi(@esi)+@$t0*4))+0x90)}
bp ztBtModule!tr_cacheWriteBlock+0xa3 ".if(poi(poi(poi(poi(@esi)))+90)=-1){}.else{.for(r $t0=0;@$t0<poi(@esi+4);r $t0=@$t0+1){.printf \"tr_cacheWriteBlock:%d cache_block:%8X, block:%d, tr_torrent:%8X, magicNumber:%8X\\n\", poi(@esi+4),poi(poi(@esi)+@$t0*4), poi(poi(poi(@esi)+@$t0*4)+0x18), poi(poi(poi(@esi)+@$t0*4)), poi(poi(poi(poi(@esi)+@$t0*4))+0x90);gc}}"


-----------------------------------------------------------------------------------------------
bp ztBtModule!tr_torrentRemove ".printf \"tr_torrentRemove torrent:%8X \\n\",@ebx;gc" 
-----------------------------------------------------------------------------------------------
bp ztBtModule!flushContiguous


  181 083133c1 e88a311800      call    ztBtModule!memmove (08496550) tr_prtArrayErase
  183 083133e4 e867e60000      call    ztBtModule!readOrWritePiece (08321a50)
  
ztBtModule!flushContiguous(struct tr_cache * cache = 0x03996ad0
dt tr_cache 03996ad0
dd 03996ad0
dt tr_ptrArray 03996ad0 
dd 0cb31158
dt cache_block 0b36b460 


bp `ztBtModule!flushContiguous` ".if (poi(MyVar)>5) {.echo MyVar Too Big} .else {.echo MyVar Acceptable; gc} " 
poi(03996ad0) //用cache找到blocks
poi(poi(03996ad0))//用cache_block找到tr_torrent
poi(poi(poi(03996ad0)))+90 //用tr_torrent找出magicNumber的指针地址,再取一次值


打印tr_ptrArray
poi(03996ad0+4) //通过cache找到n_items


poi(@edi+4)
poi(poi(poi(poi(@edi)))+90)  0001753d


bp ztBtModule!flushContiguous ".if(poi(poi(poi(poi(@edi)))+90)=95549){? poi(poi(poi(poi(@edi)))+90)} .else {? poi(@edi+4);? poi(poi(poi(poi(@edi)))+90);gc}"
r $.u0=poi(poi(poi(poi(@edi)))+90)
.if($u0=95549){.echo if}.else{.echo else}
.if($u0=-1){.echo if}.else{.echo else}


bp ztBtModule!flushContiguous "r $.u0=poi(poi(poi(poi(@edi)))+90);.if($u0=-1){}.else{? poi(@edi+4);? $u0;gc}"
bp ztBtModule!flushContiguous ".if(poi(poi(poi(poi(@edi)))+90)=-1){}.else{? poi(@edi+4);? poi(poi(poi(poi(@edi)))+90);gc}"


dt tr_cache @edi
dt tr_ptrArray @edi
dd poi(@edi) items
dd poi(@edi+4) n_items
dt cache_block poi(poi(@edi))
dt tr_torrent poi(poi(poi(@edi)))


poi(poi(@edi)+$u0*4) tr_torrent
poi(poi(poi(@edi)+$u0*4)+90)


.while(poi(poi(poi(poi(@edi)))+90)!=-1){printf()}
.for(r eax=0;@eax<poi(@edi+4);r eax=eax+1){? poi(poi(poi(@edi)+$u0*4)+90)};


.for(r eax=0;@eax<poi(@edi+4);r eax=eax+1){? poi(poi(@edi)+eax*4)}
.for(r $t0=0;@$t0<poi(@edi+4);r $t0=@$t0+1){.printf "cache_block:%8X, tr_torrent:%8X, magicNumber:%8X\n", poi(poi(@edi)+@$t0*4), poi(poi(poi(@edi)+@$t0*4)), poi(poi(poi(poi(@edi)+@$t0*4))+0x90)}
r $.u0=eax;.for(r eax=0;@eax<poi(@edi+4);r eax=eax+1){.printf "cache_block:%8X, tr_torrent:%8X, magicNumber:%8X\n", poi(poi(@edi)+eax*4), poi(poi(poi(@edi)+eax*4)), poi(poi(poi(poi(@edi)+eax*4))+0x90)};r eax=$u0


bp ztBtModule!flushContiguous+0x11a "r $.u0=eax;.for(r eax=0;@eax<poi(@edi+4);r eax=eax+1){.printf \"cache_block:%8X, tr_torrent:%8X, magicNumber:%8X\n\", poi(poi(@edi)+eax*4), poi(poi(poi(@edi)+eax*4)), poi(poi(poi(poi(@edi)+eax*4))+0x90)};r eax=$u0;.if(poi(poi(poi(poi(@edi)))+90)=-1){}.else{;gc}"


bp ztBtModule!flushContiguous+0x134 ".if(poi(poi(poi(poi(@edi)))+90)=-1){}.else{.for(r $t0=0;@$t0<poi(@edi+4);r $t0=@$t0+1){.printf \"flushContiguous:%d cache_block:%8X, tr_torrent:%8X, magicNumber:%8X\\n\", poi(@edi+4), poi(poi(@edi)+@$t0*4), poi(poi(poi(@edi)+@$t0*4)), poi(poi(poi(poi(@edi)+@$t0*4))+0x90);gc}}"
.for(r $t0=0;@$t0<poi(@edi+4);r $t0=@$t0+1){.printf "flushContiguous:%d cache_block:%8X, block:%d,tr_torrent:%8X, magicNumber:%8X\n", poi(@edi+4), poi(poi(@edi)+@$t0*4), poi(poi(poi(@edi)+@$t0*4)+0x18),poi(poi(poi(@edi)+@$t0*4)), poi(poi(poi(poi(@edi)+@$t0*4))+0x90)}


bp ztBtModule!flushContiguous+0x134 ".if(poi(poi(poi(poi(@edi)))+90)=-1){.if(poi(@edi+4)=0){.echo \"gc\";gc;}.else{.echo \"elsegc\"}}.else{.for(r $t0=0;@$t0<poi(@edi+4);r $t0=@$t0+1){.printf \"flushContiguous:%d.%d cache_block:%8X, block:%d,tr_torrent:%8X, magicNumber:%8X\\n\", poi(@edi+4), @$t0, poi(poi(@edi)+@$t0*4), poi(poi(poi(@edi)+@$t0*4)+0x18), poi(poi(poi(@edi)+@$t0*4)), poi(poi(poi(poi(@edi)+@$t0*4))+0x90);gc}}"


bp ztBtModule!flushContiguous ".printf \"flushContiguous torrent:%8X,pos:%d,n:%d \\n\",@ecx,@esi,@eax;kp;gc"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值