mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-01-11 19:43:42 +01:00
(struct UPT_info): Replace image/image_size members by "struct elf_image" member.
(struct map_iterator): Delete (moved to os-linux.h). (maps_init): Ditto. (maps_next): Ditto. (maps_close): Ditto. (Logical change 1.45)
This commit is contained in:
parent
ea39f89528
commit
bebd76e90b
1 changed files with 4 additions and 45 deletions
|
@ -1,6 +1,3 @@
|
||||||
#ifndef _UPT_internal_h
|
|
||||||
#define _UPT_internal_h
|
|
||||||
|
|
||||||
/* libunwind - a platform-independent unwind library
|
/* libunwind - a platform-independent unwind library
|
||||||
Copyright (C) 2003 Hewlett-Packard Co
|
Copyright (C) 2003 Hewlett-Packard Co
|
||||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
@ -26,6 +23,9 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#ifndef _UPT_internal_h
|
||||||
|
#define _UPT_internal_h
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libunwind.h>
|
#include <libunwind.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -39,8 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
struct UPT_info
|
struct UPT_info
|
||||||
{
|
{
|
||||||
pid_t pid; /* the process-id of the child we're unwinding */
|
pid_t pid; /* the process-id of the child we're unwinding */
|
||||||
void *image; /* mmap'ped image of the child's executable */
|
struct elf_image ei;
|
||||||
size_t image_size; /* size of the image */
|
|
||||||
unw_dyn_info_t di_cache;
|
unw_dyn_info_t di_cache;
|
||||||
unw_word_t dyn_info_list_addr;
|
unw_word_t dyn_info_list_addr;
|
||||||
unsigned int checked_dyn_info_list_addr : 1;
|
unsigned int checked_dyn_info_list_addr : 1;
|
||||||
|
@ -49,11 +48,6 @@ struct UPT_info
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct map_iterator
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
};
|
|
||||||
|
|
||||||
HIDDEN int _UPT_reg_offset[UNW_REG_LAST];
|
HIDDEN int _UPT_reg_offset[UNW_REG_LAST];
|
||||||
|
|
||||||
extern HIDDEN unw_dyn_info_t *_UPTi_find_unwind_table (struct UPT_info *ui,
|
extern HIDDEN unw_dyn_info_t *_UPTi_find_unwind_table (struct UPT_info *ui,
|
||||||
|
@ -62,39 +56,4 @@ extern HIDDEN unw_dyn_info_t *_UPTi_find_unwind_table (struct UPT_info *ui,
|
||||||
unw_word_t segbase,
|
unw_word_t segbase,
|
||||||
unw_word_t mapoff);
|
unw_word_t mapoff);
|
||||||
|
|
||||||
static inline void
|
|
||||||
maps_init (struct map_iterator *mi, pid_t pid)
|
|
||||||
{
|
|
||||||
char path[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf (path, sizeof (path), "/proc/%d/maps", pid);
|
|
||||||
mi->fp = fopen (path, "r");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
maps_next (struct map_iterator *mi,
|
|
||||||
unsigned long *low, unsigned long *high, unsigned long *offset,
|
|
||||||
char *path)
|
|
||||||
{
|
|
||||||
char line[256+PATH_MAX];
|
|
||||||
|
|
||||||
if (!mi->fp)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
while (fgets (line, sizeof (line), mi->fp))
|
|
||||||
{
|
|
||||||
if (sscanf (line, "%lx-%lx %*4c %lx %*x:%*x %*d %s\n",
|
|
||||||
low, high, offset, path) == 4)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
maps_close (struct map_iterator *mi)
|
|
||||||
{
|
|
||||||
fclose (mi->fp);
|
|
||||||
mi->fp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _UPT_internal_h */
|
#endif /* _UPT_internal_h */
|
||||||
|
|
Loading…
Reference in a new issue