Add section size for rap details

Add elf section size to the section details, because gdb will use the size of
a section.
This commit is contained in:
Peng Fan 2013-08-01 16:15:07 +08:00
parent 39f48c9047
commit 347c9b585e
2 changed files with 19 additions and 6 deletions

View File

@ -161,9 +161,10 @@ namespace rld
uint32_t name; //< The offset in the strtable.
uint32_t offset; //< The offset in the rap section.
uint32_t id; //< The rap id.
uint32_t size; //< The size of the section.
/* Constructor */
section_detail (uint32_t name, uint32_t offset, uint32_t id);
section_detail (uint32_t name, uint32_t offset, uint32_t id, uint32_t size);
};
/*
@ -481,10 +482,12 @@ namespace rld
section_detail::section_detail (uint32_t name,
uint32_t offset,
uint32_t id)
uint32_t id,
uint32_t size)
: name (name),
offset (offset),
id (id)
id (id),
size (size)
{
}
@ -1486,7 +1489,10 @@ namespace rld
strtable += '\0';
/* sec.offset + osec.offset is the offset in the rap section */
s_details.push_back (section_detail (pos, sec.offset + osec.offset, s));
s_details.push_back (section_detail (pos,
sec.offset + osec.offset,
s,
osec.size));
pos = strtable.length ();
@ -1523,6 +1529,7 @@ namespace rld
std::cout << "Out max rap section id 15\n" << std::endl;
comp << (uint32_t)((sec_detail.id << 28) | sec_detail.offset);
comp << (uint32_t)(sec_detail.size);
}
}

View File

@ -128,6 +128,7 @@ namespace rap
uint32_t name; //< The offset in the strtable.
uint32_t offset; //< The offset in the rap section.
uint32_t id; //< The rap id.
uint32_t size; //< The size of the elf section.
uint32_t obj; //< The obj id.
/* Constructor */
@ -139,6 +140,7 @@ namespace rap
: name (s.name),
offset (s.offset),
id (s.id),
size (s.size),
obj (s.obj)
{
}
@ -147,6 +149,7 @@ namespace rap
: name (0),
offset (0),
id (0),
size (0),
obj (0)
{
}
@ -519,6 +522,7 @@ namespace rap
comp >> tmp;
sec.offset = tmp & 0xfffffff;
sec.id = tmp >> 28;
comp >> sec.size;
sec_details.push_back (section_detail (sec));
}
@ -827,8 +831,10 @@ rap_show (rld::files::paths& raps,
<< std::setw (16) << (char*)&r.str_detail[tmp.name]
<< " rap_section:"<< std::setw (8)
<< rap::section_names[tmp.id]
<< std::hex << " offset:0x" << tmp.offset << std::dec
<< std::endl;
<< std::hex << std::setfill ('0')
<< " offset:0x" << std::setw (8) << tmp.offset
<< " size:0x" << std::setw (8) << tmp.size << std::dec
<< std::setfill (' ') << std::endl;
}
}