Closed Bug 392118 Opened 19 years ago Closed 19 years ago

port trace-malloc to Mac OS X

Categories

(Core :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha8

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

Attachments

(3 files, 1 obsolete file)

I have patches to get trace-malloc working on Mac OS X, modulo the Mac OS X stack walking code in XPCOM, which I don't have working yet. It was pretty easy; I checked that the thread-local storage stuff using pthreads seem to think we have a new thread at about the right places, and the nsGetTypeName code even works. The malloc-hooking required a quick look at Apple's APSL-ed Libc code to find out what the hooks were, since they're not documented in the headers.
So I hit a bad dependency rule that I think nobody's hit yet. I'm not even sure the rule is necessary; the correct solution may be to remove it. But instead I made it work, I think, although I'm not sure how portably. The problem was that EXTRA_DSO_LIBS is not a sensible thing to append to DSO_LDOPS_DEPS; there's no file called "-ltracemalloc". To work around that, I made an EXTRA_DSO_LIB_FILES variable. But then, the makefile where I was having the problem happened to override DLL_PREFIX and DLL_SUFFIX, which my definition of EXTRA_DSO_LIB_FILES depended on, so I gave that makefile a different way to do what it was doing (IS_FRAMEWORK). I'm not sure if EXTRA_DSO_LIBS are always shared libraries, though. In fact, I'm pretty sure they're not, which means this patch is wrong. But I'm not sure what we *do* want to do here. Advice?
Attachment #276565 - Flags: review?(benjamin)
Patch 3 isn't written yet, but I need to reorganize tools/trace-malloc/Makefile.in somehow so that it links leaksoup with the C++ compiler rather than the C compiler. That may involve moving spacetrace into its own subdirectory.
Comment on attachment 276564 [details] [diff] [review] patch 1: trace-malloc port to Mac OS X The declarator name in the function typedef doesn't need parens around it, but I guess that's how the hidden Apple source wrote it. r/a=me. /be
Attachment #276564 - Flags: review?(brendan)
Attachment #276564 - Flags: review+
Attachment #276564 - Flags: approval1.9+
GNU make can calculate dependencies of the form -lfoo, kinda. It uses the VPATH to determine where to look, which is IMO not ideal. I'll look at this more tomorrow when I can concentrate.
Depends on: 336517
Patch 1 landed on trunk 2007-08-14 09:35 -0700.
Right, it turns out that the half of the patch that I wrote second is sufficient on its own. Whatever makes -ltracemalloc work requires DLL_PREFIX and DLL_SUFFIX (or at least one of them) to be set correctly.
Attachment #276565 - Attachment is obsolete: true
Attachment #276984 - Flags: review?(benjamin)
Attachment #276565 - Flags: review?(benjamin)
Attachment #276984 - Flags: review?(benjamin) → review+
This is the other half of the required build system changes: this makefile is pretty weird already, and this minimal fix makes us use g++ as the linker, which is needed for leaksoup. rules.mk sets CPP_PROG_LINK if CPPSRCS or CMMSRCS are set; we're setting SIMPLE_CPPSRCS instead.
Attachment #276986 - Flags: review?(benjamin)
Attachment #276986 - Flags: review?(benjamin) → review+
Comment on attachment 276984 [details] [diff] [review] patch 2: build system patch, part 1: fix bad dependency a=bzbarsky
Attachment #276984 - Flags: approval1.9? → approval1.9+
Comment on attachment 276986 [details] [diff] [review] patch 3: build system patch, part 2: set CPP_PROG_LINK a=bzbarsky
Attachment #276986 - Flags: approval1.9? → approval1.9+
Both build system patches checked in, 2007-08-19 17:00 -0700.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: