The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
pecoff.c File Reference
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "backtrace.h"
#include "internal.h"
+ Include dependency graph for pecoff.c:

Go to the source code of this file.

Data Structures

struct  b_coff_external_symbol
 
struct  b_coff_file_header
 
struct  b_coff_internal_symbol
 
union  b_coff_name
 
struct  b_coff_name.long_name
 
struct  b_coff_optional_header
 
union  b_coff_optional_header.u
 
struct  b_coff_optional_header.u.pe
 
struct  b_coff_optional_header.u.pep
 
struct  b_coff_section_header
 
struct  coff_symbol
 
struct  coff_syminfo_data
 

Macros

#define IMAGE_SYM_DTYPE_FUNCTION   2 /* Function derived type. */
 
#define N_TBSHFT   4 /* Shift for the derived type. */
 
#define PE_MAGIC   0x10b /* PE32 executable. */
 
#define PEP_MAGIC   0x20b /* PE32+ executable (for 64bit targets). */
 
#define SYM_SZ   18
 

Functions

int backtrace_initialize (struct backtrace_state *state, const char *filename ATTRIBUTE_UNUSED, int descriptor, backtrace_error_callback error_callback, void *data, fileline *fileline_fn)
 
static int coff_add (struct backtrace_state *state, int descriptor, backtrace_error_callback error_callback, void *data, fileline *fileline_fn, int *found_sym, int *found_dwarf, uintptr_t module_handle ATTRIBUTE_UNUSED)
 
static void coff_add_syminfo_data (struct backtrace_state *state, struct coff_syminfo_data *sdata)
 
static int coff_expand_symbol (b_coff_internal_symbol *isym, const b_coff_external_symbol *sym, uint16_t sects_num, const unsigned char *strtab, size_t strtab_size)
 
static int coff_initialize_syminfo (struct backtrace_state *state, struct libbacktrace_base_address base_address, int is_64, const b_coff_section_header *sects, size_t sects_num, const b_coff_external_symbol *syms, size_t syms_size, const unsigned char *strtab, size_t strtab_size, backtrace_error_callback error_callback, void *data, struct coff_syminfo_data *sdata)
 
static int coff_is_function_symbol (const b_coff_internal_symbol *isym)
 
static int coff_long_name_eq (const char *name, unsigned int off, struct backtrace_view *str_view)
 
static int coff_nodebug (struct backtrace_state *state ATTRIBUTE_UNUSED, uintptr_t pc ATTRIBUTE_UNUSED, backtrace_full_callback callback ATTRIBUTE_UNUSED, backtrace_error_callback error_callback, void *data)
 
static void coff_nosyms (struct backtrace_state *state ATTRIBUTE_UNUSED, uintptr_t addr ATTRIBUTE_UNUSED, backtrace_syminfo_callback callback ATTRIBUTE_UNUSED, backtrace_error_callback error_callback, void *data)
 
static uint16_t coff_read2 (const unsigned char *p)
 
static uint32_t coff_read4 (const unsigned char *p)
 
static int coff_short_name_eq (const char *name, const char *cname)
 
static size_t coff_short_name_len (const char *name)
 
static int coff_symbol_compare (const void *v1, const void *v2)
 
static int coff_symbol_search (const void *vkey, const void *ventry)
 
static void coff_syminfo (struct backtrace_state *state, uintptr_t addr, backtrace_syminfo_callback callback, backtrace_error_callback error_callback ATTRIBUTE_UNUSED, void *data)
 

Variables

static const char *const debug_section_names [DEBUG_MAX]
 

Data Structure Documentation

◆ b_coff_external_symbol

struct b_coff_external_symbol

Definition at line 160 of file pecoff.c.

+ Collaboration diagram for b_coff_external_symbol:
Data Fields
b_coff_name name
unsigned char number_of_aux_symbols
unsigned char section_number[2]
unsigned char storage_class
unsigned char type[2]
unsigned char value[4]

◆ b_coff_file_header

struct b_coff_file_header

Definition at line 96 of file pecoff.c.

Data Fields
uint16_t characteristics
uint16_t machine
uint16_t number_of_sections
uint32_t number_of_symbols
uint32_t pointer_to_symbol_table
uint16_t size_of_optional_header
uint32_t time_date_stamp

◆ b_coff_internal_symbol

struct b_coff_internal_symbol

Definition at line 180 of file pecoff.c.

Data Fields
const char * name
uint16_t sc
int16_t sec
uint16_t type
uint32_t value

◆ b_coff_name

union b_coff_name

Definition at line 150 of file pecoff.c.

Data Fields
struct b_coff_name.long_name long_name
char short_name[8]

◆ b_coff_name.long_name

struct b_coff_name.long_name

Definition at line 152 of file pecoff.c.

Data Fields
unsigned char off[4]
unsigned char zeroes[4]

◆ b_coff_optional_header

struct b_coff_optional_header

Definition at line 108 of file pecoff.c.

Data Fields
uint32_t address_of_entry_point
uint32_t base_of_code
uint16_t magic
uint8_t major_linker_version
uint8_t minor_linker_version
uint32_t size_of_code
uint32_t size_of_initialized_data
uint32_t size_of_uninitialized_data
union b_coff_optional_header.u u

◆ b_coff_optional_header.u

union b_coff_optional_header.u

Definition at line 117 of file pecoff.c.

Data Fields
struct b_coff_optional_header.u.pe pe
struct b_coff_optional_header.u.pep pep

◆ b_coff_optional_header.u.pe

struct b_coff_optional_header.u.pe

Definition at line 118 of file pecoff.c.

Data Fields
uint32_t base_of_data
uint32_t image_base

◆ b_coff_optional_header.u.pep

struct b_coff_optional_header.u.pep

Definition at line 122 of file pecoff.c.

Data Fields
uint64_t image_base

◆ b_coff_section_header

struct b_coff_section_header

Definition at line 135 of file pecoff.c.

Data Fields
uint32_t characteristics
char name[8]
uint16_t number_of_line_numbers
uint16_t number_of_relocations
uint32_t pointer_to_line_numbers
uint32_t pointer_to_raw_data
uint32_t pointer_to_relocations
uint32_t size_of_raw_data
uint32_t virtual_address
uint32_t virtual_size

◆ coff_symbol

struct coff_symbol

Definition at line 215 of file pecoff.c.

Data Fields
uintptr_t address
const char * name

◆ coff_syminfo_data

struct coff_syminfo_data

Definition at line 225 of file pecoff.c.

+ Collaboration diagram for coff_syminfo_data:
Data Fields
size_t count
struct coff_syminfo_data * next
struct coff_symbol * symbols

◆ debug_section_info

struct debug_section_info

Definition at line 364 of file elf.c.

Data Fields
int compressed
const unsigned char * data
off_t offset
size_t size

Macro Definition Documentation

◆ IMAGE_SYM_DTYPE_FUNCTION

#define IMAGE_SYM_DTYPE_FUNCTION   2 /* Function derived type. */

Definition at line 172 of file pecoff.c.

◆ N_TBSHFT

#define N_TBSHFT   4 /* Shift for the derived type. */

Definition at line 171 of file pecoff.c.

◆ PE_MAGIC

#define PE_MAGIC   0x10b /* PE32 executable. */

Definition at line 130 of file pecoff.c.

◆ PEP_MAGIC

#define PEP_MAGIC   0x20b /* PE32+ executable (for 64bit targets). */

Definition at line 131 of file pecoff.c.

◆ SYM_SZ

#define SYM_SZ   18

Definition at line 176 of file pecoff.c.

Function Documentation

◆ backtrace_initialize()

int backtrace_initialize ( struct backtrace_state state,
const char *filename  ATTRIBUTE_UNUSED,
int  descriptor,
backtrace_error_callback  error_callback,
void *  data,
fileline fileline_fn 
)

Definition at line 997 of file pecoff.c.

+ Here is the call graph for this function:

◆ coff_add()

static int coff_add ( struct backtrace_state state,
int  descriptor,
backtrace_error_callback  error_callback,
void *  data,
fileline fileline_fn,
int *  found_sym,
int *  found_dwarf,
uintptr_t module_handle  ATTRIBUTE_UNUSED 
)
static

Definition at line 635 of file pecoff.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ coff_add_syminfo_data()

static void coff_add_syminfo_data ( struct backtrace_state state,
struct coff_syminfo_data sdata 
)
static

Definition at line 521 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_expand_symbol()

static int coff_expand_symbol ( b_coff_internal_symbol isym,
const b_coff_external_symbol sym,
uint16_t  sects_num,
const unsigned char *  strtab,
size_t  strtab_size 
)
static

Definition at line 346 of file pecoff.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ coff_initialize_syminfo()

static int coff_initialize_syminfo ( struct backtrace_state state,
struct libbacktrace_base_address  base_address,
int  is_64,
const b_coff_section_header sects,
size_t  sects_num,
const b_coff_external_symbol syms,
size_t  syms_size,
const unsigned char *  strtab,
size_t  strtab_size,
backtrace_error_callback  error_callback,
void *  data,
struct coff_syminfo_data sdata 
)
static

Definition at line 384 of file pecoff.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ coff_is_function_symbol()

static int coff_is_function_symbol ( const b_coff_internal_symbol isym)
static

Definition at line 375 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_long_name_eq()

static int coff_long_name_eq ( const char *  name,
unsigned int  off,
struct backtrace_view str_view 
)
static

Definition at line 317 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_nodebug()

static int coff_nodebug ( struct backtrace_state *state  ATTRIBUTE_UNUSED,
uintptr_t pc  ATTRIBUTE_UNUSED,
backtrace_full_callback callback  ATTRIBUTE_UNUSED,
backtrace_error_callback  error_callback,
void *  data 
)
static

Definition at line 238 of file pecoff.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ coff_nosyms()

static void coff_nosyms ( struct backtrace_state *state  ATTRIBUTE_UNUSED,
uintptr_t addr  ATTRIBUTE_UNUSED,
backtrace_syminfo_callback callback  ATTRIBUTE_UNUSED,
backtrace_error_callback  error_callback,
void *  data 
)
static

Definition at line 251 of file pecoff.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ coff_read2()

static uint16_t coff_read2 ( const unsigned char *  p)
static

Definition at line 275 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_read4()

static uint32_t coff_read4 ( const unsigned char *  p)
static

Definition at line 262 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_short_name_eq()

static int coff_short_name_eq ( const char *  name,
const char *  cname 
)
static

Definition at line 300 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_short_name_len()

static size_t coff_short_name_len ( const char *  name)
static

Definition at line 286 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_symbol_compare()

static int coff_symbol_compare ( const void *  v1,
const void *  v2 
)
static

Definition at line 328 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_symbol_search()

static int coff_symbol_search ( const void *  vkey,
const void *  ventry 
)
static

Definition at line 565 of file pecoff.c.

+ Here is the caller graph for this function:

◆ coff_syminfo()

static void coff_syminfo ( struct backtrace_state state,
uintptr_t  addr,
backtrace_syminfo_callback  callback,
backtrace_error_callback error_callback  ATTRIBUTE_UNUSED,
void *  data 
)
static

Definition at line 583 of file pecoff.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ debug_section_names

const char* const debug_section_names[DEBUG_MAX]
static
Initial value:
=
{
".debug_info",
".debug_line",
".debug_abbrev",
".debug_ranges",
".debug_str",
".debug_addr",
".debug_str_offsets",
".debug_line_str",
".debug_rnglists"
}

Definition at line 190 of file pecoff.c.