home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR13 / TI_BC1.ZIP / TI1556.ZIP / TI1556.ASC
Text File  |  1993-08-31  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Borland C++                           NUMBER  :  1556
  9.   VERSION  :  All
  10.        OS  :  All
  11.      DATE  :  August 31, 1993                          PAGE  :  1/2
  12.  
  13.     TITLE  :  How to trace into a run-time library function
  14.  
  15.  
  16.  
  17.  
  18.   The trace function of the IDE and standalone debugger is a useful
  19.   tool for tracing the program flow into a function call.  However,
  20.   since the C Runtime Library (RTL) functions are not built with
  21.   debugging information, you cannot trace into those calls.
  22.   Pressing F7 while the cursor is on the function simply executes
  23.   it and returns the cursor to the next line in the program.  You
  24.   cannot trace the function as it is executing.  This document
  25.   describes how you can easily get around this limitation and trace
  26.   into your RTL functions. You need the RTL source code that
  27.   shipped with Application Frameworks to take advantage of this
  28.   technique.
  29.  
  30.   For our example, suppose we want to trace through the strcpy()
  31.   function to learn how it works.
  32.  
  33.   1.   Find the source code that contains the desired function,
  34.        make a copy of this file into your working directory, and
  35.        optionally rename it.  strcpy() is contained in STRCPY.CAS,
  36.        so we'll make a copy of this file into our working directory
  37.        and rename it to MYSTRCPY.CAS.
  38.  
  39.   2.   At the top of the file, add the following lines:
  40.  
  41.           #pragma option -zC_TEXT
  42.           #pragma option -zR_DATA
  43.           #pragma option -zTDATA
  44.  
  45.   3.   Tell the compiler where to find the header files that are
  46.        needed by the RTL source file.  For the command-line
  47.        compiler, add C:\BC\CRTL\RTLINC to the -I search path.  For
  48.        the IDE, add the above path to the Include path under
  49.        Options | Directories.
  50.  
  51.   4.   If you use the command-line compiler, add the new copy of
  52.        the RTL source file (MYSTRCPY.CAS in our example) to your
  53.        list of .C or .CPP files.  If you use the Integrated
  54.        Development Environment (IDE), add it to your project file
  55.        list, or create one if you don't already use a project.
  56.  
  57.   5.   Build your program with the debug info turned on.  For BCC
  58.        and TLINK use -v.  For IDE select Option | Compiler |
  59.        Advanced Code Generation and turn on Debug Info in OBJs.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Borland C++                           NUMBER  :  1556
  75.   VERSION  :  All
  76.        OS  :  All
  77.      DATE  :  August 31, 1993                          PAGE  :  2/2
  78.  
  79.     TITLE  :  How to trace into a run-time library function
  80.  
  81.  
  82.  
  83.  
  84.   That is all.  Now when we come to a line with strcpy(), we can
  85.   hit F7 and trace into the statements for that function.
  86.  
  87.  
  88.   DISCLAIMER: You have the right to use this technical information
  89.   subject to the terms of the No-Nonsense License Statement that
  90.   you received with the Borland product to which this information
  91.   pertains.
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.