On 3/26/19 8:10 AM, clipka wrote:
> Am 26.03.2019 um 11:46 schrieb William F Pokorny:
>> Quick additional question. Is it the --enable-debug configure flag
>> that - normally - turns on the pov asserts? I've never verified this
>> assumption of mine by creating a pov assert in the code I know should
> To be honest, I haven't a clue. I'm not sure what the `--enable-debug`
> flag does exactly (it's some standard mechanism in the Automake tools),
> nor whether and how assertions are enabled or disabled in Unix builds.
> I'm pretty sure that `--enable-debug` does enable the creation of debug
> information in the binaries, so that a debugging tool can correlate
> binary code addresses with original source code lines, so that you can
> e.g. set breakpoints and step through the code line by line with a
> debugger. I also wouldn't be surprised if it turns off optimizations by
> default, because those tend to re-order instructions and make a
> line-by-line correlation impossible. Whether it does anything beyond
> that I do not know. It might dictate whether `NDEBUG` is defined or not,
> which would conceivably disable/enable assertions.
Back at it this morning.
First, flipping the file name compare so it's ahead of the file position
compare (and assert) works fine too with all the test cases I have that
Second, on enabling the POV_ASSERT source code mechanism, took the time
to do some full compiles with a known fail assert of 1 == 0 and the
short of it for *nix is doing something like:
./configure COMPILED_BY="wfp__POV_DEBUG" CXXFLAGS="-DPOV_DEBUG"
works. The -D<var> form on the define is added as a compiler flag to do
the POV_DEBUG define, which, turns on the POV asserts that exist in the
code (except I guess where not otherwise controlled or hard-set).
Lastly, on the --enable-debug flag, it is not today defining POV_DEBUG
which is what turns on the POV_ASSERTs. Most of my actual debug compiles
use a configure command like:
./configure COMPILED_BY="wfp" --disable-optimiz --disable-strip \
CXXFLAGS="-Og -ggdb fverbose-asm"
so --enable-debug isn't strictly needed for debugging though on line
documentation I read just now indicates - by default anyway - it does
something equivalent given certain arguments. Looks like you can select
what sort of debugging gets turned on - and you can provide a second
argument defining variables explicitly (ie POV_DEBUG) and there is the
NDEBUG you mentioned (boost seems to use this some) getting set by
default if the flag's argument turns debugging off (or the flag's not
used but enabled?). What some documentation says only; Not sure what
works or not for --enable-debug with our current set up without doing a
bunch of compiles and tests. An investigation for another time. The flag
doesn't control the POV_ASSERTs today via NDEBUG in any case - so at
best it might provide another way to define POV_DEBUG using that second
Post a reply to this message
On 3/28/19 6:49 AM, William F Pokorny wrote:
> On 3/26/19 8:10 AM, clipka wrote:
> Second, on enabling the POV_ASSERT source code mechanism, took the time
> to do some full compiles with a known fail assert of 1 == 0 and the
> short of it for *nix is doing something like:
> ./configure COMPILED_BY="wfp__POV_DEBUG" CXXFLAGS="-DPOV_DEBUG"
With the thought I might help others doing debug by rambling more about
my ignorance/learning while attempting to debug this issue...
Woke up this morning remembering seeing a core file when I did my
POV_ASSERT(1 == 0) test with a compile where POV_DEBUG was really
defined. This got me wondering why I didn't get a core file with initial
failing code here given an assert ran and I did a debug compile. A core
file would have have made it easy to look at the call stack with gdb.
Well, looking at the source code this morning it's because we have this
set up today for the parser related asserts in ./parser/configparser.h :
#define POV_PARSER_DEBUG POV_DEBUG
#define POV_PARSER_ASSERT(expr) POV_ASSERT_HARD(expr)
#define POV_PARSER_ASSERT(expr) POV_ASSERT_SOFT(expr)
I wasn't previously getting POV_DEBUG set so I was getting a soft assert
which parse.cpp catches triggering a more graceful - but less
informative (no core file) - program exit. Trying my debug compile again
just now with POV_DEBUG set, I do get a core file and gdb gives me :
#4 0x000055a82da4b703 in pov_parser::LexemePosition::operator==
o=...) at parser/parsertypes.cpp:62
#5 0x000055a82da40420 in pov_parser::Parser::IsEndOfInvokedMacro
#6 0x000055a82da44dcd in pov_parser::Parser::Get_Token
#7 0x000055a82da05cf7 in pov_parser::Parser::Parse_Frame
#8 0x000055a82da06591 in pov_parser::Parser::Run
#9 0x000055a82d9cb3ef in pov::ParserTask::Run
Today, I'd find my way to IsEndOfInvokedMacro in less than an hour
instead of the full day it took me to trace top down - so to speak.
The lessons I learned: Get POV_DEBUG set in your compile while debugging
any issue. If still no core file generated and tangled in a POV-Ray code
assert, be sure you're getting a hard assert and not a soft one. I
didn't know we had 'soft' POV_ASSERT* version until today.
Post a reply to this message