Re: Memory Leak

2004-05-23 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Daniel O'Connor [EMAIL PROTECTED] writes:
: -BEGIN PGP SIGNED MESSAGE-
: Hash: SHA1
: 
: On Sun, 23 May 2004 04:06, Cole wrote:
:  I just wanted to know what programs any of you have used to track down a
:  memory leak in your programs?
:  Also wondering if there is maybe a good tutorial on the subject under
:  FreeBSD or even linux if possible.
: 
:  Im running FreeBSD 4.9 so just looking for something try to help me track
:  it down.
: 
:  Unless there is someone willing to help me with this since ive never really
:  had to do anything like this, else i can easily read something, just kinda
:  need to know a good memory tracing program or something of the sorts.
: 
: There is valgrind..
: http://www.rabson.org/#valgrind
: 
: I thought it was in ports but I can't see it.

Has anybody gotten valgrind to work with non-trivial threaded
programs?  We've had some issues with that...

Warner
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


USB ethernet CDC driver

2004-05-23 Thread Sam Lawrance
Hi,

Do we have generic support for the USB CDC Ethernet class? I can't find
anything to suggest we do. If not I plan to have a go at writing it.

I just installed linux on my ipaq. It masquerades as an ethernet class
device in order to communicate with the host PC. Assuming we don't
already have support, it looks like this will enable the use of a number
of devices.

Anything to avoid uni assignments :)

Cheers
Sam.




___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Memory Leak

2004-05-23 Thread Simon Barner
Daniel O'Connor wrote:

 There is valgrind..
 http://www.rabson.org/#valgrind
 
 I thought it was in ports but I can't see it.

Hi,

as I pointed out in another message of this thread, the port is ready
and waiting for a committer.

Simon


signature.asc
Description: Digital signature


Re: Memory Leak

2004-05-23 Thread Garance A Drosihn
At 2:45 PM +0930 5/23/04, Daniel O'Connor wrote:
There is valgrind..
http://www.rabson.org/#valgrind
I thought it was in ports but I can't see it.
___
Note the separate message:
  Date: Sat, 22 May 2004 21:46:32 +0200
  From: Simon Barner [EMAIL PROTECTED]
  To: Cole [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Looking for a ports committer for valgrind (Re: Memory Leak)
   I just wanted to know what programs any of you have used to
   track down a memory leak in your programs?
  this reminds me of something... :-/
  I created a port for Doug Rabson's FreeBSD port[1] of valgrind [2].
  He considered my work ready for the ports tree, but he also said
  that that he doesn't do any ports commits these days.
  So, could somebody please have a look at the ports (there is a
  stable and a development version of valgrind) to be found at [3]?
  If they get committed, PR ports/65585 can be closed as well (also
  approved by Doug).
  It's a pity that I forgot that excellent memory debugging tool,
  most notably because all the work has already been done, and the
  ports were only rotting around. :-(
  Cole, in order two answer your question at least a little bit:
  valgrind is great at detecting memory leaks and much more,
  e.g. out-of-bound array access, ...
  Simon
  [1] http://www.rabson.org/#valgrind
  [2] http://valgrind.kde.org/
  [3] http://home.leo.org/~barner/freebsd/valgrind/
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Memory Leak

2004-05-23 Thread Brian Feldman
On Sat, May 22, 2004 at 10:30:42PM -0600, M. Warner Losh wrote:
 Any suggestions for leak detectors that work in real-time or in
 response to some external signal?  In a threaded application would be
 ideal.
 
 I've hacked malloc to add the stack traceback to the utrace info
 that's output by malloc.  However, for applications that run for days,
 and tend to allocate and free a lot of memory, you gotta have lots of
 local storage.  The restrictions in the kernel that requires this to
 be a real file makes it harder.
 
 Also, there's a difference between what's in use and what is leaking..

Try boehm-gc; I run the following local patch to the ports to fix
a few things and let me enable compile options from the ports
infrastructure.  You can call the detector at any time to see if any
leaks have occurred made.

URL:http://green.homeunix.org/~green/boehm-gc.diffs

-- 
Brian Fundakowski Feldman   \'[ FreeBSD ]''\
   [EMAIL PROTECTED]   \  The Power to Serve! \
 Opinions expressed are my own.   \,,\
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: USB ethernet CDC driver

2004-05-23 Thread Craig Boston
Hi,

On Sunday 23 May 2004 8:22 am, Sam Lawrance wrote:
 Do we have generic support for the USB CDC Ethernet class? I can't find
 anything to suggest we do. If not I plan to have a go at writing it.

 I just installed linux on my ipaq. It masquerades as an ethernet class
 device in order to communicate with the host PC. Assuming we don't
 already have support, it looks like this will enable the use of a number
 of devices.

I don't think there is any support in the tree, however I wrote a minimal CDC 
Ethernet driver a while back in order to talk to my Zaurus.  Been meaning to 
throw it up on a web page or something but I just keep getting too busy :-/

It's pretty bare-bones -- doesn't implement some of the features that a real 
CDC NIC would (multicast, etc.), but is enough to talk to simple devices like 
the Zaurus.  I've never tested it on anything else -- I suspect it wouldn't 
be too hard to adapt though.  If you're interested in looking at it I'll send 
you a copy or post it somewhere.

Craig
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


early attaching tap0

2004-05-23 Thread Arno J. Klaassen
Hello,

ehmm, i hesitate writing to this list since I'm really
not a hacker, but I have a problem I seemingly cannot
resolve :

I would like the device tap entry of my kernel-config
to create and open an ethernet-device, rather
than just initialising the necessary kernel structures.

I made the following diff (needs COPTFLAGS = -O -pipe -DTAP_INIT_ETHER
since I do not know how to implement correctly
a kernel option ...) :

Index: net/if_tap.c
===
RCS file: /home/ncvs/src/sys/net/if_tap.c,v
retrieving revision 1.42
diff -r1.42 if_tap.c
125a126,132
 #if defined (TAP_INIT_ETHER)
 #include net/if_types.h
 static int tap_need_init = 1;
 dev_t tap0dev;
 void tapether(void);
 #endif /* defined (TAP_INIT_ETHER) */
 
140c147
 	int			 s;
---
 	intrmask_t		 s;
156a164,168
 #if defined (TAP_INIT_ETHER)
 		tap0dev =  make_dev(tap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
 		tap0);
 		tapcreate (tap0dev);
 #endif /* defined (TAP_INIT_ETHER) */
264c276
 static void
---
 void
315a328,336
 #if defined (TAP_INIT_ETHER)
 	if (tap_need_init == 1) {
 		ifp-if_type = IFT_ETHER;
 		ifp-if_baudrate = 1200;
 		tp-tap_flags |= TAP_OPEN;
 		tp-tap_pid = 0; /* curproc-p_pid; */
 		tap_need_init = 0;
 	}
 #endif
325a347
 
892a915
 

A kernel with this patch boots OK single user, but when going
multi-user it panics randomly
(sorry Thomas for blaming atapicam, I thouht I doublechecked
outcommenting COPTFLAGS before contacting you, I'm not sure
I did everything well ...)

I made similar changes to -stable and RELENG_5_2 which work
OK (i.e. no panics, stable system), but against -current
I am in the mist.
If ever someone has a quick idea about what I am doing wrong,
thanx a lot in advance.

Regards, Arno

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: USB ethernet CDC driver

2004-05-23 Thread Sam Lawrance
That would be great, I would love to take a look at it.

Sam

On Mon, 2004-05-24 at 06:12, Craig Boston wrote:
 Hi,
 
 On Sunday 23 May 2004 8:22 am, Sam Lawrance wrote:
  Do we have generic support for the USB CDC Ethernet class? I can't find
  anything to suggest we do. If not I plan to have a go at writing it.
 
  I just installed linux on my ipaq. It masquerades as an ethernet class
  device in order to communicate with the host PC. Assuming we don't
  already have support, it looks like this will enable the use of a number
  of devices.
 
 I don't think there is any support in the tree, however I wrote a minimal CDC 
 Ethernet driver a while back in order to talk to my Zaurus.  Been meaning to 
 throw it up on a web page or something but I just keep getting too busy :-/
 
 It's pretty bare-bones -- doesn't implement some of the features that a real 
 CDC NIC would (multicast, etc.), but is enough to talk to simple devices like 
 the Zaurus.  I've never tested it on anything else -- I suspect it wouldn't 
 be too hard to adapt though.  If you're interested in looking at it I'll send 
 you a copy or post it somewhere.
 
 Craig
 

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: USB ethernet CDC driver

2004-05-23 Thread Craig Boston
On Sunday 23 May 2004 7:25 pm, Sam Lawrance wrote:
 That would be great, I would love to take a look at it.

I'll go ahead and copy the list in case anybody else is interested...

You can grab the source at
http://www.gank.org/freebsd/cdce.tar.gz

I'm planning to eventually make a FreeBSD projects page -- I have a few local 
patches and such I'd like to share.  If and when I ever get time to do that, 
I'll move this in with it, but the above link should work until then.

The list archives will have to suffice as documentation until then, here's a 
few random comments about it:

* It's set up as a standalone kernel module.  If you have the kernel source on 
your system it should be as simple as cd cdce; make all  make install.  
That will dump it in /boot/kernel/if_cdce.ko, which can be loaded by any of 
the normal means.

* When you plug in the device, if all goes well, you should end up with a 
cdce0 network device.  Just ifconfig it and go.

* It registers itself as the handler for the CDC Ethernet class.  If your 
device doesn't report itself as that, you may have to add a specific device 
ID for it in the cdce_devs[] structure (get the values from usbdevs -v).  If 
it complains about not being able to find endpoints, try adding it in there 
with the CDCE_NO_UNION flag.  Linux on the Zaurus seems to be slightly 
non-conformant to the spec, so it may be similar on the iPaq.

* The driver generates a random MAC address for the local end rather than 
trying to read it from the device.  While incorrect for real Ethernet 
adapters, it seems to be fine (and may even be necessary) for these kinds of 
point-to-point connections.

* There is special handling for the Zaurus's nonstandard frame format, but it 
should be off by default for other devices.  This hasn't been tested yet, 
though :)

* The driver is targeted at -CURRENT.  It was originally developed against 
5.2-RELEASE sources and should still compile fine on those systems.  It would 
probably require some work to back-port to stable though.

* Not entirely sure what to do about the copyright message -- I borrowed 
heavily from the if_axe and if_aue drivers...

* BSD license, so feel free to do whatever with it :)

* Also applies is my standard disclaimer: It works fine on my system, but may 
cause your toaster to explode.  I used to sometimes get panics on detach, but 
I think the problem is fixed now.  Haven't had one in quite a while, even if 
I unplug it while transferring something.

Good luck!

Craig
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]