hll_cv_types.txt

来自「开放源码的编译器open watcom 1.6.0版的源代码」· 文本 代码 · 共 918 行 · 第 1/3 页

TXT
918
字号

 IBM HLL and Microsoft CodeView Debugging Information Type Representation
 ========================================================================

 This document describes the format used by IBM and Microsoft tools to store
 type information in $$TYPES segments in object files and sstTypes subsections
 in executable modules. It applies to Microsoft DOS, OS/2 and Windows compilers
 up to and including MS C 6.0, as well as all known IBM OS/2 compilers. This
 includes IBM C/2, CSet/2, CSet++, and VisualAge C++ compilers as well as other
 language tools. Executable modules using debugging information described here
 use the NB02 or NB04 signatures. Both 16-bit and 32-bit modules are supported.

 A more comprehensive description of the IBM HL03 debugging information format
 may be found in a separate document.

 Note that the type information described here is similar in concept to the
 later Microsoft CV4 style debugging information, but differs significantly
 in detail.

 The following information is based on a document that is part of the publicly
 available IBM SD386 debugger source code archive.



 Type Records
 ------------

                 Record type
                ----------------------
               |                      |
   Start Leaves| MS-16 | MS-32 | IBM  |
   ------------------------------------
   Type Record |       |       |      |
   Structure   | 0x79  | 0x79  | 0x79 |
   Bit Fields  | 0x5C  | 0x5C  | 0x5C |
   Type Defs   | 0x5D  | 0x5D  | 0x5D |
   Pointers    | 0x7A  | 0x7A  | 0x7A |
   Enums       | 0x7B  | 0x7B  | 0x7B |
   Scalars     | 0x7B  | 0x7B  | 0x51 |
   Array       | 0x78  | 0x78  | 0x78 |
   List        | 0x7F  | 0x7F  | 0x7F |
   Procedure   | 0x75  | 0x75  | 0x75 | <-- these two records are identical
   Function    | 0x54  | 0x54  | 0x54 | <-- in the IBM format.
   Skip        | 0x90  | 0x90  | 0x90 |
   Null        | 0x80  | 0x80  | 0x80 |
   Class       |  -    |  -    | 0x40 |
   Member Fcn  |  -    |  -    | 0x45 |
   Class Member|  -    |  -    | 0x46 |


 Notes:

  1. Trec is the representation of the first leaf of all type records.

  2. In the IBM HL03 format, the rec id was removed from all records.

  3. The doc contains the following abbreviations for the various leaves.

        T  = Trec.
        N  = 1 byte signed numeric leaf w/o a FID_SPAN prefix.
        SN = Signed numeric leaf.
        UN = Unsigned numeric leaf.
        S  = String leaf.
        I  = Index leaf.

  4. * => variable length name.
     @ => variable length leaf.

  5. The MS format lumps scalars and enums into one scalar record.  The
     simplified form of the record only includes a primitive type index.
     We have not seen the MS C compilers actually generate any simplified
     forms of the enums; however, PLX which generates MS format records
     does.  PL/X also generates actual enum records.  What we have to do
     is distinguish between the actual enums and the "scalar" enums.  We
     will have to use the record length to distinguish between the two.

1------------------------------------------------------------------------------

  Primitive types as taken from the MSC object module format doc.

  Types 0-511 are reserved. Types 0-255 (high byte = 0) have meaning
  according to the decoding of the following bits:

  xxxx xxxx x xx xxx xx
  xxxx xxxx i md typ sz

  i=0 ==> special type don't interpret md,typ,and sz.
  i=1 ==> interpret low order 7 bits as follows.

  md - Model
  00 - Direct
  01 - Near pointer
  10 - Far pointer
  11 - Huge pointer

  type - base type
  000  - signed
  001  - unsigned
  010  - real
  011  -
  100  -
  101  - void in IBM format.
  110  -
  111  - void in Microsoft format.

  sz   - size
  00   - 8-bit
  01   - 16-bit
  10   - 32-bit
  11   - void in IBM format.

 These are the primitives that we currently use. We may need to define others.

                        i md typ sz
                        7 65 432 10
  -----------------------------------------------------
  TYPE_CHAR        0x80 1 00 000 00    8-bit  signed.
  TYPE_SHORT       0x81 1 00 000 01    16-bit signed.
  TYPE_LONG        0x82 1 00 000 10    32-bit signed.
  TYPE_UCHAR       0x84 1 00 001 00    8-bit  unsigned.
  TYPE_USHORT      0x85 1 00 001 01    16-bit unsigned.
  TYPE_ULONG       0x86 1 00 001 10    32-bit unsigned.
  TYPE_FLOAT       0x88 1 00 010 00    32-bit real.
  TYPE_DOUBLE      0x89 1 00 010 01    64-bit real.
  TYPE_LDOUBLE     0x8A 1 00 010 10    80-bit real.
  TYPE_VOID        0x97 1 00 101 11    void.

  TYPE_PCHAR       0xA0 1 01 000 00    0:32 near ptr to 8-bit  signed.
  TYPE_PSHORT      0xA1 1 01 000 01    0:32 near ptr to 16-bit signed.
  TYPE_PLONG       0xA2 1 01 000 10    0:32 near ptr to 32-bit signed.
  TYPE_PUCHAR      0xA4 1 01 001 00    0:32 near ptr to 8-bit  unsigned.
  TYPE_PUSHORT     0xA5 1 01 001 01    0:32 near ptr to 16-bit unsigned.
  TYPE_PULONG      0xA6 1 01 001 10    0:32 near ptr to 32-bit unsigned.
  TYPE_PFLOAT      0xA8 1 01 010 00    0:32 near ptr to 32-bit real.
  TYPE_PDOUBLE     0xA9 1 01 010 01    0:32 near ptr to 64-bit real.
  TYPE_PLDOUBLE    0xAA 1 01 010 10    0:32 near ptr to 80-bit real.
  TYPE_PVOID       0xB7 1 01 101 11    0:32 near ptr to void.

  TYPE_FPCHAR      0xC0 1 10 000 00    far ptr to 8-bit  signed.
  TYPE_FPSHORT     0xC1 1 10 000 01    far ptr to 16-bit signed.
  TYPE_FPLONG      0xC2 1 10 000 10    far ptr to 32-bit signed.
  TYPE_FPUCHAR     0xC4 1 10 001 00    far ptr to 8-bit  unsigned.
  TYPE_FPUSHORT    0xC5 1 10 001 01    far ptr to 16-bit unsigned.
  TYPE_FPULONG     0xC6 1 10 001 10    far ptr to 32-bit unsigned.
  TYPE_FPFLOAT     0xC8 1 10 010 00    far ptr to 32-bit real.
  TYPE_FPDOUBLE    0xC9 1 10 010 01    far ptr to 64-bit real.
  TYPE_FPLDOUBLE   0xCA 1 10 010 10    far ptr to 80-bit real.
  TYPE_FPVOID      0xD7 1 10 101 11    far ptr to void.

  TYPE_N16PCHAR    0xE0 1 11 011 11    0:16 near ptr to 8-bit  signed.
  TYPE_N16PSHORT   0xE1 1 11 000 01    0:16 near ptr to 16-bit signed.
  TYPE_N16PLONG    0xE2 1 11 000 10    0:16 near ptr to 32-bit signed.
  TYPE_N16PUCHAR   0xE4 1 11 001 00    0:16 near ptr to 8-bit  unsigned.
  TYPE_N16PUSHORT  0xE5 1 11 001 01    0:16 near ptr to 16-bit unsigned.
  TYPE_N16PULONG   0xE6 1 11 001 10    0:16 near ptr to 32-bit unsigned.
  TYPE_N16PFLOAT   0xE8 1 11 010 00    0:16 near ptr to 32-bit real.
  TYPE_N16PDOUBLE  0xE9 1 11 010 01    0:16 near ptr to 64-bit real.
  TYPE_N16PLDOUBLE 0xEA 1 11 010 10    0:16 near ptr to 80-bit real.
  TYPE_N16PVOID    0xF7 1 11 101 11    0:16 near ptr to void.

1------------------------------------------------------------------------------

 Leaf definitions.
 ----------------

    The following prefixes define the leaves:

      FID_NIL    0x80
      FID_STRING 0x82
      FID_INDEX  0x83
      FID_SPAN

        Numeric Leaves
        -----------------------
          0x8B - 8  bit unsigned
          0x85 - 16 bit unsigned
          0x86 - 32 bit unsigned

          0x88 - 8  bit signed
          0x89 - 16 bit signed
          0x8A - 32 bit signed


                   1
                   ----
             -----|    |<--- 1 byte numeric value <= 127.
            |     |    |                            (0x7F)
            |      ----
            |
            or if bit 7 of the first byte is set, then
            |
            |         --FID_span byte
            |        |
            |      1 |
            |      ---- ----
            |     |0x88|    |<--1 byte number signed/unsigned.
            |     |0x8B|    |
            |      ---- --------
            |     |0x85|        |<--2 byte number signed/unsigned.
             -----|0x89|        |
                   ---- ----------------
                  |0x86|                |<--4 byte number signed/unsigned.
                  |0x8A|                |
                   ---- ----------------


1------------------------------------------------------------------------------

 Structure
 ---------

  Microsoft 16/32 bit.
  -------------------

      T          UN         UN         I          I          S          N
     ---------- --------- ---------- ---------- ---------- ---------- ----------
    | Trec     | Length  | Number of|  Type    | Name     | Tag      | Packing  |
    |          | in bits | members  |  List    | List     | Name     |          |
     ---------- --------- ---------- ---------- ---------- ---------- ----------


    1     2        1    @    @    1    2        1    2        1     1     *              1
    ---- -------- ---- ---- ---- ---- -------- ---- -------- ----- ----- ---------//--- -----
   |rec |rec len |type|bit |num |FID |type lst|FID |name lst|FID  |name |struct        |pck'd|
   |id  |        |    |len |mems|indx|index   |indx|index   |strng|len  |tag name      |     |
   |0x01|        |0x79|    |    |0x83|        |0x83|        |0x82 |     |              |     |
    ---- -------- ---- ---- ---- ---- -------- ---- -------- ---------------------//--- -----

  IBM HL01,HL02.
  -------------
    1     2        1   1     4                2        1    2        1    2        1     1     *
    ---- -------- ---- ---- ---------------- -------- ---- -------- ---- -------- ----- ----- ---------/
   |rec |rec len |type|type| size of struct |items in|FID |type lst|FID |name lst|FID  |name |struct
   |id  |        |    |qual| in bytes       |struct  |indx|index   |indx|index   |strng|len  |tag name
   |0x01|        |0x79|    |                |        |0x83|        |0x83|        |0x82 |     |
    ---- -------- ---- ---- ---------------- -------- ---- -------- ---- -------- --------------------//

  IBM HL03.
  ---------
          2        1   1     4                2        1    2        1    2        1     1     *
         -------- ---- ---- ---------------- -------- ---- -------- ---- -------- ----- ----- ---------/
        |rec len |type|type| size of struct |items in|FID |type lst|FID |name lst|FID  |name |struct
        |        |    |qual| in bytes       |struct  |indx|index   |indx|index   |strng|len  |tag name
        |        |0x79|    |                |        |0x83|        |0x83|        |0x82 |     |
         -------- ---- ---- ---------------- -------- ---- -------- ---- -------- --------------------//


 Notes:

   1. The "type qualifier" in HL01 and HL02 only contained "packing" information.
      It was removed in HL03.

1------------------------------------------------------------------------------

 Bit Fields
 ---------

  Microsoft 16/32 bit.
  -------------------

      T          UN        UN         I
     ---------- --------- ---------- ----------
    | Trec     | Bitfield| Bitfield | Bitfield |
    | 0x5C     | size    | base type| offset   |
     ---------- --------- ---------- ----------

    1     2        1    1    1    1
    ---- -------- ---- ---- ---- ----
   |rec |rec len |type|size|base|off-|
   |id  |        |    |    |type|set |<--offset of the bitfield within the base type.
   |0x01|        |0x5C|    |    |    |
    ---- -------- ---- ---- ---- ----
                        |    |
   numeric leaf of the--      ---- 0x6F - character
   size of the bit                 0x7C - unsigned
   field. Allowed values           0x7D - signed
   are 0x00 - 0x20.                The Microsoft compilers will allow you to
                                   specify a char type for a bitfield; however,
                                   it will get mapped to an int in the debug info.

  IBM HL01,HL02.
  -------------                                                          --FID_span byte
    1     2        1   1     1    @                                     |
    ---- -------- ---- ---- ---- ----                                 1 |
   |rec |rec len |type|type|off-|size|                                ---- ----
   |id  |        |    |qual|set |    |<---Numeric leaf of the size   |0x88|    |<--1 byte signed number.
   |0x01|        |0x5C|    |    |    |  | of the bit field in bits.  |    |    |     from 0x01 - 0x20.
    ---- -------- ---- ---- ---- ----   |                             ---- ----
                        |               |
                        |               |                   ---------
                        |<--------------|------------------ 4 3 2 1 0 <-bit
                        |               |                   ---------
                        |               |                   x x x x 0 - non-varying
                        |               |                   x x x x 1 - varying
                        |               |                   x x x 0 x - unsigned
                        |               |                   x x x 1 x - signed
                        |               |                   x x 0 x x - byte alignment
                        |               |                   x x 1 x x - word alignment
                        |               |                   x 0 x x x - display as string of 0 and 1
                        |               |                   x 1 x x x - display as a value
                        |               |                   0 x x x x - no descriptor required
  IBM HL03.             |               |                   1 x x x x - descriptor required
  --------              |               |
          2        1   1|    1    @     |
         -------- ---- ---- ---- ----   |
        |rec len |type|type|off-|size|  |

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?