473,808 Members | 2,761 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

compilation option (-g) doubt?

Hi,
Is there any way to find out, whether the executable is compiled with
-g option enabled?
ThankX in advace.

Nov 14 '05 #1
5 1529
In article <11************ **********@g14g 2000cwa.googleg roups.com>,
sa************* @gmail.com <sa************ *@gmail.com> wrote:
Is there any way to find out, whether the executable is compiled with
-g option enabled?


The C standard has no knowledge of compile options, so any
answer would have to be system dependant, for the system type
you did not specify.
What's the -g option anyhow? On SGI's IRIX cc compiler,
the -g option has to do with the variety of debugging information
produced, and with whether some optimizations will be allowed even
though they make the debugging information less accurate. The
default for IRIX's cc is -g0 -- so *every* program compiled with
IRIX's cc is "compiled with -g option enabled".

gcc has a suite of -g options, which control what the format of
debugging information is, but the man page talks in terms of
"extra" debugging information. I guess for at least some versions
of gcc, it is meaningful to ask whether the -extra- debugging
information has been included.

One of the items normally included in the output of IRIX's objects is
a copy of the command line argument used for the compilation. This
is especially useful for C++ compilations in order to [automatically]
detect whether a pre-compiled template was compiled with compatable
arguments and so may be reused without having to be regenerated.
Possibly your system has something similar, and possibly your
system provides a non-standard extension such as libdwarf or
libelf to allow you to probe the headers from within a program.
But if you just want a one-shot check, then you may wish to
investigate whether your system supports a program such as
elfdump or dwarfdump, or whether your system has a version of
'nm' that will give up the information. And there's always "strings"
on the executable ;-)
--
Studies show that the average reader ignores 106% of all statistics
they see in .signatures.
Nov 14 '05 #2
sa************* @gmail.com wrote:
Hi,
Is there any way to find out, whether the executable is compiled with
-g option enabled?
ThankX in advace.

The utility objdump does it
Nov 14 '05 #3
On 8 Apr 2005 23:06:19 -0700, sa************* @gmail.com
<sa************ *@gmail.com> wrote:

<OT>
Is there any way to find out, whether the executable is compiled with
-g option enabled?


Compile it without the -g option and compare the size?
Open it with gdb and see if it has line numbers?
Use objdump to see whether it has line numbers?

If you mean from within the program, why would you want to do it and why
would it make any difference? The code in memory will be identical.

(I'm assuming from context that you are talking about the gcc -g option,
which enables debugging information in the executable file, but if your
-g option does something different anything could happen. That's why
it's off-topic in comp.lang.c, it's nothing to do with the C language,
it's specific to your system...)

Chris C
Nov 14 '05 #4
objdump -g

--
pravin

Nov 14 '05 #5
"sa************ *@gmail.com" <sa************ *@gmail.com> wrote:
Is there any way to find out, whether the executable is compiled with
-g option enabled?


No. If tcc -gN program.c does not create a program.exe, there were more
than N warnings. If, however, it _does_ create program.exe, there were
fewer, but it is not possible from the resulting executable to see
whether -g was used or warnings were simply ignored.

Oh, that wasn't what you wanted to know? The perhaps you should select
your newsgroups with more care...

Richard
Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1439
by: praba kar | last post by:
Dear all, I have doubt regarding python Compilation. I want to know whether Python is compiler language or interpreted language. If Python is interpreter language why compilation is there. with regards
3
3354
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\1f575646\ad3a161b\assembly\dl2\57ca505e\044565c0_f84fc401\Test1.DLL' The problem is that the control is defined in two different assemblies
0
1172
by: RonL | last post by:
Using Visual Studio, what is the difference between using Configuration Manager to set the Active Solution Configuration to Debug/Release and using Web.config to set Compilation to "debug=true". Does one option override the other? Example if I set the Active Solution Configuration to "Release" and the Compilation option to "debug="true" does the dll created by the build include debug information? Ron
0
2559
by: Philip Lowman | last post by:
I am in the process of trying to migrate a couple of build solutions to Visual Studio Express 2005 from VS 2003 Professional and I am running into a weird C/C++ runtime library linking issue when using the /MT compilation option. Our debug solution's /MTd flag works fine and using /MD also seems to work ok. For some reason I can't fathom, when I use /MT, linking the static excutable completely dies (problems resolving symbols in the STL,...
5
1696
by: VSP | last post by:
Hi, I have a doubt regarding using references. Please look at the below code. I am using VC++ 6.0 int &i = 10; // Compilation error error C2440: 'initializing' : cannot convert from 'const int' to 'int &' A reference that is not to 'const' cannot be bound to a non-lvalue
13
2123
by: deepak | last post by:
Hi In the following function how the memory 'll be allocated. 1) Will it allocate memory for all the char's together or allocate for first char. then for int then for float and after this only second char in the function gets memory. 2) If i declare variables where the size of al variables gone beyond sizeof stack (assume it is 1000) what 'll happen? voud foo( int a, innt b)
18
2898
by: Poldie | last post by:
How do I turn it on? I'm using vb 2005 in visual studio 2005 sp1. In my web.config I have: <compilation debug="true" strict="true" /> In my Tools/Options/Projects and solutions/vb defaults I have option strict on. In my .vb file I have:
3
357
by: somenath | last post by:
Hi All, I need to compile c code using c++ compiler .As i need to create object of classes inside the c functions I am using malloc and free. 1) My doubt is it ok to compile "c"code using c++ compiler? 2) Is behavior will be undefined ?
10
1780
by: VK | last post by:
Taking into account many new features in JavaScript1.6 and JavaScript1.7 which are syntactically incompatible with Javascript versions run on other browsers: would it be reasonable to propose as "new feature request" at bugzilla.mozilla.org the conditional compilation mechanics. Obviously this mechanics has to be then fully compatible with the existing one for IE: http://msdn2.microsoft.com/en-us/library/7kx09ct1(VS.71).aspx and further...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.