相信所有开发者都遇到过这种CPU错误吧,全是二进制的代码错误,连程序跟踪都不幸,这种问题解决,我觉得多半是经验能解决的,大家一起探讨一下这种错误的一些起因,共同交流,共同提高啊!

解决方案 »

  1.   

    遇到过
    郁闷
    没有好办法
    检查最可能的地方
    尽量
    try
    ......
    except
    end;
      

  2.   

    btw:
    个人觉得,这种应该不是CPU问题
    而是访问内存地址出错吧:)比如内存溢出...........
      

  3.   

    我遇到过一种情况就是在退出from或者mianfrom时没有释放,有可能会出现这种情况。
      

  4.   

    找到出错的大致范围F7、F8
    直到找到出错的准确范围,F5分析可能的原因,如果仍无解,Ctrl+Alt+C
      

  5.   

    对象已经被释放,这个时候调用对象的方法,就会出现av错误,这种情况居多。dll导出过程中使用了String(不只String,还有别的,参考Delphi Help)参数,没有引用sharemem也会出现av
      

  6.   

    procedure PatchINT3;
    var
      NOP : Byte;
      NTDLL: THandle;
      BytesWritten: DWORD;
      Address: Pointer;
    begin
      if Win32Platform <> VER_PLATFORM_WIN32_NT then Exit;
      NTDLL := GetModuleHandle('NTDLL.DLL');
      if NTDLL = 0 then Exit;
      Address := GetProcAddress(NTDLL, 'DbgBreakPoint');
      if Address = nil then Exit;
      try
        if Char(Address^) <> #$CC then Exit;    NOP := $90;
        if WriteProcessMemory(GetCurrentProcess, Address, @NOP, 1, BytesWritten) and
          (BytesWritten = 1) then
          FlushInstructionCache(GetCurrentProcess, Address, 1);
      except
       // Do not panic if you see an EAccessViolation here, it is perfectly harmless!
        on EAccessViolation do ;
        else raise;
      end;
    end;
    ---
    procedure TFormMain.FormCreate(Sender: TObject);
    begin
      PatchINT3;
    end;