473,748 Members | 2,470 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I compile C/C++ Debug version partially?

Hi all,

I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?

Something like:
fileA.c fileB.c
And I can compile fileA.c with debug info and compile fileB.c without
debug info?

Any suggestions will be appreciated!
Best regards,
Davy

Oct 30 '05 #1
8 2695
Davy wrote:
I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?


I know of two possible ways:
1. Separate the debug-information from the executable. Some debuggers/debug
formats support this, IIRC, just see what your compiler/debugger/linker
supports and see if that helps.
2. Only compile parts of a program with debug-info turned on. This might
work pretty well with GCC, but VC links with different runtime libs for
debug and release mode, so you might have to fall back to some tricks
there to get it running.

Else, debug modules in unittests instead of the whole program, but that's
not always an option.

Uli

Oct 30 '05 #2
On 30 Oct 2005 06:49:52 -0800, in comp.lang.c , "Davy"
<zh*******@gmai l.com> wrote:
Hi all,

I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?


This isn't a C or C++ language question. You need to read the
documentation for your compilers, and ask in compiler-specific
newsgroups.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Oct 30 '05 #3

"Davy" <zh*******@gmai l.com> wrote
I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?

Something like:
fileA.c fileB.c
And I can compile fileA.c with debug info and compile fileB.c without
debug info?

Any suggestions will be appreciated!

Probably not. The awkward workaround is probably to compile fileB.c as a
non-debug library and then link. However I don't know the details of gcc
well enough to quote.

As a hint, don't use debuggers. Use diagnostic printf()'s to work out what
the program is doing. I invariably find that debuggers are far more trouble
than they are worth with the exception of the tool to give a stack trace on
a crash. (However many regs will disgree with me on this).
Oct 30 '05 #4
Davy wrote:
Hi all,

I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?

Something like:
fileA.c fileB.c
And I can compile fileA.c with debug info and compile fileB.c without
debug info?

Any suggestions will be appreciated!
Best regards,
Davy


You are probably not aware that debug information
will NOT be loaded into RAM unless a debugger is
present.

Oct 31 '05 #5
Malcolm wrote:
"Davy" <zh*******@gmai l.com> wrote
I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?

Something like:
fileA.c fileB.c
And I can compile fileA.c with debug info and compile fileB.c without
debug info?

Any suggestions will be appreciated!


Probably not. The awkward workaround is probably to compile fileB.c as a
non-debug library and then link. However I don't know the details of gcc
well enough to quote.

As a hint, don't use debuggers. Use diagnostic printf()'s to work out what
the program is doing. I invariably find that debuggers are far more trouble
than they are worth with the exception of the tool to give a stack trace on
a crash. (However many regs will disgree with me on this).


No, I agree with you totally. The only time I ever fire up a debugger is
to work out where in some large program it is crashing.

I know some people love "break" and "watch" points, but I'd prefer to
look through a trace from my own printf calls. I wrote the program -- I
should understand what all the code means, I just have to find where I
made a mistake.

--
Simon.
Oct 31 '05 #6
jacob navia wrote:
Davy wrote:
Hi all,

I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?

Something like:
fileA.c fileB.c
And I can compile fileA.c with debug info and compile fileB.c without
debug info?

Any suggestions will be appreciated!
Best regards,
Davy


You are probably not aware that debug information
will NOT be loaded into RAM unless a debugger is
present.


That's quite a strong statement! Are you sure that it's true of all C
implementations on all platforms? Or just your own lcc-win32?

--
Simon.
Oct 31 '05 #7
Simon Biber <ne**@ralmin.cc > writes:
jacob navia wrote:
Davy wrote:
Hi all,

I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?

Something like:
fileA.c fileB.c
And I can compile fileA.c with debug info and compile fileB.c without
debug info?

Any suggestions will be appreciated!
Best regards,
Davy

You are probably not aware that debug information
will NOT be loaded into RAM unless a debugger is
present.


That's quite a strong statement! Are you sure that it's true of all C
implementations on all platforms? Or just your own lcc-win32?


The OP specified a particular environment (VC and gcc/gdb); I'm
guessing jacob's answer was appropriate for that environment.

But I can't be sure, which is why such information is more appropriate
to a system-specific newsgroup where it can be checked.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Oct 31 '05 #8
Simon Biber wrote:
jacob navia wrote:
Davy wrote:
Hi all,

I use VC and gcc/gdb to compile and debug C/C++ files. But I found some
of the debug version of the compiled files are too large to be run in a
small RAM. Can I compile C/C++ Debug partially?

Something like:
fileA.c fileB.c
And I can compile fileA.c with debug info and compile fileB.c without
debug info?

Any suggestions will be appreciated!
Best regards,
Davy


You are probably not aware that debug information
will NOT be loaded into RAM unless a debugger is
present.

That's quite a strong statement! Are you sure that it's true of all C
implementations on all platforms? Or just your own lcc-win32?

For the Visual C compiler of Microsoft the debug info is not even
in the executable but in the program database (.pdb files). So it
would be VERY surprising that it would be loaded into memory.

Normally under windows, the debug info is described in the debug
section of the data directory of the executable, and not in a section
that should be loaded by the program loader.

Most OSses will not map the debug info if no debugger is present.

Another possibility is that debug executables without any optimizations
are bigger than optimized programs, and in that case it would make
a small difference.

Files with or without debug info can be mixed freely in most
implementations that I know of, so the question of the memory
used by a program makes even less sense. If you just want to debug
module X you can eliminate all debug info from all other modules
and only compile with debug info for module X. The linker should
accept that anyway, and most debuggers will work in such a setting.

jacob
Oct 31 '05 #9

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

Similar topics

1
1901
by: Stanley | last post by:
I am working with Exceptions and have found a bit of a problem for me. Using the code below in Debug I get the info I want which is basically: -Line of error -Column of error -Method where error happened However, when you compile to Release version you get no line or column numbers. So I assume this is because the .pdb file holds all of the info regarding the lines and columns or something to that order. I am not really to sure what...
5
3334
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new rightType;
8
526
by: Davy | last post by:
Hi all, I use VC and gcc/gdb to compile and debug C/C++ files. But I found some of the debug version of the compiled files are too large to be run in a small RAM. Can I compile C/C++ Debug partially? Something like: fileA.c fileB.c And I can compile fileA.c with debug info and compile fileB.c without debug info?
6
3324
by: Baskar RajaSekharan | last post by:
In C-sharp, I wnat to know whether the Component is compiled in Debug Mode or Run Mode through Code. How is it possible? Is there any way to Access the Config file and check? Please let me know with example
13
3070
by: Adam Blair | last post by:
Is it possible to bind a switch statement to an Enum such that a compile-time error is raised if not all values within the Enum are handled in the switch statement? I realise you can use default: to catch unhandled cases, but of course this is only at run-time. Example: public enum MyEnum { one, two, three, four }
3
6033
by: SStory | last post by:
I would like to have some code compile if my Active Configuration is set to debug and not compile if it is set to Release. I don't want to have to remember to define a constant. I just want to change configurations and all debug code not execute. How is this possible. Thanks in advance,
2
3587
by: Smoke | last post by:
Whats is the deal with Debug.WriteLine command... I mean, in my programs, i usually add many of those commands to debug it while programming, and to be able to find bugs and things easier, but, it is safe to leave those lines when u compile the program? or you are suposed to remove them? Maybe the compiler delete that lines automatically when u compile the program, but that wont make much sense since inside VS.net the program you launch is...
1
5879
by: Alexander Walker | last post by:
Hello I have recently published a web application using the "Publish Web Site" option of the solution explorer from Visual Studio 2005, I have published the website so that the pages could not be updated, do I need to set the web.config so that it contains <compilation defaultLanguage="c#" debug="false"> before I publish the web site or can I make this configuration change on the deployment machine after the site has been deployed? ...
1
1299
by: srussell705 | last post by:
Having a hard time with this VS2005 VB 3tier winform app. I run teh app in debug mde just fine. I go to the folder for debug and click on the exe file. The JIT error comes up: ************** Exception Text ************** System.Security.SecurityException: That assembly does not allow partially trusted callers. at
0
8831
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
9555
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9376
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...
1
9329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8247
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4878
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
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
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.