-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow debug builds #494
Allow debug builds #494
Conversation
5f2d4a5
to
95edec1
Compare
388b7d8
to
1cd6160
Compare
051940f
to
a73398b
Compare
shouldn't we add --enable-debug param to zcutil/build-mac.sh to activate debug build? |
let's also put CXXFLAGS value in quotes (instead of apostrophes) in build-mac.sh to fix incorrect |
I added --enable-debug to configure params and did a rebuild. Now I can access to all variables under lldb. This is wonderful! (previously most of vars were not accessible due to optimisation).
This occurs because of calling mutex in CAddrMan::Clear() from the constructor CAddrMan::CAddrMan() for static addrman. To fix this I suggest removing Clear() call from the CAddrMan::CAddrMan() and call it inside AppInit2(): dimxy@b4fdd3c |
Good question. The So the questions become:
My opinion: We should examine all asserts and switch them to exceptions if they should exists beyond the development phase. With the asserts fixed, |
Fixed the single/double quote issue. I am testing that now. It is in there twice due to the difference between CPPFLAGS and CXXFLAGS. If we remove it from one, there is a small chance that either C or C++ programs will be compiled without the flags we desire. While most scripts combine CPPFLAGS and CXXFLAGS, I would guess some do not. So I recommend leaving them both in there. If you wish to only put them in one, let me know and I'll happily do so. |
I wonder why this was not caught earlier. Thanks. The constructor does not need the lock, so calling a private function that does not lock. What do you think? See my fix in 8618e6e |
I think --enable-debug is needed first of all to switch off optimisation which hides variables in the debugger
I can also see that --enable-debug seems to not affect the NDEBUG def (disabling asserts) and I do not see we use the DEBUG def somewhere |
That is done in the individual platform configuration files. See
I was confusing -DDEBUG with -DNDEBUG. Thanks for fixing my head. |
does this mean executables will be always built with no optimisation and with most debug info (-g3)? I thought it would be good if we have optimisation on and only some debug info when enable-debug=no and no opt and full debug info if yes |
As it stands with the latest commit 20e90c6 default optimizations are set at 3 on Linux, 1 on Mac. I am not sure why mac is different. It may benefit us performance-wise to up that. According to the In the latest commit I have modified things so that if you run the script in zcutil on Linux or MacOS with --enable-debugging, optimization is turned off, and debugging information is turned on. Previously, I was using As for including debug information in the executables, we can certainly do that. We can include debugging information globally (modify the .mk), or only certain libraries/executables (modify the appropriate Makefile.am).
|
yes I really like this
I think we need some debug info in release executables (to diagnose crashes) and I could see the basic option was '-g' (and seems the same is in the bitcoin sources https://github.com/bitcoin/bitcoin/blob/807169e10b4a18324356ed6ee4d69587b96a7c70/configure.ac#L357) |
I tried to build with enable-debugging and in the output it is printed:
I think is because in the configure.ac the 'enable-debug' option is checked and you changed it to 'enable-debugging' |
507a8d7
to
8ac9778
Compare
Fixed. --enable-debug is now the standard across the project. The latest commit fixes the inaccurate output. |
PR #464 seems to have had problems during the merge. This PR fixes that.
Also fixes #492