Skip to content

Commit 59d65be

Browse files
committed
[libunwind] Remove the remote unwinding support
This is unfinished, unused and incomplete. This could be brought back in the future if there's a desire to build a more complete implementation, but at the moment it's just bitrotting. Differential Revision: https://reviews.llvm.org/D57252 llvm-svn: 352965
1 parent 6d6cbf6 commit 59d65be

File tree

3 files changed

+0
-245
lines changed

3 files changed

+0
-245
lines changed

libunwind/include/libunwind.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -125,32 +125,6 @@ extern int unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *) LIBUN
125125

126126
extern unw_addr_space_t unw_local_addr_space;
127127

128-
#ifdef UNW_REMOTE
129-
/*
130-
* Mac OS X "remote" API for unwinding other processes on same machine
131-
*
132-
*/
133-
extern unw_addr_space_t unw_create_addr_space_for_task(task_t);
134-
extern void unw_destroy_addr_space(unw_addr_space_t);
135-
extern int unw_init_remote_thread(unw_cursor_t *, unw_addr_space_t, thread_t *);
136-
#endif /* UNW_REMOTE */
137-
138-
/*
139-
* traditional libunwind "remote" API
140-
* NOT IMPLEMENTED on Mac OS X
141-
*
142-
* extern int unw_init_remote(unw_cursor_t*, unw_addr_space_t,
143-
* thread_t*);
144-
* extern unw_accessors_t unw_get_accessors(unw_addr_space_t);
145-
* extern unw_addr_space_t unw_create_addr_space(unw_accessors_t, int);
146-
* extern void unw_flush_cache(unw_addr_space_t, unw_word_t,
147-
* unw_word_t);
148-
* extern int unw_set_caching_policy(unw_addr_space_t,
149-
* unw_caching_policy_t);
150-
* extern void _U_dyn_register(unw_dyn_info_t*);
151-
* extern void _U_dyn_cancel(unw_dyn_info_t*);
152-
*/
153-
154128
#ifdef __cplusplus
155129
}
156130
#endif

libunwind/src/AddressSpace.hpp

Lines changed: 0 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -601,138 +601,6 @@ inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
601601
return false;
602602
}
603603

604-
605-
606-
#ifdef UNW_REMOTE
607-
608-
/// RemoteAddressSpace is used as a template parameter to UnwindCursor when
609-
/// unwinding a thread in the another process. The other process can be a
610-
/// different endianness and a different pointer size which is handled by
611-
/// the P template parameter.
612-
template <typename P>
613-
class RemoteAddressSpace {
614-
public:
615-
RemoteAddressSpace(task_t task) : fTask(task) {}
616-
617-
typedef typename P::uint_t pint_t;
618-
619-
uint8_t get8(pint_t addr);
620-
uint16_t get16(pint_t addr);
621-
uint32_t get32(pint_t addr);
622-
uint64_t get64(pint_t addr);
623-
pint_t getP(pint_t addr);
624-
uint64_t getRegister(pint_t addr);
625-
uint64_t getULEB128(pint_t &addr, pint_t end);
626-
int64_t getSLEB128(pint_t &addr, pint_t end);
627-
pint_t getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
628-
pint_t datarelBase = 0);
629-
bool findFunctionName(pint_t addr, char *buf, size_t bufLen,
630-
unw_word_t *offset);
631-
bool findUnwindSections(pint_t targetAddr, UnwindInfoSections &info);
632-
bool findOtherFDE(pint_t targetAddr, pint_t &fde);
633-
private:
634-
void *localCopy(pint_t addr);
635-
636-
task_t fTask;
637-
};
638-
639-
template <typename P> uint8_t RemoteAddressSpace<P>::get8(pint_t addr) {
640-
return *((uint8_t *)localCopy(addr));
641-
}
642-
643-
template <typename P> uint16_t RemoteAddressSpace<P>::get16(pint_t addr) {
644-
return P::E::get16(*(uint16_t *)localCopy(addr));
645-
}
646-
647-
template <typename P> uint32_t RemoteAddressSpace<P>::get32(pint_t addr) {
648-
return P::E::get32(*(uint32_t *)localCopy(addr));
649-
}
650-
651-
template <typename P> uint64_t RemoteAddressSpace<P>::get64(pint_t addr) {
652-
return P::E::get64(*(uint64_t *)localCopy(addr));
653-
}
654-
655-
template <typename P>
656-
typename P::uint_t RemoteAddressSpace<P>::getP(pint_t addr) {
657-
return P::getP(*(uint64_t *)localCopy(addr));
658-
}
659-
660-
template <typename P>
661-
typename P::uint_t OtherAddressSpace<P>::getRegister(pint_t addr) {
662-
return P::getRegister(*(uint64_t *)localCopy(addr));
663-
}
664-
665-
template <typename P>
666-
uint64_t OtherAddressSpace<P>::getULEB128(pint_t &addr, pint_t end) {
667-
uintptr_t size = (end - addr);
668-
LocalAddressSpace::pint_t laddr = (LocalAddressSpace::pint_t) localCopy(addr);
669-
LocalAddressSpace::pint_t sladdr = laddr;
670-
uint64_t result = LocalAddressSpace::getULEB128(laddr, laddr + size);
671-
addr += (laddr - sladdr);
672-
return result;
673-
}
674-
675-
template <typename P>
676-
int64_t RemoteAddressSpace<P>::getSLEB128(pint_t &addr, pint_t end) {
677-
uintptr_t size = (end - addr);
678-
LocalAddressSpace::pint_t laddr = (LocalAddressSpace::pint_t) localCopy(addr);
679-
LocalAddressSpace::pint_t sladdr = laddr;
680-
uint64_t result = LocalAddressSpace::getSLEB128(laddr, laddr + size);
681-
addr += (laddr - sladdr);
682-
return result;
683-
}
684-
685-
template <typename P> void *RemoteAddressSpace<P>::localCopy(pint_t addr) {
686-
// FIX ME
687-
}
688-
689-
template <typename P>
690-
bool RemoteAddressSpace<P>::findFunctionName(pint_t addr, char *buf,
691-
size_t bufLen,
692-
unw_word_t *offset) {
693-
// FIX ME
694-
}
695-
696-
/// unw_addr_space is the base class that abstract unw_addr_space_t type in
697-
/// libunwind.h points to.
698-
struct unw_addr_space {
699-
cpu_type_t cpuType;
700-
task_t taskPort;
701-
};
702-
703-
/// unw_addr_space_i386 is the concrete instance that a unw_addr_space_t points
704-
/// to when examining
705-
/// a 32-bit intel process.
706-
struct unw_addr_space_i386 : public unw_addr_space {
707-
unw_addr_space_i386(task_t task) : oas(task) {}
708-
RemoteAddressSpace<Pointer32<LittleEndian>> oas;
709-
};
710-
711-
/// unw_addr_space_x86_64 is the concrete instance that a unw_addr_space_t
712-
/// points to when examining
713-
/// a 64-bit intel process.
714-
struct unw_addr_space_x86_64 : public unw_addr_space {
715-
unw_addr_space_x86_64(task_t task) : oas(task) {}
716-
RemoteAddressSpace<Pointer64<LittleEndian>> oas;
717-
};
718-
719-
/// unw_addr_space_ppc is the concrete instance that a unw_addr_space_t points
720-
/// to when examining
721-
/// a 32-bit PowerPC process.
722-
struct unw_addr_space_ppc : public unw_addr_space {
723-
unw_addr_space_ppc(task_t task) : oas(task) {}
724-
RemoteAddressSpace<Pointer32<BigEndian>> oas;
725-
};
726-
727-
/// unw_addr_space_ppc is the concrete instance that a unw_addr_space_t points
728-
/// to when examining a 64-bit PowerPC process.
729-
struct unw_addr_space_ppc64 : public unw_addr_space {
730-
unw_addr_space_ppc64(task_t task) : oas(task) {}
731-
RemoteAddressSpace<Pointer64<LittleEndian>> oas;
732-
};
733-
734-
#endif // UNW_REMOTE
735-
736604
} // namespace libunwind
737605

738606
#endif // __ADDRESSSPACE_HPP__

libunwind/src/libunwind.cpp

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -80,93 +80,6 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor,
8080
return UNW_ESUCCESS;
8181
}
8282

83-
#ifdef UNW_REMOTE
84-
/// Create a cursor into a thread in another process.
85-
_LIBUNWIND_EXPORT int unw_init_remote_thread(unw_cursor_t *cursor,
86-
unw_addr_space_t as,
87-
void *arg) {
88-
// special case: unw_init_remote(xx, unw_local_addr_space, xx)
89-
if (as == (unw_addr_space_t)&LocalAddressSpace::sThisAddressSpace)
90-
return unw_init_local(cursor, NULL); //FIXME
91-
92-
// use "placement new" to allocate UnwindCursor in the cursor buffer
93-
switch (as->cpuType) {
94-
case CPU_TYPE_I386:
95-
new ((void *)cursor)
96-
UnwindCursor<RemoteAddressSpace<Pointer32<LittleEndian>>,
97-
Registers_x86>(((unw_addr_space_i386 *)as)->oas, arg);
98-
break;
99-
case CPU_TYPE_X86_64:
100-
new ((void *)cursor)
101-
UnwindCursor<RemoteAddressSpace<Pointer64<LittleEndian>>,
102-
Registers_x86_64>(((unw_addr_space_x86_64 *)as)->oas, arg);
103-
break;
104-
case CPU_TYPE_POWERPC:
105-
new ((void *)cursor)
106-
UnwindCursor<RemoteAddressSpace<Pointer32<BigEndian>>,
107-
Registers_ppc>(((unw_addr_space_ppc *)as)->oas, arg);
108-
break;
109-
default:
110-
return UNW_EUNSPEC;
111-
}
112-
return UNW_ESUCCESS;
113-
}
114-
115-
116-
static bool is64bit(task_t task) {
117-
return false; // FIXME
118-
}
119-
120-
/// Create an address_space object for use in examining another task.
121-
_LIBUNWIND_EXPORT unw_addr_space_t unw_create_addr_space_for_task(task_t task) {
122-
#if __i386__
123-
if (is64bit(task)) {
124-
unw_addr_space_x86_64 *as = malloc(sizeof(unw_addr_space_x86_64));
125-
new (as) unw_addr_space_x86_64(task);
126-
as->taskPort = task;
127-
as->cpuType = CPU_TYPE_X86_64;
128-
//as->oas
129-
} else {
130-
unw_addr_space_i386 *as = malloc(sizeof(unw_addr_space_i386));
131-
new (as) unw_addr_space_i386(task);
132-
as->taskPort = task;
133-
as->cpuType = CPU_TYPE_I386;
134-
//as->oas
135-
}
136-
#else
137-
// FIXME
138-
#endif
139-
}
140-
141-
142-
/// Delete an address_space object.
143-
_LIBUNWIND_EXPORT void unw_destroy_addr_space(unw_addr_space_t asp) {
144-
switch (asp->cpuType) {
145-
#if __i386__ || __x86_64__
146-
case CPU_TYPE_I386: {
147-
unw_addr_space_i386 *as = (unw_addr_space_i386 *)asp;
148-
as->~unw_addr_space_i386();
149-
free(as);
150-
}
151-
break;
152-
case CPU_TYPE_X86_64: {
153-
unw_addr_space_x86_64 *as = (unw_addr_space_x86_64 *)asp;
154-
as->~unw_addr_space_x86_64();
155-
free(as);
156-
}
157-
break;
158-
#endif
159-
case CPU_TYPE_POWERPC: {
160-
unw_addr_space_ppc *as = (unw_addr_space_ppc *)asp;
161-
as->~unw_addr_space_ppc();
162-
free(as);
163-
}
164-
break;
165-
}
166-
}
167-
#endif // UNW_REMOTE
168-
169-
17083
/// Get value of specified register at cursor position in stack frame.
17184
_LIBUNWIND_EXPORT int unw_get_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
17285
unw_word_t *value) {

0 commit comments

Comments
 (0)