Open Bug 947669 Opened 11 years ago Updated 2 years ago

install gdb pretty printers for standalone build

Categories

(Core :: JavaScript Engine, defect)

24 Branch
x86_64
Linux
defect

Tracking

()

People

(Reporter: darkxst, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

It would be nice to have the GDB pretty-printers installed for standalone spidermonkey build.

This would require installing a 'libmozjs-24.1.so-gdb.py' wrapper under /usr/share/gdb/auto-load and install the python scripts somewhere as well.

also on Ubuntu atleast gdb runs using python3, so the scripts would need some minor changes to work.
Trying to get the pretty printers running under python3, fixed most of the obvious changes, however

dummy = gdb.Value(0).cast(cache.JSString_ptr_t)

throws

Python Exception <class 'TypeError'> 'gdb.Value' object cannot be interpreted as an integer:

no idea how to fix this ;(
Does GDB support Python 3 now? It didn't last I checked, and there's no mention of Python 3 support in the NEWS file.

> no idea how to fix this ;(

That doesn't look familiar to me, either.
It certainly is using python3 on Ubuntu 13.10 and later, no idea about other distros though.
Attached patch changes required for python3 (obsolete) — Splinter Review
this patch is against js24
Will these patches also work with Python 2.7?

$ /usr/bin/gdb
GNU gdb (GDB) Fedora 7.6.1-46.fc19
...
(gdb) python print sys.version
2.7.5 (default, Nov 12 2013, 16:18:42) 
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)]
(gdb)
Ted, are these build patches the right way to get this done, or can we accomplish the same thing with moz.build?
Flags: needinfo?(ted)
I don't think there's a better way at the moment, which is sort of unfortunate.
Flags: needinfo?(ted)
Jim, The python patch will need to be reworked slightly to work on both python 2 and 3.

The build patch will work with both
Updated python3 patch to maintain compatibilty with python2. 

I am pretty sure this will work, however I don't actually have a machine with gdb/python2 to test it.
Attachment #8344927 - Attachment is obsolete: true
So are these ok to land? I will rebase against m-c if so...

I may also look at adding frame filters sometime before the next standalone release, since we now have a new enough gdb in Ubuntu.
(In reply to darkxst from comment #11)
> So are these ok to land? I will rebase against m-c if so...

You need to flag them for review.
Attachment #8345512 - Flags: review?(jimb)
Attachment #8344975 - Flags: review?(jimb)
have checked and patches apply cleanly against m-c
So this is a good idea in general, however we'll need to work out how to support gdb/python2 and gdb/python3 together; assuming python3 isn't safe, not only because of the version requirements (7.7 and above iirc) but also because even that version might be linked to python2.

I suggest we duplicate this particular portion of the source tree into a python2 and python3 version, if we can't make the code generic enough that it will support both (and even with py3.3 i think that's unlikely)

Thoughts?
Ian, patch 8345512 maintains compatibility with python2 see comment #10. And the install patch is in no way dependant on the version of python.
also python3 support came with 7.6 or perhaps earlier? 7.7 introduced the the new frame-filter api, but adding support for that will be a different bug.
Comment on attachment 8344975 [details] [diff] [review]
mozjs-gdb-install.patch

Review of attachment 8344975 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks very much for the patch; I apologize for dropping the review.

Could you make sure this patch works with the current sources? I think the stand-alone build process is broken at the moment.

::: js/src/Makefile.in
@@ +555,5 @@
> +	$(SYSINSTALL) $^ $(DESTDIR)$(prefix)/share/gdb/auto-load$(libdir)
> +
> +install:: gdb/mozilla
> +	$(SYSINSTALL) $^ $(DESTDIR)$(prefix)/share/mozilla/gdb
> +endif

I think this should be done with the PP_TARGETS and INSTALL_TARGETS variables, as it was done here: 

https://hg.mozilla.org/mozilla-central/file/7f81be7db528/js/src/shell/Makefile.in#l26

The more we can avoid putting shell commands in Makefiles, the easier it is for the folks working on our build system to automatically migrate Makefile contents into moz.build files.

::: js/src/libmozjs-gdb.py.in
@@ +1,1 @@
> +"""GDB Python customization auto-loader for GDB spidermoneky library"""

"SpiderMonkey"

@@ +3,5 @@
> +
> +import sys
> +
> +import os.path
> +sys.path[0:0] = [os.path.join('@autoloaddir@', 'gdb')]

The name "@autoloaddir@" suggests $prefix/share/gdb/auto-load, but this is actually $(prefix)/share/mozilla; that's confusing. Could we call it @mozillasharedir@?
Attachment #8344975 - Flags: review?(jimb)
Comment on attachment 8345512 [details] [diff] [review]
mozjs-gdb-py3-v2.patch

Review of attachment 8345512 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you for the patch! I think this patch was taken care of by bug 1014479.
Attachment #8345512 - Flags: review?(jimb)
I can use  PP_TARGETS and INSTALL_TARGETS however I will still need a shell command to rename the python wrapper, atleast I don't see how that is possible using _TARGETS... 

i.e the template 'libmozjs-gdb.py.in' needs to end up installed as 'libmozjs-34a1.so-gdb.py'
also INSTALL_TARGETS doesn't seem to support installing directories, i.e.

MOZJS_INSTALL_GDB_FILES := gdb/mozilla

creates the folder but doesn’t install the python files in that directory
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: