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 name; //< The offset in the strtable.
uint32_t offset; //< The offset in the rap section. uint32_t offset; //< The offset in the rap section.
uint32_t id; //< The rap id. uint32_t id; //< The rap id.
uint32_t size; //< The size of the section.
/* Constructor */ /* 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, section_detail::section_detail (uint32_t name,
uint32_t offset, uint32_t offset,
uint32_t id) uint32_t id,
uint32_t size)
: name (name), : name (name),
offset (offset), offset (offset),
id (id) id (id),
size (size)
{ {
} }
@ -1486,7 +1489,10 @@ namespace rld
strtable += '\0'; strtable += '\0';
/* sec.offset + osec.offset is the offset in the rap section */ /* 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 (); pos = strtable.length ();
@ -1523,6 +1529,7 @@ namespace rld
std::cout << "Out max rap section id 15\n" << std::endl; 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.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 name; //< The offset in the strtable.
uint32_t offset; //< The offset in the rap section. uint32_t offset; //< The offset in the rap section.
uint32_t id; //< The rap id. uint32_t id; //< The rap id.
uint32_t size; //< The size of the elf section.
uint32_t obj; //< The obj id. uint32_t obj; //< The obj id.
/* Constructor */ /* Constructor */
@ -139,6 +140,7 @@ namespace rap
: name (s.name), : name (s.name),
offset (s.offset), offset (s.offset),
id (s.id), id (s.id),
size (s.size),
obj (s.obj) obj (s.obj)
{ {
} }
@ -147,6 +149,7 @@ namespace rap
: name (0), : name (0),
offset (0), offset (0),
id (0), id (0),
size (0),
obj (0) obj (0)
{ {
} }
@ -519,6 +522,7 @@ namespace rap
comp >> tmp; comp >> tmp;
sec.offset = tmp & 0xfffffff; sec.offset = tmp & 0xfffffff;
sec.id = tmp >> 28; sec.id = tmp >> 28;
comp >> sec.size;
sec_details.push_back (section_detail (sec)); 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] << std::setw (16) << (char*)&r.str_detail[tmp.name]
<< " rap_section:"<< std::setw (8) << " rap_section:"<< std::setw (8)
<< rap::section_names[tmp.id] << rap::section_names[tmp.id]
<< std::hex << " offset:0x" << tmp.offset << std::dec << std::hex << std::setfill ('0')
<< std::endl; << " offset:0x" << std::setw (8) << tmp.offset
<< " size:0x" << std::setw (8) << tmp.size << std::dec
<< std::setfill (' ') << std::endl;
} }
} }