mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
libbacktrace: support FDPIC (1dd5c40)
This commit is contained in:
@@ -318,8 +318,9 @@ static const char * const dwarf_section_names[DEBUG_MAX] =
|
||||
/* Forward declaration. */
|
||||
|
||||
static int macho_add (struct backtrace_state *, const char *, int, off_t,
|
||||
const unsigned char *, uintptr_t, int,
|
||||
backtrace_error_callback, void *, fileline *, int *);
|
||||
const unsigned char *, struct libbacktrace_base_address,
|
||||
int, backtrace_error_callback, void *, fileline *,
|
||||
int *);
|
||||
|
||||
/* A dummy callback function used when we can't find any debug info. */
|
||||
|
||||
@@ -514,7 +515,7 @@ macho_defined_symbol (uint8_t type)
|
||||
|
||||
static int
|
||||
macho_add_symtab (struct backtrace_state *state, int descriptor,
|
||||
uintptr_t base_address, int is_64,
|
||||
struct libbacktrace_base_address base_address, int is_64,
|
||||
off_t symoff, unsigned int nsyms, off_t stroff,
|
||||
unsigned int strsize,
|
||||
backtrace_error_callback error_callback, void *data)
|
||||
@@ -629,7 +630,7 @@ macho_add_symtab (struct backtrace_state *state, int descriptor,
|
||||
if (name[0] == '_')
|
||||
++name;
|
||||
macho_symbols[j].name = name;
|
||||
macho_symbols[j].address = value + base_address;
|
||||
macho_symbols[j].address = libbacktrace_add_base (value, base_address);
|
||||
++j;
|
||||
}
|
||||
|
||||
@@ -762,7 +763,8 @@ macho_syminfo (struct backtrace_state *state, uintptr_t addr,
|
||||
static int
|
||||
macho_add_fat (struct backtrace_state *state, const char *filename,
|
||||
int descriptor, int swapped, off_t offset,
|
||||
const unsigned char *match_uuid, uintptr_t base_address,
|
||||
const unsigned char *match_uuid,
|
||||
struct libbacktrace_base_address base_address,
|
||||
int skip_symtab, uint32_t nfat_arch, int is_64,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
fileline *fileline_fn, int *found_sym)
|
||||
@@ -864,7 +866,8 @@ macho_add_fat (struct backtrace_state *state, const char *filename,
|
||||
|
||||
static int
|
||||
macho_add_dsym (struct backtrace_state *state, const char *filename,
|
||||
uintptr_t base_address, const unsigned char *uuid,
|
||||
struct libbacktrace_base_address base_address,
|
||||
const unsigned char *uuid,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
fileline* fileline_fn)
|
||||
{
|
||||
@@ -982,7 +985,7 @@ macho_add_dsym (struct backtrace_state *state, const char *filename,
|
||||
static int
|
||||
macho_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
off_t offset, const unsigned char *match_uuid,
|
||||
uintptr_t base_address, int skip_symtab,
|
||||
struct libbacktrace_base_address base_address, int skip_symtab,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
fileline *fileline_fn, int *found_sym)
|
||||
{
|
||||
@@ -1244,7 +1247,7 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
|
||||
c = _dyld_image_count ();
|
||||
for (i = 0; i < c; ++i)
|
||||
{
|
||||
uintptr_t base_address;
|
||||
struct libbacktrace_base_address base_address;
|
||||
const char *name;
|
||||
int d;
|
||||
fileline mff;
|
||||
@@ -1268,7 +1271,7 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
|
||||
continue;
|
||||
}
|
||||
|
||||
base_address = _dyld_get_image_vmaddr_slide (i);
|
||||
base_address.m = _dyld_get_image_vmaddr_slide (i);
|
||||
|
||||
mff = macho_nodebug;
|
||||
if (!macho_add (state, name, d, 0, NULL, base_address, 0,
|
||||
@@ -1323,10 +1326,12 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
|
||||
void *data, fileline *fileline_fn)
|
||||
{
|
||||
fileline macho_fileline_fn;
|
||||
struct libbacktrace_base_address zero_base_address;
|
||||
int found_sym;
|
||||
|
||||
macho_fileline_fn = macho_nodebug;
|
||||
if (!macho_add (state, filename, descriptor, 0, NULL, 0, 0,
|
||||
memset (&zero_base_address, 0, sizeof zero_base_address);
|
||||
if (!macho_add (state, filename, descriptor, 0, NULL, zero_base_address, 0,
|
||||
error_callback, data, &macho_fileline_fn, &found_sym))
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user