From owner-freebsd-mozilla Tue Apr 14 19:50:56 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA26492 for freebsd-mozilla-outgoing; Tue, 14 Apr 1998 19:50:56 -0700 (PDT) (envelope-from owner-freebsd-mozilla@FreeBSD.ORG) Received: from terror.hungry.com (toshok@[199.181.107.40]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA26470 for ; Wed, 15 Apr 1998 02:50:46 GMT (envelope-from toshok@Hungry.COM) Received: (from toshok@localhost) by terror.hungry.com (8.9.0.Beta3/8.9.0.Beta3) id TAA10538; Tue, 14 Apr 1998 19:50:45 -0700 (PDT) To: freebsd-mozilla@FreeBSD.ORG Subject: Re: GDB, Memory, and NSPR Threads? References: <199804150212.TAA00969@northwest.com> From: Christoph Toshok Date: 14 Apr 1998 19:50:45 -0700 In-Reply-To: stevemw@northwest.com's message of 14 Apr 1998 19:14:47 -0700 Message-ID: Lines: 58 X-Mailer: Gnus v5.3/Emacs 19.34 Sender: owner-freebsd-mozilla@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG stevemw@northwest.com (Stephen Wynne) writes: > > In message , Christoph Toshok writes: > > yeah, someone has brought it up on mozilla.general some days ago. > don't know if they're moving on it, though. > > Chris, > > Thanks for your reply. That someone would be I. And we didn't get a > response (to that specific question) back from Brendan Eich in that > thread, which is why I'm asking here. ahh... sorry for the confusion :) > what exactly are you trying to do? I mean, why do you want to pop > between threads? > > I want to walk through the code that handles plugins in order to more > fully understand it. Also, when I start working on a plugin, I want to > be able to set breakpoints in it and do the normal things I do with a > debugger. Right now, I end up in the main thread (I think), and I > never get the chance to enter the other ones. It's all very confusing > still. hmmm.. when I was debugging libmocha interactions with layout, setting breakpoints in mocha functions that were called on the mocha thread worked ok... I mean, I don't know anyone at netscape using unix that has ever been able to do what you want, and we've been reasonably (heh :) effective at debugging things... but nevertheless, information is always a good thing. > Here's what Brendan advised in mozilla-general: > > I always end up memorizing the stack-pointer and program-counter > offsets in the PRThread's jmpbuf or ucontext or whatever struct, > printing them out (the current thread is pointed at by > [_pr_currentThread], usually the same as mozilla_thread or > lm_InterpretThread), setting $sp and $pc, and voila -- you've > convinced gdb to switch threads. > > I think I might be able follow Brendan's advice if I knew how to find > this alleged data structure that describes the threads. I don't know > how to use his advice about "ucontext." I didn't see anything I could > comprehend as a live thread map (is there such a thing?) when I looked > at things declared as PRThread. look in nsprpub/include/md/_freebsd.h. ->md.context is a sigjmp_buf. This should have all the information you need (the stack pointer is ->md.context[0]._sjb[2], for instance). for the list of active threads (and the waitq links), look in nsprpub/pr/include/private/primpl.h. This file has the struct definition for PRThread in it. if you're not using pthreads (which freebsd doesn't), there are PRCLists that you can use. chris To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mozilla" in the body of the message