I am trying to invoke unmanaged call with a flag as the first parameter of the call. (Since C doesnt do parameter matching, I can get away with this). So, i call f( flag, param1)
The corresponding call that is invoked in the shared library is f(param1). So, the first parameter is like a flag to mono, I dont want to push it on stack/marshal it. mono_marshal_get_native_wrapper() calls mono_marshal_emit_native_wrapper() which sets up the stack and handles the marshalling. The method signature "sig" that gets passed to mono_marshal_emit_native_wrapper( marshal.c) should be changed to emit the correct wrapper. Modifying mono code at emit_wrapper seems dangerous. Any ideas/directions on how to achive this? Thanks, --- Jonathan Pryor <[EMAIL PROTECTED]> wrote: > On Fri, 2005-10-14 at 20:50 -0700, Shankari wrote: > > I have some questions in unmanaged call internals. > > From what I understood, an unmanaged code is a > > function call. > > <pedantic> > Unmanaged code can be anything (including Perl > code), and can be an > unmanaged *function*. A function call would invoke > the function. > </pedantic> > > > To figure out where exactly the switch from > managed to > > unmanaged code is happening, I set a breakpoint in > my > > C program and tried a backtrace from it. Here is > the > > info I got. > > > > (gdb) backtrace > > #0 printmsg () at cprog.c:13 > > #1 0x0045b6ac in ?? () > > #2 0x00000001 in ?? () > > #3 0x00e65710 in ?? () > > #4 0x00450ad7 in ?? () > > #5 0x093458e0 in ?? () > > #6 0x093458c8 in ?? () > > #7 0x09389398 in ?? () > > #8 0x0002be60 in ?? () > > #9 0x00000000 in ?? () > > (gdb) n > > 0x0045b6ac in ?? () > > (gdb) > > Translation of all that: Mono created a new thread > which contains JITed > code, so no debug symbols exist (that GDB knows > about). > > Consequently, you need the managed callstack, which > you can get using > mono_print_method_from_ip, which takes a stack > pointer as an argument, > e.g.: > > (gdb) p mono_print_method_from_ip (0x0045b6ac) > > > I am not able to single step through the code from > the > > point where unmanaged code is ending. > > That's because no source code exists for those > functions, at least as > far as GDB is concerned. > > > Since the backtrace addr are not resolved, it > looks > > like an unmanaged call is spawned in a new thread. > > Correct. Mono creates several threads during > startup for myriad reasons > (such as for the garbage collector, finalizer > thread, etc.). > > - Jon > > > __________________________________ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ _______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list