diff options
-rw-r--r-- | doc/gcov.txt | 8 | ||||
-rw-r--r-- | extract-gcov.c | 11 |
2 files changed, 11 insertions, 8 deletions
diff --git a/doc/gcov.txt b/doc/gcov.txt index c5944d04..956c5c88 100644 --- a/doc/gcov.txt +++ b/doc/gcov.txt @@ -40,13 +40,13 @@ FSP: linux (e.g. petitboot environment): dd if=/proc/kcore skip=1572864 count=6656 of=skiboot.dump -You basically need to dump out the 2MB of skiboot. +You basically need to dump out the first 3MB of skiboot memory. -You will need to find the following message in the skiboot log: -[2822590,5] GCOV: gcov_info_list at 0x3010a350 +Then you need to find out where the gcov data structures are: +perl -e "printf '0x%x', 0x30000000 + 0x`grep gcov_info_list skiboot.map|cut -f 1 -d ' '`" That address needs to be supplied to the extract-gcov utility: -./extract-gcov skiboot.dump 0x3010a350 +./extract-gcov skiboot.dump 0x3023ec40 Once you've run extract-gcov, it will have extracted the gcda files from the skiboot memory image. diff --git a/extract-gcov.c b/extract-gcov.c index dfbc961d..f1781668 100644 --- a/extract-gcov.c +++ b/extract-gcov.c @@ -127,7 +127,7 @@ static void write_gcda(char *addr, struct gcov_info* gi) write_u32(fd, be32toh(gi->version)); write_u32(fd, be32toh(gi->stamp)); - printf("nfunctions: %d \n", be32toh(gi->n_functions)); + //printf("nfunctions: %d \n", be32toh(gi->n_functions)); for(fn = 0; fn < be32toh(gi->n_functions); fn++) { functions = (struct gcov_fn_info**) @@ -151,13 +151,14 @@ static void write_gcda(char *addr, struct gcov_info* gi) write_u32(fd, (GCOV_TAG_FOR_COUNTER(ctr))); write_u32(fd, be32toh(ctr_info->num)*2); - printf(" ctr %d gcov_ctr_info->num %u\n", - ctr, be32toh(ctr_info->num)); + /* printf(" ctr %d gcov_ctr_info->num %u\n", + * ctr, be32toh(ctr_info->num)); + */ for(cv = 0; cv < be32toh(ctr_info->num); cv++) { gcov_type *ctrv = (gcov_type *) SKIBOOT_ADDR(addr, ctr_info->values); - printf("%lx\n", be64toh(ctrv[cv])); + //printf("%lx\n", be64toh(ctrv[cv])); write_u64(fd, be64toh(ctrv[cv])); } ctr_info++; @@ -203,6 +204,8 @@ int main(int argc, char *argv[]) (void*)SKIBOOT_OFFSET, (void*)SKIBOOT_OFFSET+sb.st_size); gcov_list_addr = strtoll(argv[2], NULL, 0); + gcov_list_addr = (u64)(addr + (gcov_list_addr - SKIBOOT_OFFSET)); + gcov_list_addr = be64toh(*(u64*)gcov_list_addr); printf("Skiboot gcov_info_list at %p\n", (void*)gcov_list_addr); |