Closed
Bug 336517
Opened 19 years ago
Closed 18 years ago
stack walking code for Mac OS X
Categories
(Core :: XPCOM, enhancement)
Tracking
()
RESOLVED
FIXED
People
(Reporter: dbaron, Assigned: dbaron)
References
Details
Attachments
(1 file)
1.97 KB,
patch
|
benjamin
:
review+
benjamin
:
approval1.9+
|
Details | Diff | Splinter Review |
We have stack walking code in xpcom/base/nsStackFrame* and xpcom/base/nsTraceRefcntImpl.cpp that's useful for Linux and Windows, but we don't have any for Mac OS X.
It seems like it may well be possible to do something like what the Linux code does, now that trunk supports only 10.3 and up. (Is that correct?)
See the information on dladdr in http://developer.apple.com/documentation/DeveloperTools/Reference/MachOReference/Reference/reference.html
We'd might also need to back out bug 196115 if dladdr is in libdl, which is where I'd expect.
Comment 1•19 years ago
|
||
We can use dladdr in theory, but we'll need to move all of the trunk build machines to be using a 10.3 SDK first (they're on 10.2 now). Because 10.3 SDKs are half-braindead, we need to be mindful of bug 329579.
We won't need to back out bug 196115. dladdr is in libSystem. libdl.dylib is just a symlink to libSystem, there's no need to bring it in explicitly.
Comment 2•18 years ago
|
||
Yeah, I enabled the stackwalker code on OS X to be able to use the refcount balancer. It works, but the stack dumps aren't always very accurate (print out the wrong function names sometimes).
Assignee | ||
Comment 3•18 years ago
|
||
Any chance you could attach the patch? It's probably worth getting in; maybe others could improve it once it does, or write a post-processor like fix-linux-stack.pl.
Comment 4•18 years ago
|
||
dbaron, does the patch in bug 305581 do the same thing you're asking for in this bug?
Assignee | ||
Comment 5•18 years ago
|
||
Looks like so.
May be worth waiting until after bug 374689 and bug 374829 to merge to tip...
Comment 6•18 years ago
|
||
Bug 305581 is PowerPC only I think. I don't really have a useable patch for this bug, I just commented out some ifdef's in nsStackFrameUnix.cpp and nsTraceRefcntImpl.cpp so I use the linux code. But we really should add ifdef's to enable this on OS X on Intel.
Assignee | ||
Comment 7•18 years ago
|
||
We'll leave the other bug for the code Simon has there, if it eventually becomes usable.
Here's a patch that enables the Linux code for Mac OS X. I've tested it only on PPC (which actually required a small change); I suspect it will work on x86 too, but somebody testing wouldn't be a bad idea.
It only shows publicly-visible symbols. I'll try writing a perl script based on fix-linux-stack.pl to at least get correct function names based on otool -l, otool -tv, and c++filt, which should be pretty quick.
Assignee | ||
Updated•18 years ago
|
Attachment #276568 -
Flags: review?(benjamin)
Assignee | ||
Comment 8•18 years ago
|
||
Actually, nm -an should give me a good bit more useful info for a perl script. It even shows the debugging information.
Assignee | ||
Comment 9•18 years ago
|
||
I checked in a perl script into mozilla/tools/rb/fix-macosx-stack.pl that will fix the stack traces generated by the above code. It works for me on PPC; it may need some tweaking for x86.
Assignee | ||
Comment 10•18 years ago
|
||
Jesse tested this on x86-Mac, and it works fine there too, as does fix-macosx-stack.pl, which is now at revision 1.5 (but that's not quite on LXR yet):
http://mxr.mozilla.org/seamonkey/source/tools/rb/fix-macosx-stack.pl?raw=1
Assignee | ||
Updated•18 years ago
|
Attachment #276568 -
Flags: review?(peterv)
Updated•18 years ago
|
Attachment #276568 -
Flags: review?(benjamin) → review+
Updated•18 years ago
|
Attachment #276568 -
Flags: approval1.9+
Assignee | ||
Comment 11•18 years ago
|
||
Fix checked in to trunk, 2007-08-15 17:03 -0700.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•