Closed Bug 394214 Opened 18 years ago Closed 18 years ago

using nsTArray<T> breaks linking if debug is on

Categories

(Core :: XPCOM, defect)

defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 387584

People

(Reporter: ynvich, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070723 Iceweasel/2.0.0.6 (Debian-2.0.0.6-1) Build Identifier: hg 64d9dbec8991 (2007-08-29) An attempt to use nsTArray in a xul-app/extension with debugging on will cause an error at link stage if xulrunner is built w/ --disable-debug: symbol lookup error: /path/to/lib: undefined symbol: _ZN13nsTArray_baseC2Ev Reproducible: Always Steps to Reproduce: 1. build and install a nightly XR w/ --disable-debug 2. #include "nsTArray.h" 3. $(CC) $FLAGS -DDEBUG somefile.cpp Actual Results: symbol lookup error: /path/to/lib: undefined symbol: _ZN13nsTArray_baseC2Ev Expected Results: somefile lib 'nsTArray_base' constructor has two variant depending on the value of NS_BUILD_REFCNT_LOG macro, which is switched on/off by DEBUG macro. Non-debug version is in-line, and debug version is not. As a result, if XR is built as normally with --disable-debug, an in-line version is used and 'xpcomglue' library doesn't contain a constructor for 'nsTArray_base'. When later someone tries do switch debugging on, 'nsTArray' clients begin to search for the constructor that does not exist.
What you want is a debug version of the xpcom glue library. I believe that if you link your debug component against a debug glue, it will run correctly on a release XR. I don't think we're going to be in the business of releasing debug xpcom glue libraries though... you'll have to compile your own.
Moving constructor/destructor code to class declaration fixes this bug. Clients that what debugging will now log refcnt info in their bodies. In cases when --disable-debug is used, there is no change of behavior, since MOZ_COUNT_* are no-op.
(In reply to comment #1) > I don't think we're going to be in the business of releasing debug xpcom glue > libraries though... you'll have to compile your own. Well, you post a comment faster than I typed a description for the patch. That is impressive :)
see also bug 387584 which I think will fix this particular issue the other way round (always outlining).
(In reply to comment #4) > see also bug 387584 which I think will fix this particular issue the other way > round (always outlining). > Right. That is exactly the same issue. My fault.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: