Discussion:
[LyX/master] print callstack on assert
Richard Heck
2014-08-27 22:20:30 UTC
Permalink
On 08/27/2014 01:52 PM, Peter Kümmel wrote:
> commit ada262a78b2ec12e9697783b27523b8c13b51066
> Author: Peter Kümmel <***@lyx.org>
> Date: Wed Aug 27 19:40:40 2014 +0200
>
> print callstack on assert
>
> diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
> index 281330e..fa2ffb0 100644
> --- a/src/support/lassert.cpp
> +++ b/src/support/lassert.cpp
> @@ -10,6 +10,7 @@
> */
>
> #include <config.h>
> +#include <lassert.h>
>
> #include "support/convert.h"
> #include "support/debug.h"
> @@ -35,13 +36,21 @@ namespace lyx {
> using namespace std;
> using namespace support;
>
> -// TODO Should we try to print the call stack in the course of these?
> +
> +void doAssertWithCallstack(bool value)
> +{
> + if (!value) {
> + printCallStack();
> + BOOST_ASSERT(false);
> + }
> +}
> +
>

What about:

printCallStack();
BOOST_ASSERT(value);

It seems worth printing the call stack whether we are going to abort or not.

Richard
Peter Kümmel
2014-08-28 07:19:39 UTC
Permalink
On 28.08.2014 00:20, Richard Heck wrote:
> On 08/27/2014 01:52 PM, Peter Kümmel wrote:
>> commit ada262a78b2ec12e9697783b27523b8c13b51066
>> Author: Peter Kümmel <***@lyx.org>
>> Date: Wed Aug 27 19:40:40 2014 +0200
>>
>> print callstack on assert
>>
>> diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
>> index 281330e..fa2ffb0 100644
>> --- a/src/support/lassert.cpp
>> +++ b/src/support/lassert.cpp
>> @@ -10,6 +10,7 @@
>> */
>> #include <config.h>
>> +#include <lassert.h>
>> #include "support/convert.h"
>> #include "support/debug.h"
>> @@ -35,13 +36,21 @@ namespace lyx {
>> using namespace std;
>> using namespace support;
>> -// TODO Should we try to print the call stack in the course of these?
>> +
>> +void doAssertWithCallstack(bool value)
>> +{
>> + if (!value) {
>> + printCallStack();
>> + BOOST_ASSERT(false);
>> + }
>> +}
>> +
>
> What about:
>
> printCallStack();
> BOOST_ASSERT(value);
>
> It seems worth printing the call stack whether we are going to abort or not.
>
> Richard
>
>

Doesn't this produce too much noise for all the "true" cases? (it is declared in assert.h ATM)

But feel free to change it to your needs.


Is it still a cmake-build only feature?

Peter
Richard Heck
2014-08-28 15:31:06 UTC
Permalink
On 08/28/2014 03:19 AM, Peter Kümmel wrote:
> On 28.08.2014 00:20, Richard Heck wrote:
>> On 08/27/2014 01:52 PM, Peter Kümmel wrote:
>>> commit ada262a78b2ec12e9697783b27523b8c13b51066
>>> Author: Peter Kümmel <***@lyx.org>
>>> Date: Wed Aug 27 19:40:40 2014 +0200
>>>
>>> print callstack on assert
>>>
>>> diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
>>> index 281330e..fa2ffb0 100644
>>> --- a/src/support/lassert.cpp
>>> +++ b/src/support/lassert.cpp
>>> @@ -10,6 +10,7 @@
>>> */
>>> #include <config.h>
>>> +#include <lassert.h>
>>> #include "support/convert.h"
>>> #include "support/debug.h"
>>> @@ -35,13 +36,21 @@ namespace lyx {
>>> using namespace std;
>>> using namespace support;
>>> -// TODO Should we try to print the call stack in the course of these?
>>> +
>>> +void doAssertWithCallstack(bool value)
>>> +{
>>> + if (!value) {
>>> + printCallStack();
>>> + BOOST_ASSERT(false);
>>> + }
>>> +}
>>> +
>>
>> What about:
>>
>> printCallStack();
>> BOOST_ASSERT(value);
>>
>> It seems worth printing the call stack whether we are going to abort
>> or not.
>>
>> Richard
>>
>>
>
> Doesn't this produce too much noise for all the "true" cases? (it is
> declared in assert.h ATM)

Oh, I see. Never mind then.

> Is it still a cmake-build only feature?

No idea.

rh
Kornel Benko
2014-08-28 17:12:27 UTC
Permalink
Am Donnerstag, 28. August 2014 um 11:31:06, schrieb Richard Heck <***@lyx.org>
> On 08/28/2014 03:19 AM, Peter KÃŒmmel wrote:
> > On 28.08.2014 00:20, Richard Heck wrote:
> >> On 08/27/2014 01:52 PM, Peter KÃŒmmel wrote:
> >>> commit ada262a78b2ec12e9697783b27523b8c13b51066
> >>> Author: Peter KÃŒmmel <***@lyx.org>
> >>> Date: Wed Aug 27 19:40:40 2014 +0200
> >>>
> >>> print callstack on assert
> >>>
> >>> diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
> >>> index 281330e..fa2ffb0 100644
> >>> --- a/src/support/lassert.cpp
> >>> +++ b/src/support/lassert.cpp
> >>> @@ -10,6 +10,7 @@
> >>> */
> >>> #include <config.h>
> >>> +#include <lassert.h>
> >>> #include "support/convert.h"
> >>> #include "support/debug.h"
> >>> @@ -35,13 +36,21 @@ namespace lyx {
> >>> using namespace std;
> >>> using namespace support;
> >>> -// TODO Should we try to print the call stack in the course of these?
> >>> +
> >>> +void doAssertWithCallstack(bool value)
> >>> +{
> >>> + if (!value) {
> >>> + printCallStack();
> >>> + BOOST_ASSERT(false);
> >>> + }
> >>> +}
> >>> +
> >>
> >> What about:
> >>
> >> printCallStack();
> >> BOOST_ASSERT(value);
> >>
> >> It seems worth printing the call stack whether we are going to abort
> >> or not.
> >>
> >> Richard
> >>
> >>
> >
> > Doesn't this produce too much noise for all the "true" cases? (it is
> > declared in assert.h ATM)
>
> Oh, I see. Never mind then.
>
> > Is it still a cmake-build only feature?
>
> No idea.
>
> rh

There are no traces of LYX_CALLSTACK_PRINTING in automake files.

Kornel
Peter Kuemmel
2014-08-29 06:02:20 UTC
Permalink
It's Friday:

>
> There are no traces of LYX_CALLSTACK_PRINTING in automake files.

Not important, automake will be dropped anyway ;)

>
> Kornel
Stephan Witt
2014-08-29 06:13:08 UTC
Permalink
Am 29.08.2014 um 08:02 schrieb Peter Kuemmel <***@gmx.net>:

> It's Friday:
>
>>
>> There are no traces of LYX_CALLSTACK_PRINTING in automake files.
>
> Not important, automake will be dropped anyway ;)

So, you're working on a cmake way to produce Mac packages? When is it finished? ;)

Stephan
Peter Kuemmel
2014-08-29 06:28:22 UTC
Permalink
>
> > It's Friday:
> >
> >>
> >> There are no traces of LYX_CALLSTACK_PRINTING in automake files.
> >
> > Not important, automake will be dropped anyway ;)
>
> So, you're working on a cmake way to produce Mac packages? When is it finished? ;)

Isn't the package created by a bash script after building?
Or is the cmake-build broken on Mac?

>
> Stephan
Stephan Witt
2014-09-17 12:37:18 UTC
Permalink
Am 29.08.2014 um 08:28 schrieb Peter Kuemmel <***@gmx.net>:

>>
>>> It's Friday:
>>>
>>>>
>>>> There are no traces of LYX_CALLSTACK_PRINTING in automake files.
>>>
>>> Not important, automake will be dropped anyway ;)
>>
>> So, you're working on a cmake way to produce Mac packages? When is it finished? ;)
>
> Isn't the package created by a bash script after building?
> Or is the cmake-build broken on Mac?

Sorry, I've missed your reply.

I'm using the cmake-generator to produce a Xcode project.
I didn't know what command line parameters I have to pass to cmake
and xcodebuild to build a reasonable LyX package.

This is what I've tried:

$ cmake ... -DLYX_INSTALL_PREFIX=/Users/Shared/LyX/cmake/LyX-2.2 -DLYX_DMG=ON
$ xcodebuild -project lyx-build/cmake/2.2.0dev/LyX.xcodeproj -target install

After this I have a working LyX2.2.app in /Users/Shared/LyX/cmake/LyX-2.2 but
cannot find any disk image.

$ xcodebuild -project lyx-build/cmake/2.2.0dev/LyX.xcodeproj -target package

looks better. I get a LyX22-2.2.0-Darwin.dmg inside install dir. It opens with
a english GNU GPL disclaimer and if I agree with it I'm able to start the LyX app.

Not that bad, but not production ready, I'd say. E.g. if I don't agree but do
something else I'm unable to open the disk image again. The GPL query isn't shown
anymore and there is no possibility to agree or disagree. The disk image isn't
usable anymore…

Stephan
Peter Kuemmel
2014-09-18 11:06:17 UTC
Permalink
> > Isn't the package created by a bash script after building?
> > Or is the cmake-build broken on Mac?
>
> Sorry, I've missed your reply.
>
> I'm using the cmake-generator to produce a Xcode project.

I would use make (-G"Unix Makefiles") just to build the binaries
and then use the script you also use with autotools.

Only if this works we could try to completely generate the dmg with cmake.

Peter

> I didn't know what command line parameters I have to pass to cmake
> and xcodebuild to build a reasonable LyX package.
>
> This is what I've tried:
>
> $ cmake ... -DLYX_INSTALL_PREFIX=/Users/Shared/LyX/cmake/LyX-2.2 -DLYX_DMG=ON
> $ xcodebuild -project lyx-build/cmake/2.2.0dev/LyX.xcodeproj -target install
>
> After this I have a working LyX2.2.app in /Users/Shared/LyX/cmake/LyX-2.2 but
> cannot find any disk image.
>
> $ xcodebuild -project lyx-build/cmake/2.2.0dev/LyX.xcodeproj -target package
>
> looks better. I get a LyX22-2.2.0-Darwin.dmg inside install dir. It opens with
> a english GNU GPL disclaimer and if I agree with it I'm able to start the LyX app.
>
> Not that bad, but not production ready, I'd say. E.g. if I don't agree but do
> something else I'm unable to open the disk image again. The GPL query isn't shown
> anymore and there is no possibility to agree or disagree. The disk image isn't
> usable anymore…
>
> Stephan
Benjamin Piwowarski
2014-09-18 14:22:17 UTC
Permalink
Hi,

I did work on the cmake bundling issue, but stopped since the CMake disk image builder is not working that well
 I think the best would be to adapt the existing script to build a disk image directly, depending on the install target.

Benjamin

From: Peter Kuemmel <***@gmx.net>
Reply: Peter Kuemmel <***@gmx.net>>
Date: 18 Sep 2014 at 13:06:22
To: lyx-***@lists.lyx.org Devel <lyx-***@lists.lyx.org>>
Subject:  Re: [LyX/master] print callstack on assert

> > Isn't the package created by a bash script after building?
> > Or is the cmake-build broken on Mac?
>
> Sorry, I've missed your reply.
>
> I'm using the cmake-generator to produce a Xcode project.

I would use make (-G"Unix Makefiles") just to build the binaries
and then use the script you also use with autotools.

Only if this works we could try to completely generate the dmg with cmake.

Peter

> I didn't know what command line parameters I have to pass to cmake
> and xcodebuild to build a reasonable LyX package.
>
> This is what I've tried:
>
> $ cmake ... -DLYX_INSTALL_PREFIX=/Users/Shared/LyX/cmake/LyX-2.2 -DLYX_DMG=ON
> $ xcodebuild -project lyx-build/cmake/2.2.0dev/LyX.xcodeproj -target install
>
> After this I have a working LyX2.2.app in /Users/Shared/LyX/cmake/LyX-2.2 but
> cannot find any disk image.
>
> $ xcodebuild -project lyx-build/cmake/2.2.0dev/LyX.xcodeproj -target package
>
> looks better. I get a LyX22-2.2.0-Darwin.dmg inside install dir. It opens with
> a english GNU GPL disclaimer and if I agree with it I'm able to start the LyX app.
>
> Not that bad, but not production ready, I'd say. E.g. if I don't agree but do
> something else I'm unable to open the disk image again. The GPL query isn't shown
> anymore and there is no possibility to agree or disagree. The disk image isn't
> usable anymore

>
> Stephan
Peter Kuemmel
2014-09-18 17:38:23 UTC
Permalink
> I did work on the cmake bundling issue, but stopped since the CMake disk image builder is not working that well…
> I think the best would be to adapt the existing script to build a disk image directly, depending on the install target.
> Benjamin

We could create a target which calls the script with all needed parameters or create such a script with
configure_file() which replaces variables which are set by the user or calculated by cmake.

Peter
Loading...