Locate the app crash point in WinCE
Sometimes our app crashed in WinCE due to an unknown reason, how could we know where is the crash point? Below way is not very detailed, but can provide an overview of howto.
First, use AddVectoredExceptionHandler API to register a callback function for an exception. We'll have exception address and exception code when the callback is called. The exception address in here is from global view. In other words, to locate the actual offset to the DLL, we need to subtract it from DLL's load address.
Once we have exception address and code, we have two ways to find the crash point.
1. map+cod
One way is to generate map and cod file in Visual Studio for us to debug. Below is the position in Visual Studio to enable above two.
In map file, it lists all function addresses relative to DLL's load address. In cod file, it lists all source addresses relative to function's address listed in map file.
To get a DLL's load address, we can use the following APIs:
GetModuleHandle
GetModuleInformation
So we need to subtract the exception address from DLL's load address and seek it in map file to find the crash function. Then we look into the cod file to find the actual crash point.
Ref: http://blog.csdn.net/guijun123/article/details/7640917
2. pdb+CrashFinder
By this way we need to generate the pdb file.
In pdb file it provides lots of information about the DLL. We need to have an utility named CrashFinder to help us to locate the crash point.
Please find below reference links for more information about how to use CrashFinder with pdb file to locate the crash point.
Ref:
http://blog.csdn.net/paul73022/article/details/6061370
http://www.microsoft.com/msj/0498/bugslayer0498.aspx
http://www.cppblog.com/woaidongmao/archive/2008/11/19/67288.html
First, use AddVectoredExceptionHandler API to register a callback function for an exception. We'll have exception address and exception code when the callback is called. The exception address in here is from global view. In other words, to locate the actual offset to the DLL, we need to subtract it from DLL's load address.
Once we have exception address and code, we have two ways to find the crash point.
1. map+cod
One way is to generate map and cod file in Visual Studio for us to debug. Below is the position in Visual Studio to enable above two.
Generate cod file |
Generate map file |
To get a DLL's load address, we can use the following APIs:
GetModuleHandle
GetModuleInformation
So we need to subtract the exception address from DLL's load address and seek it in map file to find the crash function. Then we look into the cod file to find the actual crash point.
Ref: http://blog.csdn.net/guijun123/article/details/7640917
2. pdb+CrashFinder
By this way we need to generate the pdb file.
Generate pdb file |
Please find below reference links for more information about how to use CrashFinder with pdb file to locate the crash point.
Ref:
http://blog.csdn.net/paul73022/article/details/6061370
http://www.microsoft.com/msj/0498/bugslayer0498.aspx
http://www.cppblog.com/woaidongmao/archive/2008/11/19/67288.html
留言
張貼留言