GDB (xrefs)

Classes | Macros | Functions | Variables
/tmp/gdb-8.1/gdb/coff-pe-read.c File Reference
`#include "defs.h"`
`#include "coff-pe-read.h"`
`#include "bfd.h"`
`#include "gdbtypes.h"`
`#include "command.h"`
`#include "gdbcmd.h"`
`#include "symtab.h"`
`#include "symfile.h"`
`#include "objfiles.h"`
`#include "common/common-utils.h"`
`#include "coff/internal.h"`
`#include <ctype.h>`

Go to the source code of this file.

## Classes
struct | read_pe_section_data
struct | pe_sections_info

## Macros
#define | IMAGE_SCN_CNT_CODE 0x20
#define | IMAGE_SCN_CNT_INITIALIZED_DATA 0x40
#define | IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x80
#define | PE_SECTION_INDEX_TEXT 0
#define | PE_SECTION_INDEX_DATA 1
#define | PE_SECTION_INDEX_BSS 2
#define | PE_SECTION_TABLE_SIZE 3
#define | PE_SECTION_INDEX_INVALID -1
#define | DEFAULT_COFF_PE_TEXT_SECTION_OFFSET 0x1000

## Functions
static int | read_pe_section_index (const char *section_name)
static int | get_pe_section_index (const char *section_name, struct read_pe_section_data *sections, int nb_sections)
static void | get_section_vmas (bfd *abfd, asection *sectp, void *context)
static void | add_pe_exported_sym (minimal_symbol_reader &reader, const char *sym_name, unsigned long func_rva, int ordinal, const struct read_pe_section_data *section_data, const char *dll_name, struct objfile *objfile)
static int | add_pe_forwarded_sym (minimal_symbol_reader &reader, const char *sym_name, const char *forward_dll_name, const char *forward_func_name, int ordinal, const char *dll_name, struct objfile *objfile)
static void | read_pe_truncate_name (char *dll_name)
static unsigned int | pe_get16 (bfd *abfd, int where)
static unsigned int | pe_get32 (bfd *abfd, int where)
static unsigned int | pe_as16 (void *ptr)
static unsigned int | pe_as32 (void *ptr)
void | read_pe_exported_syms (minimal_symbol_reader &reader, struct objfile *objfile)
CORE_ADDR | pe_text_section_offset (struct bfd *abfd)
static void | show_debug_coff_pe_read (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
void | _initialize_coff_pe_read (void)

## Variables
static unsigned int | debug_coff_pe_read

## Macro Definition Documentation

## ◆ DEFAULT_COFF_PE_TEXT_SECTION_OFFSET

#define DEFAULT_COFF_PE_TEXT_SECTION_OFFSET 0x1000

Definition at line 637 of file coff-pe-read.c.

Referenced by pe_text_section_offset().

## ◆ IMAGE_SCN_CNT_CODE

#define IMAGE_SCN_CNT_CODE 0x20

Definition at line 60 of file coff-pe-read.c.

Referenced by read_pe_exported_syms().

## ◆ IMAGE_SCN_CNT_INITIALIZED_DATA

#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x40

Definition at line 61 of file coff-pe-read.c.

Referenced by read_pe_exported_syms().

## ◆ IMAGE_SCN_CNT_UNINITIALIZED_DATA

#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x80

Definition at line 62 of file coff-pe-read.c.

Referenced by read_pe_exported_syms().

## ◆ PE_SECTION_INDEX_BSS

#define PE_SECTION_INDEX_BSS 2

Definition at line 65 of file coff-pe-read.c.

Referenced by read_pe_exported_syms(), and read_pe_section_index().

## ◆ PE_SECTION_INDEX_DATA

#define PE_SECTION_INDEX_DATA 1

Definition at line 64 of file coff-pe-read.c.

Referenced by read_pe_exported_syms(), and read_pe_section_index().

## ◆ PE_SECTION_INDEX_INVALID

#define PE_SECTION_INDEX_INVALID -1

Definition at line 67 of file coff-pe-read.c.

Referenced by get_pe_section_index(), get_section_vmas(), read_pe_exported_syms(), and read_pe_section_index().

## ◆ PE_SECTION_INDEX_TEXT

#define PE_SECTION_INDEX_TEXT 0

Definition at line 63 of file coff-pe-read.c.

Referenced by read_pe_exported_syms(), and read_pe_section_index().

## ◆ PE_SECTION_TABLE_SIZE

#define PE_SECTION_TABLE_SIZE 3

Definition at line 66 of file coff-pe-read.c.

Referenced by read_pe_exported_syms().

## Function Documentation

## ◆ _initialize_coff_pe_read()

void _initialize_coff_pe_read | ( | void |  | ) |

Definition at line 704 of file coff-pe-read.c.

References _, add_setshow_zuinteger_cmd(), class_maintenance, debug_coff_pe_read, setdebuglist, show_debug_coff_pe_read(), and showdebuglist.

## ◆ add_pe_exported_sym()

static void add_pe_exported_sym | ( | minimal_symbol_reader & | reader,
|  | const char * | sym_name,
|  | unsigned long | func_rva,
|  | int | ordinal,
|  | const struct read_pe_section_data * | section_data,
|  | const char * | dll_name,
|  | struct objfile * | objfile
| ) |  |
| static

Definition at line 153 of file coff-pe-read.c.

References _, debug_coff_pe_read, fprintf_unfiltered(), gdb_stdlog, read_pe_section_data::index, read_pe_section_data::ms_type, mst_unknown, minimal_symbol_reader::record_with_info(), read_pe_section_data::section_name, read_pe_section_data::vma_offset, xfree(), and xstrprintf().

Referenced by read_pe_exported_syms().

## ◆ add_pe_forwarded_sym()

static int add_pe_forwarded_sym | ( | minimal_symbol_reader & | reader,
|  | const char * | sym_name,
|  | const char * | forward_dll_name,
|  | const char * | forward_func_name,
|  | int | ordinal,
|  | const char * | dll_name,
|  | struct objfile * | objfile
| ) |  |
| static

Definition at line 203 of file coff-pe-read.c.

References _, ANOFFSET, BMSYMBOL_VALUE_ADDRESS, debug_coff_pe_read, fprintf_unfiltered(), gdb_stdlog, lookup_minimal_symbol_and_objfile(), bound_minimal_symbol::minsym, MSYMBOL_SECTION, MSYMBOL_TYPE, minimal_symbol_reader::record_with_info(), SECT_OFF_TEXT, objfile::section_offsets, xfree(), xsnprintf(), and xstrprintf().

Referenced by read_pe_exported_syms().

## ◆ get_pe_section_index()

static int get_pe_section_index | ( | const char * | section_name,
|  | struct read_pe_section_data * | sections,
|  | int | nb_sections
| ) |  |
| static

Definition at line 102 of file coff-pe-read.c.

References PE_SECTION_INDEX_INVALID.

Referenced by get_section_vmas().

## ◆ get_section_vmas()

static void get_section_vmas | ( | bfd * | abfd,
|  | asection * | sectp,
|  | void * | context
| ) |  |
| static

Definition at line 126 of file coff-pe-read.c.

References get_pe_section_index(), pe_sections_info::nb_sections, PE_SECTION_INDEX_INVALID, read_pe_section_data::rva_start, pe_sections_info::sections, and read_pe_section_data::vma_offset.

Referenced by read_pe_exported_syms().

## ◆ pe_as16()

static unsigned int pe_as16 | ( | void * | ptr | ) |
| static

Definition at line 313 of file coff-pe-read.c.

Referenced by read_pe_exported_syms().

## ◆ pe_as32()

static unsigned int pe_as32 | ( | void * | ptr | ) |
| static

Definition at line 321 of file coff-pe-read.c.

Referenced by read_pe_exported_syms().

## ◆ pe_get16()

static unsigned int pe_get16 | ( | bfd * | abfd,
|  | int | where
| ) |  |
| static

Definition at line 293 of file coff-pe-read.c.

References SEEK_SET.

Referenced by pe_text_section_offset(), and read_pe_exported_syms().

## ◆ pe_get32()

static unsigned int pe_get32 | ( | bfd * | abfd,
|  | int | where
| ) |  |
| static

Definition at line 303 of file coff-pe-read.c.

References SEEK_SET.

Referenced by pe_text_section_offset(), and read_pe_exported_syms().

## ◆ pe_text_section_offset()

CORE_ADDR pe_text_section_offset | ( | struct bfd * | abfd | ) |

Definition at line 640 of file coff-pe-read.c.

References DEFAULT_COFF_PE_TEXT_SECTION_OFFSET, pe_get16(), pe_get32(), and SEEK_SET.

Referenced by windows_xfer_shared_library().

## ◆ read_pe_exported_syms()

void read_pe_exported_syms | ( | minimal_symbol_reader & | reader,
|  | struct objfile * | objfile
| ) |  |

Definition at line 333 of file coff-pe-read.c.

References _, add_pe_exported_sym(), add_pe_forwarded_sym(), debug_coff_pe_read, do_cleanups(), fprintf_unfiltered(), free_current_contents(), gdb_stdlog, get_section_vmas(), IMAGE_SCN_CNT_CODE, IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_CNT_UNINITIALIZED_DATA, make_cleanup(), mst_bss, mst_data, mst_text, mst_unknown, name, pe_sections_info::nb_sections, null_cleanup(), objfile::obfd, pe_as16(), pe_as32(), pe_get16(), pe_get32(), PE_SECTION_INDEX_BSS, PE_SECTION_INDEX_DATA, PE_SECTION_INDEX_INVALID, PE_SECTION_INDEX_TEXT, PE_SECTION_TABLE_SIZE, read_pe_section_index(), read_pe_truncate_name(), pe_sections_info::sections, SEEK_SET, XCNEWVEC, xfree(), xmalloc(), and XRESIZEVEC.

Referenced by coff_symtab_read().

## ◆ read_pe_section_index()

static int read_pe_section_index | ( | const char * | section_name | ) |
| static

Definition at line 74 of file coff-pe-read.c.

References PE_SECTION_INDEX_BSS, PE_SECTION_INDEX_DATA, PE_SECTION_INDEX_INVALID, and PE_SECTION_INDEX_TEXT.

Referenced by read_pe_exported_syms().

## ◆ read_pe_truncate_name()

static void read_pe_truncate_name | ( | char * | dll_name | ) |
| static

Definition at line 283 of file coff-pe-read.c.

Referenced by read_pe_exported_syms().

## ◆ show_debug_coff_pe_read()

static void show_debug_coff_pe_read | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 695 of file coff-pe-read.c.

References _, and fprintf_filtered().

Referenced by _initialize_coff_pe_read().

## Variable Documentation

## ◆ debug_coff_pe_read

unsigned int debug_coff_pe_read
| static

Definition at line 47 of file coff-pe-read.c.

Referenced by _initialize_coff_pe_read(), add_pe_exported_sym(), add_pe_forwarded_sym(), and read_pe_exported_syms().