Subject: gcc Q - a bit off topic
To: None <current-users@NetBSD.ORG>
From: Bill Studenmund <>
List: current-users
Date: 10/21/1997 18:15:31

I'm trying to debug some reference-keeping code I've added to the kernel.
I've got an addref and a delref function. When the ref count goes to 0,
the object gets deleted.

Unfortunatly I've got a leak. I add a reference which doesn't get deleted.

I want to turn the call to the addref and delref functions into macros,
and print out what source file they were called from. Does anyone know how
to do this? I.E. is there a variable in gcc which is the name of the
source file being compiled? Or anything else which would help?

The calls happen as part of normal kernel life, so I'd rather not have to
go through the debugger and manually do a back trace & a continue for each

Take care,