# STABS

This document describes the stabs debugging symbol tables.

Copyright © 1992-2020 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Julia Menapace, Jim Kingdon, and David MacKenzie.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

# The "stabs" representation of debugging information

This document describes the stabs debugging format.

## Table of Contents

- 1 Overview of Stabs
  - 1.1 Overview of Debugging Information Flow
  - 1.2 Overview of Stab Format
  - 1.3 The String Field
  - 1.4 A Simple Example in C Source
  - 1.5 The Simple Example at the Assembly Level
- 2 Encoding the Structure of the Program
  - 2.1 Main Program
  - 2.2 Paths and Names of the Source Files
  - 2.3 Names of Include Files
  - 2.4 Line Numbers
  - 2.5 Procedures
  - 2.6 Nested Procedures
  - 2.7 Block Structure
  - 2.8 Alternate Entry Points
- 3 Constants
- 4 Variables
  - 4.1 Automatic Variables Allocated on the Stack
  - 4.2 Global Variables
  - 4.3 Register Variables
  - 4.4 Common Blocks
  - 4.5 Static Variables
  - 4.6 Fortran Based Variables
  - 4.7 Parameters
    - 4.7.1 Passing Parameters in Registers
    - 4.7.2 Storing Parameters as Local Variables
    - 4.7.3 Passing Parameters by Reference
    - 4.7.4 Passing Conformant Array Parameters
- 5 Defining Types
  - 5.1 Builtin Types
    - 5.1.1 Traditional Builtin Types
      - 5.1.1.1 Traditional Integer Types
      - 5.1.1.2 Traditional Other Types
    - 5.1.2 Defining Builtin Types Using Builtin Type Descriptors
    - 5.1.3 Negative Type Numbers
  - 5.2 Miscellaneous Types
  - 5.3 Cross-References to Other Types
  - 5.4 Subrange Types
  - 5.5 Array Types
  - 5.6 Strings
  - 5.7 Enumerations
  - 5.8 Structures
  - 5.9 Giving a Type a Name
  - 5.10 Unions
  - 5.11 Function Types
- 6 Representation of #define and #undef
- 7 Symbol Information in Symbol Tables
  - 7.1 Symbol Table Format
  - 7.2 Transformations on Symbol Tables
    - 7.2.1 Transformations on Static Variables
    - 7.2.2 Transformations on Global Variables
    - 7.2.3 Transformations of Stabs in separate sections
- 8 GNU C`++` Stabs
  - 8.1 C`++` Class Names
  - 8.2 Defining a Symbol Within Another Type
  - 8.3 Basic Types For C`++`
  - 8.4 Simple Class Definition
  - 8.5 Class Instance
  - 8.6 Method Definition
  - 8.7 The ‘`#`’ Type Descriptor
  - 8.8 The ‘`@`’ Type Descriptor
  - 8.9 Protections
  - 8.10 Method Modifiers (`const`, `volatile`, `const volatile`)
  - 8.11 Virtual Methods
  - 8.12 Inheritance
  - 8.13 Virtual Base Classes
  - 8.14 Static Members
- Appendix A Table of Stab Types
  - A.1 Non-Stab Symbol Types
  - A.2 Stab Symbol Types
- Appendix B Table of Symbol Descriptors
- Appendix C Table of Type Descriptors
- Appendix D Expanded Reference by Stab Type
  - D.1 N_PC
  - D.2 N_NSYMS
  - D.3 N_NOMAP
  - D.4 N_M2C
  - D.5 N_BROWS
  - D.6 N_DEFD
  - D.7 N_EHDECL
  - D.8 N_MOD2
  - D.9 N_CATCH
  - D.10 N_SSYM
  - D.11 N_SCOPE
  - D.12 Non-base registers on Gould systems
  - D.13 N_LENG
- Appendix E Questions and Anomalies
- Appendix F Using Stabs in Their Own Sections
  - F.1 How to Embed Stabs in Sections
  - F.2 Having the Linker Relocate Stabs in ELF
- Appendix G GNU Free Documentation License
- Symbol Types Index