This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

elf.c:3701: off += (m->sections[0]->vma - off) % bed->maxpagesize


From elf.c:

3701                off += (m->sections[0]->vma - off) % bed->maxpagesize;
(gdb) print off
$51 = 0x54
(gdb) print m->sections[0]->vma
$52 = 0x0
(gdb) print bed->maxpagesize
$53 = 0x10000

ok:

(gdb) ptype m->sections[0]->vma
type = long unsigned int
(gdb) ptype off
type = long int
(gdb) ptype bed->maxpagesize
type = long unsigned int
(gdb) print  off + (m->sections[0]->vma - off) % bed->maxpagesize
$50 = 0x10000

broken:

(gdb) ptype m->sections[0]->vma
type = long unsigned int
(gdb) ptype off
type = long long int
(gdb) ptype bed->maxpagesize
type = long unsigned int
(gdb) print  off + (m->sections[0]->vma - off) % bed->maxpagesize
$39 = 0x0

I can make it work with:

(gdb) print off + (m->sections[0]->vma - off) % (ufile_ptr) bed->maxpagesize
$40 = 0x10000


but is there a better way to write this expression? (that arithmetic strikes me as weird) and just how many others like this are lurking :-/ :-)?

enjoy,
Andrew



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]