variables/fields used during debuginfo reading for greater clarity.
git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_2_BRANCH@6511
#include "priv_readelf.h"
+/*------------------------------------------------------------*/
+/*--- The _svma / _avma / _image / _bias naming scheme ---*/
+/*------------------------------------------------------------*/
+
+/* JRS 11 Jan 07: I find the different kinds of addresses involved in
+ debuginfo reading confusing. Recently I arrived at some
+ terminology which makes it clearer (to me, at least). There are 3
+ kinds of address used in the debuginfo reading process:
+
+ stated VMAs - the address where (eg) a .so says a symbol is, that
+ is, what it tells you if you consider the .so in
+ isolation
+
+ actual VMAs - the address where (eg) said symbol really wound up
+ after the .so was mapped into memory
+
+ image addresses - pointers into the copy of the .so (etc)
+ transiently mmaped aboard whilst we read its info
+
+ Additionally I use the term 'bias' to denote the difference
+ between stated and actual VMAs for a given entity.
+
+ This terminology is not used consistently, but a start has been
+ made. readelf.c and the call-frame info reader in readdwarf.c now
+ use it. Specifically, various variables and structure fields have
+ been annotated with _avma / _svma / _image / _bias.
+*/
+
+
/*------------------------------------------------------------*/
/*--- Root structure ---*/
/*------------------------------------------------------------*/
{
SegInfo* si = VG_(arena_calloc)(VG_AR_SYMTAB, 1, sizeof(SegInfo));
- si->start = start;
- si->size = size;
- si->foffset = foffset;
- si->filename = VG_(arena_strdup)(VG_AR_SYMTAB, filename);
+ si->text_start_avma = start;
+ si->text_size = size;
+ si->foffset = foffset;
+ si->filename = VG_(arena_strdup)(VG_AR_SYMTAB, filename);
// Everything else -- pointers, sizes, arrays -- is zeroed by calloc.
return si;
if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
VG_(message)(Vg_DebugMsg,
"Discarding syms at %p-%p in %s due to munmap()",
- si->start, si->start + si->size,
+ si->text_start_avma,
+ si->text_start_avma + si->text_size,
curr->filename ? curr->filename : (UChar*)"???");
vg_assert(*prev_next_ptr == curr);
*prev_next_ptr = curr->next;
while (True) {
if (curr == NULL)
break;
- if (start+length-1 < curr->start
- || curr->start+curr->size-1 < start) {
+ if (start+length - 1 < curr->text_start_avma
+ || curr->text_start_avma + curr->text_size - 1 < start) {
/* no overlap */
} else {
found = True;
SegInfo* si;
for (si = segInfo_list; si != NULL; si = si->next) {
- if (si->start <= ptr && ptr < si->start+si->size) {
+ if (si->text_start_avma <= ptr
+ && ptr < si->text_start_avma + si->text_size) {
sno = ML_(search_one_symtab) ( si, ptr, match_anywhere_in_fun );
if (sno == -1) goto not_found;
*symno = sno;
SegInfo* si;
for (si = segInfo_list; si != NULL; si = si->next) {
- if (si->start <= ptr && ptr < si->start+si->size) {
+ if (si->text_start_avma <= ptr
+ && ptr < si->text_start_avma + si->text_size) {
lno = ML_(search_one_loctab) ( si, ptr );
if (lno == -1) goto not_found;
*locno = lno;
SegInfo* si;
for (si = segInfo_list; si != NULL; si = si->next) {
- if (si->start <= a && a < si->start+si->size) {
+ if (si->text_start_avma <= a
+ && a < si->text_start_avma + si->text_size) {
VG_(strncpy_safely)(buf, si->filename, nbuf);
return True;
}
SegInfo* si;
for (si = segInfo_list; si != NULL; si = si->next) {
- if (si->start <= a && a < si->start+si->size) {
+ if (si->text_start_avma <= a
+ && a < si->text_start_avma + si->text_size) {
return si;
}
}
Addr VG_(seginfo_start)(const SegInfo* si)
{
- return si->start;
+ return si->text_start_avma;
}
SizeT VG_(seginfo_size)(const SegInfo* si)
{
- return si->size;
+ return si->text_size;
}
const UChar* VG_(seginfo_soname)(const SegInfo* si)
ULong VG_(seginfo_sym_offset)(const SegInfo* si)
{
- return si->offset;
+ return si->text_bias;
}
VgSectKind VG_(seginfo_sect_kind)(Addr a)
VgSectKind ret = Vg_SectUnknown;
for(si = segInfo_list; si != NULL; si = si->next) {
- if (a >= si->start && a < (si->start + si->size)) {
+ if (a >= si->text_start_avma
+ && a < si->text_start_avma + si->text_size) {
if (0)
VG_(printf)(
"addr=%p si=%p %s got=%p %d plt=%p %d data=%p %d bss=%p %d\n",
a, si, si->filename,
- si->got_start_vma, si->got_size,
- si->plt_start_vma, si->plt_size,
- si->data_start_vma, si->data_size,
- si->bss_start_vma, si->bss_size);
+ si->got_start_avma, si->got_size,
+ si->plt_start_avma, si->plt_size,
+ si->data_start_avma, si->data_size,
+ si->bss_start_avma, si->bss_size);
ret = Vg_SectText;
- if (a >= si->data_start_vma && a < (si->data_start_vma + si->data_size))
+ if (a >= si->data_start_avma && a < si->data_start_avma + si->data_size)
ret = Vg_SectData;
else
- if (a >= si->bss_start_vma && a < (si->bss_start_vma + si->bss_size))
+ if (a >= si->bss_start_avma && a < si->bss_start_avma + si->bss_size)
ret = Vg_SectBSS;
else
- if (a >= si->plt_start_vma && a < (si->plt_start_vma + si->plt_size))
+ if (a >= si->plt_start_avma && a < si->plt_start_avma + si->plt_size)
ret = Vg_SectPLT;
else
- if (a >= si->got_start_vma && a < (si->got_start_vma + si->got_size))
+ if (a >= si->got_start_avma && a < si->got_start_avma + si->got_size)
ret = Vg_SectGOT;
}
}
This module was also extensively hacked on by Jeremy Fitzhardinge
and Tom Hughes.
*/
+/* See comment at top of debuginfo.c for explanation of
+ the _svma / _avma / _image / _bias naming scheme.
+*/
#ifndef __PRIV_STORAGE_H
#define __PRIV_STORAGE_H
struct _SegInfo* next; /* list of SegInfos */
/* Description of the mapped segment. */
- Addr start;
- UInt size;
+ Addr text_start_avma;
+ UInt text_size;
UChar* filename; /* in mallocville */
- OffT foffset;
+ OffT foffset; /* file offset for mapped text section - UNUSED */
UChar* soname;
/* An expandable array of symbols. */
UChar strtab[SEGINFO_STRCHUNKSIZE];
} *strchunks;
- /* 'offset' is what needs to be added to an address in the address
- space of the library as stored on disk (which is not 0-based for
- executables or prelinked libraries) to get an address in memory
- for the object loaded at 'start' */
- OffT offset;
+ /* 'text_bias' is what needs to be added to an address in the
+ address space of the library as stored on disk [a so-called
+ stated VMA] (which is not 0-based for executables or prelinked
+ libraries) to get an address in memory for the object loaded at
+ 'text_start_avma'. At least for text symbols. */
+ OffT text_bias;
/* Bounds of data, BSS, PLT, GOT and OPD (for ppc64-linux) so that
tools can see what section an address is in. In the running
image! */
- Addr plt_start_vma;
+ Addr plt_start_avma;
UInt plt_size;
- Addr got_start_vma;
+ Addr got_start_avma;
UInt got_size;
- Addr opd_start_vma;
+ Addr opd_start_avma;
UInt opd_size;
- Addr data_start_vma;
+ Addr data_start_avma;
UInt data_size;
- Addr bss_start_vma;
+ Addr bss_start_avma;
UInt bss_size;
};
}
-/* A structure which holds information needed by read_encoded_Addr().
- Not sure what these address-like fields are -- really ought to
- distinguish properly svma/avma/image addresses.
+/* A structure which holds information needed by read_encoded_Addr().
*/
typedef
struct {
UChar encoding;
- UChar* ehframe;
- Addr ehframe_addr;
+ UChar* ehframe_image;
+ Addr ehframe_avma;
}
AddressDecodingInfo;
UChar* data )
{
Addr base;
- Int offset;
- UChar encoding = adi->encoding;
- UChar* ehframe = adi->ehframe;
- Addr ehframe_addr = adi->ehframe_addr;
+ Word offset;
+ UChar encoding = adi->encoding;
+ UChar* ehframe_image = adi->ehframe_image;
+ Addr ehframe_avma = adi->ehframe_avma;
vg_assert((encoding & DW_EH_PE_indirect) == 0);
base = 0;
break;
case DW_EH_PE_pcrel:
- base = ehframe_addr + ( data - ehframe );
+ base = ehframe_avma + ( data - ehframe_image );
break;
case DW_EH_PE_datarel:
vg_assert(0);
break;
case DW_EH_PE_aligned:
base = 0;
- offset = data - ehframe;
+ offset = data - ehframe_image;
if ((offset % sizeof(Addr)) != 0) {
*nbytes = sizeof(Addr) - (offset % sizeof(Addr));
data += *nbytes;
void ML_(read_callframe_info_dwarf2)
( /*OUT*/struct _SegInfo* si,
- UChar* ehframe, Int ehframe_sz, Addr ehframe_addr )
+ UChar* ehframe_image, Int ehframe_sz, Addr ehframe_avma )
{
Int nbytes;
HChar* how = NULL;
Int n_CIEs = 0;
- UChar* data = ehframe;
+ UChar* data = ehframe_image;
# if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
/* These targets don't use CFI-based stack unwinding. */
if (VG_(clo_trace_cfi)) {
VG_(printf)("\n-----------------------------------------------\n");
- VG_(printf)("CFI info: ehframe %p, ehframe_sz %d\n",
- ehframe, ehframe_sz );
+ VG_(printf)("CFI info: szB %d, _avma %p, _image %p\n",
+ ehframe_sz, (void*)ehframe_avma, (void*)ehframe_image );
VG_(printf)("CFI info: name %s\n",
si->filename );
}
UInt cie_pointer;
/* Are we done? */
- if (data == ehframe + ehframe_sz)
+ if (data == ehframe_image + ehframe_sz)
return;
/* Overshot the end? Means something is wrong */
- if (data > ehframe + ehframe_sz) {
+ if (data > ehframe_image + ehframe_sz) {
how = "overran the end of .eh_frame";
goto bad;
}
ciefde_start = data;
if (VG_(clo_trace_cfi))
- VG_(printf)("\ncie/fde.start = %p (ehframe + 0x%x)\n",
- ciefde_start, ciefde_start - ehframe);
+ VG_(printf)("\ncie/fde.start = %p (ehframe_image + 0x%x)\n",
+ ciefde_start, ciefde_start - ehframe_image);
ciefde_len = read_UInt(data); data += sizeof(UInt);
if (VG_(clo_trace_cfi))
of the sequence. ?? Neither the DWARF2 spec not the AMD64
ABI spec say this, though. */
if (ciefde_len == 0) {
- if (data == ehframe + ehframe_sz)
+ if (data == ehframe_image + ehframe_sz)
return;
how = "zero-sized CIE/FDE but not at section end";
goto bad;
/* Record its offset. This is how we will find it again
later when looking at an FDE. */
- the_CIEs[this_CIE].offset = ciefde_start - ehframe;
+ the_CIEs[this_CIE].offset = ciefde_start - ehframe_image;
cie_version = read_UChar(data); data += sizeof(UChar);
if (VG_(clo_trace_cfi))
if (VG_(clo_trace_cfi)) {
AddressDecodingInfo adi;
- adi.encoding = the_CIEs[this_CIE].address_encoding;
- adi.ehframe = ehframe;
- adi.ehframe_addr = ehframe_addr;
+ adi.encoding = the_CIEs[this_CIE].address_encoding;
+ adi.ehframe_image = ehframe_image;
+ adi.ehframe_avma = ehframe_avma;
show_CF_instructions(the_CIEs[this_CIE].instrs,
the_CIEs[this_CIE].ilen, &adi );
}
/* re sizeof(UInt), matches XXX above. For 64-bit dwarf this
will have to be a ULong instead. */
- look_for = (data - sizeof(UInt) - ehframe) - cie_pointer;
+ look_for = (data - sizeof(UInt) - ehframe_image) - cie_pointer;
for (cie = 0; cie < n_CIEs; cie++) {
if (0) VG_(printf)("look for %d %d\n",
goto bad;
}
- adi.encoding = the_CIEs[cie].address_encoding;
- adi.ehframe = ehframe;
- adi.ehframe_addr = ehframe_addr;
+ adi.encoding = the_CIEs[cie].address_encoding;
+ adi.ehframe_image = ehframe_image;
+ adi.ehframe_avma = ehframe_avma;
fde_initloc = read_encoded_Addr(&nbytes, &adi, data);
data += nbytes;
if (VG_(clo_trace_cfi))
VG_(printf)("fde.initloc = %p\n", (void*)fde_initloc);
- adi.encoding = the_CIEs[cie].address_encoding & 0xf;
- adi.ehframe = ehframe;
- adi.ehframe_addr = ehframe_addr;
+ adi.encoding = the_CIEs[cie].address_encoding & 0xf;
+ adi.ehframe_image = ehframe_image;
+ adi.ehframe_avma = ehframe_avma;
fde_arange = read_encoded_Addr(&nbytes, &adi, data);
data += nbytes;
if (VG_(clo_trace_cfi))
data += fde_ilen;
- adi.encoding = the_CIEs[cie].address_encoding;
- adi.ehframe = ehframe;
- adi.ehframe_addr = ehframe_addr;
+ adi.encoding = the_CIEs[cie].address_encoding;
+ adi.ehframe_image = ehframe_image;
+ adi.ehframe_avma = ehframe_avma;
if (VG_(clo_trace_cfi))
show_CF_instructions(fde_instrs, fde_ilen, &adi);
if (!plausible
&& ELFXX_ST_TYPE(sym->st_info) == STT_NOTYPE
&& sym->st_size > 0
- && si->opd_start_vma != 0
- && sym_addr >= si->opd_start_vma
- && sym_addr < si->opd_start_vma + si->opd_size)
+ && si->opd_start_avma != 0
+ && sym_addr >= si->opd_start_avma
+ && sym_addr < si->opd_start_avma + si->opd_size)
plausible = True;
# endif
/* If it's apparently in a GOT or PLT, it's really a reference to a
symbol defined elsewhere, so ignore it. */
- if (si->got_start_vma != 0
- && sym_addr >= si->got_start_vma
- && sym_addr < si->got_start_vma + si->got_size) {
+ if (si->got_start_avma != 0
+ && sym_addr >= si->got_start_avma
+ && sym_addr < si->got_start_avma + si->got_size) {
TRACE_SYMTAB(" ignore -- in GOT: %s\n", sym_name);
return False;
}
- if (si->plt_start_vma != 0
- && sym_addr >= si->plt_start_vma
- && sym_addr < si->plt_start_vma + si->plt_size) {
+ if (si->plt_start_avma != 0
+ && sym_addr >= si->plt_start_avma
+ && sym_addr < si->plt_start_avma + si->plt_size) {
TRACE_SYMTAB(" ignore -- in PLT: %s\n", sym_name);
return False;
}
*/
is_in_opd = False;
- if (si->opd_start_vma != 0
- && sym_addr >= si->opd_start_vma
- && sym_addr < si->opd_start_vma + si->opd_size) {
+ if (si->opd_start_avma != 0
+ && sym_addr >= si->opd_start_avma
+ && sym_addr < si->opd_start_avma + si->opd_size) {
# if !defined(VGP_ppc64_linux)
TRACE_SYMTAB(" ignore -- in OPD: %s\n", sym_name);
return False;
the vma of the opd section start, so we can figure out how
far into the opd section this is. */
- offset_in_opd = (Addr)sym_addr - (Addr)(si->opd_start_vma);
+ offset_in_opd = (Addr)sym_addr - (Addr)(si->opd_start_avma);
if (offset_in_opd < 0 || offset_in_opd >= si->opd_size) {
TRACE_SYMTAB(" ignore -- invalid OPD offset: %s\n", sym_name);
return False;
/* Here's yet another ppc64-linux hack. Get rid of leading dot if
the symbol is outside .opd. */
# if defined(VGP_ppc64_linux)
- if (si->opd_start_vma != 0
+ if (si->opd_start_avma != 0
&& !is_in_opd
&& sym_name[0] == '.') {
vg_assert(!(*from_opd_out));
/* If no part of the symbol falls within the mapped range,
ignore it. */
- if (*sym_addr_out + *sym_size_out <= si->start
- || *sym_addr_out >= si->start+si->size) {
+ if (*sym_addr_out + *sym_size_out <= si->text_start_avma
+ || *sym_addr_out >= si->text_start_avma + si->text_size) {
TRACE_SYMTAB( "ignore -- %p .. %p outside mapped range %p .. %p\n",
*sym_addr_out, *sym_addr_out + *sym_size_out,
- si->start, si->start+si->size);
+ si->text_start_avma,
+ si->text_start_avma + si->text_size);
return False;
}
section. This would completely mess up function redirection and
intercepting. This assert ensures that any symbols that make it
into the symbol table on ppc64-linux don't point into .opd. */
- if (si->opd_start_vma != 0) {
- vg_assert(*sym_addr_out + *sym_size_out <= si->opd_start_vma
- || *sym_addr_out >= si->opd_start_vma + si->opd_size);
+ if (si->opd_start_avma != 0) {
+ vg_assert(*sym_addr_out + *sym_size_out <= si->opd_start_avma
+ || *sym_addr_out >= si->opd_start_avma + si->opd_size);
}
# endif
oimage = (Addr)NULL;
if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
VG_(message)(Vg_DebugMsg, "Reading syms from %s (%p)",
- si->filename, si->start );
+ si->filename, si->text_start_avma );
/* mmap the object image aboard, so that we can read symbols and
line number info out of it. It will be munmapped immediately
oimage = sres.val;
+ if (0) {
+ VG_(printf)("read_elf_debug_info: OIMAGE = %p - %p\n",
+ (void*)oimage, (void*)(oimage + (UWord)n_oimage));
+ }
+
/* Ok, the object image is safely in oimage[0 .. n_oimage-1].
Now verify that it is a valid ELF .so or executable image.
*/
if (!offset_set) {
offset_set = True;
- offset_oimage = si->start - o_phdr->p_vaddr;
+ offset_oimage = si->text_start_avma - o_phdr->p_vaddr;
baseaddr = o_phdr->p_vaddr;
}
// Get the data and bss start/size if appropriate
mapped = o_phdr->p_vaddr + offset_oimage;
mapped_end = mapped + o_phdr->p_memsz;
- if (si->data_start_vma == 0 &&
+ if (si->data_start_avma == 0 &&
(o_phdr->p_flags & (PF_R|PF_W|PF_X)) == (PF_R|PF_W)) {
- si->data_start_vma = mapped;
- si->data_size = o_phdr->p_filesz;
- si->bss_start_vma = mapped + o_phdr->p_filesz;
+ si->data_start_avma = mapped;
+ si->data_size = o_phdr->p_filesz;
+ si->bss_start_avma = mapped + o_phdr->p_filesz;
if (o_phdr->p_memsz > o_phdr->p_filesz)
si->bss_size = o_phdr->p_memsz - o_phdr->p_filesz;
else
mapped = mapped & ~(VKI_PAGE_SIZE-1);
mapped_end = (mapped_end + VKI_PAGE_SIZE - 1) & ~(VKI_PAGE_SIZE-1);
- if (VG_(needs).data_syms &&
- (mapped >= si->start && mapped <= (si->start+si->size)) &&
- (mapped_end > (si->start+si->size))) {
- UInt newsz = mapped_end - si->start;
- if (newsz > si->size) {
+ if (VG_(needs).data_syms
+ && mapped >= si->text_start_avma
+ && mapped <= (si->text_start_avma + si->text_size)
+ && mapped_end > (si->text_start_avma + si->text_size)) {
+ /* XXX jrs 2007 Jan 11: what's going on here? If data
+ syms are involved, surely we shouldn't be messing with
+ the segment's text_size unless there is an assumption
+ that the data segment has been mapped immediately after
+ the text segment. Which doesn't sound good to me. */
+ UInt newsz = mapped_end - si->text_start_avma;
+ if (newsz > si->text_size) {
if (0)
VG_(printf)("extending mapping %p..%p %d -> ..%p %d\n",
- si->start, si->start+si->size, si->size,
- si->start+newsz, newsz);
+ si->text_start_avma,
+ si->text_start_avma + si->text_size,
+ si->text_size,
+ si->text_start_avma + newsz, newsz);
- si->size = newsz;
+ si->text_size = newsz;
}
}
}
}
- si->offset = offset_oimage;
+ si->text_bias = offset_oimage;
/* If, after looking at all the program headers, we still didn't
find a soname, add a fake one. */
information */
{
/* Pointers to start of sections (in the oimage, not in the
- running image) */
+ running image) -- image addresses */
UChar* o_strtab = NULL; /* .strtab */
ElfXX_Sym* o_symtab = NULL; /* .symtab */
UChar* o_dynstr = NULL; /* .dynstr */
UInt dwarf1l_sz = 0;
UInt ehframe_sz = 0;
- /* Section virtual addresses */
- Addr dummy_vma = 0;
- Addr ehframe_vma = 0;
+ /* Section actual virtual addresses */
+ Addr dummy_avma = 0;
+ Addr ehframe_avma = 0;
/* Find all interesting sections */
/* Nb: must find where .got and .plt sections will be in the
* executable image, not in the object image transiently loaded. */
- /* NAME SIZE ADDR_IN_OIMAGE ADDR_WHEN_MAPPED */
- FIND(".dynsym", o_dynsym_sz, o_dynsym, dummy_vma)
- FIND(".dynstr", o_dynstr_sz, o_dynstr, dummy_vma)
- FIND(".symtab", o_symtab_sz, o_symtab, dummy_vma)
- FIND(".strtab", o_strtab_sz, o_strtab, dummy_vma)
+ /* NAME SIZE ADDR_IN_OIMAGE ADDR_WHEN_MAPPED */
+ FIND(".dynsym", o_dynsym_sz, o_dynsym, dummy_avma)
+ FIND(".dynstr", o_dynstr_sz, o_dynstr, dummy_avma)
+ FIND(".symtab", o_symtab_sz, o_symtab, dummy_avma)
+ FIND(".strtab", o_strtab_sz, o_strtab, dummy_avma)
- FIND(".gnu_debuglink", debuglink_sz, debuglink, dummy_vma)
+ FIND(".gnu_debuglink", debuglink_sz, debuglink, dummy_avma)
- FIND(".stab", stab_sz, stab, dummy_vma)
- FIND(".stabstr", stabstr_sz, stabstr, dummy_vma)
+ FIND(".stab", stab_sz, stab, dummy_avma)
+ FIND(".stabstr", stabstr_sz, stabstr, dummy_avma)
- FIND(".debug_line", debug_line_sz, debug_line, dummy_vma)
- FIND(".debug_info", debug_info_sz, debug_info, dummy_vma)
- FIND(".debug_abbrev", debug_abbv_sz, debug_abbv, dummy_vma)
- FIND(".debug_str", debug_str_sz, debug_str, dummy_vma)
+ FIND(".debug_line", debug_line_sz, debug_line, dummy_avma)
+ FIND(".debug_info", debug_info_sz, debug_info, dummy_avma)
+ FIND(".debug_abbrev", debug_abbv_sz, debug_abbv, dummy_avma)
+ FIND(".debug_str", debug_str_sz, debug_str, dummy_avma)
- FIND(".debug", dwarf1d_sz, dwarf1d, dummy_vma)
- FIND(".line", dwarf1l_sz, dwarf1l, dummy_vma)
- FIND(".eh_frame", ehframe_sz, ehframe, ehframe_vma)
+ FIND(".debug", dwarf1d_sz, dwarf1d, dummy_avma)
+ FIND(".line", dwarf1l_sz, dwarf1l, dummy_avma)
+ FIND(".eh_frame", ehframe_sz, ehframe, ehframe_avma)
- FIND(".got", si->got_size, dummy_filea, si->got_start_vma)
- FIND(".plt", si->plt_size, dummy_filea, si->plt_start_vma)
- FIND(".opd", si->opd_size, opd_filea, si->opd_start_vma)
+ FIND(".got", si->got_size, dummy_filea, si->got_start_avma)
+ FIND(".plt", si->plt_size, dummy_filea, si->plt_start_avma)
+ FIND(".opd", si->opd_size, opd_filea, si->opd_start_avma)
# undef FIND
}
for (i = 0; i < ehdr->e_phnum; i++) {
ElfXX_Phdr *o_phdr = &((ElfXX_Phdr *)(dimage + ehdr->e_phoff))[i];
if (o_phdr->p_type == PT_LOAD) {
- offset_dimage = si->start - o_phdr->p_vaddr;
+ offset_dimage = si->text_start_avma - o_phdr->p_vaddr;
break;
}
}
sh_strtab = (UChar*)(dimage + shdr[ehdr->e_shstrndx].sh_offset);
/* Same deal as previous FIND, except simpler - doesn't
- look for vma, only oimage address. */
+ look for avma, only oimage address. */
/* Find all interesting sections */
for (i = 0; i < ehdr->e_shnum; i++) {
} \
}
+ /* ?? NAME SIZE ADDR_IN_OIMAGE */
FIND(need_symtab, ".symtab", o_symtab_sz, o_symtab)
FIND(need_symtab, ".strtab", o_strtab_sz, o_strtab)
FIND(1, ".stab", stab_sz, stab)
/* Read .eh_frame (call-frame-info) if any */
if (ehframe) {
- ML_(read_callframe_info_dwarf2) ( si, ehframe, ehframe_sz, ehframe_vma );
+ ML_(read_callframe_info_dwarf2)
+ ( si, ehframe/*image*/, ehframe_sz, ehframe_avma );
}
/* Read the stabs and/or dwarf2 debug information, if any. It
size = 1;
}
- /* vg_assert(this < si->start + si->size && next-1 >= si->start); */
- if (this >= si->start + si->size || next-1 < si->start) {
+ /* vg_assert(this < si->text_start_avma + si->size
+ && next-1 >= si->text_start_avma); */
+ if (this >= si->text_start_avma + si->text_size
+ || next-1 < si->text_start_avma) {
if (0)
VG_(message)(Vg_DebugMsg,
"warning: ignoring line info entry falling "
"outside current SegInfo: %p %p %p %p",
- si->start, si->start + si->size,
+ si->text_start_avma,
+ si->text_start_avma + si->text_size,
this, next-1);
return;
}
/* Rule out ones which are completely outside the segment. These
probably indicate some kind of bug, but for the meantime ignore
them. */
- if ( cfsi->base + cfsi->len - 1 < si->start
- || si->start + si->size - 1 < cfsi->base ) {
+ if ( cfsi->base + cfsi->len - 1 < si->text_start_avma
+ || si->text_start_avma + si->text_size - 1 < cfsi->base ) {
static Int complaints = 3;
if (VG_(clo_trace_cfi) || complaints > 0) {
complaints--;
"warning: DiCfSI %p .. %p outside segment %p .. %p",
cfsi->base,
cfsi->base + cfsi->len - 1,
- si->start,
- si->start + si->size - 1
+ si->text_start_avma,
+ si->text_start_avma + si->text_size - 1
);
}
if (VG_(clo_trace_cfi))