|
From: <sv...@va...> - 2007-01-11 19:42:19
|
Author: sewardj
Date: 2007-01-11 19:42:11 +0000 (Thu, 11 Jan 2007)
New Revision: 6506
Log:
Non-functional change: rename a bunch of variables and field names
that hold various kinds of addresses during debuginfo reading, so as
to make it easier to understand. See comment at top of debuginfo.c.
Modified:
trunk/coregrind/m_debuginfo/debuginfo.c
trunk/coregrind/m_debuginfo/priv_storage.h
trunk/coregrind/m_debuginfo/readdwarf.c
trunk/coregrind/m_debuginfo/readelf.c
trunk/coregrind/m_debuginfo/storage.c
Modified: trunk/coregrind/m_debuginfo/debuginfo.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/debuginfo.c 2007-01-10 19:30:19 UTC (rev =
6505)
+++ trunk/coregrind/m_debuginfo/debuginfo.c 2007-01-11 19:42:11 UTC (rev =
6506)
@@ -59,7 +59,37 @@
# include "priv_readxcoff.h"
#endif
=20
+
/*------------------------------------------------------------*/
+/*--- 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:
+=20
+ 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
+=20
+ actual VMAs - the address where (eg) said symbol really wound up
+ after the .so was mapped into memory
+=20
+ 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 ---*/
/*------------------------------------------------------------*/
=20
@@ -84,12 +114,13 @@
{
SegInfo* si =3D VG_(arena_calloc)(VG_AR_SYMTAB, 1, sizeof(SegInfo));
=20
- si->start =3D start;
- si->size =3D size;
- si->foffset =3D foffset;
- si->filename =3D VG_(arena_strdup)(VG_AR_SYMTAB, filename);
- si->memname =3D memname ? VG_(arena_strdup)(VG_AR_SYMTAB, memname)
- : NULL;
+ si->text_start_avma =3D start;
+ si->size =3D size;
+ si->foffset =3D foffset;
+ si->filename =3D VG_(arena_strdup)(VG_AR_SYMTAB, filename);
+ si->memname =3D memname=20
+ ? VG_(arena_strdup)(VG_AR_SYMTAB, memname)
+ : NULL;
=20
// Everything else -- pointers, sizes, arrays -- is zeroed by calloc.
return si;
@@ -137,7 +168,8 @@
if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
VG_(message)(Vg_DebugMsg,=20
"Discarding syms at %p-%p in %s due to %s()",=20
- si->start, si->start + si->size,
+ si->text_start_avma,=20
+ si->text_start_avma + si->size,
curr->filename ? curr->filename : (UChar*)"???"=
,
reason);
vg_assert(*prev_next_ptr =3D=3D curr);
@@ -170,8 +202,8 @@
while (True) {
if (curr =3D=3D NULL)
break;
- if (start+length-1 < curr->start=20
- || curr->start+curr->size-1 < start) {
+ if (start+length-1 < curr->text_start_avma=20
+ || curr->text_start_avma+curr->size-1 < start) {
/* no overlap */
} else {
found =3D True;
@@ -440,7 +472,8 @@
SegInfo* si;
=20
for (si =3D segInfo_list; si !=3D NULL; si =3D si->next) {
- if (si->start <=3D ptr && ptr < si->start+si->size) {
+ if (si->text_start_avma <=3D ptr=20
+ && ptr < si->text_start_avma + si->size) {
sno =3D ML_(search_one_symtab) ( si, ptr, match_anywhere_in_fun=
);
if (sno =3D=3D -1) goto not_found;
*symno =3D sno;
@@ -464,7 +497,8 @@
SegInfo* si;
=20
for (si =3D segInfo_list; si !=3D NULL; si =3D si->next) {
- if (si->start <=3D ptr && ptr < si->start+si->size) {
+ if (si->text_start_avma <=3D ptr=20
+ && ptr < si->text_start_avma + si->size) {
lno =3D ML_(search_one_loctab) ( si, ptr );
if (lno =3D=3D -1) goto not_found;
*locno =3D lno;
@@ -607,7 +641,7 @@
=20
vg_assert(nbuf > 0);
for (si =3D segInfo_list; si !=3D NULL; si =3D si->next) {
- if (si->start <=3D a && a < si->start+si->size) {
+ if (si->text_start_avma <=3D a && a < si->text_start_avma+si->size=
) {
VG_(strncpy_safely)(buf, si->filename, nbuf);
if (si->memname) {
used =3D VG_(strlen)(buf);
@@ -634,7 +668,7 @@
SegInfo* si;
=20
for (si =3D segInfo_list; si !=3D NULL; si =3D si->next) {
- if (si->start <=3D a && a < si->start+si->size) {
+ if (si->text_start_avma <=3D a && a < si->text_start_avma + si->si=
ze) {
return si;
}
}
@@ -1050,7 +1084,7 @@
=20
Addr VG_(seginfo_start)(const SegInfo* si)
{
- return si->start;
+ return si->text_start_avma;
}
=20
SizeT VG_(seginfo_size)(const SegInfo* si)
@@ -1079,29 +1113,30 @@
VgSectKind ret =3D Vg_SectUnknown;
=20
for(si =3D segInfo_list; si !=3D NULL; si =3D si->next) {
- if (a >=3D si->start && a < (si->start + si->size)) {
+ if (a >=3D si->text_start_avma=20
+ && a < si->text_start_avma + si->size) {
=20
if (0)
VG_(printf)(
"addr=3D%p si=3D%p %s got=3D%p %d plt=3D%p %d data=3D%p =
%d bss=3D%p %d\n",
a, si, si->filename,=20
- 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);
=20
ret =3D Vg_SectText;
=20
- if (a >=3D si->data_start_vma && a < (si->data_start_vma + si->data_si=
ze))
+ if (a >=3D si->data_start_avma && a < si->data_start_avma + si->data_s=
ize)
ret =3D Vg_SectData;
else=20
- if (a >=3D si->bss_start_vma && a < (si->bss_start_vma + si->bs=
s_size))
+ if (a >=3D si->bss_start_avma && a < si->bss_start_avma + si->b=
ss_size)
ret =3D Vg_SectBSS;
else=20
- if (a >=3D si->plt_start_vma && a < (si->plt_start_vma + si->pl=
t_size))
+ if (a >=3D si->plt_start_avma && a < si->plt_start_avma + si->p=
lt_size)
ret =3D Vg_SectPLT;
else=20
- if (a >=3D si->got_start_vma && a < (si->got_start_vma + si->go=
t_size))
+ if (a >=3D si->got_start_avma && a < si->got_start_avma + si->g=
ot_size)
ret =3D Vg_SectGOT;
}
}
Modified: trunk/coregrind/m_debuginfo/priv_storage.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/priv_storage.h 2007-01-10 19:30:19 UTC (r=
ev 6505)
+++ trunk/coregrind/m_debuginfo/priv_storage.h 2007-01-11 19:42:11 UTC (r=
ev 6506)
@@ -34,6 +34,9 @@
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.
+*/
=20
#ifndef __PRIV_STORAGE_H
#define __PRIV_STORAGE_H
@@ -139,7 +142,7 @@
struct _SegInfo* next; /* list of SegInfos */
=20
/* Description of the mapped segment. */
- Addr start;
+ Addr text_start_avma;
UInt size;
UChar* filename; /* in mallocville */
UChar* memname; /* malloc'd. AIX5 only: .a member name */
@@ -180,15 +183,15 @@
/* 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;
};
=20
Modified: trunk/coregrind/m_debuginfo/readdwarf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/readdwarf.c 2007-01-10 19:30:19 UTC (rev =
6505)
+++ trunk/coregrind/m_debuginfo/readdwarf.c 2007-01-11 19:42:11 UTC (rev =
6506)
@@ -1592,15 +1592,13 @@
}
=20
=20
-/* 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.=20
+/* A structure which holds information needed by read_encoded_Addr().=20
*/
typedef
struct {
UChar encoding;
- UChar* ehframe;
- Addr ehframe_addr;
+ UChar* ehframe_image;
+ Addr ehframe_avma;
}
AddressDecodingInfo;
=20
@@ -1839,10 +1837,10 @@
UChar* data )
{
Addr base;
- Int offset;
- UChar encoding =3D adi->encoding;
- UChar* ehframe =3D adi->ehframe;
- Addr ehframe_addr =3D adi->ehframe_addr;
+ Word offset;
+ UChar encoding =3D adi->encoding;
+ UChar* ehframe_image =3D adi->ehframe_image;
+ Addr ehframe_avma =3D adi->ehframe_avma;
=20
vg_assert((encoding & DW_EH_PE_indirect) =3D=3D 0);
=20
@@ -1853,7 +1851,7 @@
base =3D 0;
break;
case DW_EH_PE_pcrel:
- base =3D ehframe_addr + ( data - ehframe );
+ base =3D ehframe_avma + ( data - ehframe_image );
break;
case DW_EH_PE_datarel:
vg_assert(0);
@@ -1868,7 +1866,7 @@
break;
case DW_EH_PE_aligned:
base =3D 0;
- offset =3D data - ehframe;
+ offset =3D data - ehframe_image;
if ((offset % sizeof(Addr)) !=3D 0) {
*nbytes =3D sizeof(Addr) - (offset % sizeof(Addr));
data +=3D *nbytes;
@@ -2477,12 +2475,12 @@
=20
void ML_(read_callframe_info_dwarf2)=20
( /*OUT*/struct _SegInfo* si,=20
- UChar* ehframe, Int ehframe_sz, Addr ehframe_addr )
+ UChar* ehframe_image, Int ehframe_sz, Addr ehframe_avma )
{
Int nbytes;
HChar* how =3D NULL;
Int n_CIEs =3D 0;
- UChar* data =3D ehframe;
+ UChar* data =3D ehframe_image;
=20
# if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
/* These targets don't use CFI-based stack unwinding. */
@@ -2491,8 +2489,8 @@
=20
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 );
}
@@ -2524,11 +2522,11 @@
UInt cie_pointer;
=20
/* Are we done? */
- if (data =3D=3D ehframe + ehframe_sz)
+ if (data =3D=3D ehframe_image + ehframe_sz)
return;
=20
/* Overshot the end? Means something is wrong */
- if (data > ehframe + ehframe_sz) {
+ if (data > ehframe_image + ehframe_sz) {
how =3D "overran the end of .eh_frame";
goto bad;
}
@@ -2538,8 +2536,8 @@
=20
ciefde_start =3D data;
if (VG_(clo_trace_cfi))=20
- VG_(printf)("\ncie/fde.start =3D %p (ehframe + 0x%x)\n",=20
- ciefde_start, ciefde_start - ehframe);
+ VG_(printf)("\ncie/fde.start =3D %p (ehframe_image + 0x%x)\n"=
,=20
+ ciefde_start, ciefde_start - ehframe_image);
=20
ciefde_len =3D read_UInt(data); data +=3D sizeof(UInt);
if (VG_(clo_trace_cfi))=20
@@ -2549,7 +2547,7 @@
of the sequence. ?? Neither the DWARF2 spec not the AMD64
ABI spec say this, though. */
if (ciefde_len =3D=3D 0) {
- if (data =3D=3D ehframe + ehframe_sz)
+ if (data =3D=3D ehframe_image + ehframe_sz)
return;
how =3D "zero-sized CIE/FDE but not at section end";
goto bad;
@@ -2585,7 +2583,7 @@
=20
/* Record its offset. This is how we will find it again
later when looking at an FDE. */
- the_CIEs[this_CIE].offset =3D ciefde_start - ehframe;
+ the_CIEs[this_CIE].offset =3D ciefde_start - ehframe_image;
=20
cie_version =3D read_UChar(data); data +=3D sizeof(UChar);
if (VG_(clo_trace_cfi))
@@ -2694,9 +2692,9 @@
=20
if (VG_(clo_trace_cfi)) {
AddressDecodingInfo adi;
- adi.encoding =3D the_CIEs[this_CIE].address_encoding;
- adi.ehframe =3D ehframe;
- adi.ehframe_addr =3D ehframe_addr;
+ adi.encoding =3D the_CIEs[this_CIE].address_encoding;
+ adi.ehframe_image =3D ehframe_image;
+ adi.ehframe_avma =3D ehframe_avma;
show_CF_instructions(the_CIEs[this_CIE].instrs,=20
the_CIEs[this_CIE].ilen, &adi );
}
@@ -2720,7 +2718,7 @@
=20
/* re sizeof(UInt), matches XXX above. For 64-bit dwarf this
will have to be a ULong instead. */
- look_for =3D (data - sizeof(UInt) - ehframe) - cie_pointer;
+ look_for =3D (data - sizeof(UInt) - ehframe_image) - cie_pointe=
r;
=20
for (cie =3D 0; cie < n_CIEs; cie++) {
if (0) VG_(printf)("look for %d %d\n",
@@ -2734,17 +2732,17 @@
goto bad;
}
=20
- adi.encoding =3D the_CIEs[cie].address_encoding;
- adi.ehframe =3D ehframe;
- adi.ehframe_addr =3D ehframe_addr;
+ adi.encoding =3D the_CIEs[cie].address_encoding;
+ adi.ehframe_image =3D ehframe_image;
+ adi.ehframe_avma =3D ehframe_avma;
fde_initloc =3D read_encoded_Addr(&nbytes, &adi, data);
data +=3D nbytes;
if (VG_(clo_trace_cfi))=20
VG_(printf)("fde.initloc =3D %p\n", (void*)fde_initloc);
=20
- adi.encoding =3D the_CIEs[cie].address_encoding & 0xf;
- adi.ehframe =3D ehframe;
- adi.ehframe_addr =3D ehframe_addr;
+ adi.encoding =3D the_CIEs[cie].address_encoding & 0xf;
+ adi.ehframe_image =3D ehframe_image;
+ adi.ehframe_avma =3D ehframe_avma;
fde_arange =3D read_encoded_Addr(&nbytes, &adi, data);
data +=3D nbytes;
if (VG_(clo_trace_cfi))=20
@@ -2769,9 +2767,9 @@
=20
data +=3D fde_ilen;
=20
- adi.encoding =3D the_CIEs[cie].address_encoding;
- adi.ehframe =3D ehframe;
- adi.ehframe_addr =3D ehframe_addr;
+ adi.encoding =3D the_CIEs[cie].address_encoding;
+ adi.ehframe_image =3D ehframe_image;
+ adi.ehframe_avma =3D ehframe_avma;
=20
if (VG_(clo_trace_cfi))
show_CF_instructions(fde_instrs, fde_ilen, &adi);
Modified: trunk/coregrind/m_debuginfo/readelf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/readelf.c 2007-01-10 19:30:19 UTC (rev 65=
05)
+++ trunk/coregrind/m_debuginfo/readelf.c 2007-01-11 19:42:11 UTC (rev 65=
06)
@@ -233,9 +233,9 @@
if (!plausible
&& ELFXX_ST_TYPE(sym->st_info) =3D=3D STT_NOTYPE
&& sym->st_size > 0
- && si->opd_start_vma !=3D 0
- && sym_addr >=3D si->opd_start_vma
- && sym_addr < si->opd_start_vma + si->opd_size)
+ && si->opd_start_avma !=3D 0
+ && sym_addr >=3D si->opd_start_avma
+ && sym_addr < si->opd_start_avma + si->opd_size)
plausible =3D True;
# endif
=20
@@ -262,15 +262,15 @@
=20
/* 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 !=3D 0
- && sym_addr >=3D si->got_start_vma=20
- && sym_addr < si->got_start_vma + si->got_size) {
+ if (si->got_start_avma !=3D 0
+ && sym_addr >=3D si->got_start_avma=20
+ && 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 !=3D 0
- && sym_addr >=3D si->plt_start_vma
- && sym_addr < si->plt_start_vma + si->plt_size) {
+ if (si->plt_start_avma !=3D 0
+ && sym_addr >=3D si->plt_start_avma
+ && sym_addr < si->plt_start_avma + si->plt_size) {
TRACE_SYMTAB(" ignore -- in PLT: %s\n", sym_name);
return False;
}
@@ -285,9 +285,9 @@
*/
is_in_opd =3D False;
=20
- if (si->opd_start_vma !=3D 0
- && sym_addr >=3D si->opd_start_vma
- && sym_addr < si->opd_start_vma + si->opd_size) {
+ if (si->opd_start_avma !=3D 0
+ && sym_addr >=3D 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;
@@ -307,7 +307,7 @@
the vma of the opd section start, so we can figure out how
far into the opd section this is. */
=20
- offset_in_opd =3D (Addr)sym_addr - (Addr)(si->opd_start_vma);
+ offset_in_opd =3D (Addr)sym_addr - (Addr)(si->opd_start_avma);
if (offset_in_opd < 0 || offset_in_opd >=3D si->opd_size) {
TRACE_SYMTAB(" ignore -- invalid OPD offset: %s\n", sym_name=
);
return False;
@@ -346,7 +346,7 @@
/* 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 !=3D 0
+ if (si->opd_start_avma !=3D 0
&& !is_in_opd
&& sym_name[0] =3D=3D '.') {
vg_assert(!(*from_opd_out));
@@ -356,11 +356,11 @@
=20
/* If no part of the symbol falls within the mapped range,
ignore it. */
- if (*sym_addr_out + *sym_size_out <=3D si->start
- || *sym_addr_out >=3D si->start+si->size) {
+ if (*sym_addr_out + *sym_size_out <=3D si->text_start_avma
+ || *sym_addr_out >=3D si->text_start_avma + si->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->size)=
;
return False;
}
=20
@@ -369,9 +369,9 @@
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 !=3D 0) {
- vg_assert(*sym_addr_out + *sym_size_out <=3D si->opd_start_vma
- || *sym_addr_out >=3D si->opd_start_vma + si->opd_size);
+ if (si->opd_start_avma !=3D 0) {
+ vg_assert(*sym_addr_out + *sym_size_out <=3D si->opd_start_avma
+ || *sym_addr_out >=3D si->opd_start_avma + si->opd_size)=
;
}
# endif
=20
@@ -826,7 +826,7 @@
oimage =3D (Addr)NULL;
if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir))
VG_(message)(Vg_DebugMsg, "Reading syms from %s (%p)",=20
- si->filename, si->start );
+ si->filename, si->text_start_avma );
=20
/* mmap the object image aboard, so that we can read symbols and
line number info out of it. It will be munmapped immediately
@@ -858,6 +858,11 @@
=20
oimage =3D sres.res;
=20
+ if (0) {
+ VG_(printf)("read_elf_debug_info: OIMAGE =3D %p - %p\n",=20
+ (void*)oimage, (void*)(oimage + (UWord)n_oimage));
+ }
+
/* Ok, the object image is safely in oimage[0 .. n_oimage-1].=20
Now verify that it is a valid ELF .so or executable image.
*/
@@ -927,7 +932,7 @@
=20
if (!offset_set) {
offset_set =3D True;
- offset_oimage =3D si->start - o_phdr->p_vaddr;
+ offset_oimage =3D si->text_start_avma - o_phdr->p_vaddr;
baseaddr =3D o_phdr->p_vaddr;
}
=20
@@ -941,11 +946,11 @@
// Get the data and bss start/size if appropriate
mapped =3D o_phdr->p_vaddr + offset_oimage;
mapped_end =3D mapped + o_phdr->p_memsz;
- if (si->data_start_vma =3D=3D 0 &&
+ if (si->data_start_avma =3D=3D 0 &&
(o_phdr->p_flags & (PF_R|PF_W|PF_X)) =3D=3D (PF_R|PF_W)) {
- si->data_start_vma =3D mapped;
- si->data_size =3D o_phdr->p_filesz;
- si->bss_start_vma =3D mapped + o_phdr->p_filesz;
+ si->data_start_avma =3D mapped;
+ si->data_size =3D o_phdr->p_filesz;
+ si->bss_start_avma =3D mapped + o_phdr->p_filesz;
if (o_phdr->p_memsz > o_phdr->p_filesz)
si->bss_size =3D o_phdr->p_memsz - o_phdr->p_filesz;
else
@@ -955,15 +960,18 @@
mapped =3D mapped & ~(VKI_PAGE_SIZE-1);
mapped_end =3D (mapped_end + VKI_PAGE_SIZE - 1) & ~(VKI_PAGE_SIZE-1);
=20
- if (VG_(needs).data_syms &&
- (mapped >=3D si->start && mapped <=3D (si->start+si->size)) &&
- (mapped_end > (si->start+si->size))) {
- UInt newsz =3D mapped_end - si->start;
+ if (VG_(needs).data_syms=20
+ && mapped >=3D si->text_start_avma=20
+ && mapped <=3D (si->text_start_avma + si->size)
+ && mapped_end > (si->text_start_avma + si->size)) {
+ UInt newsz =3D mapped_end - si->text_start_avma;
if (newsz > si->size) {
if (0)
VG_(printf)("extending mapping %p..%p %d -> ..%p %d\n",=20
- si->start, si->start+si->size, si->size,
- si->start+newsz, newsz);
+ si->text_start_avma,=20
+ si->text_start_avma + si->size,=20
+ si->size,
+ si->text_start_avma + newsz, newsz);
=20
si->size =3D newsz;
}
@@ -995,7 +1003,7 @@
information */
{
/* Pointers to start of sections (in the oimage, not in the
- running image) */
+ running image) -- image addresses */
UChar* o_strtab =3D NULL; /* .strtab */
ElfXX_Sym* o_symtab =3D NULL; /* .symtab */
UChar* o_dynstr =3D NULL; /* .dynstr */
@@ -1034,9 +1042,9 @@
UInt dwarf1l_sz =3D 0;
UInt ehframe_sz =3D 0;
=20
- /* Section virtual addresses */
- Addr dummy_vma =3D 0;
- Addr ehframe_vma =3D 0;
+ /* Section actual virtual addresses */
+ Addr dummy_avma =3D 0;
+ Addr ehframe_avma =3D 0;
=20
/* Find all interesting sections */
=20
@@ -1074,29 +1082,29 @@
=20
/* 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=
)
=20
- FIND(".gnu_debuglink", debuglink_sz, debuglink, dummy_vma=
)
+ FIND(".gnu_debuglink", debuglink_sz, debuglink, dummy_avma=
)
=20
- 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=
)
=20
- 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=
)
=20
- FIND(".debug", dwarf1d_sz, dwarf1d, dummy_vma=
)
- FIND(".line", dwarf1l_sz, dwarf1l, dummy_vma=
)
- FIND(".eh_frame", ehframe_sz, ehframe, ehframe_v=
ma)
+ FIND(".debug", dwarf1d_sz, dwarf1d, dummy_avma=
)
+ FIND(".line", dwarf1l_sz, dwarf1l, dummy_avma=
)
+ FIND(".eh_frame", ehframe_sz, ehframe, ehframe_av=
ma)
=20
- FIND(".got", si->got_size, dummy_filea, si->got_s=
tart_vma)
- FIND(".plt", si->plt_size, dummy_filea, si->plt_s=
tart_vma)
- FIND(".opd", si->opd_size, opd_filea, si->opd_s=
tart_vma)
+ FIND(".got", si->got_size, dummy_filea, si->got_st=
art_avma)
+ FIND(".plt", si->plt_size, dummy_filea, si->plt_st=
art_avma)
+ FIND(".opd", si->opd_size, opd_filea, si->opd_st=
art_avma)
=20
# undef FIND
}
@@ -1125,7 +1133,7 @@
for (i =3D 0; i < ehdr->e_phnum; i++) {
ElfXX_Phdr *o_phdr =3D &((ElfXX_Phdr *)(dimage + ehdr-=
>e_phoff))[i];
if (o_phdr->p_type =3D=3D PT_LOAD) {
- offset_dimage =3D si->start - o_phdr->p_vaddr;
+ offset_dimage =3D si->text_start_avma - o_phdr->p_v=
addr;
break;
}
}
@@ -1138,7 +1146,7 @@
sh_strtab =3D (UChar*)(dimage + shdr[ehdr->e_shstrndx].sh=
_offset);
=20
/* Same deal as previous FIND, except simpler - doesn't
- look for vma, only oimage address. */
+ look for avma, only oimage address. */
=20
/* Find all interesting sections */
for (i =3D 0; i < ehdr->e_shnum; i++) {
@@ -1162,6 +1170,7 @@
} \
}
=20
+ /* ?? NAME SIZE ADDR_I=
N_OIMAGE */
FIND(need_symtab, ".symtab", o_symtab_sz, o_sy=
mtab)
FIND(need_symtab, ".strtab", o_strtab_sz, o_st=
rtab)
FIND(1, ".stab", stab_sz, stab=
)
@@ -1203,7 +1212,8 @@
=20
/* Read .eh_frame (call-frame-info) if any */
if (ehframe) {
- ML_(read_callframe_info_dwarf2) ( si, ehframe, ehframe_sz, ehfr=
ame_vma );
+ ML_(read_callframe_info_dwarf2)
+ ( si, ehframe/*image*/, ehframe_sz, ehframe_avma );
}
=20
/* Read the stabs and/or dwarf2 debug information, if any. It
Modified: trunk/coregrind/m_debuginfo/storage.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/storage.c 2007-01-10 19:30:19 UTC (rev 65=
05)
+++ trunk/coregrind/m_debuginfo/storage.c 2007-01-11 19:42:11 UTC (rev 65=
06)
@@ -253,13 +253,16 @@
size =3D 1;
}
=20
- /* vg_assert(this < si->start + si->size && next-1 >=3D si->start); *=
/
- if (this >=3D si->start + si->size || next-1 < si->start) {
+ /* vg_assert(this < si->text_start_avma + si->size=20
+ && next-1 >=3D si->text_start_avma); */
+ if (this >=3D si->text_start_avma + si->size=20
+ || next-1 < si->text_start_avma) {
if (0)
VG_(message)(Vg_DebugMsg,=20
"warning: ignoring line info entry falling "
"outside current SegInfo: %p %p %p %p",
- si->start, si->start + si->size,=20
+ si->text_start_avma,=20
+ si->text_start_avma + si->size,=20
this, next-1);
return;
}
@@ -319,8 +322,8 @@
/* 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->size - 1 < cfsi->base ) {
static Int complaints =3D 3;
if (VG_(clo_trace_cfi) || complaints > 0) {
complaints--;
@@ -330,8 +333,8 @@
"warning: DiCfSI %p .. %p outside segment %p .. %p",
cfsi->base,=20
cfsi->base + cfsi->len - 1,
- si->start,
- si->start + si->size - 1=20
+ si->text_start_avma,
+ si->text_start_avma + si->size - 1=20
);
}
if (VG_(clo_trace_cfi))=20
|