# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
-/* Exact copy from libdwfl/segment.c. */
-
-static GElf_Addr
-segment_start (Dwfl *dwfl, GElf_Addr start)
-{
- if (dwfl->segment_align > 1)
- start &= -dwfl->segment_align;
- return start;
-}
-
-/* Exact copy from libdwfl/segment.c. */
-
-static GElf_Addr
-segment_end (Dwfl *dwfl, GElf_Addr end)
-{
- if (dwfl->segment_align > 1)
- end = (end + dwfl->segment_align - 1) & -dwfl->segment_align;
- return end;
-}
-
static bool
dwfl_frame_state_core_memory_read (Dwarf_Addr addr, Dwarf_Addr *result,
void *user_data)
if (phdr == NULL || phdr->p_type != PT_LOAD)
continue;
/* Bias is zero here, a core file itself has no bias. */
- GElf_Addr start = segment_start (dwfl, phdr->p_vaddr);
- GElf_Addr end = segment_end (dwfl, phdr->p_vaddr + phdr->p_memsz);
+ GElf_Addr start = __libdwfl_segment_start (dwfl, phdr->p_vaddr);
+ GElf_Addr end = __libdwfl_segment_end (dwfl,
+ phdr->p_vaddr + phdr->p_memsz);
unsigned bytes = process->ebl->class == ELFCLASS64 ? 8 : 4;
if (addr < start || addr + bytes > end)
continue;
void *memory_read_user_data)
internal_function;
+/* Align segment START downwards or END upwards addresses according to DWFL. */
+extern GElf_Addr __libdwfl_segment_start (Dwfl *dwfl, GElf_Addr start);
+extern GElf_Addr __libdwfl_segment_end (Dwfl *dwfl, GElf_Addr end);
+
/* Decompression wrappers: decompress whole file into memory. */
extern Dwfl_Error __libdw_gunzip (int fd, off64_t start_offset,
void *mapped, size_t mapped_size,
#include "libdwflP.h"
-static GElf_Addr
-segment_start (Dwfl *dwfl, GElf_Addr start)
+GElf_Addr
+internal_function
+__libdwfl_segment_start (Dwfl *dwfl, GElf_Addr start)
{
if (dwfl->segment_align > 1)
start &= -dwfl->segment_align;
return start;
}
-static GElf_Addr
-segment_end (Dwfl *dwfl, GElf_Addr end)
+GElf_Addr
+internal_function
+__libdwfl_segment_end (Dwfl *dwfl, GElf_Addr end)
{
if (dwfl->segment_align > 1)
end = (end + dwfl->segment_align - 1) & -dwfl->segment_align;
for (Dwfl_Module *mod = dwfl->modulelist; mod != NULL; mod = mod->next)
if (! mod->gc)
{
- const GElf_Addr start = segment_start (dwfl, mod->low_addr);
- const GElf_Addr end = segment_end (dwfl, mod->high_addr);
+ const GElf_Addr start = __libdwfl_segment_start (dwfl, mod->low_addr);
+ const GElf_Addr end = __libdwfl_segment_end (dwfl, mod->high_addr);
bool resized = false;
int idx = lookup (dwfl, start, hint);
dwfl->lookup_module = NULL;
}
- GElf_Addr start = segment_start (dwfl, bias + phdr->p_vaddr);
- GElf_Addr end = segment_end (dwfl, bias + phdr->p_vaddr + phdr->p_memsz);
+ GElf_Addr start = __libdwfl_segment_start (dwfl, bias + phdr->p_vaddr);
+ GElf_Addr end = __libdwfl_segment_end (dwfl,
+ bias + phdr->p_vaddr + phdr->p_memsz);
/* Coalesce into the last one if contiguous and matching. */
if (ndx != dwfl->lookup_tail_ndx