After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691039 - Add a wrapper for JS_DumpHeap
Add a wrapper for JS_DumpHeap
Status: RESOLVED OBSOLETE
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2013-01-02 23:03 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2013-07-19 20:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
configure: Remove CLASS_TRACE gunk (1.33 KB, patch)
2013-01-02 23:03 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
configure: Move useless echo lines (791 bytes, patch)
2013-01-02 23:03 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
jsapi-util: Rewrite argument counting logic (1.87 KB, patch)
2013-01-02 23:03 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
jsapi-util: Add a maybe prefix flag for gjs_parse_args (3.84 KB, patch)
2013-01-02 23:03 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
system: Add a wrapper for JS_DumpHeap (3.86 KB, patch)
2013-01-02 23:03 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
configure: Remove HAVE_JS_CLASS_TRACE gunk (1.38 KB, patch)
2013-01-03 22:22 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review

Description Jasper St. Pierre (not reading bugmail) 2013-01-02 23:03:20 UTC
This is designed to be used by JS code to help debug GC cycles
and other such issues.
Comment 1 Jasper St. Pierre (not reading bugmail) 2013-01-02 23:03:22 UTC
Created attachment 232591 [details] [review]
configure: Remove CLASS_TRACE gunk

This was removed when we added support for js187, and
was broken anyway.
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-01-02 23:03:24 UTC
Created attachment 232592 [details] [review]
configure: Move useless echo lines

JS_CFLAGS and JS_LIBS don't exist
Comment 3 Jasper St. Pierre (not reading bugmail) 2013-01-02 23:03:26 UTC
Created attachment 232593 [details] [review]
jsapi-util: Rewrite argument counting logic

We're going to need this for maybe args, so let's clean up
the code now.
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-01-02 23:03:28 UTC
Created attachment 232594 [details] [review]
jsapi-util: Add a maybe prefix flag for gjs_parse_args

This allows users to have "maybe" values where the C value
is treated as NULL.
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-01-02 23:03:30 UTC
Created attachment 232595 [details] [review]
system: Add a wrapper for JS_DumpHeap

If JS was compiled with debug information, it will have
JS_DumpHeap among others, which provide valuable debugging insight.
Comment 6 Giovanni Campagna 2013-01-03 00:31:52 UTC
Review of attachment 232595 [details] [review]:

::: gjs/jsapi-private.cpp
@@ +48,3 @@
+#undef ADDED_DEBUG
+#endif /* HAVE_JS_DUMPHEAP */
+

Why do you need this dance inside jsapi-private.cpp?
Comment 7 Giovanni Campagna 2013-01-03 00:39:36 UTC
Review of attachment 232591 [details] [review]:

JS_CLASS_TRACE and JS_MARK_IS_TRACE are still needed on js185.
Comment 8 Giovanni Campagna 2013-01-03 00:39:52 UTC
Review of attachment 232592 [details] [review]:

Yes.
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-01-03 00:39:53 UTC
Review of attachment 232595 [details] [review]:

::: gjs/jsapi-private.cpp
@@ +48,3 @@
+#undef ADDED_DEBUG
+#endif /* HAVE_JS_DUMPHEAP */
+

Because it fails to compile without it.

I'd love to not do the dance, but I'm not sure of a better way to do it.
Comment 10 Giovanni Campagna 2013-01-03 00:40:51 UTC
Review of attachment 232593 [details] [review]:

Ok
Comment 11 Jasper St. Pierre (not reading bugmail) 2013-01-03 00:41:51 UTC
Review of attachment 232591 [details] [review]:

Except we never use HAVE_JS_CLASS_TRACE. And if you look in your log files, the answer is always "no" because it can't find jsapi.h because this is ran before the CFLAGS are around.

The commit message is wrong, though.
Comment 12 Giovanni Campagna 2013-01-03 00:42:54 UTC
Review of attachment 232594 [details] [review]:

Ok

(gettext needs to die, replaced with JS and introspection. I have a patch somewhere...)
Comment 13 Jasper St. Pierre (not reading bugmail) 2013-01-03 22:22:40 UTC
Created attachment 232686 [details] [review]
configure: Remove HAVE_JS_CLASS_TRACE gunk

This is unused and was broken, as it didn't have the correct
CFLAGS, leading to a "jsapi.h is not found" error.



Fixed up commit message. Re-review?
Comment 14 Jasper St. Pierre (not reading bugmail) 2013-01-04 22:09:11 UTC
Attachment 232592 [details] pushed as 1738678 - configure: Move useless echo lines
Attachment 232593 [details] pushed as 86b380d - jsapi-util: Rewrite argument counting logic
Attachment 232594 [details] pushed as ef4e523 - jsapi-util: Add a maybe prefix flag for gjs_parse_args
Comment 15 Colin Walters 2013-01-08 23:18:12 UTC
Review of attachment 232595 [details] [review]:

Two minor things, but feel free to commit just addressing the first.

::: configure.ac
@@ +115,3 @@
+    [have_js_dumpheap=no])
+
+if test "x$have_js_dumpheap" = xyes; then

Use AS_IF() here.

::: modules/system.c
@@ +113,3 @@
+    JSObject *target_obj;
+    if (!gjs_parse_args(context, "dumpHeap", "?o", argc, argv, "object", &target_obj))
+        return JS_FALSE;

Seems like it'd be nice to support redirecting to a filename and not just stderr.
Comment 16 Jasper St. Pierre (not reading bugmail) 2013-07-19 20:11:47 UTC
This is complicated, and it's not going to work.