View Full Version : help making ntice break on exception.
tinman
February 9th, 2003, 22:32
I am trying to get softice to break on exceptions. I have Windows 2000 Pro. I am writing programs that cause an exception. However, when run, my debugger does not break in. How can I make this happen? For example, the following code does not break when run (unless I load it in a debugger, and step thru it):
int func(void);
void main(void) {
func();
return;
}
int func(void) {
char buffer[8];
int i;
for(i=0;i<2048;i++)
buffer[I]='A';
return 0;
}
Thanks in advance!
Aimless
February 10th, 2003, 00:07
In NT and kin, the exception handler (default, if not explicitly designed) is kicked off before the debugger breaks. That could be one reason why the debugger is not breaking on.
Try compiling the executable to a minimal so that it does not insert the exception handler. Alternatively, break on the NT exception handler rather than SET FAULTS ON.
Have Phun
tinman
February 10th, 2003, 00:22
Thank you Aimless,
do you know how to turn off the NT exception handler? Or at least what to google for? I have searched for everything I can think of, but I can't find anything useful. I don't want just this program to break on exception, but all programs, the program posted was just for illustration. Do you know how to configure the NT exception handler to be the debugger of my choice?
Thanks in advance.
Aimless
February 10th, 2003, 00:53
There are 2 paths to take:
1. Use a SYSTEM debugger, like SoftICE (or)
2. Use a Windows based debugger like (the powerful microsoft debugger - www.microsoft.com\ddk\debugging or OllyDbg)
For the first case:
============
1. Find a utility that dumps the exports from a particular .exe or .dll (like dumpbin, tdump, etc.)
2. Run the utility on kernel32.dll to get a list of functions that the dll exports
3. Search for ALL "exception" keywords
4. Breakpoint on all of them (not that you need all, just unhandledexceptionhandler is enough, but just in case if you want to be exhaustive)
5. The breakpoint will break when ANY program incurs the fault because ONLY and ONLY address below 80000000h (2 GB) is address-context sensitive.
6. Continue as you would
For the Second Case:
================
1. Install your debugger and check that it works, just in case.
2. When you are satisfied that the debugger indeed works, open the registry key using regedit.exe:
\\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug for the entries named Debugger
The value for the Debugger entry specifies the command for the debugger that will be used to analyze program errors (simply put, it will execute your debugger in the context of the failure).
Note: its pretty useless to combine and use BOTH first and second cases.
Stick with only one case.
Have Phun
tinman
February 10th, 2003, 12:30
That is exactly what I needed to know, thanks for you patience, hopefully soon I can start contributing to this board!
Powered by vBulletin® Version 4.2.2 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.