Ejemplo n.º 1
0
        internal override void OnVMLoad(ExecutionEngine vm, byte[] script)
        {
            var context = vm.CallingContext;

            if (context != null)
            {
                var sb = new StringBuilder();
                for (int i = 0; i < context.EvaluationStack.Count; i++)
                {
                    var item = context.EvaluationStack.Peek(i);
                    if (sb.Length > 0)
                    {
                        sb.Append(",");
                    }
                    ;
                    sb.Append(FormattingUtils.StackItemAsString(item));
                }
                Logger("Inputs: " + sb.ToString());
            }

            base.OnVMLoad(vm, script);

            var hash       = script.ToScriptHash();
            var hash_bytes = hash.ToArray();

            foreach (var entry in _breakpoints)
            {
                if (entry.script == hash)
                {
                    vm.AddBreakPoint(hash_bytes, entry.offset);
                }
            }

            if (_debugger != null)
            {
                _debugger.SendScript(script);
            }
        }