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

Andrew Cagney cagney@gnu.org
Wed Jan 21 02:30:00 GMT 2004


 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




More information about the Binutils mailing list