Debug


Files

file  elf_core.h
file  istate.h
file  istate.h
file  symtab.h

Data Structures

struct  symtab_t

Functions

static int chunk_load (int fd, off64_t start, size_t size, void **ptr)
 Load a segment of bytes from a file and return it as a new memory block.
int elf_core_save (const char *file_name, as_area_info_t *ainfo, unsigned int n, int phoneid)
 Save ELF core file.
static int elf_hdr_check (elf_header_t *ehdr)
 Check if ELF header is valid.
static int read_all (int fd, void *buf, size_t len)
 Read until the buffer is read in its entirety.
static int section_hdr_load (int fd, const elf_header_t *elf_hdr, int idx, elf_section_header_t *sec_hdr)
 Load ELF section header.
int symtab_addr_to_name (symtab_t *st, uintptr_t addr, char **name, size_t *offs)
 Convert symbol address to name.
void symtab_delete (symtab_t *st)
 Delete a symtab structure.
int symtab_load (const char *file_name, symtab_t **symtab)
 Load symbol table from an ELF file.
int symtab_name_to_addr (symtab_t *st, char *name, uintptr_t *addr)
 Convert symbol name to address.

Function Documentation

static int chunk_load ( int  fd,
off64_t  start,
size_t  size,
void **  ptr 
) [static]

Load a segment of bytes from a file and return it as a new memory block.

This function fails if it cannot read exactly size bytes from the file.

Parameters:
fd File to read from.
start Position in file where to start reading.
size Number of bytes to read.
ptr Place to store pointer to newly allocated block.
Returns:
EOK on success or EIO on failure.

Definition at line 331 of file symtab.c.

int elf_core_save ( const char *  file_name,
as_area_info_t *  ainfo,
unsigned int  n,
int  phoneid 
)

Save ELF core file.

Parameters:
file_name Name of file to save to.
ainfo Array of n memory area info structures.
n Number of memory areas.
phoneid Debugging phone.
Returns:
EOK on sucess, ENOENT if file cannot be created, ENOMEM on out of memory, EIO on write error.

Definition at line 81 of file elf_core.c.

static int elf_hdr_check ( elf_header_t *  ehdr  )  [static]

Check if ELF header is valid.

Returns:
EOK on success or negative error code.

Definition at line 288 of file symtab.c.

static int read_all ( int  fd,
void *  buf,
size_t  len 
) [static]

Read until the buffer is read in its entirety.

This function fails if it cannot read exactly len bytes from the file.

Parameters:
fd The file to read from.
buf Buffer for storing data, len bytes long.
len Number of bytes to read.
Returns:
EOK on error, EIO if file is short or return value from read() if reading failed.

Definition at line 370 of file symtab.c.

static int section_hdr_load ( int  fd,
const elf_header_t *  elf_hdr,
int  idx,
elf_section_header_t *  sec_hdr 
) [static]

Load ELF section header.

Parameters:
fd File descriptor of ELF file.
elf_hdr Pointer to ELF file header in memory.
idx Index of section whose header to load (0 = first).
sec_hdr Place to store section header data.
Returns:
EOK on success or EIO if I/O failed.

Definition at line 303 of file symtab.c.

int symtab_addr_to_name ( symtab_t st,
uintptr_t  addr,
char **  name,
size_t offs 
)

Convert symbol address to name.

This function finds the symbol which starts at the highest address less than or equal to addr.

Parameters:
st Symbol table.
addr Address for lookup.
name Place to store pointer name of symbol, if found. This is valid while st exists.
Returns:
EOK on success or ENOENT if no matching symbol was found.

Definition at line 242 of file symtab.c.

void symtab_delete ( symtab_t st  ) 

Delete a symtab structure.

Deallocates all resources used by the symbol table.

Definition at line 186 of file symtab.c.

int symtab_load ( const char *  file_name,
symtab_t **  symtab 
)

Load symbol table from an ELF file.

Parameters:
file_name Name of the ELF file to read from.
symtab Place to save pointer to new symtab structure.
Returns:
EOK on success, ENOENT if file could not be open, ENOTSUP if file parsing failed.

Definition at line 62 of file symtab.c.

int symtab_name_to_addr ( symtab_t st,
char *  name,
uintptr_t addr 
)

Convert symbol name to address.

Parameters:
st Symbol table.
name Name of the symbol.
addr Place to store address for symbol, if found.
Returns:
EOK on success, ENOENT if no such symbol was found.

Definition at line 205 of file symtab.c.


Generated on Thu Jun 2 07:45:57 2011 for HelenOS/USB by  doxygen 1.4.7