Пример #1
0
        private bool TryCallback(ThreadServant thread, TargetMemoryAccess memory,
                                 ref StackFrame frame, bool exact_match)
        {
            try {
                if (frame == null)
                {
                    return(false);
                }

                Inferior.CallbackFrame callback = thread.GetCallbackFrame(
                    frame.StackPointer, exact_match);
                if (callback == null)
                {
                    return(false);
                }

                frame = thread.Architecture.CreateFrame(
                    thread.Client, FrameType.Normal, memory, callback.Registers);

                FrameType callback_type;
                string    frame_name = "<method called from mdb>";

                if (callback.IsRuntimeInvokeFrame)
                {
                    callback_type = FrameType.RuntimeInvoke;
                    TargetFunctionType func = thread.GetRuntimeInvokedFunction(callback.ID);
                    if (func != null)
                    {
                        frame_name = String.Format("<Invocation of: {0}>", func.FullName);
                    }
                }
                else
                {
                    callback_type = FrameType.Callback;
                }

                AddFrame(new StackFrame(
                             thread.Client, callback_type, callback.CallAddress, callback.StackPointer,
                             TargetAddress.Null, callback.Registers, thread.NativeLanguage,
                             new Symbol(frame_name, callback.CallAddress, 0)));
                return(true);
            } catch (TargetException) {
                return(false);
            }
        }