Can't compile release 2.1.1 with debug option #14714

Open
goganchic opened this Issue Dec 21, 2016 · 17 comments

Projects

None yet

2 participants

@goganchic
goganchic commented Dec 21, 2016 edited

Centos 7 x86_64

git clone https://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 2.1.1
git submodule init
git submodule update
./build.py -d
./bin/phantomjs
1 + 1
ctrl-d
LEAK: 12 WebCoreNode <-- error

If i compile phantomjs without -d - everything works.

@goganchic goganchic changed the title from branch 2.1 do not work with -d option to Can't compile release 2.1.1 with debug option Dec 21, 2016
@Vitallium
Collaborator

Sorry, could you please elaborate? What are you trying to do?

@goganchic
goganchic commented Dec 21, 2016 edited

I want to debug #14713. So I need debug version of phantom.js, but unfortunately it does not work :(
Maybe there is something I'm missing?

@Vitallium
Collaborator
Vitallium commented Dec 21, 2016 edited

@goganchic what do you mean by it doesn't work? You just need to build it with --debug option enabled.

@goganchic

@Vitallium I've built phantomjs with -d option (I think it's an equivalent of --debug). I'm trying to run simple test script with recently build binary:

$ cat test.js
var x = 1 + 2;
console.log(x);
phantom.exit(0);
$ ./phantomjs test.js
ASSERTION FAILED: url == m_string
platform/KURL.cpp(334) : WebCore::KURL::KURL(WebCore::ParsedURLStringTag, const WTF::String&)
1   0x1f99692 ./phantomjs() [0x1f99692]
2   0xc470d0 ./phantomjs() [0xc470d0]
3   0x1a8e470 ./phantomjs() [0x1a8e470]
4   0x1a8e361 ./phantomjs() [0x1a8e361]
5   0x1a864e1 ./phantomjs() [0x1a864e1]
6   0x9a4743 ./phantomjs() [0x9a4743]
7   0xd496be ./phantomjs() [0xd496be]
8   0x1a816ec ./phantomjs() [0x1a816ec]
9   0xa70160 ./phantomjs() [0xa70160]
10  0xa701c9 ./phantomjs() [0xa701c9]
11  0xa61670 ./phantomjs() [0xa61670]
12  0x848fbf ./phantomjs() [0x848fbf]
13  0xa61517 ./phantomjs() [0xa61517]
14  0xa61a9b ./phantomjs() [0xa61a9b]
15  0xa61412 ./phantomjs() [0xa61412]
16  0xa60cad ./phantomjs() [0xa60cad]
17  0xa5fd41 ./phantomjs() [0xa5fd41]
18  0xa5fdc7 ./phantomjs() [0xa5fdc7]
19  0xa64471 ./phantomjs() [0xa64471]
20  0xa807d6 ./phantomjs() [0xa807d6]
21  0xa83492 ./phantomjs() [0xa83492]
22  0xa82931 ./phantomjs() [0xa82931]
23  0xa9cfff ./phantomjs() [0xa9cfff]
24  0xa9e08b ./phantomjs() [0xa9e08b]
25  0x845f9c ./phantomjs() [0x845f9c]
26  0x84c343 ./phantomjs() [0x84c343]
27  0xa9d967 ./phantomjs() [0xa9d967]
28  0xa7d169 ./phantomjs() [0xa7d169]
29  0xa7cbda ./phantomjs() [0xa7cbda]
30  0xa7c75c ./phantomjs() [0xa7c75c]
31  0x864b7a ./phantomjs() [0x864b7a]
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
Segmentation fault (core dumped)

If I start this script with phantomjs which was built without -d option - everything works fine.

@Vitallium
Collaborator
Vitallium commented Dec 21, 2016 edited

@goganchic ah, yes. In the old PJS you need to comment out that assert.
You can find it here: https://github.com/Vitallium/qtwebkit/blob/e7b74331d695bfa8b77e39cdc50fc2d84a49a22a/Source/WebCore/platform/KURL.cpp#L334

But you also can build WebKit with asserts disabled by passing ASSERT_DISABLED option

@goganchic

@Vitallium thanks a lot! Can you please tell me is there some more assets which I should comment? And one more question: what does this message in the end of phantomjs output mean LEAK: 12 WebCoreNode?

@Vitallium
Collaborator
Vitallium commented Dec 21, 2016 edited

AFAIR this is the only assert.

And one more question: what does this message in the end of phantomjs output mean LEAK: 12 WebCoreNode?

That means destructor wasn't called for these WebCoreNodes. You can ignore it. That's fine.

@goganchic
goganchic commented Dec 21, 2016 edited

@Vitallium thanks for information! And may be you know how can I build phantomjs from master branch? There is no build.py or Makefile or something else and no submodules with dependencies.

@Vitallium
Collaborator
Vitallium commented Dec 21, 2016 edited

@goganchic it's pretty simple:

  • build new QtWebKit
  • build PJS from master as a regular qmake project
@goganchic

@Vitallium ok, thanks!

@goganchic
goganchic commented Dec 21, 2016 edited

@Vitallium one more fail

ASSERTION FAILED: leftSide->category() != CalcOther && rightSide->category() != CalcOther
css/CSSCalculationValue.cpp(290) : static WTF::PassRefPtr<WebCore::CSSCalcBinaryOperation> WebCore::CSSCalcBinaryOperation::create(WTF::PassRefPtr<WebCore::CSSCalcExpressionNode>, WTF::PassRefPtr<WebCore::CSSCalcExpressionNode>, WebCore::CalcOperator)

Should I comment something more?

@Vitallium
Collaborator
Vitallium commented Dec 21, 2016 edited

@goganchic no (but you can comment this assert out). Debug mode means that all asserts in WebKit will be enabled. And there are a lot of asserts :-)

@goganchic

@Vitallium ok, how can I set ASSERT_DISABLED option? ./build.py --webkit-qmake-args ASSERT_DISABLED -d ?

@goganchic

./build.py --webkit-qmake-args DEFINES+=ASSERT_DISABLED -d

@goganchic

do not work :(

@goganchic

@Vitallium can you please tell me what should I do exactly to add debug info but disable assertions in webkit?

@goganchic
goganchic commented Dec 22, 2016 edited

such diff worked for me:

diff --git a/Source/WTF/wtf/Assertions.h b/Source/WTF/wtf/Assertions.h
index b26fa36..7940004 100644
--- a/Source/WTF/wtf/Assertions.h
+++ b/Source/WTF/wtf/Assertions.h
@@ -48,7 +48,7 @@
 /* Disable ASSERT* macros in release mode. */
 #define ASSERTIONS_DISABLED_DEFAULT 1
 #else
-#define ASSERTIONS_DISABLED_DEFAULT 0
+#define ASSERTIONS_DISABLED_DEFAULT 1
 #endif

 #ifndef BACKTRACE_DISABLED
diff --git a/Source/WebCore/rendering/InlineBox.cpp b/Source/WebCore/rendering/InlineBox.cpp
index 883490b..5dad2b0 100644
--- a/Source/WebCore/rendering/InlineBox.cpp
+++ b/Source/WebCore/rendering/InlineBox.cpp
@@ -49,7 +49,7 @@ struct SameSizeAsInlineBox {
 #endif
 };

-COMPILE_ASSERT(sizeof(InlineBox) == sizeof(SameSizeAsInlineBox), InlineBox_size_guard);
+// COMPILE_ASSERT(sizeof(InlineBox) == sizeof(SameSizeAsInlineBox), InlineBox_size_guard);

 #if !ASSERT_DISABLED
 static bool inInlineBoxDetach;
diff --git a/Source/WebCore/rendering/InlineBox.h b/Source/WebCore/rendering/InlineBox.h
index 2f480c8..5ef1a41 100644
--- a/Source/WebCore/rendering/InlineBox.h
+++ b/Source/WebCore/rendering/InlineBox.h
@@ -272,7 +272,7 @@ public:
     // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system.
     virtual float placeEllipsisBox(bool ltr, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool&);

-#if !ASSERT_DISABLED
+#if !NDEBUG
     void setHasBadParent();
 #endif

@@ -415,7 +415,7 @@ protected:
     // For InlineFlowBox and InlineTextBox
     bool extracted() const { return m_bitfields.extracted(); }

-#if !ASSERT_DISABLED
+#if !NDEBUG
 private:
     bool m_hasBadParent;
 #endif
@@ -427,7 +427,7 @@ inline InlineBox::~InlineBox()
 }
 #endif

-#if !ASSERT_DISABLED
+#if !NDEBUG
 inline void InlineBox::setHasBadParent()
 {
     m_hasBadParent = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment