History log of /haiku/src/kits/support/Referenceable.cpp
Revision Date Author Comments
# 9392d87e 16-Feb-2022 Augustin Cavalier <waddlesplash@gmail.com>

BReferenceable: Remove unneeded linebreak from debugger message.


# 1e926a21 10-Feb-2022 Augustin Cavalier <waddlesplash@gmail.com>

BReferenceable: Enable reference-count assertions even outside DEBUG.

Now that we are merely doing basic comparison tests and do not invoke
get_thread_info or the like, this is cheap enough that we can enable it
even when DEBUG is not enabled, and get assertions in more cases.


# 071d20db 10-Feb-2022 Augustin Cavalier <waddlesplash@gmail.com>

BReferenceable: Relax reference-count destruction checks.

"delete object;" is logically the same as "object->ReleaseReference();"
when there is a reference count of 1, and we need to permit that instead
of asserting on it, so the case where a referenceable object is a member
variable of a class works without asserting.

This manifested in packagefs: the Resolvable class has a linked-list with
Dependency objects (which are referenceable) in it. (Further, the stack
checks do not work quite right for kernel stacks.)

Fixes #17575.


# fc38a413 08-Feb-2022 Augustin Cavalier <waddlesplash@gmail.com>

BReferenceable: Fix build when the kernel is built with DEBUG enabled.


# f6b66066 07-Feb-2022 Augustin Cavalier <waddlesplash@gmail.com>

BReferenceable: Always enable DEBUG in kernel mode when PARANOID_KERNEL_FREE is enabled.

This checks the reference counts are actually 0 (or 1 and allocated
on the stack). As PARANOID_KERNEL_FREE is enabled at KDEBUG_LEVEL 2,
this will thus be enabled on nightly builds.


# d0688588 01-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

kits/support: Skip debug check in boot loader


# 1238bebd 01-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

build: Add stub _get_thread_info() needed by support/Referenceable.cpp

This is a step towards fixing #10042.

When DEBUG is set BReferenceable::~BReferenceable() performs some checks
ensuring that the object is destroyed correctly. These checks require
information on thread stack, which is obtained by get_thread_info().

_get_thread_info() stub is added (actually, readded) which always returns
B_ERROR. Moreover, the check in BReferenceable destructor is modified
so that it does not fail when get_thread_info() fails.


# 38cb1c91 15-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Improve debug output.


# 59a998dc 15-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Fix userland build with tracing enabled.


# 1fd93573 14-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Fix incorrect type.


# 58a2847a 14-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Improve debug output.

Should make it easier to determine the exact reason the debugger
call is triggered.


# a34020ba 06-Dec-2012 Rene Gollent <anevilyak@gmail.com>

A bit more fine-tuning to BReferenceable debugging.

- Rework quick stack range check as suggested by Ingo.
- If the ref count is > 1 we invoke the debugger unconditionally.
- If equal to 1, we first perform a quick heuristic check to see if the
var might be on the stack. If we can't conclusively determine that is,
we make certain by comparing to the thread's actual stack range.


# 4a5bcf0f 05-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Rework debugging check in BReferenceable.

- If a BReferenceable object is deleted with a non-zero reference count,
we now test to see if the object was allocated on the stack. If so,
we don't flag a warning if the reference count is currently 1.


# 860c710c 04-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Add some additional BReferenceable debugging.

- When libbe is built in debug mode, BReferenceable now issues a
debugger call if it's destroyed without all references having been
released.


# 8c3c1172 10-Jun-2011 Rene Gollent <anevilyak@gmail.com>

Adjust ReleaseReference() to also return the previous ref count as
AcquireReference() now does, and adjust all callers that relied on the previous
return type.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42091 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a99d0dd7 09-Jun-2011 Rene Gollent <anevilyak@gmail.com>

AcquireReference() now returns the previous ref count.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42079 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 756b64fd 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed the obsolescent [B]Reference[able] API and replaced the remaining
uses. Fixes the gcc 2 acpi build.
* Renamed WeakReferenceable::{Add,Remove}Reference() to
{Acquire,Release}Reference() for consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39871 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d32f94f4 01-Oct-2010 Axel Dörfler <axeld@pinc-software.de>

* Added optional tracing support which can be very useful when debugging
reference count problems.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38866 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4736b6b9 04-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Made BReferenceable the class implementation and BPrivate::Referenceable the
typedef, so it's clearer which one is the preferred one.
* Added BReference, a clone of BPrivate::Reference.

BPrivate::{Referenceable,Reference} are being phased out. Only the B* versions
should be used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33879 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7aa7cb4b 01-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed {Add,Remove}Reference() to {Acquire,Release}Reference(). Methods with
the old names still exist as deprecated aliases for the time being.
* Introduced hooks FirstReferenceAcquired() and LastReferenceReleased(). Besides
added flexibility this also makes the deleteWhenUnreferenced constructor
parameter and the fDeleteWhenUnreferenced attribute superfluous, since the
"don't delete" behavior can be obtained by overriding LastReferenceReleased().
Parameter and attribute will be removed eventually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31367 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2851dbad 31-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Moved Referenceable.cpp to src/kits/support (private libbe API), and its header to
private/shared.
* Made AddReference() and CountReferences() inlines.
* The registrar is now using the private Referenceable version in libbe.so.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21767 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d06885888d26a1037b2f6c03069dd160625a150f 01-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

kits/support: Skip debug check in boot loader


# 1238bebddc4939d2dc0741c9bdc625a1ce85c1ff 01-Oct-2013 Pawel Dziepak <pdziepak@quarnos.org>

build: Add stub _get_thread_info() needed by support/Referenceable.cpp

This is a step towards fixing #10042.

When DEBUG is set BReferenceable::~BReferenceable() performs some checks
ensuring that the object is destroyed correctly. These checks require
information on thread stack, which is obtained by get_thread_info().

_get_thread_info() stub is added (actually, readded) which always returns
B_ERROR. Moreover, the check in BReferenceable destructor is modified
so that it does not fail when get_thread_info() fails.


# 38cb1c91964cfe910d20e614150d7a8ffccec692 15-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Improve debug output.


# 59a998dc1d030591f416dd1aa76570dcc665f407 15-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Fix userland build with tracing enabled.


# 1fd93573e66d64d43d799bb878285be73e6b7e49 14-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Fix incorrect type.


# 58a2847a128a44839be10451a26851c650e4fa42 14-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Improve debug output.

Should make it easier to determine the exact reason the debugger
call is triggered.


# a34020ba21777c21f57e3bb765d083b38ae9ad1e 06-Dec-2012 Rene Gollent <anevilyak@gmail.com>

A bit more fine-tuning to BReferenceable debugging.

- Rework quick stack range check as suggested by Ingo.
- If the ref count is > 1 we invoke the debugger unconditionally.
- If equal to 1, we first perform a quick heuristic check to see if the
var might be on the stack. If we can't conclusively determine that is,
we make certain by comparing to the thread's actual stack range.


# 4a5bcf0f7a069e4f97493d0c881ddac2f049a80a 05-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Rework debugging check in BReferenceable.

- If a BReferenceable object is deleted with a non-zero reference count,
we now test to see if the object was allocated on the stack. If so,
we don't flag a warning if the reference count is currently 1.


# 860c710c4b59b2499800badbd12d09fbfdcd0622 04-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Add some additional BReferenceable debugging.

- When libbe is built in debug mode, BReferenceable now issues a
debugger call if it's destroyed without all references having been
released.


# 8c3c1172011e71f591060f73e460f45a717a4e31 10-Jun-2011 Rene Gollent <anevilyak@gmail.com>

Adjust ReleaseReference() to also return the previous ref count as
AcquireReference() now does, and adjust all callers that relied on the previous
return type.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42091 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a99d0dd7b7a920540401d591a54a5776afb5ec48 09-Jun-2011 Rene Gollent <anevilyak@gmail.com>

AcquireReference() now returns the previous ref count.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42079 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 756b64fd836dad5b63f41f0b01f8cedfec795f9d 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed the obsolescent [B]Reference[able] API and replaced the remaining
uses. Fixes the gcc 2 acpi build.
* Renamed WeakReferenceable::{Add,Remove}Reference() to
{Acquire,Release}Reference() for consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39871 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d32f94f43c296e2346c045bef770b8926794c2e8 01-Oct-2010 Axel Dörfler <axeld@pinc-software.de>

* Added optional tracing support which can be very useful when debugging
reference count problems.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38866 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4736b6b9e5ea079bfb704c0b3be6525c02c9a83a 04-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Made BReferenceable the class implementation and BPrivate::Referenceable the
typedef, so it's clearer which one is the preferred one.
* Added BReference, a clone of BPrivate::Reference.

BPrivate::{Referenceable,Reference} are being phased out. Only the B* versions
should be used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33879 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7aa7cb4b54735360df17571f51e3631418617833 01-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed {Add,Remove}Reference() to {Acquire,Release}Reference(). Methods with
the old names still exist as deprecated aliases for the time being.
* Introduced hooks FirstReferenceAcquired() and LastReferenceReleased(). Besides
added flexibility this also makes the deleteWhenUnreferenced constructor
parameter and the fDeleteWhenUnreferenced attribute superfluous, since the
"don't delete" behavior can be obtained by overriding LastReferenceReleased().
Parameter and attribute will be removed eventually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31367 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2851dbad53bd9d11b64ba4267c96f637d133f81c 31-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Moved Referenceable.cpp to src/kits/support (private libbe API), and its header to
private/shared.
* Made AddReference() and CountReferences() inlines.
* The registrar is now using the private Referenceable version in libbe.so.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21767 a95241bf-73f2-0310-859d-f6bbb57e9c96