mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 12:03:41 +01:00
Implement freebsd-specific vm walker.
This commit is contained in:
parent
81f2de0083
commit
4de09a9c15
1 changed files with 23 additions and 2 deletions
|
@ -24,8 +24,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
#ifndef UNW_REMOTE_ONLY
|
#ifndef UNW_REMOTE_ONLY
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/user.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <libutil.h>
|
||||||
|
|
||||||
#include "libunwind_i.h"
|
#include "libunwind_i.h"
|
||||||
|
|
||||||
|
@ -33,9 +36,27 @@ HIDDEN int
|
||||||
tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
|
tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
|
||||||
unsigned long *segbase, unsigned long *mapoff)
|
unsigned long *segbase, unsigned long *mapoff)
|
||||||
{
|
{
|
||||||
|
struct kinfo_vmentry *freep, *kve;
|
||||||
|
int cnt, rc, i;
|
||||||
|
|
||||||
/* XXXKIB */
|
freep = kinfo_getvmmap(pid, &cnt);
|
||||||
return (0);
|
if (freep == NULL)
|
||||||
|
return (-1);
|
||||||
|
for (i = 0; i < cnt; i++) {
|
||||||
|
kve = &freep[i];
|
||||||
|
if (ip < kve->kve_start || ip >= kve->kve_end)
|
||||||
|
continue;
|
||||||
|
if (kve->kve_type != KVME_TYPE_VNODE) {
|
||||||
|
free(freep);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
segbase = kve->kve_start;
|
||||||
|
mapoff = kve->kve_offset;
|
||||||
|
rc = elf_map_image(ei, kve->kve_path);
|
||||||
|
free(freep);
|
||||||
|
return (rc);
|
||||||
|
}
|
||||||
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* UNW_REMOTE_ONLY */
|
#endif /* UNW_REMOTE_ONLY */
|
||||||
|
|
Loading…
Reference in a new issue