LBR是P6(Pentium Pro)就开始支持的功能。你能描述一下具体的现象么,在什么环境下,怎么记录不到?关于BTS,可以通过IA32_MISC_ENABLE MSR寄存器(地址为416-十进制)来检查是否支持,如果位11为0则支持,为1则不支持。
以我现在用的笔记本为例,其CPU是P6系统的奔腾M,因此支持LBR。
lkd> !lbr.lbrAccess LBR (Last Branch Recording) registers of IA-32 CPU.Version 1.0.0.2 by RaymondMSR_DEBUGCTLB=1LBR bit is cleared now.MSR_LASTBRANCH_TOS=3MSR_LASTBRANCH_3: [804ff190] nt!WRMSR+0MSR_LASTBRANCH_3: [8065ef6e] nt!KdpSysWriteMsr+1cMSR_LASTBRANCH_2: [8065ef5e] nt!KdpSysWriteMsr+cMSR_LASTBRANCH_2: [805374da] nt!_SEH_prolog+3aMSR_LASTBRANCH_1: [805374a0] nt!_SEH_prolog+0MSR_LASTBRANCH_1: [8065ef59] nt!KdpSysWriteMsr+7MSR_LASTBRANCH_0: [8065ef52] nt!KdpSysWriteMsr+0MSR_LASTBRANCH_0: [8060d364] nt!NtSystemDebugControl+356MSR_LASTBRANCH_7: [8060d356] nt!NtSystemDebugControl+348MSR_LASTBRANCH_7: [8060d0c3] nt!NtSystemDebugControl+b5MSR_LASTBRANCH_6: [8060d0b6] nt!NtSystemDebugControl+a8MSR_LASTBRANCH_6: [8060d0a1] nt!NtSystemDebugControl+93MSR_LASTBRANCH_5: [8060d09c] nt!NtSystemDebugControl+8eMSR_LASTBRANCH_5: [8060d08d] nt!NtSystemDebugControl+7fMSR_LASTBRANCH_4: [8060d089] nt!NtSystemDebugControl+7bMSR_LASTBRANCH_4: [8060d082] nt!NtSystemDebugControl+74LBR bit is set now.
使用本地内核调试,然后执行 !cpuinfo命令就可以读到CPU的系列号:
lkd> !cpuinfoCP F/M/S Manufacturer MHz PRCB Signature MSR 8B Signature Features 0 6,13,8 GenuineIntel 1862 0000002000000000 0000002000000000 a0033fff
其中的的6是系列6,13是型号,8是Stepping(版本)
使用version命令可以显示操作系统和WinDBG的详细版本号
lkd> versionWindows XP Kernel Version 2600 (Service Pack 2) UP Free x86 compatibleProduct: WinNt, suite: TerminalServer SingleUserTSBuilt by: 2600.xpsp_sp2_qfe.070227-2300Kernel base = 0x804d7000 PsLoadedModuleList = 0x805535a0Debug session time: Thu Jul 24 22:22:47.229 2008 (GMT+8)System Uptime: 0 days 1:46:45.299Local KD
Microsoft (R) Windows Debugger Version 6.9.0003.113 X86Copyright (c) Microsoft Corporation. All rights reserved.
command line: '"C:\windbgbeta\windbg.exe" ' Debugger Process 0x1740 dbgeng: image 6.9.0003.113, built Fri Mar 21 04:29:34 2008 [path: C:\windbgbeta\dbgeng.dll]dbghelp: image 6.9.0003.113, built Fri Mar 21 04:28:43 2008 [path: C:\windbgbeta\dbghelp.dll] DIA version: 21024Extension DLL search Path:
跑这里来问了啊,
BTF开启之后TF被视为是 Single Step On Branches,不是分支指令就不会 int1。
To Raymond:
所谓突破限制是指,hook 所有处理器的 int1 isr ,可以在中断里重新设置TF,然后根据 fs 判断进程记录一次LBR。