Skip to content

Commit

Permalink
rv_histogram: Make it more verbose
Browse files Browse the repository at this point in the history
section headers must be present for static analysis

Closed #272
  • Loading branch information
ChinYikMing committed Nov 23, 2023
1 parent dd7ce2e commit 394f584
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/rv_histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,16 @@ int main(int argc, const char *args[])

elf_t *e = elf_new();
if (!elf_open(e, elf_prog)) {
fprintf(stderr, "elf_open failed\n");
fprintf(stderr, "elf_open %s failed\n", elf_prog);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 17.7 rule Note

MISRA 17.7 rule
return 1;
}

struct Elf32_Ehdr *hdr = get_elf_header(e);
if(!hdr->e_shnum){
fprintf(stderr, "no section headers are found in %s\n", elf_prog);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 17.7 rule Note

MISRA 17.7 rule
return 1;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.5 rule Note

MISRA 15.5 rule
}

uint8_t *elf_first_byte = get_elf_first_byte(e);
const struct Elf32_Shdr **shdrs =
(const struct Elf32_Shdr **) &elf_first_byte[hdr->e_shoff];
Expand Down

0 comments on commit 394f584

Please sign in to comment.