Borland debug sections.

Info retrieved from Turbo Dump 5.0.16.12 and 'Visual C++ 5.0 Symbolic Debug Information Specification'.
If you don't understand something read 'Visual C++ 5.0 Symbolic Debug Information Specification' and if
you don't understand even then, well mail me.

When new TDUMP comes out I'll try to complete this text.
Another thing, this is only for PE type programs. If someone needs this text for 16bit mail me and I'll send you
IDA4's TDUMP files.

mail: mostekaccess@mailcity.com

NOTICE!
Not all are explained (at this time) because some are not needed for sufficient Borland TASM debug info.
----------------------------------------------------------------------------------------------------
120   sstModule
121+  sstTypes
122+  sstPublic
123+  sstPublicSym
124+  sstSymbols
125   sstAlignSym
126+  sstSrcLnSeg
127   sstSrcModule
128   sstLibraries
129   sstGlobalSym
12A   sstGlobalPub
12B   sstGlobalTypes
12C   ?              //probably not used by Borland
12D+  sstMystery1
12E+  sstMystery2
12F   *??*           //probably not used by Borland
130   sstNames
131   sstBrowse

+ = data not defined in TDUMP32

----------------------------------------------------------------------------------------------------
****************************************************************************************************
120  sstModule
This describes the basic information about an object module including code segments, module name,
and the number of segments for the modules that follow.
Directory entries for sstModules precede all other subsection directory entries.

header:
offset  size     name
0       SHORT    ovlNumber
2       SHORT    iLib
4       SHORT    cSeg
6       SHORT    style
8       ULONG    iName
C       ULONG    time
10      ULONG       //don't know
14      ULONG       //don't know
18      ULONG       //don't know
1C      *        segmentData

ovlNumber - Overlay number.
iLib - Index into sstLibraries subsection if this module was linked from a library.
cSeg - Count of the number of code segments this module contributes to.
Style - Debugging style for this module.  Currently only "CV" is defined.
iName - Index of string in sstNames. (1 is the first string)
time - Object creation time. (not certain about that, but probably it is so)
segmentData - Is the structure that has Segment properties. sizeof(segmentData)=sizeof(segmentData_Struct)*cSeg


segmentData_Struct:
offset  size     name
1C      SHORT    seg
1E      SHORT    flags
20      ULONG    offset
24      ULONG    lSeg

seg - segment that this structure describes.
flags - defines what kind of the segment is this. (1=CODE, 0=DATA)
offset - Offset in segment where the code starts.
lSeg - Lenght of segement in bytes.

****************************************************************************************************
125  sstAlignSym

General Format of Symbol Records

Data in the sstAlignSym segment is a stream of variable length records with the general format:

offset  size     name
0       SHORT    lenght
2       SHORT    index
4       *        data

length - Length of record, excluding the length and index field.
index - Type of symbol.
data - Data specific to each symbol format(explained in 'Symbol Indices Explained.txt').


****************************************************************************************************
127  sstSrcModule

This table describes the source line number to addressing mapping information for a module.

offset  size     name
0       SHORT    cFile (Borland=1)
2       SHORT    cSeg (Borland=1)
4       ULONG    baseSourceFile  //ULONG only in Borland (where we have multiple sstSrcModules)
8     2*ULONG    modStartEnd     //.. only in Borland (where we have multiple sstSrcModules)
10      SHORT    seg (Borland=1) //.. only in Borland (where we have multiple sstSrcModules)

sstSourceModule - baseSourceFile

cFile - The number of source files contributing code to segments. (Borland=1)
cSeg - The number of code segments receiving code from this module. (Borland=1)
baseSourceFile - This is an array of base offsets from the beginning of the sstSrcModule table.
modStartEnd - An array of two 32-bit offsets per segment that receives code from this module.
            The first offset is the offset within the segment of the first byte of code from this module.
            The second  offset is the ending address of the code from this module.
            The order of these pairs corresponds to the ordering of the segments in the seg array.
            Zeroes in these entries means that the information is not known and the file and
            line tables described below need to be examined to determine if
            an address of interest is contained within the code from this module.
            *
            *Short: This is the start offset and the end offset of the code(in bytes) that
            *       our sourceCode(text) is for.
            *
seg - An array of segment indices that receive code from this module.

-----------------------------------------------------------------------------------
The file table describes the code segments that receive code from each source file.
BaseSourceFile points to this table.

offset  size     name
0       SHORT    cSeg (Borland=1)
2       ULONG    iName
6       ULONG    fileBaseSrcLn  //.. only in Borland (where we have multiple sstSrcModules)
A     2*ULONG    fileStartEnd   //....

cSeg - Number of segments that receive code from this source file.
iName - Index of string in sstNames. (1 is the first string)
fileBaseSrcLn - An array of offsets for the line/address mapping tables for each of the
                segments that receive code from this source file.
filebaseSrcln - Same as modStartEnd

-----------------------------------------------------------------------------------
The line number to address mapping information is contained in a table with the following format.
The preferred ordering for this table is by offset order. Line number and offsets must be unique.

FileBaseSrcLn points to this table.

BCV4_dumpLineNumberTable:
offset    size     name
0         SHORT    seg
2         SHORT    cPair
4   cPair*ULONG    offset
*   cPair*SHORT    lineNumber

seg - Segment index for this table.
cPair - Count of the number of source line pairs to follow.
offset - An array of 32-bit offsets for the offset within the code segment
         of the start of the line contained in the parallel array linenumber.
lineNumber - This is an array of 16-bit line numbers for the numbers of the lines in
             the source file that cause code to be emitted to the code segment.
             This array is parallel to the offset array.

*ex.
*
*offset(0*4) paralel lineNumber(0*2)
*offset(1*4) paralel lineNumber(1*2)
*offset(2*4) paralel lineNumber(2*2)
*....
*
*Well:
*lineNumber  offsetInCodeSeg      sourceText
*    *        no bytes used       (normal beginning defenitions)
*    7        no bytes used       .code
*    8        no bytes used       Main:
*	9             0              call GetModuleHandle, NULL
*   10             7              jmp  @JumpSetOne
*   11             9              nop
*   12             A              nop
*   13        no bytes used       @JumpSetOne:
*   14             B              call SetOne
*   15            10              mov NextData, eax
*....
*
*
*So BCV4_dumpLineNumberTable. are:
*offset  lineNumber
*   0        9
*   7       10
*   9       11
*   A       12
*   B       14
*  10       15
*....
*
*As you can see there are only lines that have commands.
*


****************************************************************************************************
128  sstLibraries
****************************************************************************************************
129  sstGlobalSym

This subsection contains globally compacted symbols.

header:
offset  size     name
0       SHORT    symHash
2       SHORT    addrHash
4       ULONG    cbSymbols
8       ULONG    cbSymHash
C       ULONG    cbAddrHash
10      ULONG    cUDTs
14      ULONG    cOthers
18      ULONG    total
1C      ULONG    cNameSpaces


symHash - Index of the symbol hash function. (normaly 0)
addrHash - Index of the address hash function. (normaly 0)
cbSymbols - Count of the number of bytes in the symbol table.
cbSymHash - Count of the number of bytes in the symbol hash table. (normaly 0)
cbAddrHash - Count of the number of bytes in the address hashing table. (normaly 0)
cUDTs - Count of S_UDTs in sstGlobalSym section.
cOthers - Count of others symbol types in sstGlobalSym section.
total - cUDTs+cOthers
cNameSpaces - ? (normaly 0)

-----------------------------------------------------------------------------------
This is followed by the symbol information.

Look in 'Symbol Indices Explained.txt'.

*ex.
*
*1.all S_UDT
*2.all S_GPROCREF
*3.all S_GDATA32

****************************************************************************************************
12A  sstGlobalPub

Same as sstGlobalSym.

****************************************************************************************************
12B  sstGlobalTypes

This subsection contains the packed type records for the executable file.
Type is a collective information.
*ex.
*
*You define only one type with the same arguments
*Type=xxxx LF_LABEL Mode:near
*Type=yyyy LF_LABEL Mode:far
*so this two are ALL diferent LF_LABEL types.
*
The lowest user defined type is 1000h(next is 1001h),
the biggest 00FFFFFFh (the upper byte must be 0).

header:
offset      size     name
0           ULONG    flags
4           ULONG    cTypes
8    cTypes*ULONG    typeOffset

flags - types table flag. (It must be 1='Global types table signature'.)
cTypes - Number of types.
typeOffset - Offset of each typeRecord from start of sstGlobalTypes.

typeRecord:
offset  size     name
0       SHORT    lenght
2       *        typeString

length - The length in bytes of the following type string.
         This count does not include the length field.
typeString - Explained in 'Type Strings Explained.txt'.


****************************************************************************************************
130  sstNames
This section contains all the symbol strings (functions, variable, ...).

offset  size     name
0       ULONG    cNames
4       *        nameTables  (size=sizeof(namesTable)*cNames)


cNames - defines how many strings are in the section
namesTable - defines every name

namesTable{
     BYTE      lenght of the string
     *         string(name)
     BYTE      zeroEnded
}

****************************************************************************************************
131  sstBrowse
****************************************************************************************************

