Exemple #1
0
        void get_thread_info(Inferior inferior, SingleSteppingEngine engine)
        {
            if (thread_db == null)
            {
                if (mono_manager == null)
                {
                    return;
                }
                Report.Error("Failed to initialize thread_db on {0}: {1} {2}",
                             start.CommandLine, start, Environment.StackTrace);
                throw new InternalError();
            }

            bool found = false;

            thread_db.GetThreadInfo(inferior, delegate(int lwp, long tid) {
                if (lwp != engine.PID)
                {
                    return;
                }

                engine.SetTID(tid);
                found = true;
            });

            if (!found)
            {
                Report.Error("Cannot find thread {0:x} in {1}",
                             engine.PID, start.CommandLine);
            }
        }
Exemple #2
0
        internal void InitializeThreads(Inferior inferior, bool resume_threads)
        {
            if (thread_db != null)
            {
                return;
            }

            thread_db = ThreadDB.Create(this, inferior);
            if (thread_db == null)
            {
                if (!IsManaged)
                {
                    return;
                }

                Report.Error("Failed to initialize thread_db on {0}", start.CommandLine);
                throw new TargetException(TargetError.CannotStartTarget,
                                          "Failed to initialize thread_db on {0}", start.CommandLine);
            }

            int[] threads = inferior.GetThreads();
            foreach (int thread in threads)
            {
                if (thread_hash.Contains(thread))
                {
                    continue;
                }
                ThreadCreated(inferior, thread, Inferior.HasThreadEvents, resume_threads);
            }

            thread_db.GetThreadInfo(inferior, delegate(int lwp, long tid) {
                SingleSteppingEngine engine = (SingleSteppingEngine)thread_hash [lwp];
                if (engine == null)
                {
                    Report.Error("Unknown thread {0} in {1}", lwp, start.CommandLine);
                    return;
                }
                engine.SetTID(tid);
            });
        }