JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++
Binaries
C#
Java

Description: Procedure (== PDG)

Each user-defined procedure in a project is represented as a procedure dependence graph (PDG). There are also several other kinds of PDGs generated by CodeSonar for technical purposes.

The C++ and Python API implementations name the corresponding type procedure. The C implementation names it cs_pdg. The discussion in this section will generally refer to the abstraction as a PDG in order to avoid confusion with the concrete notion of a procedure, since the two are not always in 1-1 correspondence.

Language Module Support: Internal representation for procedures is available for C/C++, binary, C#, and Java analyses.



API Functionality

The API provides access to various aspects of a PDG:

PDG kinds

The PDG kinds are:

Kind Identifier Description
user-defined name as given in source code CodeSonar creates a PDG of this kind for each function defined in a project's source files.
generated-indirect #Indirect~i CodeSonar creates a PDG of this kind for each non-singleton set of functions that may be the target of an indirect function call.
undefined name as given in source code CodeSonar creates a PDG of this kind for each function that is called in the project but not defined, CodeSonar.
library . A function PDG is given kind library if the preprocessor symbol __CSURF_MARKER_LIBRARY_FUNCTION__ is defined when the open curly brace of the function is encountered. There is one exception: member functions defined inside classes are marked as library functions only if the preprocessor symbol is defined when the closing colon of the class definition is encountered.

All library models shipped with CodeSonar are marked as library functions.

system-initialization #System_Initialization The #System_Initialization PDG acts as a project's true main procedure, i.e., the procedure called by the operating system. This PDG calls the file-initialization procedures of each file that contains initialized global or static variables, and then calls main. #System_Initialization is associated with the file that contains the program's main procedure.
file-initialization
  • #Global_Initialization_0
  • #Global_Initialization_1
  • #Global_Initialization_2
  • #File_Initialization
Each file that contains initialized global or static variables has at least one of these procedures. The initialization for each such variable occurs in one of these PDGs. These functions are called before main is called, and they are called in the following order:
  1. all #Global_Initialization_0s,
  2. all #Global_Initialization_1s,
  3. all #Global_Initialization_2s,
  4. all #File_Initializations.
Global variables implicitly initialized to 0 are set in #Global_Initialization_0 routines. Global variables with explicit static initializations are set in #Global_Initialization_1 routines. Global variables with dynamic initializations are set in #Global_Initialization_2 routines. Static variables local to a function are set in #File_Initialization routines, as are the character arrays associated with string constants. After all #File_Initialization routines are called (but before main is called) all user-defined PDGs that are marked as constructors (not C++ constructors, but GNU constructors) are called.
  • #Local_Static_Cleanup
  • #Global_Cleanup
Each file that contains global or static variables that have to be destroyed before the program terminates has at least one of these procedures. The destruction for each such variable is contained in one of these PDGs; exactly which PDG contains the destruction depends on the language and the front end.

These functions are called after main returns, and they are called in the following order:

  1. all #Local_Static_Cleanups,
  2. and then all #Global_Cleanups.
All user-defined PDGs that are marked as destructors (not C++ destructors, but GNU destructors) are called before all #Local_Static_Cleanups, but after main.
objc-load #Objc_Loads1 A PDG containing a chain of calls to Objective C +load functions in the order in which they need to be called.

CodeSonar will generate one of these for every project that contains at least one Objective C compilation unit, called from #System_Initialization.

objc-initialize #Objc_Initialize1 A PDG containing chain of calls to Objective C +initialize functions in the order in which they need to be called.

CodeSonar will generate one of these for every project that contains at least one Objective C compilation unit, called from #System_Initialization.

hammock-generated . For internal use only. Should never be encountered during normal usage.
unknown . Internal error.

Links

By API implementation:

Language Procedure (PDG) Functionality and Types Provided By Procedure (PDG) Type PDG Kind Type
C++ class procedure class procedure class procedure_kind
Python class procedure class procedure class procedure_kind
C Header cs_pdg.h typedef cs_pdg typedef cs_pdg_kind

See also:

 

To report problems with this documentation, please visit https://support.codesecure.com/.