 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andrew Guest
|
Posted: Tue Jan 20, 2004 10:28 am Post subject: ntdll.DbgUserBreakPoint problem |
|
|
Hi,
Using BCB6 enterprise update 4 and Win2K SP4.
I have a problem with an app I have made, it is the server of the
client/server system I created, when I run either the client within the IDE
and the server outside the IDE, or both apps outside the IDE I get an error
"Exception occured", this exception is occuring within the server app.
So I run the server app from the IDE and I never get any exceptions, all
runs perfectly fine apart from one thing, when I perform a certain action
(canceling an alarm) the IDE halts as though a breakpoint had been
encountered and I need to press F9 to resume, the CPU window is shown and
the following can be seen:
.....
.....
77FA144C C3 ret
ntdll.DbgUserBreakPoint:
77FA144D CC int 3
.....
.....
This does not reference any specific line of code I have written so I can go
to it, and stepping thruogh seems to take me nowhere in my code.
It would appear there is somehow a breakpoint within my code, I can look in
the breakpoint list within Builder and no breakpoints are shown. I tried
deleteing all the object files and the .TDS files and performing a complete
build of every app and DLL within the project group but still the above
breakpoint remains. Since I cannot get the server to fail during debuging I
can only assume that this is causing a problem somehow ????
Has anyone seen this before, if so how do I get rid of it and why does it
happen?
TIA
Andrew
|
|
| Back to top |
|
 |
Maurice Barnum Guest
|
Posted: Fri Jan 30, 2004 5:11 am Post subject: Re: ntdll.DbgUserBreakPoint problem |
|
|
| Quote: | Hi,
Using BCB6 enterprise update 4 and Win2K SP4.
I have a problem with an app I have made, it is the server of the
client/server system I created, when I run either the client within the IDE
and the server outside the IDE, or both apps outside the IDE I get an error
"Exception occured", this exception is occuring within the server app.
|
what exception? 0x80000003 probably. maybe "Breakpoint exception"?
| Quote: |
So I run the server app from the IDE and I never get any exceptions, all
runs perfectly fine apart from one thing, when I perform a certain action
(canceling an alarm) the IDE halts as though a breakpoint had been
encountered and I need to press F9 to resume, the CPU window is shown and
the following can be seen:
....
....
77FA144C C3 ret
ntdll.DbgUserBreakPoint:
77FA144D CC int 3
|
this is a hardcoded breakpoint, and the default handling in Win32 (and
VCL) isn't too friendly. when the debugger sees this, it acts as if
you meant to stop there and then marks the exception "handled" when
you resume. [that's actually a bug in the debugger: it should be
configurable in the OS exceptions dialog what it does]
look at the stack trace and see how you got there, that might provide
some clues.
|
|
| Back to top |
|
 |
OBones Guest
|
Posted: Fri Jan 30, 2004 5:18 am Post subject: Re: ntdll.DbgUserBreakPoint problem |
|
|
Maurice Barnum wrote:
| Quote: |
look at the stack trace and see how you got there, that might provide
some clues.
|
Usually, it's a problem with a driver and/or windows file that got
shipped as a debug version, thus containing the breakpoint.
If that's the case, there is nothing you can do about that. I had the
problem when I tried using some low level IP configuration APIs
|
|
| Back to top |
|
 |
Andrew Guest
|
Posted: Fri Jan 30, 2004 9:03 am Post subject: Re: ntdll.DbgUserBreakPoint problem |
|
|
Hi,
Thanks for your replies, I have been searching the internet for this type of
problem and I found the following piece of code. It was originally in Delphi
so I ported it accross to Builder, I found it on www.howtodothings.com . It
seems that these breakpoints were left in the the microsoft DLL ntdll.dll by
accident, this function dynamically overwrites the int 3 instruction with a
NOP instruction, I have now found my problem and am very happily continueing
with my work. I hope this helps other people who have the same problem I
did....
void __fastcall TMainForm::PatchInt3(void)
{
unsigned char NOP;
DWORD BytesWritten;
HMODULE NtDll;
FARPROC P;
unsigned char szBuf[10];
if (Win32Platform != VER_PLATFORM_WIN32_NT)
return;
NtDll = GetModuleHandle("NTDLL.DLL");
if (NtDll == NULL)
return;
P = GetProcAddress(NtDll, "DbgBreakPoint");
if (P == NULL)) then
return;
try
{
if(ReadProcessMemory(GetCurrentProcess(),P,&szBuf[0],1,NULL))
{
if(szBuf[0] != 0xcc)
return;
NOP = 90;
if(WriteProcessMemory(GetCurrentProcess(),P,&NOP,1,&BytesWritten))
{
if (BytesWritten == 1)
FlushInstructionCache(GetCurrentProcess(),P,1);
}
}
}
catch(...)
{
// an exception may be raised here but don't worry about it
}
}
Thanks
Andrew
|
|
| Back to top |
|
 |
Maurice Barnum Guest
|
Posted: Sat Jan 31, 2004 4:43 am Post subject: Re: ntdll.DbgUserBreakPoint problem |
|
|
| Quote: | }
catch(...)
{
// an exception may be raised here but don't worry about it
}
|
you want __try / __except(1) for this type of thing: catch(...) only
catches OS exceptions when using the VCL flavor library.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|