[comp.os.msdos.programmer] 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.
-----------------------------------------------------------------------------

spolsky-joel@cs.yale.edu (Joel Spolsky) (09/07/90)

In article <1990Sep6.174743.13108@odin.corp.sgi.com> nelson@bolyard.wpd.sgi.com (Nelson Bolyard) writes:
>If you can help me get TD386 to debug TC code linked from a library, I'd
>greatly appreciate it!

You can't include symbollic debugging information in libraries, only
in .OBJ files. The /E flag does not do what you think (it just makes
it easier to find things in the library). The idea is that you debug
your object modules completely before putting them into libraries.

Joel Spolsky
spolsky@cs.yale.edu                                        Talk Hard.

few@quad1.quad.com (Frank Whaley) (09/07/90)

In article <1990Sep6.174743.13108@odin.corp.sgi.com>,
nelson@bolyard.wpd.sgi.com (Nelson Bolyard) writes:
>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.

Your error was in using TLINK.  For some unfathomable reason the 2.0 version
of TLINK strips symbolic debugging information.  Other library managers do
not do this.  I use Plib86 because they include a time-stamp that is
recognized by my make program, although LIB otherwise works just as well.
-- 
Frank Whaley
few@quad1.quad.com
uunet!ccicpg!quad1!few

Water separates the people of the world;
Wine unites them.

c164-bd@polonius.uucp (John D. Mitchell) (09/07/90)

As far as I know (i.e. I haven't tried it but it is my assumption) that
you do need to have the /E.  I have my new (as yet unfinished) libraries
built that way but have not as yet tried to TD386'em.  B-land's documentation
is very up-and-down.  Some of what's there seems pretty good but so much
stuff is either not there at all or is only mentioned in passing.

Oh well, Good Luck,
	John

stever@Octopus.COM (Steve Resnick ) (09/07/90)

In article <26035@cs.yale.edu> spolsky-joel@cs.yale.edu (Joel Spolsky) writes:
>In article <1990Sep6.174743.13108@odin.corp.sgi.com> nelson@bolyard.wpd.sgi.com (Nelson Bolyard) writes:
>>If you can help me get TD386 to debug TC code linked from a library, I'd
>>greatly appreciate it!
>
>You can't include symbollic debugging information in libraries, only
>in .OBJ files. The /E flag does not do what you think (it just makes
>it easier to find things in the library). The idea is that you debug
>your object modules completely before putting them into libraries.
>
Sure you can - or at least I could. I compiled a bunch of .OBJ files with the
-v flag set (this also implies -y), used -G- -Z- -O- to disable any 
optimizations. I linked my program using tcc as the "front-end" to the linker.
When I ran the program I got the symbolic and line number info for one of
the library routines. Getting creative, I moved the source file for that
routine into my current directory and , voila! I was able to trace thru my
library routine.

Hope this helps.... 
Steve


-- 
----------------------------------------------------------------------------
steve.resnick@f105.n143.z1@FIDONET.ORG #include<std_disclaimer.h>
Flames, grammar errors, spelling errrors >/dev/nul
----------------------------------------------------------------------------

keck@sea.com (Jon Keck) (09/10/90)

In article <1990Sep6.174743.13108@odin.corp.sgi.com> nelson@bolyard.wpd.sgi.com (Nelson Bolyard) writes:
>If you can help me get TD386 to debug TC code linked from a library, I'd
>greatly appreciate it!

[description of problem of stripped library modules]

>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?

It's a bug in TLIB.  Call Borland Technical Support, they have a patch.

-- 
John Keck INTERNET:keck@sea.com UUCP:...!ucsd!soledad!keck VOICE:619/581-6181
Systems Engineering Associates, 2204 Garnet Ave Suite 203, San Diego CA 92109
-----------------------------------------------------------------------------
 "Much speech leads inevitably to silence. Better to hold fast to the void."