[Mono-list] Method signature modification
shankari82 at yahoo.com
Sun Oct 16 23:27:21 EDT 2005
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.
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?
--- Jonathan Pryor <jonpryor at vt.edu> 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.
> Unmanaged code can be anything (including Perl
> code), and can be an
> unmanaged *function*. A function call would invoke
> the function.
> > To figure out where exactly the switch from
> managed to
> > unmanaged code is happening, I set a breakpoint in
> > C program and tried a backtrace from it. Here is
> > 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
> Consequently, you need the managed callstack, which
> you can get using
> mono_print_method_from_ip, which takes a stack
> pointer as an argument,
> (gdb) p mono_print_method_from_ip (0x0045b6ac)
> > I am not able to single step through the code from
> > 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
> > 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.
More information about the Mono-list