9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] naive acid debugging
@ 2009-07-15 15:26 gdiaz
  2009-07-15 16:41 ` erik quanstrom
  0 siblings, 1 reply; 5+ messages in thread
From: gdiaz @ 2009-07-15 15:26 UTC (permalink / raw)
  To: 9fans

Hello

While understanding how refs work inside nupas, i decided to try to implement the same function nupas has to find mailbox references in acid langauge, so i did:

defn findmboxrefs(mb,fids) {
	local f, refs;
	f=fids;
	while f!=0 do {
		print("f=", f\X,"\n");
		if f->mb==mb then
			refs++;
		print("f->mb=", f->mb\X,"	=?	mb=",mb\X,"\n");
		f=f->next;
	}
	print("refs ==", refs,"\n");
}

using a Broken nupas (broked by an assert call), i got this:

acid: findmboxrefs(*checkmboxrefs:mb,fids);
f=0x0003a090
f->mb=0x00000000	=?	mb=0x0004a468
f=0x0004bf68
f->mb=0x8d1c2444	=?	mb=0x0004a468
f=0x89ffffe4
<stdin>:75: (error) indir: can't read address 0x89ffffe4: bad arg in system call

is that related to something wrongly done in the acid function?
that means that there is an f which is pointing to an incorrect place?
or means that as the process is broken, acid cannot read some parts of it?

i forgot another possible issue, the broken process is owned by another user, i just chmod'ed /proc/pid/*. . . .

thanks

gabi




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] naive acid debugging
  2009-07-15 15:26 [9fans] naive acid debugging gdiaz
@ 2009-07-15 16:41 ` erik quanstrom
  2009-07-15 18:30   ` Russ Cox
  0 siblings, 1 reply; 5+ messages in thread
From: erik quanstrom @ 2009-07-15 16:41 UTC (permalink / raw)
  To: 9fans

> While understanding how refs work inside nupas, i decided to try to implement the same function nupas has to find mailbox references in acid langauge, so i did:
>
> defn findmboxrefs(mb,fids) {
> 	local f, refs;
> 	f=fids;
> 	while f!=0 do {
> 		print("f=", f\X,"\n");
> 		if f->mb==mb then
> 			refs++;
> 		print("f->mb=", f->mb\X,"	=?	mb=",mb\X,"\n");
> 		f=f->next;
> 	}
> 	print("refs ==", refs,"\n");
> }

first, i want to complement you on a fine use of acid.
very nice.

>
> using a Broken nupas (broked by an assert call), i got this:
>
> acid: findmboxrefs(*checkmboxrefs:mb,fids);
> f=0x0003a090
> f->mb=0x00000000	=?	mb=0x0004a468
> f=0x0004bf68
> f->mb=0x8d1c2444	=?	mb=0x0004a468
> f=0x89ffffe4
> <stdin>:75: (error) indir: can't read address 0x89ffffe4: bad arg in system call

your assmption that each fid has a mailbox is wrong.
see rattach() and sanefid().  they encode the rules.

- erik



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] naive acid debugging
  2009-07-15 18:30   ` Russ Cox
@ 2009-07-15 17:52     ` gdiaz
  0 siblings, 0 replies; 5+ messages in thread
From: gdiaz @ 2009-07-15 17:52 UTC (permalink / raw)
  To: 9fans

Hello

Thanks Russ, seems that even though i tried to use your iwp9 2007 talk as a reference, i missed the point, i should read more carefully.

gabi

>>>               print("f->mb=", f->mb\X,"       =?      mb=",mb\X,"\n");
>>>               f=f->next;
>
> Always use . (never ->) in acid.
>
> If f is a pointer, then the acid expression f.mb
> is like the C expression (*f).mb aka f->mb.
> The acid expression f->mb is like the C expression (**f).mb.
> By using -> here you are indirecting one level too far.
>
> -> is one of those acid features that seems
> to exist only to cause confusion.
>
> Russ




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] naive acid debugging
  2009-07-15 16:41 ` erik quanstrom
@ 2009-07-15 18:30   ` Russ Cox
  2009-07-15 17:52     ` gdiaz
  0 siblings, 1 reply; 5+ messages in thread
From: Russ Cox @ 2009-07-15 18:30 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>>               print("f->mb=", f->mb\X,"       =?      mb=",mb\X,"\n");
>>               f=f->next;

Always use . (never ->) in acid.

If f is a pointer, then the acid expression f.mb
is like the C expression (*f).mb aka f->mb.
The acid expression f->mb is like the C expression (**f).mb.
By using -> here you are indirecting one level too far.

-> is one of those acid features that seems
to exist only to cause confusion.

Russ


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] naive acid debugging
@ 2009-07-15 15:37 gdiaz
  0 siblings, 0 replies; 5+ messages in thread
From: gdiaz @ 2009-07-15 15:37 UTC (permalink / raw)
  To: quanstro, 9fans

hello

thank you very much  Erik, I'll look at that code today night, i hope to see the light soon ☺

gabi

> While understanding how refs work inside nupas, i decided to try to implement the same function nupas has to find mailbox references in acid langauge, so i did:
>
> defn findmboxrefs(mb,fids) {
> 	local f, refs;
> 	f=fids;
> 	while f!=0 do {
> 		print("f=", f\X,"\n");
> 		if f->mb==mb then
> 			refs++;
> 		print("f->mb=", f->mb\X,"	=?	mb=",mb\X,"\n");
> 		f=f->next;
> 	}
> 	print("refs ==", refs,"\n");
> }

first, i want to complement you on a fine use of acid.
very nice.

>
> using a Broken nupas (broked by an assert call), i got this:
>
> acid: findmboxrefs(*checkmboxrefs:mb,fids);
> f=0x0003a090
> f->mb=0x00000000	=?	mb=0x0004a468
> f=0x0004bf68
> f->mb=0x8d1c2444	=?	mb=0x0004a468
> f=0x89ffffe4
> <stdin>:75: (error) indir: can't read address 0x89ffffe4: bad arg in system call

your assmption that each fid has a mailbox is wrong.
see rattach() and sanefid().  they encode the rules.

- erik





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-07-15 18:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-15 15:26 [9fans] naive acid debugging gdiaz
2009-07-15 16:41 ` erik quanstrom
2009-07-15 18:30   ` Russ Cox
2009-07-15 17:52     ` gdiaz
2009-07-15 15:37 gdiaz

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).