From 13f70177511d825a71991d542925ce97c5e370d3 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Wed, 4 Nov 2015 16:09:57 -0800 Subject: util: signer: improve debug output readability Assorted modifications which make it easier to follow debug output, when enabled. BRANCH=none BUG=none TEST=ran signer in verbose mode, observe improved debug output. Change-Id: Ieb2e7012342480217388dd5001b61ea95adf71a4 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/311312 Reviewed-by: Nagendra Modadugu --- util/signer/codesigner.cc | 8 ++++++-- util/signer/image.cc | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/util/signer/codesigner.cc b/util/signer/codesigner.cc index 547c829c8f..35056570fc 100644 --- a/util/signer/codesigner.cc +++ b/util/signer/codesigner.cc @@ -486,8 +486,10 @@ int main(int argc, char* argv[]) { } // Print out fuse hash input. - VERBOSE("expected fuse state:\n"); + VERBOSE("expected fuse state:"); for (size_t i = 0; i < FUSE_MAX; ++i) { + if (! (i % 8)) + VERBOSE("\n"); VERBOSE("%08x ", fuse_values[i]); } VERBOSE("\n"); @@ -509,8 +511,10 @@ int main(int argc, char* argv[]) { // TODO: read values from JSON or implement version logic here. // Print out info hash input. - VERBOSE("expected info state:\n"); + VERBOSE("expected info state:"); for (size_t i = 0; i < INFO_MAX; ++i) { + if (! (i % 8)) + VERBOSE("\n"); VERBOSE("%08x ", info_values[i]); } VERBOSE("\n"); diff --git a/util/signer/image.cc b/util/signer/image.cc index ac84957492..d5e67db297 100644 --- a/util/signer/image.cc +++ b/util/signer/image.cc @@ -107,25 +107,30 @@ bool Image::fromElf(const string& filename) { gelf_getshdr(scn, &shdr); VERBOSE("type %08x; flags %08lx ", shdr.sh_type, shdr.sh_flags); - VERBOSE("%08lx(@%08lx)[%08lx] align %lu\n", + VERBOSE("%08lx(@%08lx)[%08lx] align %lu ", shdr.sh_addr, shdr.sh_offset, shdr.sh_size, shdr.sh_addralign); // Ignore sections that are not alloc if (!(shdr.sh_flags & SHF_ALLOC)) { + VERBOSE("non aloc, ignored\n"); continue; } // Ignore sections that are not exec if (!(shdr.sh_flags & SHF_EXECINSTR)) { + VERBOSE("non exec, ignored\n"); continue; } // Ignore sections outside our flash range if (shdr.sh_addr < FLASH_START * 16 || shdr.sh_addr + shdr.sh_size >= FLASH_END * 16) { + VERBOSE("out of bounds, ignored\n"); continue; } + VERBOSE("\n"); + // Track rx boundaries if (shdr.sh_addr < rx_base_) { rx_base_ = shdr.sh_addr; @@ -141,13 +146,14 @@ bool Image::fromElf(const string& filename) { phdr.p_vaddr, phdr.p_paddr, phdr.p_filesz, phdr.p_memsz); if (phdr.p_filesz != phdr.p_memsz) { - VERBOSE(" (not loading)\n"); + VERBOSE(" (size mismatch, not loading)\n"); continue; } // Ignore sections outside our flash range if (phdr.p_paddr < FLASH_START * 16 || phdr.p_paddr + phdr.p_memsz >= FLASH_END * 16) { + VERBOSE(" (out of bounds, not loading)\n"); continue; } -- cgit v1.2.1