[comp.lang.c] Need help Turbo Debugging code in a library

nelson@bolyard.wpd.sgi.com (Nelson Bolyard) (09/07/90)

If you can help me get TD386 to debug TC code linked from a library, I'd
greatly appreciate it!

When programming on my 386 at home, I routinely compile everything under
Turbo C 2.0 (tcc) with the -y and -v flags set so I can use Turbo Debugger
(TD386) to debug them (and mostly to analyze the assembler instructions 
produced by tcc for optimization purposes).  Tcc passes the -v flag on to
tlink so that it will put the debugging info into the .exe file.

Recently, I used tlib to put a bunch of my .OBJ files into a .lib file
and changed my makefile to have tcc pick up the .lib file.  When I tried
to step through the .exe with TD386, I discovered to my dismay that all the
debugging information for the code in the library was absent from the .exe
file.  The TD386 CPU window showed me no line number information nor source 
for any of the routines in the library.

For the time being, I have gone back to linking all the .objs by name in the
tcc step that make the .exe.  Fortunately for me, I have not yet run into
the command line length limit.  The Turbo C Reference Manual says that
libraries are a big productivity enhancement for developers, but if code in
libraries cannot be debugged, then this claim seems dubious.

A few details:  I do NOT use /E (create Extended Data Dictionary) when
running tlib.  The Turbo C reference manual description of tlink states that 
tlink ignores debugging information in libraries that have Extended Data
Dictionaries UNLESS the /e option is given to tlink.  It does not say
anything about debugging information in libraries that do NOT have extended
data dictionaries (like mine).  I tried passing the e flag to tlink from tcc
via the -le option to tcc (which says pass -e on to tlink).  I also tried
-l-e.  Neither had any effect.  

I have not yet tried (but will soon) to make my library with tlib /E.
The Turbo C reference manual nowhere says that /E is necessary for debugging
info to be preserved.  The only reason for /E given in the manual is to
speed up linking.  Again, the tlink discussion in the manual indicates that
libraries made with /E have the debugging info ignored unless a special flag
(-e) is given to tlink.  

Questions:

1. Do you know how to have the debugging info preserved in libraries and get
passed by tlink into the .exe?  If so, please help.

2. Is it perhaps the (undocumented) case that tlib strips out the debugging
information from .obj files unless the /E option is selected?  If so, why
wasn't this documented?

Please note that I have redirected followups to comp.os.msdos.programmer.
-----------------------------------------------------------------------------
Nelson Bolyard      nelson@sgi.COM      {decwrl,sun}!sgi!whizzer!nelson
Disclaimer: Views expressed herein do not represent the views of my employer.
-----------------------------------------------------------------------------