Re: Problems running self-building code with Unicode
From: Ivan Brugiolo [MSFT] (ivanbrug_at_online.microsoft.com)
Date: 06/09/04
- Next message: qfel: "Re: Emulating runas"
- Previous message: Ivan Brugiolo [MSFT]: "Re: CriticalSection Deadlock with OwningThread of zero"
- In reply to: Toby Sharp: "Problems running self-building code with Unicode"
- Next in thread: Toby Sharp: "Re: Problems running self-building code with Unicode"
- Reply: Toby Sharp: "Re: Problems running self-building code with Unicode"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 9 Jun 2004 09:30:53 -0700
When the application has the dialog-box of the C-Runtime abort function out,
you can attach a non invasive debugger (cdb/ntsd/windbg -pv -p PID),
and then inspect all the threads (execute the `~*kb` command).
You will find a thread with a stack that has on top the messagebox code from
your C-Runtime,
and, in the middle, the abort()/terminate() functions from C-Runtime, and
at, the bottom,
something that looks like an exception filter.
Switch to that thread (`~XXXs`, where XXX is the debugger thread ordinal).
Execute the following command
0:001>s -d poi(@$teb+8) poi(@$teb+4) 1003f
at this point you will have a list of stack based CONTEXT records.
Pick-up the one at the bottom of the displayed list.
Issue the command
0:001>.cxr <address from the previous step>
and then issues the `kb` command.
You should be able to see what's the cause of your problem over there.
-- This posting is provided "AS IS" with no warranties, and confers no rights. Use of any included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm "Toby Sharp" <toby_sharp at hotmail dot com> wrote in message news:u$UKbriTEHA.1984@TK2MSFTNGP12.phx.gbl... > I have an app developed with C++ and inline assembly, compiled with MSDEV > .NET. > > In the program, I generate code in memory at run-time which is then > executed. The memory where the code is built is allocated with VirtualAlloc > with PAGE_EXECUTE_READWRITE access. After building the code I call > FlushInstructionCache(::GetCurrentProcess(), NULL, 0); > > The program runs very well in all but one circumstance. It works in Debug > mode, in Release mode, in Unicode Debug mode. It works in Unicode Release > mode if run from within the debugger (F5). But if run outside the debugger > in Unicode Release mode, it crashes with: > > "Runtime Error! > Program: <appname>.exe > This application has requested the Runtime to terminate in an unusual way. > Please contact the application's support team for more information." > > Then: > > "The instruction at 0x7c2b88b5 referenced memory at 0x0000001c. The memory > could not be read. Click on OK to terminate the program." > > Then: > > "Runtime Error! > Program: <appname>.exe > R6025 - pure virtual function call" > > I use the same code in a test app and it works fine. The only substantial > difference that I can think of is that in the real app (where it crashes), > this code is executed in a separate thread. > > Does the FlushInstructionCache call work OK with threads? > > Any ideas on this would be really welcome. > > Thanks, > Toby. > >
- Next message: qfel: "Re: Emulating runas"
- Previous message: Ivan Brugiolo [MSFT]: "Re: CriticalSection Deadlock with OwningThread of zero"
- In reply to: Toby Sharp: "Problems running self-building code with Unicode"
- Next in thread: Toby Sharp: "Re: Problems running self-building code with Unicode"
- Reply: Toby Sharp: "Re: Problems running self-building code with Unicode"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|