Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2001 13:17:18 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        arch@freebsd.org
Subject:   KSEs and PTRACE/PROCFS
Message-ID:  <Pine.BSF.4.21.0112141306510.17119-100000@InterJet.elischer.org>

next in thread | raw e-mail | index | archive | help
Is there someone who really understands these, and
who feels that they have a good idea of what the behaviour of a
multi-threaded process should be when ptraced?

The question is:

WHat does it mean to "single step" a process with several threads?
WHen you suspend a process, what happens?

If there is someone with feelings on these topics I whuold welcome 
your input.

Here's a brief example:
        case PT_STEP:
        case PT_CONTINUE:
        case PT_DETACH:
                if ((uap->req != PT_STEP) && ((unsigned)uap->data >=
NSIG))
                        return (EINVAL);

                PHOLD(p);

                if (uap->req == PT_STEP) {
                        if ((error =
			  ptrace_single_step(FIRST_THREAD_IN_PROC(p))) {
                                PRELE(p);
                                return (error);
                        }
                }

                if (uap->addr != (caddr_t)1) {
                        fill_kinfo_proc(p, &p->p_uarea->u_kproc);
                        if ((error = ptrace_set_pc(
                                  FIRST_THREAD_IN_PROC(p),
                            (u_long)(uintfptr_t)uap->addr))) {
                                PRELE(p);
                                return (error);
                        }  
                }
                PRELE(p);

In this code in the "ptrace" function, we use 
FIRST_THREAD_IN_PROC() which returns tgeh only thread in a normal 
system but if there are many threads active in the process,
what should we do?
Should we set asside one thread and KSE to run all work, thus
serialising everything? if so where do we store it, and how do
we separate it from all the other threads?
Should we pick threads at random? 

If you are a debugger afficionado, I'd lov eto hear your ideas on this,

julian



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0112141306510.17119-100000>