Module dwarf
Declares methods that can be invoked on binary containing DWARF information (instance of the 'dwarf' class)
Functions
api:debug () | Generic debug function for the API |
api:finish () | Finish the API session |
api:get () | Get the current API session |
api:get_containers () | Get the list of containers of the binary |
api:get_containers_count () | Get the count of containers in the binary |
api:get_file_by_name (name) | Get a file by its name |
api:get_files () | Get the list of files of the binary |
api:get_files_count () | Get the count of files in the binary |
api:get_function_by_addr (address) | Get a function by its address |
api:get_function_by_name (name) | Get a function by its name |
api:get_global_by_address (address) | Get a global by its address |
api:get_global_by_name (name) | Get a global by its name |
api:get_globals () | Get the list of globals of the binary |
api:get_globals_count () | Get the count of files in the binary |
api:get_line (address) | Get a line number by its address |
api:get_lines () | TODO : Get an array of lines by their addresses |
api:get_verbose () | Get the current verbose |
api:set_verbose (verbose) | Set the verbose |
container:debug () | Generic debug function for a DwarfContainer |
container:get_byte_size () | Get the byte size of the container |
container:get_name () | Get the name of the container |
container:get_objects () | Get the list of DwarfObject of a DwarfContainer |
container:get_objects_count () | Get the count of DwarfObject is the list |
container:get_type () | Get the type of the container |
container:get_type_str () | Get a string containing the type of the container |
dwarf_api.init (filename) | Initialize the API session for a given binary name |
file:debug () | Generic debug function for a DwarfFile |
file:get_dir () | Get the directory of the file |
file:get_function_by_addr (address) | Get a function by its address |
file:get_function_by_name (name) | Get a function by its name |
file:get_function_count () | Get the count of the functions declared in the file |
file:get_functions () | Get the functions in a file |
file:get_language () | Get the language of the file |
file:get_name () | Get the name of the file |
file:get_vendor () | Get the language of the file |
file:get_version () | Get the version of the file |
func:debug () | Generic debug function for a DwarfFunc |
func:get_col () | Get the column declaring the function |
func:get_file () | Get the DwarfFile declaring the function |
func:get_high_pc () | Get the address of the last instruction of the function |
func:get_line () | Get the line declaring the function |
func:get_linkage_name () | Get the linkage name of the function |
func:get_local_count () | Get the count of the local variables declared in the function |
func:get_locals () | Get a list of local variables of the function |
func:get_low_pc () | Get the address of the first instruction of the function |
func:get_name () | Get the name of the function |
func:get_param_count () | Get the count of the parameters declared in the function |
func:get_parameters () | Get a list of parameters of the function |
func:get_ret_var () | Get the return variable of the function |
global:debug () | Generic debug function for a DwarfGlobal |
global:get_file () | Get the DwarfFile of the global |
global:get_var () | Get the DwarfVar of the global |
memloc:debug () | Generic debug function for a DwarfMemLoc |
memloc:get_address () | Get the address of the memory location |
memloc:get_high_pc () | Get the last instruction of the memory location |
memloc:get_low_pc () | Get the first instruction of the memory location |
memloc:get_offset () | Get the offset of the memory location |
memloc:get_reg_name () | Get the name of the register |
memloc:get_type () | Get the type of a DwarfMemLoc, |
memloc:get_type_str () | Get a string containing the type of the memloc |
memloc:is_address () | Test if the memory location is an address |
memloc:is_register () | Test if the memory location is a register or an address in a register + offset |
var:debug () | Generic debug function for a DwarfVar |
var:get_access_str () | Get a string containing the accessibility of the variable (for C++) |
var:get_accessibility () | Get the accessibility of the variable (for C++) |
var:get_array_size () | Get the size of the array |
var:get_byte_size () | Get the byte size of the array |
var:get_col () | Get the column of declaration of the variable |
var:get_first_memloc () | Get the first memory location of the variable |
var:get_full_type () | Get the full type of the variable |
var:get_function () | Get the function declaring the variable |
var:get_line () | Get the line of declaration of the variable |
var:get_mem_locations () | Get a list of the memory locations of a variable |
var:get_memlocs_count () | Get the count of memory locations of a variable |
var:get_name () | Get the name of the variable |
var:get_pointer_count () | Get the number of pointers |
var:get_type () | Get the type of the variable |
var:is_array () | Test if the variable is an array |
var:is_const () | Test if the variable is const |
var:is_enum () | Test if the variable is enum |
var:is_extern () | Test if the variable is extern |
var:is_inline () | Test if the variable is inline |
var:is_static () | Test if the variable is static |
var:is_struct () | Test if the variable is a struct |
Functions
- api:debug ()
- Generic debug function for the API
- api:finish ()
- Finish the API session
- api:get ()
-
Get the current API session
Return value:
a DwarfAPI pointer, the current API session - api:get_containers ()
-
Get the list of containers of the binary
Return value:
an iterator on DwarfContainer queue - api:get_containers_count ()
-
Get the count of containers in the binary
Return value:
the count of containers - api:get_file_by_name (name)
-
Get a file by its name
Parameters
- name: the name of the file
Return value:
a DwarfFile pointer - api:get_files ()
-
Get the list of files of the binary
Return value:
an iterator on DwarfFile queue - api:get_files_count ()
-
Get the count of files in the binary
Return value:
the count of files - api:get_function_by_addr (address)
-
Get a function by its address
Parameters
- address: the address of the first instruction of the function (low_pc)
Return value:
a DwarfFunction pointer - api:get_function_by_name (name)
-
Get a function by its name
Parameters
- name: the demangled name of the function
Return value:
a DwarfFunction pointer - api:get_global_by_address (address)
-
Get a global by its address
Parameters
- address: of the global to find
Return value:
a DwarfGlobal if the global has been found at this address, or NULL if it's not the case - api:get_global_by_name (name)
-
Get a global by its name
Parameters
- name: The name of the global to find
Return value:
a DwarfGlobal if the global has been found at this address, or NULL if it's not the case - api:get_globals ()
-
Get the list of globals of the binary
Return value:
an iterator on DwarfGlobal queue - api:get_globals_count ()
-
Get the count of files in the binary
Return value:
the count of files - api:get_line (address)
-
Get a line number by its address
Parameters
- address: the address of the line
Return value:
a line number - api:get_lines ()
- TODO : Get an array of lines by their addresses
- api:get_verbose ()
- Get the current verbose
- api:set_verbose (verbose)
-
Set the verbose
Parameters
- verbose: The verbose level : 0 mute all the warning and error messages. 1 enable some of them, the most important. 2 enable all of them. The default verbose is 1.
- container:debug ()
- Generic debug function for a DwarfContainer
- container:get_byte_size ()
-
Get the byte size of the container
Return value:
the byte size of the container - container:get_name ()
-
Get the name of the container
Return value:
the name of the container - container:get_objects ()
-
Get the list of DwarfObject of a DwarfContainer
Return value:
the list of DwarfObject of a DwarfContainer - container:get_objects_count ()
-
Get the count of DwarfObject is the list
Return value:
the count of DwarfObject is the list - container:get_type ()
-
Get the type of the container
Return value:
the type of the container: DWARF_CONTAINER_CLASS = 0, DWARF_CONTAINER_STRUCT = 1, DWARF_CONTAINER_ENUM = 2, DWARF_CONTAINER_NAMESPACE = 3 - container:get_type_str ()
-
Get a string containing the type of the container
Return value:
a string containing the type of the container (DWARF_CONTAINER_CLASS, DWARF_CONTAINER_STRUCT, DWARF_CONTAINER_ENUM or DWARF_CONTAINER_NAMESPACE) - dwarf_api.init (filename)
-
Initialize the API session for a given binary name
Parameters
- filename: the filename of the binary to analyze
Return value:
a DwarfAPI pointer, an API handler for the binary - file:debug ()
- Generic debug function for a DwarfFile
- file:get_dir ()
-
Get the directory of the file
Return value:
a string containing the name of the file - file:get_function_by_addr (address)
-
Get a function by its address
Parameters
- address: the address of the function;
Return value:
a DwarfFunction pointer - file:get_function_by_name (name)
-
Get a function by its name
Parameters
- name: the demangled name of the function
Return value:
a DwarfFunction pointer - file:get_function_count ()
-
Get the count of the functions declared in the file
Return value:
the count of the functions declared in the file - file:get_functions ()
-
Get the functions in a file
Return value:
a list of functions - file:get_language ()
-
Get the language of the file
Return value:
a string containing the directory of the file - file:get_name ()
-
Get the name of the file
Return value:
a string containing the name of the file - file:get_vendor ()
-
Get the language of the file
Return value:
a string containing the directory of the file - file:get_version ()
-
Get the version of the file
Return value:
a string containing the directory of the file - func:debug ()
- Generic debug function for a DwarfFunc
- func:get_col ()
-
Get the column declaring the function
Return value:
the column declaring the function - func:get_file ()
-
Get the DwarfFile declaring the function
Return value:
a DwarfFile - func:get_high_pc ()
-
Get the address of the last instruction of the function
Return value:
the address of the last instruction of the function - func:get_line ()
-
Get the line declaring the function
Return value:
the line declaring the function - func:get_linkage_name ()
-
Get the linkage name of the function
Return value:
a string containing the linkage name of the function - func:get_local_count ()
-
Get the count of the local variables declared in the function
Return value:
the count of the local variables declared in the function - func:get_locals ()
-
Get a list of local variables of the function
Return value:
a list of the local variables, DwarfVar - func:get_low_pc ()
-
Get the address of the first instruction of the function
Return value:
the address of the first instruction of the function - func:get_name ()
-
Get the name of the function
Return value:
a string containing the name of the function - func:get_param_count ()
-
Get the count of the parameters declared in the function
Return value:
the count of the parameters declared in the function - func:get_parameters ()
-
Get a list of parameters of the function
Return value:
a list of the parameters, DwarfVar - func:get_ret_var ()
-
Get the return variable of the function
Return value:
a DwarfVar which describe the return variable of the function - global:debug ()
- Generic debug function for a DwarfGlobal
- global:get_file ()
-
Get the DwarfFile of the global
Return value:
a DwarfFile - global:get_var ()
-
Get the DwarfVar of the global
Return value:
a DwarfVar - memloc:debug ()
- Generic debug function for a DwarfMemLoc
- memloc:get_address ()
-
Get the address of the memory location
Return value:
the address of the memory location if the type of the memloc is DWARF_ADDR, or 0 if not the case - memloc:get_high_pc ()
-
Get the last instruction of the memory location
Return value:
the last instruction of the memory location - memloc:get_low_pc ()
-
Get the first instruction of the memory location
Return value:
the first instruction of the memory location - memloc:get_offset ()
-
Get the offset of the memory location
Return value:
the offset of the memory location if the type of the memloc is DWARF_BREG, or 0 if not the case - memloc:get_reg_name ()
-
Get the name of the register
Return value:
a string containing the name of the register ("EAX", "EBX", etc...) - memloc:get_type ()
-
Get the type of a DwarfMemLoc,
Return value:
the type of a DwarfMemLoc : DWARF_BREG, DWARF_ADDR or DWARF_REG - memloc:get_type_str ()
-
Get a string containing the type of the memloc
Return value:
a string containing the type of the memloc - memloc:is_address ()
-
Test if the memory location is an address
Return value:
TRUE or FALSE - memloc:is_register ()
-
Test if the memory location is a register or an address in a register + offset
Return value:
TRUE or FALSE - var:debug ()
- Generic debug function for a DwarfVar
- var:get_access_str ()
-
Get a string containing the accessibility of the variable (for C++)
Return value:
a string containing the accessibility of the variable, "public", "protected" or "private" - var:get_accessibility ()
-
Get the accessibility of the variable (for C++)
Return value:
the accessibility of the variable, 0 for public, 1 for protected, 2 for private - var:get_array_size ()
-
Get the size of the array
Return value:
the size of the array, 0 or -1 if not available - var:get_byte_size ()
-
Get the byte size of the array
Return value:
the byte size of the array - var:get_col ()
-
Get the column of declaration of the variable
Return value:
the column of declaration of the variable - var:get_first_memloc ()
-
Get the first memory location of the variable
Return value:
a DwarfMemLoc, the first one of the variable - var:get_full_type ()
-
Get the full type of the variable
Return value:
a string containing the full type of the variable (with *, and modifiers as struct enum extern etc) - var:get_function ()
-
Get the function declaring the variable
Return value:
a DwarfFunction - var:get_line ()
-
Get the line of declaration of the variable
Return value:
the line of declaration of the variable - var:get_mem_locations ()
-
Get a list of the memory locations of a variable
Return value:
a list of the memory locations of a variable, DwarfMemLoc - var:get_memlocs_count ()
-
Get the count of memory locations of a variable
Return value:
count of memory locations of a variable - var:get_name ()
-
Get the name of the variable
Return value:
a string containing the name of the variable - var:get_pointer_count ()
-
Get the number of pointers
Return value:
the number of pointers, i.e. 1 if the variable is char *var, 2 if the variable is char **var, etc. - var:get_type ()
-
Get the type of the variable
Return value:
a string containing the basic type of the variable - var:is_array ()
-
Test if the variable is an array
Return value:
TRUE or FALSE - var:is_const ()
-
Test if the variable is const
Return value:
TRUE or FALSE - var:is_enum ()
-
Test if the variable is enum
Return value:
TRUE or FALSE - var:is_extern ()
-
Test if the variable is extern
Return value:
TRUE or FALSE - var:is_inline ()
-
Test if the variable is inline
Return value:
TRUE or FALSE - var:is_static ()
-
Test if the variable is static
Return value:
TRUE or FALSE - var:is_struct ()
-
Test if the variable is a struct
Return value:
TRUE or FALSE