1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-26 03:11:44 +02: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:
mostang.com!davidm 2003-02-08 10:10:59 +00:00
parent ea39f89528
commit bebd76e90b

View file

@ -1,6 +1,3 @@
#ifndef _UPT_internal_h
#define _UPT_internal_h
/* libunwind - a platform-independent unwind library
Copyright (C) 2003 Hewlett-Packard Co
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
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef _UPT_internal_h
#define _UPT_internal_h
#include <errno.h>
#include <libunwind.h>
#include <limits.h>
@ -39,8 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
struct UPT_info
{
pid_t pid; /* the process-id of the child we're unwinding */
void *image; /* mmap'ped image of the child's executable */
size_t image_size; /* size of the image */
struct elf_image ei;
unw_dyn_info_t di_cache;
unw_word_t dyn_info_list_addr;
unsigned int checked_dyn_info_list_addr : 1;
@ -49,11 +48,6 @@ struct UPT_info
#endif
};
struct map_iterator
{
FILE *fp;
};
HIDDEN int _UPT_reg_offset[UNW_REG_LAST];
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 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 */