Linux - Debug {Split}
Moderator: Community Managers
- Blackstorm
- Retired
- Posts: 354
- Joined: Thu Sep 04, 2014 11:11 am
- Location: Paris, FRANCE
- Contact:
Linux - Debug {Split}
Microsoft rules to compile 32 and 64bits plateforms.
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
On Linux 64 you are using gcc with x64 libs by default. On windows the default compiler type should be in 32bits.
I'am not sure the link is useful for the question but can help ^^
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
On Linux 64 you are using gcc with x64 libs by default. On windows the default compiler type should be in 32bits.
I'am not sure the link is useful for the question but can help ^^
- John Adams
- Retired
- Posts: 4581
- Joined: Wed Aug 28, 2013 9:40 am
- Location: Phoenix, AZ.
- Contact:
Re: Peer Code Reviews
Black, since you manage our "makefile", is there a flag in there for DEBUG? And, what is the effect if we remove it? ie., no more gdb debugging on linux, etc
- Blackstorm
- Retired
- Posts: 354
- Joined: Thu Sep 04, 2014 11:11 am
- Location: Paris, FRANCE
- Contact:
Re: Peer Code Reviews
John,
I know in the make file we have a VG_DEBUG flag, but i don't know if we have a compiler debug flag value.
I am checking.
Edit: We have a -g arg into the WFLAGS the should be used to generate some debug.
edit2:
also i see this thread : http://stackoverflow.com/questions/1047 ... difference
maybe we should replace -g by -ggdb to improve the compatibility and the output msg (it's say: gdb can use the -g but i think it's not espacialy for it and we recommend to use gdb for vg debug ^^)
edit3:
ok, so, with gcc, you have not really a "release" or a "debug" mode (http://stackoverflow.com/questions/1534 ... ons-in-gcc)
it's depend of what optimizations are used.
see : https://gcc.gnu.org/onlinedocs/gcc/Opti ... tions.html
Actually we are running gcc with the simple -O optimization and -g (should be equivalent to "debug" VS mode), and that should be -02 -s -DNDEBUG for an equivalent of "Release" VS optimization.
(see the 2nd answer)
edit4:
i've tried to compile on linux vg_world with the optimized (-02 -s -DNDEBUG) options. I have no problem.
Of course, if we remove all debug info from the compiler, we will have an optimized and light binary, but we have no more debug.
An intermediate case should be : -02 -ggdb
so you have some optimizations and gdb debug (with all symbols)
I know in the make file we have a VG_DEBUG flag, but i don't know if we have a compiler debug flag value.
I am checking.
Edit: We have a -g arg into the WFLAGS the should be used to generate some debug.
Code: Select all
-g
Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2). GDB can work with this debugging information.
On most systems that use stabs format, -g enables use of extra debugging information that only GDB can use; this extra information makes debugging work better in GDB but probably makes other debuggers crash or refuse to read the program. If you want to control for certain whether to generate the extra information, use -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
GCC allows you to use -g with -O. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values are already at hand; some statements may execute in different places because they have been moved out of loops.
Nevertheless it proves possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have bugs.
The following options are useful when GCC is generated with the capability for more than one debugging format.
also i see this thread : http://stackoverflow.com/questions/1047 ... difference
maybe we should replace -g by -ggdb to improve the compatibility and the output msg (it's say: gdb can use the -g but i think it's not espacialy for it and we recommend to use gdb for vg debug ^^)
edit3:
ok, so, with gcc, you have not really a "release" or a "debug" mode (http://stackoverflow.com/questions/1534 ... ons-in-gcc)
it's depend of what optimizations are used.
see : https://gcc.gnu.org/onlinedocs/gcc/Opti ... tions.html
Actually we are running gcc with the simple -O optimization and -g (should be equivalent to "debug" VS mode), and that should be -02 -s -DNDEBUG for an equivalent of "Release" VS optimization.
(see the 2nd answer)
edit4:
i've tried to compile on linux vg_world with the optimized (-02 -s -DNDEBUG) options. I have no problem.
Of course, if we remove all debug info from the compiler, we will have an optimized and light binary, but we have no more debug.
An intermediate case should be : -02 -ggdb
so you have some optimizations and gdb debug (with all symbols)
- John Adams
- Retired
- Posts: 4581
- Joined: Wed Aug 28, 2013 9:40 am
- Location: Phoenix, AZ.
- Contact:
Re: Peer Code Reviews
Perfect answer, Black. Thank you for looking at that. I was mostly curious if we needed to maintain a 2nd makefile for "optimized" mode; it would be important to see our performance as we go because I never trust Debug to be a good measure.
I will look into the Release (non-debug) of VS2012 as well. I think it's time to come out of hiding.
I will look into the Release (non-debug) of VS2012 as well. I think it's time to come out of hiding.
- Blackstorm
- Retired
- Posts: 354
- Joined: Thu Sep 04, 2014 11:11 am
- Location: Paris, FRANCE
- Contact:
Re: Peer Code Reviews
on Linux the make file can be modified to use : "make debug" like you use "make clean", so in place of "release" vars the process will use the "debug" vars.
So we will have only one make file to manage ^^ i can make these modifications if wanted.
So we will have only one make file to manage ^^ i can make these modifications if wanted.
- John Adams
- Retired
- Posts: 4581
- Joined: Wed Aug 28, 2013 9:40 am
- Location: Phoenix, AZ.
- Contact:
Re: Peer Code Reviews
Sure, let's do it for our Linux friends. Please make the default "debug" though, meaning if I just type "make -j8" like I do now, it will compile Debug.
I assume if I wanted, I could then type "make release -j8" to make the release binary.
I assume if I wanted, I could then type "make release -j8" to make the release binary.
- Blackstorm
- Retired
- Posts: 354
- Joined: Thu Sep 04, 2014 11:11 am
- Location: Paris, FRANCE
- Contact:
Re: Linux - Debug {Split}
done, i will update the svn just with that file. I just need some minutes to cleanup my own Makefile.. because...
edit: updated. John, can you try it on Ubuntu please and tell me if these args are good for you ?
[quote]Linux:
- New Makefile to manage Debug and Release builds.
syntax:
make (debug build: -O -ggdb)
make debug (debug build: -O -ggdb)
make release (release build: -O2 -s -DNDEBUG)[/quote]
edit: updated. John, can you try it on Ubuntu please and tell me if these args are good for you ?
[quote]Linux:
- New Makefile to manage Debug and Release builds.
syntax:
make (debug build: -O -ggdb)
make debug (debug build: -O -ggdb)
make release (release build: -O2 -s -DNDEBUG)[/quote]
- Blackstorm
- Retired
- Posts: 354
- Joined: Thu Sep 04, 2014 11:11 am
- Location: Paris, FRANCE
- Contact:
Re: Linux - Debug {Split}
added a fix to use the args into the subfunctions.
i.e: make release -j8
i.e: make release -j8
- John Adams
- Retired
- Posts: 4581
- Joined: Wed Aug 28, 2013 9:40 am
- Location: Phoenix, AZ.
- Contact:
Re: Linux - Debug {Split}
Take 2, decided to try them all for you First response:
On Unbuntu, my "make release -j8" compiled using -DVG_DEBUG still.
I see -DNDEBUG in there.
"release" binary size
Debug compile:
Debug size:
So yes, I do believe it is correct. The VG_DEBUG is just our preprocessor for use in the code, and not about "Debug Mode" at all.
On Unbuntu, my "make release -j8" compiled using -DVG_DEBUG still.
Code: Select all
g++ -c `mysql_config --cflags` -march=native -pipe -pthread -O2 -s -DNDEBUG -std=c++0x -Wall -Wno-reorder -DVG_WORLD -DVG_DEBUG -D_GNU_SOURCE SpawnUtil.cpp -o SpawnUtil.o
"release" binary size
2540344 Jul 31 19:25 vgemu-world
Debug compile:
Code: Select all
g++ -c `mysql_config --cflags` -march=native -pipe -pthread -O -ggdb -std=c++0x -Wall -Wno-reorder -DVG_WORLD -DVG_DEBUG -D_GNU_SOURCE SpawnUtil.cpp -o SpawnUtil.o
44094335 Jul 31 19:29 vgemu-world
So yes, I do believe it is correct. The VG_DEBUG is just our preprocessor for use in the code, and not about "Debug Mode" at all.
- Blackstorm
- Retired
- Posts: 354
- Joined: Thu Sep 04, 2014 11:11 am
- Location: Paris, FRANCE
- Contact:
Re: Linux - Debug {Split}
[quote="John Adams"]
I see -DNDEBUG in there.
[/quote]
"you'll build the Release CFLAGS version where optimization is turned on (-O2), debugging symbols stripped (-s) and assertions disabled (-DNDEBUG)."
I see -DNDEBUG in there.
[/quote]
"you'll build the Release CFLAGS version where optimization is turned on (-O2), debugging symbols stripped (-s) and assertions disabled (-DNDEBUG)."