9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Ronald G. Minnich" <rminnich@lanl.gov>
To: 9fans@cse.psu.edu
Subject: [9fans] debugging p9p threads question
Date: Tue,  2 Aug 2005 16:42:16 -0600	[thread overview]
Message-ID: <Pine.LNX.4.58.0508021631260.27135@enigma.lanl.gov> (raw)


I'm hacking on sshnet and have truncated it and ported it to linux, but it 
is not quite baked. One odd thing I've seen: I've truncated the last bit 
of it to this:

void
threadmain(int argc, char **argv)
{
        char *user, *service;
/*
        fmtinstall('B', mpfmt);
        fmtinstall('H', encodefmt);
*/
        service = nil;
        user = nil;
        ARGBEGIN{
        case 'B':       /* undocumented, debugging */
                doabort = 1;
                break;
        case 'D':       /* undocumented, debugging */
                debuglevel = strtol(EARGF(usage()), nil, 0);
                break;
        case '9':       /* undocumented, debugging */
                chatty9p++;
                break;
        case 's':
                service = EARGF(usage());
                break;
        default:
                usage();
        }ARGEND

        if(argc)
                usage();
//      sshmsgchan = chancreate(sizeof(Msg*), 16);
        fsreqchan = chancreate(sizeof(Req*), 0);
        fsreqwaitchan = chancreate(sizeof(void*), 0);
        fsclunkchan = chancreate(sizeof(Fid*), 0);
        fsclunkwaitchan = chancreate(sizeof(void*), 0);

        proccreate(fsnetproc, nil, 8192);

        threadpostmountsrv(&fs, service, nil, MREPL|MCREATE);
        fprint(2, "threadpostmountsrv RETURNS!~!!!!!!\n");
        threadexitsall(0);
}

If I run this program, the fsnetproc will get a SIGUSR1, but not long 
after, will get a SIGUSR2; in fact, it gets the SIGUSR2 after the first 
time the server sends it a send and the does a recv. If I do this:

.
.
.
        
        proccreate(fsnetproc, nil, 8192);
        
        threadpostmountsrv(&fs, service, nil, MREPL|MCREATE);
        fprint(2, "threadpostmountsrv RETURNS!~!!!!!!\n");
	while(1)
		yield();
        threadexitsall(0);
}


Then the program will run, just fine.

Any idea what I could have done to break things? I have also done this to 
fsnetproc:

void
fsnetproc(void*v)
{
        ulong path;
        Alt a[4];
        Fid *fid;
        Req *r;

        threadsetname("fsthread");

        a[0].op = CHANRCV;
        a[0].c = fsclunkchan;
        a[0].v = &fid;
        a[1].op = CHANRCV;
        a[1].c = fsreqchan;
        a[1].v = &r;
#ifdef NO
        a[2].op = CHANRCV;
        a[2].c = sshmsgchan;
        a[2].v = &m;
        a[3].op = CHANEND;
#endif

        for(;;){
.
.
.


So I don't think the unitialized sshmsgchan should be a problem. 

I'm actually more interested in this question: how do you go about 
debugging this sort of problem? What's your favorite way to see what's 
going on? strace is pretty good, but not perfect. Do you use acid, or ...

thanks

ron


             reply	other threads:[~2005-08-02 22:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-02 22:42 Ronald G. Minnich [this message]
2005-08-02 22:48 ` Russ Cox
2005-08-02 23:00   ` Ronald G. Minnich
2005-08-02 23:36     ` Charles Forsyth
2005-08-03  7:20     ` Uriel
2005-08-03 10:40       ` Russ Cox
2005-08-03 12:12         ` Ronald G. Minnich
2005-08-06 23:48       ` Harri Haataja
2005-08-09 14:48         ` Gorka guardiola
2005-08-03  0:12 YAMANASHI Takeshi
2005-08-03  0:31 ` Skip Tavakkolian
2005-08-03  5:49   ` LiteStar numnums
2005-08-03  6:56   ` Tim Newsham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0508021631260.27135@enigma.lanl.gov \
    --to=rminnich@lanl.gov \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).