size_t linenos_size;
uint64_t lnnoptr0;
/* Loader address. */
- uintptr_t base_address;
+ struct libbacktrace_base_address base_address;
};
/* Information we gather for the DWARF sections we care about. */
static int
xcoff_initialize_syminfo (struct backtrace_state *state,
- uintptr_t base_address,
+ struct libbacktrace_base_address base_address,
const b_xcoff_syment *syms, size_t nsyms,
const unsigned char *strtab, size_t strtab_size,
backtrace_error_callback error_callback, void *data,
{
const b_xcoff_auxent *aux = (const b_xcoff_auxent *) (asym + 1);
xcoff_symbols[j].name = xcoff_symname (asym, strtab, strtab_size);
- xcoff_symbols[j].address = base_address + asym->n_value;
+ xcoff_symbols[j].address =
+ libbacktrace_add_base (asym->n_value, base_address);
/* x_fsize will be 0 if there is no debug information. */
xcoff_symbols[j].size = aux->x_fcn.x_fsize;
++j;
lineno = (const b_xcoff_lineno *) lineptr;
if (lineno->l_lnno == 0)
break;
- if (pc <= fdata->base_address + lineno->l_addr.l_paddr)
+ if (pc <= libbacktrace_add_base (lineno->l_addr.l_paddr,
+ fdata->base_address))
break;
match = lnnoptr;
lnno = lineno->l_lnno;
static int
xcoff_initialize_fileline (struct backtrace_state *state,
- uintptr_t base_address,
+ struct libbacktrace_base_address base_address,
const b_xcoff_scnhdr *sects,
const b_xcoff_syment *syms, size_t nsyms,
const unsigned char *strtab, size_t strtab_size,
fn->name = xcoff_symname (fsym, strtab, strtab_size);
fn->filename = filename;
fn->sect_base = sects[fsym->n_scnum - 1].s_paddr;
- fn->pc = base_address + fsym->n_value;
+ fn->pc = libbacktrace_add_base (fsym->n_value, base_address);
fn->size = fsize;
fn->lnno = lnno;
fn->lnnoptr = lnnoptr;
static int
xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
- uintptr_t base_address, backtrace_error_callback error_callback,
+ struct libbacktrace_base_address base_address,
+ backtrace_error_callback error_callback,
void *data, fileline *fileline_fn, int *found_sym, int exe)
{
struct backtrace_view fhdr_view;
On AIX, virtual address is either fixed for executable
or given by ldinfo. This address will include the XCOFF
headers. */
- base_address = ((exe ? XCOFF_AIX_TEXTBASE : base_address)
- + stext->s_scnptr
- - stext->s_paddr);
+ base_address.m = ((exe ? XCOFF_AIX_TEXTBASE : base_address.m)
+ + stext->s_scnptr
+ - stext->s_paddr);
lnnoptr = stext->s_lnnoptr;
nlnno = stext->s_nlnno;
static int
xcoff_armem_add (struct backtrace_state *state, int descriptor,
- uintptr_t base_address, const char *member,
- backtrace_error_callback error_callback, void *data,
- fileline *fileline_fn, int *found_sym)
+ struct libbacktrace_base_address base_address,
+ const char *member, backtrace_error_callback error_callback,
+ void *data, fileline *fileline_fn, int *found_sym)
{
struct backtrace_view view;
b_ar_fl_hdr fl_hdr;
ldinfo = (const struct ld_info *) buf;
while ((const char *) ldinfo < (const char *) buf + buflen)
{
+ struct libbacktrace_base_address base_address;
+
if (*ldinfo->ldinfo_filename != '/')
goto next;
/* Check if it is an archive (member name not empty). */
member = ldinfo->ldinfo_filename + strlen (ldinfo->ldinfo_filename) + 1;
+ memset (&base_address, 0, sizeof base_address);
+ base_address.m = (uintptr_t) ldinfo->ldinfo_textorg;
if (*member)
{
- xcoff_armem_add (state, descriptor,
- (uintptr_t) ldinfo->ldinfo_textorg, member,
+ xcoff_armem_add (state, descriptor, base_address, member,
error_callback, data, fileline_fn, &lib_found_sym);
}
else
{
- xcoff_add (state, descriptor, 0, (uintptr_t) ldinfo->ldinfo_textorg,
- error_callback, data, fileline_fn, &lib_found_sym, 0);
+ xcoff_add (state, descriptor, 0, base_address, error_callback, data,
+ fileline_fn, &lib_found_sym, 0);
}
if (lib_found_sym)
*found_sym = 1;
backtrace_error_callback error_callback,
void *data, fileline *fileline_fn)
{
+ struct libbacktrace_base_address zero_base_address;
int ret;
int found_sym;
fileline xcoff_fileline_fn = xcoff_nodebug;
- ret = xcoff_add (state, descriptor, 0, 0, error_callback, data,
- &xcoff_fileline_fn, &found_sym, 1);
+ memset (&zero_base_address, 0, sizeof zero_base_address);
+ ret = xcoff_add (state, descriptor, 0, zero_base_address,
+ error_callback, data, &xcoff_fileline_fn, &found_sym, 1);
if (!ret)
return 0;