Skip to content

Commit

Permalink
Trying to fix things
Browse files Browse the repository at this point in the history
  • Loading branch information
charlieMonroe committed Aug 19, 2013
1 parent bdd16a5 commit 83cacc4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 33 deletions.
19 changes: 19 additions & 0 deletions Gglobal.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ HIDDEN const uint8_t dwarf_to_unw_regnum_map[DWARF_NUM_PRESERVED_REGS] =
UNW_X86_64_R14,
UNW_X86_64_R15,
UNW_X86_64_RIP,
#ifdef CONFIG_MSABI_SUPPORT
UNW_X86_64_XMM0,
UNW_X86_64_XMM1,
UNW_X86_64_XMM2,
UNW_X86_64_XMM3,
UNW_X86_64_XMM4,
UNW_X86_64_XMM5,
UNW_X86_64_XMM6,
UNW_X86_64_XMM7,
UNW_X86_64_XMM8,
UNW_X86_64_XMM9,
UNW_X86_64_XMM10,
UNW_X86_64_XMM11,
UNW_X86_64_XMM12,
UNW_X86_64_XMM13,
UNW_X86_64_XMM14,
UNW_X86_64_XMM15
#endif
};

HIDDEN void
Expand All @@ -69,6 +87,7 @@ tdep_init (void)
mi_init ();
dwarf_init ();
tdep_init_mem_validate ();
x86_64_local_addr_space_init ();

tdep_init_done = 1; /* signal that we're initialized... */
}
Expand Down
5 changes: 2 additions & 3 deletions Ginit.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/linker.h>

#include "unwind_i.h"

Expand Down Expand Up @@ -238,9 +239,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
char *buf, size_t buf_len, unw_word_t *offp,
void *arg)
{
// TODO
return 0;
// return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
return linker_search_symbol_name((caddr_t)ip, buf, buf_len, offp);
}

HIDDEN void
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SRCS = libunwind.c \
_ReadULEB.c \
backtrace.c \
dyn-cancel.c \
dyn-info-list.c \
dyn-register.c \
flush_cache.c \
init.c \
Expand Down
29 changes: 0 additions & 29 deletions getcontext.S
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,6 @@ _Ux86_64_getcontext:
movq %rax, UC_MCONTEXT_GREGS_RAX(%rdi)
movq %rcx, UC_MCONTEXT_GREGS_RCX(%rdi)

#if defined __linux__
/* Save fp state (not needed, except for setcontext not
restoring garbage). */
leaq UC_MCONTEXT_FPREGS_MEM(%rdi),%r8
movq %r8, UC_MCONTEXT_FPREGS_PTR(%rdi)
fnstenv (%r8)
stmxcsr FPREGS_OFFSET_MXCSR(%r8)
#elif defined __FreeBSD__
/* Save rflags and segment registers, so that sigreturn(2)
does not complain. */
pushfq
.cfi_adjust_cfa_offset 8
popq UC_MCONTEXT_RFLAGS(%rdi)
.cfi_adjust_cfa_offset -8
movl $0, UC_MCONTEXT_FLAGS(%rdi)
movw %cs, UC_MCONTEXT_CS(%rdi)
movw %ss, UC_MCONTEXT_SS(%rdi)
#if 0
/* Setting the flags to 0 above disables restore of segment
registers from the context */
movw %ds, UC_MCONTEXT_DS(%rdi)
movw %es, UC_MCONTEXT_ES(%rdi)
movw %fs, UC_MCONTEXT_FS(%rdi)
movw %gs, UC_MCONTEXT_GS(%rdi)
#endif
movq $UC_MCONTEXT_MC_LEN_VAL, UC_MCONTEXT_MC_LEN(%rdi)
#else
#error Port me
#endif

leaq 8(%rsp), %rax /* exclude this call. */
movq %rax, UC_MCONTEXT_GREGS_RSP(%rdi)
Expand Down
4 changes: 3 additions & 1 deletion init.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

/* Avoid a trip to x86_64_r_uc_addr() for purely local initialisation. */
# define REG_INIT_LOC(c, rlc, ruc) \
DWARF_LOC ((unw_word_t) &c->uc->uc_mcontext.mc_ ## rlc, 0)
DWARF_REG_LOC (&c->dwarf, UNW_X86_64_ ## ruc)
// ?
// DWARF_LOC ((unw_word_t) &c->uc->uc_mcontext.mc_ ## rlc, 0)

static inline int
common_init (struct cursor *c, unsigned use_prev_instr)
Expand Down

0 comments on commit 83cacc4

Please sign in to comment.