C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Davy
Guest





PostPosted: Sun Oct 30, 2005 2:49 pm    Post subject: Can I compile C/C++ Debug version partially? Reply with quote



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

Back to top
Ulrich Eckhardt
Guest





PostPosted: Sun Oct 30, 2005 3:00 pm    Post subject: Re: Can I compile C/C++ Debug version partially? Reply with quote



Davy wrote:
Quote:
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


Back to top
Mark McIntyre
Guest





PostPosted: Sun Oct 30, 2005 5:02 pm    Post subject: Re: Can I compile C/C++ Debug version partially? Reply with quote



On 30 Oct 2005 06:49:52 -0800, in comp.lang.c , "Davy"
<zhushenli (AT) gmail (DOT) com> wrote:

Quote:
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>


http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Back to top
Malcolm
Guest





PostPosted: Sun Oct 30, 2005 11:06 pm    Post subject: Re: Can I compile C/C++ Debug version partially? Reply with quote


"Davy" <zhushenli (AT) gmail (DOT) com> wrote
Quote:
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).



Back to top
jacob navia
Guest





PostPosted: Mon Oct 31, 2005 8:24 am    Post subject: Re: Can I compile C/C++ Debug version partially? Reply with quote

Davy wrote:
Quote:
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.


Back to top
Simon Biber
Guest





PostPosted: Mon Oct 31, 2005 2:33 pm    Post subject: Re: Can I compile C/C++ Debug version partially? Reply with quote

Malcolm wrote:
Quote:
"Davy" <zhushenli (AT) gmail (DOT) 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.

Back to top
Simon Biber
Guest





PostPosted: Mon Oct 31, 2005 2:34 pm    Post subject: Re: Can I compile C/C++ Debug version partially? Reply with quote

jacob navia wrote:
Quote:
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.

Back to top
Keith Thompson
Guest





PostPosted: Mon Oct 31, 2005 7:21 pm    Post subject: Re: Can I compile C/C++ Debug version partially? Reply with quote

Simon Biber <news (AT) ralmin (DOT) cc> writes:
Quote:
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_Keith) [email]kst-u (AT) mib (DOT) org[/email] <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.

Back to top
jacob navia
Guest





PostPosted: Mon Oct 31, 2005 9:20 pm    Post subject: Re: Can I compile C/C++ Debug version partially? Reply with quote

Simon Biber wrote:
Quote:
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

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.