From 370435add497e97985d184b282a0b60413c3f9ca Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 1 Aug 2013 16:15:07 +0800 Subject: Add section size for rap details Add elf section size to the section details, because gdb will use the size of a section. --- rld-rap.cpp | 15 +++++++++++---- rtems-rapper.cpp | 10 ++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/rld-rap.cpp b/rld-rap.cpp index e1365b3..99bc4a3 100644 --- a/rld-rap.cpp +++ b/rld-rap.cpp @@ -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); } } diff --git a/rtems-rapper.cpp b/rtems-rapper.cpp index fbee1d1..91435bb 100644 --- a/rtems-rapper.cpp +++ b/rtems-rapper.cpp @@ -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; } } -- cgit v1.2.3