Closed Bug 288823 Opened 19 years ago Closed 19 years ago

Trace-malloc fails to compile on windows

Categories

(Core :: XPCOM, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: mcsmurf, Assigned: mcsmurf)

Details

Attachments

(1 file, 1 obsolete file)

I tried to compile a XULRunner build (i think this bug also happens with a
normal Mozilla or Firefox build) with trace-malloc enabled. First it fails on
PR_EXTERN(void)
NS_TrackAllocation(__ptr_t ptr, FILE *ofp);
in nsTraceMalloc.h and nsTraceMalloc.cpp. This problem can be solved by adding
adding
#ifndef __ptr_t
#define __ptr_t void *
#endif
to the header file.

The second error occours when it executes make libs in tools/trace-malloc/.
There i get the error
make[1]: *** No rule to make target `../../dist/lib/xpcom.lib', needed by `space
trace.exe'.  Stop.
after it has compiled spacetrace.c, spacecategory.c and formdata.c
Attached patch Patch (obsolete) — Splinter Review
This patch makes trace-malloc compile with xulrunner (in general libxul apps),
fixes some general issues with new strict string api and compiling on Windows.
I'm not sure yet if it works so in xulrunner, i only get a empty file when
calling the dump function, but that's another problem.
Attachment #180511 - Flags: review?(dbaron)
Comment on attachment 180511 [details] [diff] [review]
Patch


>Index: tools/trace-malloc/Makefile.in
>===================================================================
[...]
>+DEFINES += -DMOZILLA_INTERNAL_API=1

Skip that line, i saw this has been fixed in the meantime (also a little bit
different, but it fixes the issue).
Comment on attachment 180511 [details] [diff] [review]
Patch

>Index: tools/trace-malloc/Makefile.in
>+DEFINES += -DMOZILLA_INTERNAL_API=1

This shouldn't be in the patch.

>Index: tools/trace-malloc/lib/nsTraceMalloc.h
>+#ifdef XP_WIN
>+#define setlinebuf(stream) setvbuf(stream, (char *)NULL, _IOLBF, 0)
>+#endif

Use (stream) inside the function call (although it doesn't really matter in
this case).

>+#ifndef __ptr_t
>+typedef void* __ptr_t;
>+#endif

This won't work if __ptr_t is a typedef.

You should probably just change NS_TrackAllocation to use void* instead.

With those changes, r=dbaron.
Attachment #180511 - Flags: review?(dbaron) → review-
Attached patch Patch 2Splinter Review
r+, review comments have been addressed.
Assignee: dougt → bugzilla
Attachment #180511 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #182247 - Flags: review+
Comment on attachment 182247 [details] [diff] [review]
Patch 2

Can you give sr on this or should i look for someone else?
Attachment #182247 - Flags: superreview?(cls)
Attachment #182247 - Flags: superreview?(cls) → superreview?(brendan)
Attachment #182247 - Flags: superreview?(brendan) → superreview+
Comment on attachment 182247 [details] [diff] [review]
Patch 2

This can be checked in for 1.8b3, it's not part of the default build.

/be
Attachment #182247 - Flags: approval1.8b3+
Comment on attachment 182247 [details] [diff] [review]
Patch 2

Checking in toolkit/library/Makefile.in;
/cvsroot/mozilla/toolkit/library/Makefile.in,v	<--  Makefile.in
new revision: 1.14; previous revision: 1.13
done
Checking in tools/trace-malloc/lib/nsTraceMalloc.c;
/cvsroot/mozilla/tools/trace-malloc/lib/nsTraceMalloc.c,v  <--	nsTraceMalloc.c
new revision: 1.51; previous revision: 1.50
done
Checking in tools/trace-malloc/lib/nsTraceMalloc.h;
/cvsroot/mozilla/tools/trace-malloc/lib/nsTraceMalloc.h,v  <--	nsTraceMalloc.h
new revision: 1.19; previous revision: 1.18
done
Comment on attachment 182247 [details] [diff] [review]
Patch 2

Checking in Makefile.in;
/cvsroot/mozilla/Makefile.in,v	<--  Makefile.in
new revision: 1.294; previous revision: 1.293
done
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: