UFO: Alien Invasion
|
#include <unistd.h>
#include <sys/stat.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <assert.h>
#include "bfd.h"
#include "bucomm.h"
#include "demangle.h"
#include "libiberty.h"
Go to the source code of this file.
Data Structures | |
struct | _libtrace_data |
struct | _sym_info |
Macros | |
#define | ADDR_BUF_LEN ((CHAR_BIT/4)*(sizeof(void*))+1) |
Typedefs | |
typedef struct _libtrace_data | libtrace_data |
typedef struct _sym_info | sym_info |
Functions | |
static int | slurp_symtab (bfd *) |
static void | find_address_in_section (bfd *, asection *, void *) |
static void | find_offset_in_section (bfd *, asection *, sym_info *) |
static int | translate_addresses (bfd *abfd, asection *section, void *addr, char *buf_func, size_t buf_func_len, char *buf_file, size_t buf_file_len) |
void | bfd_nonfatal (const char *string) |
void | report (const char *format, va_list args) |
void | non_fatal (const char *format,...) |
off_t | get_file_size (const char *file_name) |
void | list_matching_formats (char **p) |
void | set_default_bfd_target (void) |
int | libtrace_init (const char *file_name, const char *section_name, const char *target) |
int | libtrace_close (void) |
int | libtrace_resolve (void *addr, char *buf_func, size_t buf_func_len, char *buf_file, size_t buf_file_len,...) |
Variables | |
static libtrace_data | m_libtrace_data |
static const char * | program_name = "addr2line" |
Definition in file addr2line.cpp.
#define ADDR_BUF_LEN ((CHAR_BIT/4)*(sizeof(void*))+1) |
Referenced by translate_addresses().
typedef struct _libtrace_data libtrace_data |
These variables are used to pass information between translate_addresses and find_address_in_section.
void bfd_nonfatal | ( | const char * | string | ) |
Definition at line 60 of file addr2line.cpp.
References program_name.
Referenced by libtrace_init(), and slurp_symtab().
Look for an address in a section. This is called via bfd_map_over_sections.
Definition at line 161 of file addr2line.cpp.
References _sym_info::filename, _sym_info::found, _sym_info::functionname, _sym_info::line, _sym_info::pc, and _libtrace_data::syms.
Referenced by translate_addresses().
Look for an offset in a section. This is directly called.
Definition at line 186 of file addr2line.cpp.
References _sym_info::filename, _sym_info::found, _sym_info::functionname, _sym_info::line, _sym_info::pc, and _libtrace_data::syms.
Referenced by translate_addresses().
off_t get_file_size | ( | const char * | file_name | ) |
Returns the size of the named file. If the file does not exist, or if it is not a real file, then a suitable non-fatal error message is printed and zero is returned.
Definition at line 89 of file addr2line.cpp.
References non_fatal().
Referenced by libtrace_init().
Definition at line 308 of file addr2line.cpp.
References _libtrace_data::abfd, and _libtrace_data::syms.
int libtrace_init | ( | const char * | file_name, |
const char * | section_name, | ||
const char * | target | ||
) |
Definition at line 265 of file addr2line.cpp.
References _libtrace_data::abfd, bfd_nonfatal(), get_file_size(), list_matching_formats(), non_fatal(), _libtrace_data::section, set_default_bfd_target(), and slurp_symtab().
int libtrace_resolve | ( | void * | addr, |
char * | buf_func, | ||
size_t | buf_func_len, | ||
char * | buf_file, | ||
size_t | buf_file_len, | ||
... | |||
) |
Definition at line 318 of file addr2line.cpp.
References _libtrace_data::abfd, _libtrace_data::section, and translate_addresses().
void list_matching_formats | ( | char ** | p | ) |
After a FALSE return from bfd_check_format_matches with bfd_get_error () == bfd_error_file_ambiguously_recognized, print the possible matching targets.
Definition at line 109 of file addr2line.cpp.
References program_name.
Referenced by libtrace_init().
void non_fatal | ( | const char * | format, |
... | |||
) |
Definition at line 77 of file addr2line.cpp.
References report().
Referenced by get_file_size(), libtrace_init(), and set_default_bfd_target().
void report | ( | const char * | format, |
va_list | args | ||
) |
Set the default BFD target based on the configured target. Doing this permits the binutils to be configured for a particular target, and linked against a shared BFD library which was configured for a different target.
Definition at line 124 of file addr2line.cpp.
References non_fatal().
Referenced by libtrace_init().
|
static |
Read in the symbol table.
Definition at line 139 of file addr2line.cpp.
References bfd_nonfatal(), and _libtrace_data::syms.
Referenced by libtrace_init().
|
static |
Translate xaddr into file_name:line_number and optionally function name.
Definition at line 206 of file addr2line.cpp.
References ADDR_BUF_LEN, _libtrace_data::base_names, _libtrace_data::do_demangle, _sym_info::filename, find_address_in_section(), find_offset_in_section(), _sym_info::found, _sym_info::functionname, _sym_info::line, name, _sym_info::pc, _libtrace_data::unwind_inlines, and _libtrace_data::with_functions.
Referenced by libtrace_resolve().
|
static |
Definition at line 38 of file addr2line.cpp.
|
static |
Definition at line 58 of file addr2line.cpp.
Referenced by bfd_nonfatal(), list_matching_formats(), and report().