View unanswered posts

VGOEmulator.net

A Development Project for the Vanguard:Saga of Heroes MMO
It is currently Tue Aug 22, 2017 7:52 am

Linux - Debug {Split}

Help with the Linux x86/x64 versions of the VGOEmulator Server

Moderator: Community Managers

Linux - Debug {Split}

Postby Blackstorm » Fri Jul 31, 2015 6:14 am

Microsoft rules to compile 32 and 64bits plateforms.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa384242(v=vs.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 ^^
User avatar
Blackstorm
Retired
 
Posts: 352
Joined: Thu Sep 04, 2014 11:11 am
Location: Paris, FRANCE

Re: Peer Code Reviews

Postby John Adams » Fri Jul 31, 2015 6:48 am

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
John Adams
Retired
 
Posts: 4555
Joined: Wed Aug 28, 2013 9:40 am
Location: Phoenix, AZ.

Re: Peer Code Reviews

Postby Blackstorm » Fri Jul 31, 2015 8:38 am

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.

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.


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)
User avatar
Blackstorm
Retired
 
Posts: 352
Joined: Thu Sep 04, 2014 11:11 am
Location: Paris, FRANCE

Re: Peer Code Reviews

Postby John Adams » Fri Jul 31, 2015 2:51 pm

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.
John Adams
Retired
 
Posts: 4555
Joined: Wed Aug 28, 2013 9:40 am
Location: Phoenix, AZ.

Re: Peer Code Reviews

Postby Blackstorm » Fri Jul 31, 2015 2:58 pm

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.
User avatar
Blackstorm
Retired
 
Posts: 352
Joined: Thu Sep 04, 2014 11:11 am
Location: Paris, FRANCE

Re: Peer Code Reviews

Postby John Adams » Fri Jul 31, 2015 3:57 pm

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.
John Adams
Retired
 
Posts: 4555
Joined: Wed Aug 28, 2013 9:40 am
Location: Phoenix, AZ.

Re: Linux - Debug {Split}

Postby Blackstorm » Fri Jul 31, 2015 5:09 pm

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 ?

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)
User avatar
Blackstorm
Retired
 
Posts: 352
Joined: Thu Sep 04, 2014 11:11 am
Location: Paris, FRANCE

Re: Linux - Debug {Split}

Postby Blackstorm » Fri Jul 31, 2015 6:03 pm

added a fix to use the args into the subfunctions.
i.e: make release -j8
User avatar
Blackstorm
Retired
 
Posts: 352
Joined: Thu Sep 04, 2014 11:11 am
Location: Paris, FRANCE

Re: Linux - Debug {Split}

Postby John Adams » Fri Jul 31, 2015 7:31 pm

Take 2, decided to try them all for you :) First response:

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

I see -DNDEBUG in there.

"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


Debug size:
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.
John Adams
Retired
 
Posts: 4555
Joined: Wed Aug 28, 2013 9:40 am
Location: Phoenix, AZ.

Re: Linux - Debug {Split}

Postby Blackstorm » Fri Jul 31, 2015 7:49 pm

John Adams wrote:I see -DNDEBUG in there.


"you'll build the Release CFLAGS version where optimization is turned on (-O2), debugging symbols stripped (-s) and assertions disabled (-DNDEBUG)."
User avatar
Blackstorm
Retired
 
Posts: 352
Joined: Thu Sep 04, 2014 11:11 am
Location: Paris, FRANCE


Return to Linux

Who is online

Users browsing this forum: No registered users and 1 guest