/ Check-in [4257e9b7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the MSVC makefile, support several levels of debugging, each one building on the previous. Also, add comment about the SQLITE_WIN32_MALLOC_VALIDATE macro.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | winNativeHeap
Files: files | file ages | folders
SHA1: 4257e9b7ca78feb03df08fde56da947ae64c5c6f
User & Date: mistachkin 2011-08-25 02:02:25
Context
2011-08-25
04:09
Add comments for the various debug levels. When debugging, disable optimizations. Prevent the win32lock tests from spinning forever. check-in: 40185923 user: mistachkin tags: winNativeHeap
02:02
In the MSVC makefile, support several levels of debugging, each one building on the previous. Also, add comment about the SQLITE_WIN32_MALLOC_VALIDATE macro. check-in: 4257e9b7 user: mistachkin tags: winNativeHeap
01:16
Make sure that SQLITE_FCNTL_SIZE_HINT on Windows does not shrink the file. check-in: d4f6437f user: mistachkin tags: winNativeHeap
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

     6      6   # that contains this "Makefile.msc".
     7      7   #
     8      8   TOP = .
     9      9   
    10     10   # Set this non-0 to create and use the SQLite amalgamation file.
    11     11   #
    12     12   USE_AMALGAMATION = 1
           13  +DEBUG=0
    13     14   
    14     15   # Version numbers and release number for the SQLite being compiled.
    15     16   #
    16     17   VERSION = 3.7
    17     18   VERSION_NUMBER = 3007007
    18     19   RELEASE = 3.7.7
    19     20   
................................................................................
    37     38   TCC = $(TCC) -I$(TOP)\ext\rtree
    38     39   !ENDIF
    39     40   
    40     41   # Define -DNDEBUG to compile without debugging (i.e., for production usage)
    41     42   # Omitting the define will cause extra debugging code to be inserted and
    42     43   # includes extra comments when "EXPLAIN stmt" is used.
    43     44   #
           45  +!IF $(DEBUG)==0
    44     46   TCC = $(TCC) -DNDEBUG
           47  +!ENDIF
           48  +
           49  +!IF $(DEBUG)>1
           50  +TCC = $(TCC) -DSQLITE_DEBUG
           51  +!ENDIF
           52  +
           53  +!IF $(DEBUG)>3
           54  +TCC = $(TCC) -DSQLITE_DEBUG_OS_TRACE=1
           55  +!ENDIF
           56  +
           57  +!IF $(DEBUG)>4
           58  +TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE
           59  +!ENDIF
    45     60   
    46     61   #
    47     62   # Prevent warnings about "insecure" runtime library functions being used.
    48     63   #
    49     64   TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
    50     65   
    51     66   #
    52         -# Use native Win32 heap.
           67  +# Use native Win32 heap instead of malloc/free?
    53     68   #
    54     69   TCC = $(TCC) -DSQLITE_WIN32_MALLOC=1
    55         -# TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
           70  +
           71  +#
           72  +# Validate the heap on every call into the native Win32 heap subsystem?
           73  +#
           74  +!IF $(DEBUG)>2
           75  +TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
           76  +!ENDIF
    56     77   
    57     78   # The locations of the Tcl header and library files.  Also, the library that
    58     79   # non-stubs enabled programs using Tcl must link against.  These variables
    59     80   # (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment
    60     81   # prior to running nmake in order to match the actual installed location and
    61     82   # version on this machine.
    62     83   #
................................................................................
   125    146   # END required Windows option
   126    147   
   127    148   TCC = $(TCC) $(OPT_FEATURE_FLAGS)
   128    149   
   129    150   # Add in any optional parameters specified on the make commane line
   130    151   # ie.  make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
   131    152   TCC = $(TCC) $(OPTS)
          153  +
          154  +# Add debug information if enabled.
          155  +!IF $(DEBUG)!=0
          156  +TCC = $(TCC) -Zi -D_DEBUG
          157  +!ENDIF
   132    158   
   133    159   # libtool compile/link
   134    160   LTCOMPILE = $(TCC) -Fo$@
   135    161   LTLIB = lib.exe
   136    162   LTLINK = $(TCC) -Fe$@
   137    163   
   138    164   # If a platform was set, force the linker to target that.
................................................................................
   139    165   # Note that the vcvars*.bat family of batch files typically
   140    166   # set this for you.  Otherwise, the linker will attempt
   141    167   # to deduce the binary type based on the object files.
   142    168   !IF "$(PLATFORM)"!=""
   143    169   LTLINKOPTS = /MACHINE:$(PLATFORM)
   144    170   LTLIBOPTS = /MACHINE:$(PLATFORM)
   145    171   !ENDIF
          172  +
          173  +!IF $(DEBUG)!=0
          174  +LTLINKOPTS = $(LTLINKOPTS) /DEBUG
          175  +!ENDIF
   146    176   
   147    177   # nawk compatible awk.
   148    178   NAWK = gawk.exe
   149    179   
   150    180   # You should not have to change anything below this line
   151    181   ###############################################################################
   152    182   

Changes to src/sqliteInt.h.

   145    145   /*
   146    146   ** Exactly one of the following macros must be defined in order to
   147    147   ** specify which memory allocation subsystem to use.
   148    148   **
   149    149   **     SQLITE_SYSTEM_MALLOC          // Use normal system malloc()
   150    150   **     SQLITE_WIN32_MALLOC           // Use Win32 native heap API
   151    151   **     SQLITE_MEMDEBUG               // Debugging version of system malloc()
          152  +**
          153  +** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the
          154  +** assert() macro is enabled, each call into the Win32 native heap subsystem
          155  +** will cause HeapValidate to be called.  If heap validation should fail, an
          156  +** assertion will be triggered.
   152    157   **
   153    158   ** (Historical note:  There used to be several other options, but we've
   154    159   ** pared it down to just these two.)
   155    160   **
   156    161   ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
   157    162   ** the default.
   158    163   */