Embedding program crashes with JS45.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Embedding program crashes with JS45.

Kent Williams
Source Code here: http://pastebin.com/xR7kkBu3
Stack Backtrace here: http://pastebin.com/hjVkSCEd

The test program is the program from the JSAPI User Guide page, only
modified slightly so that it will compile.
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_User_Guide

It's a weird one, The last sensible place in the source is in
jsscript.h, in ScriptBytecodeHasher::hash.

It calls mozilla::HashBytes, which segfaults at address 0.
--

*Kent Williams*| C++ Developer
*CourseLeaf from Leepfrog Technologies *

/“The Process of Academic Change”
/319-337-3877 | courseleaf.com <http://www.courseleaf.com/>

/This message contains confidential information and is intended only for
the individual named. If you are not the intended recipient of this
transmission or a person responsible for delivering it to the intended
recipient, any disclosure, copying, distribution, or other use of any of
the information in this transmission is strictly prohibited. Please
notify the sender immediately by e-mail if you have received this e-mail
by mistake and delete this e-mail from your system./

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Embedding program crashes with JS45.

Kent Williams
So I got this fixed with help from the people on IRC.

I attach the patch below I don't even understand why it fixes things,
except that it produces the right libraries configured the right way for
me to link statically to the JS library.

Basically, the esr45 tag on github is broken.  There's this stuff I
don't understand that has to do with MOZ_GLUE, and then there's the
libjs_static that isn't in the right place.  To get my stuff linking, I
also have to link to libmozglue.a which you don't have to do in esr38

Will some of this stuff get smoothed out before SpiderMonkey 45 is the
official version?

diff --git a/js/src/configure.in b/js/src/configure.in
index 25b4ae8..6df66b1 100644
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2916,10 +2916,10 @@ dnl
========================================================
  dnl = Enable jemalloc
  dnl ========================================================

-LOCAL_MOZ_MEMORY=1
-MOZ_ARG_DISABLE_BOOL(jemalloc,
-[  --disable-jemalloc       Don't replace memory allocator with jemalloc],
-    LOCAL_MOZ_MEMORY=)
+MOZ_ARG_ENABLE_BOOL(jemalloc,
+[  --enable-jemalloc       Replace the memory allocator with jemalloc.
+                          Consider using JS_USE_CUSTOM_ALLOCATOR when
embedding.],
+    LOCAL_MOZ_MEMORY=1)

  dnl Consult the command-line arguments in stand alone-builds only. In
  dnl non-stand-alone builds, we always use the value of MOZ_MEMORY
inherited from
@@ -2928,16 +2928,20 @@ if test "$JS_STANDALONE"; then
      MOZ_MEMORY=$LOCAL_MOZ_MEMORY
  fi

-case "${OS_TARGET}" in
-Android|WINNT|Darwin)
-  MOZ_GLUE_IN_PROGRAM=
-  ;;
-*)
-  dnl On !Android !Windows !OSX, we only want to link executables
against mozglue
-  MOZ_GLUE_IN_PROGRAM=1
-  AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
-  ;;
-esac
+if test "$DISABLE_SHARED_JS" = "1" ; then
+     MOZ_GLUE_IN_PROGRAM=
+else
+     case "${OS_TARGET}" in
+          Android|WINNT|Darwin)
+                MOZ_GLUE_IN_PROGRAM=
+                ;;
+    *)
+            dnl On !Android !Windows !OSX, we only want to link
executables against mozglue
+          MOZ_GLUE_IN_PROGRAM=1
+          AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
+          ;;
+     esac
+fi

  if test "$MOZ_MEMORY"; then
    AC_DEFINE(MOZ_MEMORY)
diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build
index 58e2db6..37ca8dc 100644
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -6,7 +6,8 @@

  # Build mozglue as a shared lib on Windows, OSX and Android.
  # If this is ever changed, update MOZ_SHARED_MOZGLUE in
browser/installer/Makefile.in
-if CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
+# If JS_STANDALONE, always build as static.
+if CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android') and not
CONFIG['JS_STANDALONE']:
      SharedLibrary('mozglue')
  else:
      Library('mozglue')
@@ -24,13 +25,6 @@ if CONFIG['MOZ_ASAN']:
          'AsanOptions.cpp',
      ]

-if CONFIG['OS_TARGET'] == 'WINNT':
-    DEFFILE = 'mozglue.def'
-    # We'll break the DLL blocklist if we immediately load user32.dll
-    DELAYLOAD_DLLS += [
-        'user32.dll',
-    ]
-
  if not CONFIG['JS_STANDALONE']:

      if CONFIG['MOZ_MEMORY'] and (CONFIG['MOZ_NATIVE_JEMALLOC'] or
FORCE_SHARED_LIB):
@@ -44,6 +38,7 @@ if not CONFIG['JS_STANDALONE']:
          ]

      if CONFIG['OS_TARGET'] == 'WINNT':
+        DEFFILE = 'mozglue.def'
          SOURCES += [
              'WindowsDllBlocklist.cpp',
          ]
@@ -51,6 +46,10 @@ if not CONFIG['JS_STANDALONE']:
          OS_LIBS += [
              'version',
          ]
+        # We'll break the DLL blocklist if we immediately load user32.dll
+        DELAYLOAD_DLLS += [
+            'user32.dll',
+        ]

      if CONFIG['MOZ_NUWA_PROCESS']:
          EXPORTS.ipc += [

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine