Closed
Bug 208098
Opened 21 years ago
Closed 21 years ago
XPCOM_DEBUG_BREAK=stack no longer works
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: benjamin, Assigned: dougt)
References
()
Details
Attachments
(1 file, 2 obsolete files)
61.14 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
On linux, setting XPCOM_DEBUG_BREAK to "stack" no longer seems to work... there
is an #ifndef XPCOM_GLUE at
http://lxr.mozilla.org/seamonkey/source/xpcom/glue/nsDebug.cpp#317 but it
doesn't seem to be honored. I put an debugging assertion in nsHashtable.cpp and
it says "unrecognized value of XPCOM_DEBUG_BREAK env var!"
Assignee | ||
Comment 1•21 years ago
|
||
in xpfe/bootstrap/Makefile.in, if you set GRE_BUILD to be zero and rebuild, do
you still see this problem?
I don't, which is why I've had that change in my xpfe/bootstrap/Makefile.in
since it landed. (And I've mentioned this to dougt before.)
Reporter | ||
Comment 3•21 years ago
|
||
Well, it looks to me that this can work even when BUILD_GRE...
nsStackFrameUnix.o is statically linked into the mozilla binary, so it's not a
question of linking libxpcom.so...
Perhaps another #if !defined(XPCOM_GLUE) || defined(MOZ_BOOTSTRAP) would work?
Assignee | ||
Comment 4•21 years ago
|
||
nsDebug.cpp gets built into the glue library and into the xpcom lib. There are
only two copies. Adding this extra define would require another pass to build a
gluelib that supports this.
Assignee | ||
Comment 5•21 years ago
|
||
this patch looks scarier than it is.
The basic idea is to create a nsIDebug interface that the glue code can use to
implement a nsDebug object. This is very similar to what we did with nsMemory.
The bulk of the change was moving nsDebug.[c|h] from xpcom/glue to xpcom/base.
Then i removed the cruft that wasn't being used. it turned out that all of the
methods declared in nsDebug were either unused or could be boiled down to three
core.
I'm worried that this might not work on all platforms when using the glue
library. It creates two different instances of nsDebug::Assertion, etc., one of
which calls the other. With the dynamic linker doing what it sometimes does on
Linux, can't this lead to an infinite loop? (It's also confusing.)
It seems cleaner, anyway, to do what nsMemory does -- which would mean to move
the guts of nsDebug directly into nsDebugImpl.cpp in xpcom/base (rather than
have that be a thin wrapper around nsDebug) and then have what you put in
glue/standalone/ in glue/ directly. (Roughly, anyway.) We really don't need to
worry about the performance of these functions since they're called quite rarely
(only when assertions fail). (With nsTraceRefcnt that could be a little more of
an issue, although it's probably not worth worrying about.)
Assignee | ||
Comment 7•21 years ago
|
||
with dbaron's suggestion.
Attachment #126984 -
Attachment is obsolete: true
Comment on attachment 127021 [details] [diff] [review]
patch v.2
>Index: glue/standalone/Makefile.in
No need for any changes to this file anymore.
>Index: glue/standalone/nsXPCOMGlue.cpp
>+ rv = GlueStartupDebug();
>+
>+ if (NS_FAILED(rv)) {
>+ free(xpcomFunctions);
>+ xpcomFunctions = nsnull;
>+ PR_UnloadLibrary(xpcomLib);
>+ xpcomLib = nsnull;
>+ return NS_ERROR_FAILURE;
>+ }
>+
> // startup the nsMemory
> return GlueStartupMemory();
> #endif
Why no error handling for GlueStartupMemory?
(I need to apply the patch and diff between moved files to review the rest of
the patch...)
Assignee | ||
Comment 9•21 years ago
|
||
I will revert glue/standalone/Makefile.in.
The caller will take care of shutting down if GlueStartupMemory fails.
The license on nsDebugImpl.cpp should probably come from nsDebug.cpp, since it's
pretty much the same code.
Removing the |Break(aFile, aLine)| at the end of nsDebug::Assertion seems like a
major change. It seems like that would break XPCOM_DEBUG_BREAK for Assertions
and break dropping into the debugger on Windows. I think that should be readded.
You've also made a major change to NS_WARNING. I think you should probably
readd nsIDebug/nsDebugImpl::Warning to restore backwards compatibility.
nsDebugImpl::Create should either null out |*aInstancePtr| at the beginning or
not bother at all. If QI fails, the QI implementation will do it anyway.
patch thinks your glue/nsDebug.cpp changes are a malformed diff, but, if I'm
reading them correctly, you need to write ENSURE_DEBUGOBJECT (to call
SetupDebugObject, I presume).
GlueStartupDebug/GlueShutdownDebug and FreeDebugObject/SetupDebugObject both
keep an owning reference in the same variable, so I'd think we're guarantd to
leak the debug service in the XPCOM_GLUE case (we current leak the nsMemory
object, I think, so don't trust that code as reliable). Perhaps the
GlueStartupDebug and GlueShutdownDebug are unnecessary?
Other than that (including comment 8), this looks good to me.
Assignee | ||
Comment 11•21 years ago
|
||
Fixed above comments.
>GlueStartupDebug/GlueShutdownDebug and FreeDebugObject/SetupDebugObject both
keep an owning reference in the same variable, so I'd think we're guarantd to
leak the debug service in the XPCOM_GLUE case (we current leak the nsMemory
object, I think, so don't trust that code as reliable). Perhaps the
GlueStartupDebug and GlueShutdownDebug are unnecessary?
The leak is a know issue. The Glue versions are to ensure that a standalone
component (ones that don't link to xpcom) does correctly resolve its own global
variable.
But why bother with GlueStartupDebug and GlueShutdownDebug when you can just get
it lazily when you need it and free it at shutdown?
Assignee | ||
Comment 13•21 years ago
|
||
well, suppose you have one of these components that are built outside of
mozilla. these components can be (and some are) unloaded before "app shutdown".
So, these componets need to have a way to free up memory when the component
shutdown. When these componets are unloaded, the xpcom-glue is shutdown for
them, resulting in calling GlueShutdownDebug.
Assignee | ||
Comment 14•21 years ago
|
||
Attachment #127021 -
Attachment is obsolete: true
Comment on attachment 127022 [details] [diff] [review]
includes more dbaron feedback
r=dbaron, although I still don't see why you shouldn't do the same cleanup for
GlueStartupMemory failure as for the other failure cases.
Attachment #127022 -
Flags: review+
Assignee | ||
Comment 16•21 years ago
|
||
yeah. will add the extra clean up.
Assignee | ||
Comment 17•21 years ago
|
||
I cleaned up the patch that dbaron r'ed. Specifically, i made it so that
nsDebug could be used before InitXPCOM. The changes were minor.
Checking in base/Makefile.in;
/cvsroot/mozilla/xpcom/base/Makefile.in,v <-- Makefile.in
new revision: 1.59; previous revision: 1.58
done
RCS file: /cvsroot/mozilla/xpcom/base/nsDebugImpl.cpp,v
done
Checking in base/nsDebugImpl.cpp;
/cvsroot/mozilla/xpcom/base/nsDebugImpl.cpp,v <-- nsDebugImpl.cpp
initial revision: 3.1
done
RCS file: /cvsroot/mozilla/xpcom/base/nsDebugImpl.h,v
done
Checking in base/nsDebugImpl.h;
/cvsroot/mozilla/xpcom/base/nsDebugImpl.h,v <-- nsDebugImpl.h
initial revision: 3.1
done
RCS file: /cvsroot/mozilla/xpcom/base/nsIDebug.idl,v
done
Checking in base/nsIDebug.idl;
/cvsroot/mozilla/xpcom/base/nsIDebug.idl,v <-- nsIDebug.idl
initial revision: 3.1
done
Checking in base/nsISupportsObsolete.h;
/cvsroot/mozilla/xpcom/base/nsISupportsObsolete.h,v <-- nsISupportsObsolete.h
new revision: 3.7; previous revision: 3.6
done
Checking in build/nsXPComInit.cpp;
/cvsroot/mozilla/xpcom/build/nsXPComInit.cpp,v <-- nsXPComInit.cpp
new revision: 1.181; previous revision: 1.180
done
Checking in components/nsComponentManager.h;
/cvsroot/mozilla/xpcom/components/nsComponentManager.h,v <-- nsComponentManager.h
new revision: 1.90; previous revision: 1.89
done
Checking in glue/nsDebug.cpp;
/cvsroot/mozilla/xpcom/glue/nsDebug.cpp,v <-- nsDebug.cpp
new revision: 3.74; previous revision: 3.73
done
Checking in glue/nsDebug.h;
/cvsroot/mozilla/xpcom/glue/nsDebug.h,v <-- nsDebug.h
new revision: 1.11; previous revision: 1.10
done
Checking in glue/nsISupportsImpl.h;
/cvsroot/mozilla/xpcom/glue/nsISupportsImpl.h,v <-- nsISupportsImpl.h
new revision: 3.21; previous revision: 3.20
done
Checking in glue/standalone/nsXPCOMGlue.cpp;
/cvsroot/mozilla/xpcom/glue/standalone/nsXPCOMGlue.cpp,v <-- nsXPCOMGlue.cpp
new revision: 1.12; previous revision: 1.11
done
Checking in build/nsXPCOM.h;
/cvsroot/mozilla/xpcom/build/nsXPCOM.h,v <-- nsXPCOM.h
new revision: 1.10; previous revision: 1.9
done
Checking in build/nsXPCOMPrivate.h;
/cvsroot/mozilla/xpcom/build/nsXPCOMPrivate.h,v <-- nsXPCOMPrivate.h
new revision: 1.11; previous revision: 1.10
done
I have left nsIDebug as "UNDER_REVIEW". Of course, this will be frozen for 1.5
and any changes to this interface from today forward will also need to modify
the IID.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•