mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
binfmt/: Change debug macro from berr() to binfo() when dumping module data. The report of problems is important during development but when it enables complete informative output about load binaries then the important information can be easily overlooked. The huge output sent to serial terminal slows loading significantly as well.
This commit is contained in:
+11
-11
@@ -70,21 +70,21 @@ int dump_module(FAR const struct binary_s *bin)
|
|||||||
{
|
{
|
||||||
if (bin)
|
if (bin)
|
||||||
{
|
{
|
||||||
berr("Module:\n");
|
binfo("Module:\n");
|
||||||
berr(" filename: %s\n", bin->filename);
|
binfo(" filename: %s\n", bin->filename);
|
||||||
berr(" argv: %p\n", bin->argv);
|
binfo(" argv: %p\n", bin->argv);
|
||||||
berr(" entrypt: %p\n", bin->entrypt);
|
binfo(" entrypt: %p\n", bin->entrypt);
|
||||||
berr(" mapped: %p size=%d\n", bin->mapped, bin->mapsize);
|
binfo(" mapped: %p size=%d\n", bin->mapped, bin->mapsize);
|
||||||
berr(" alloc: %p %p %p\n", bin->alloc[0], bin->alloc[1], bin->alloc[2]);
|
binfo(" alloc: %p %p %p\n", bin->alloc[0], bin->alloc[1], bin->alloc[2]);
|
||||||
#ifdef CONFIG_BINFMT_CONSTRUCTORS
|
#ifdef CONFIG_BINFMT_CONSTRUCTORS
|
||||||
berr(" ctors: %p nctors=%d\n", bin->ctors, bin->nctors);
|
binfo(" ctors: %p nctors=%d\n", bin->ctors, bin->nctors);
|
||||||
berr(" dtors: %p ndtors=%d\n", bin->dtors, bin->ndtors);
|
binfo(" dtors: %p ndtors=%d\n", bin->dtors, bin->ndtors);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
berr(" addrenv: %p\n", bin->addrenv);
|
binfo(" addrenv: %p\n", bin->addrenv);
|
||||||
#endif
|
#endif
|
||||||
berr(" stacksize: %d\n", bin->stacksize);
|
binfo(" stacksize: %d\n", bin->stacksize);
|
||||||
berr(" unload: %p\n", bin->unload);
|
binfo(" unload: %p\n", bin->unload);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
+41
-41
@@ -112,58 +112,58 @@ static void elf_dumploadinfo(FAR struct elf_loadinfo_s *loadinfo)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
berr("LOAD_INFO:\n");
|
binfo("LOAD_INFO:\n");
|
||||||
berr(" textalloc: %08lx\n", (long)loadinfo->textalloc);
|
binfo(" textalloc: %08lx\n", (long)loadinfo->textalloc);
|
||||||
berr(" dataalloc: %08lx\n", (long)loadinfo->dataalloc);
|
binfo(" dataalloc: %08lx\n", (long)loadinfo->dataalloc);
|
||||||
berr(" textsize: %ld\n", (long)loadinfo->textsize);
|
binfo(" textsize: %ld\n", (long)loadinfo->textsize);
|
||||||
berr(" datasize: %ld\n", (long)loadinfo->datasize);
|
binfo(" datasize: %ld\n", (long)loadinfo->datasize);
|
||||||
berr(" filelen: %ld\n", (long)loadinfo->filelen);
|
binfo(" filelen: %ld\n", (long)loadinfo->filelen);
|
||||||
#ifdef CONFIG_BINFMT_CONSTRUCTORS
|
#ifdef CONFIG_BINFMT_CONSTRUCTORS
|
||||||
berr(" ctoralloc: %08lx\n", (long)loadinfo->ctoralloc);
|
binfo(" ctoralloc: %08lx\n", (long)loadinfo->ctoralloc);
|
||||||
berr(" ctors: %08lx\n", (long)loadinfo->ctors);
|
binfo(" ctors: %08lx\n", (long)loadinfo->ctors);
|
||||||
berr(" nctors: %d\n", loadinfo->nctors);
|
binfo(" nctors: %d\n", loadinfo->nctors);
|
||||||
berr(" dtoralloc: %08lx\n", (long)loadinfo->dtoralloc);
|
binfo(" dtoralloc: %08lx\n", (long)loadinfo->dtoralloc);
|
||||||
berr(" dtors: %08lx\n", (long)loadinfo->dtors);
|
binfo(" dtors: %08lx\n", (long)loadinfo->dtors);
|
||||||
berr(" ndtors: %d\n", loadinfo->ndtors);
|
binfo(" ndtors: %d\n", loadinfo->ndtors);
|
||||||
#endif
|
#endif
|
||||||
berr(" filfd: %d\n", loadinfo->filfd);
|
binfo(" filfd: %d\n", loadinfo->filfd);
|
||||||
berr(" symtabidx: %d\n", loadinfo->symtabidx);
|
binfo(" symtabidx: %d\n", loadinfo->symtabidx);
|
||||||
berr(" strtabidx: %d\n", loadinfo->strtabidx);
|
binfo(" strtabidx: %d\n", loadinfo->strtabidx);
|
||||||
|
|
||||||
berr("ELF Header:\n");
|
binfo("ELF Header:\n");
|
||||||
berr(" e_ident: %02x %02x %02x %02x\n",
|
binfo(" e_ident: %02x %02x %02x %02x\n",
|
||||||
loadinfo->ehdr.e_ident[0], loadinfo->ehdr.e_ident[1],
|
loadinfo->ehdr.e_ident[0], loadinfo->ehdr.e_ident[1],
|
||||||
loadinfo->ehdr.e_ident[2], loadinfo->ehdr.e_ident[3]);
|
loadinfo->ehdr.e_ident[2], loadinfo->ehdr.e_ident[3]);
|
||||||
berr(" e_type: %04x\n", loadinfo->ehdr.e_type);
|
binfo(" e_type: %04x\n", loadinfo->ehdr.e_type);
|
||||||
berr(" e_machine: %04x\n", loadinfo->ehdr.e_machine);
|
binfo(" e_machine: %04x\n", loadinfo->ehdr.e_machine);
|
||||||
berr(" e_version: %08x\n", loadinfo->ehdr.e_version);
|
binfo(" e_version: %08x\n", loadinfo->ehdr.e_version);
|
||||||
berr(" e_entry: %08lx\n", (long)loadinfo->ehdr.e_entry);
|
binfo(" e_entry: %08lx\n", (long)loadinfo->ehdr.e_entry);
|
||||||
berr(" e_phoff: %d\n", loadinfo->ehdr.e_phoff);
|
binfo(" e_phoff: %d\n", loadinfo->ehdr.e_phoff);
|
||||||
berr(" e_shoff: %d\n", loadinfo->ehdr.e_shoff);
|
binfo(" e_shoff: %d\n", loadinfo->ehdr.e_shoff);
|
||||||
berr(" e_flags: %08x\n" , loadinfo->ehdr.e_flags);
|
binfo(" e_flags: %08x\n" , loadinfo->ehdr.e_flags);
|
||||||
berr(" e_ehsize: %d\n", loadinfo->ehdr.e_ehsize);
|
binfo(" e_ehsize: %d\n", loadinfo->ehdr.e_ehsize);
|
||||||
berr(" e_phentsize: %d\n", loadinfo->ehdr.e_phentsize);
|
binfo(" e_phentsize: %d\n", loadinfo->ehdr.e_phentsize);
|
||||||
berr(" e_phnum: %d\n", loadinfo->ehdr.e_phnum);
|
binfo(" e_phnum: %d\n", loadinfo->ehdr.e_phnum);
|
||||||
berr(" e_shentsize: %d\n", loadinfo->ehdr.e_shentsize);
|
binfo(" e_shentsize: %d\n", loadinfo->ehdr.e_shentsize);
|
||||||
berr(" e_shnum: %d\n", loadinfo->ehdr.e_shnum);
|
binfo(" e_shnum: %d\n", loadinfo->ehdr.e_shnum);
|
||||||
berr(" e_shstrndx: %d\n", loadinfo->ehdr.e_shstrndx);
|
binfo(" e_shstrndx: %d\n", loadinfo->ehdr.e_shstrndx);
|
||||||
|
|
||||||
if (loadinfo->shdr && loadinfo->ehdr.e_shnum > 0)
|
if (loadinfo->shdr && loadinfo->ehdr.e_shnum > 0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < loadinfo->ehdr.e_shnum; i++)
|
for (i = 0; i < loadinfo->ehdr.e_shnum; i++)
|
||||||
{
|
{
|
||||||
FAR Elf32_Shdr *shdr = &loadinfo->shdr[i];
|
FAR Elf32_Shdr *shdr = &loadinfo->shdr[i];
|
||||||
berr("Sections %d:\n", i);
|
binfo("Sections %d:\n", i);
|
||||||
berr(" sh_name: %08x\n", shdr->sh_name);
|
binfo(" sh_name: %08x\n", shdr->sh_name);
|
||||||
berr(" sh_type: %08x\n", shdr->sh_type);
|
binfo(" sh_type: %08x\n", shdr->sh_type);
|
||||||
berr(" sh_flags: %08x\n", shdr->sh_flags);
|
binfo(" sh_flags: %08x\n", shdr->sh_flags);
|
||||||
berr(" sh_addr: %08x\n", shdr->sh_addr);
|
binfo(" sh_addr: %08x\n", shdr->sh_addr);
|
||||||
berr(" sh_offset: %d\n", shdr->sh_offset);
|
binfo(" sh_offset: %d\n", shdr->sh_offset);
|
||||||
berr(" sh_size: %d\n", shdr->sh_size);
|
binfo(" sh_size: %d\n", shdr->sh_size);
|
||||||
berr(" sh_link: %d\n", shdr->sh_link);
|
binfo(" sh_link: %d\n", shdr->sh_link);
|
||||||
berr(" sh_info: %d\n", shdr->sh_info);
|
binfo(" sh_info: %d\n", shdr->sh_info);
|
||||||
berr(" sh_addralign: %d\n", shdr->sh_addralign);
|
binfo(" sh_addralign: %d\n", shdr->sh_addralign);
|
||||||
berr(" sh_entsize: %d\n", shdr->sh_entsize);
|
binfo(" sh_entsize: %d\n", shdr->sh_entsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-19
@@ -111,31 +111,31 @@ static void nxflat_dumploadinfo(FAR struct nxflat_loadinfo_s *loadinfo)
|
|||||||
{
|
{
|
||||||
unsigned long dsize = loadinfo->datasize + loadinfo->bsssize;
|
unsigned long dsize = loadinfo->datasize + loadinfo->bsssize;
|
||||||
|
|
||||||
berr("LOAD_INFO:\n");
|
binfo("LOAD_INFO:\n");
|
||||||
berr(" ISPACE:\n");
|
binfo(" ISPACE:\n");
|
||||||
berr(" ispace: %08lx\n", loadinfo->ispace);
|
binfo(" ispace: %08lx\n", loadinfo->ispace);
|
||||||
berr(" entryoffs: %08lx\n", loadinfo->entryoffs);
|
binfo(" entryoffs: %08lx\n", loadinfo->entryoffs);
|
||||||
berr(" isize: %08lx\n", loadinfo->isize);
|
binfo(" isize: %08lx\n", loadinfo->isize);
|
||||||
|
|
||||||
berr(" DSPACE:\n");
|
binfo(" DSPACE:\n");
|
||||||
berr(" dspace: %08lx\n", loadinfo->dspace);
|
binfo(" dspace: %08lx\n", loadinfo->dspace);
|
||||||
if (loadinfo->dspace != NULL)
|
if (loadinfo->dspace != NULL)
|
||||||
{
|
{
|
||||||
berr(" crefs: %d\n", loadinfo->dspace->crefs);
|
binfo(" crefs: %d\n", loadinfo->dspace->crefs);
|
||||||
berr(" region: %08lx\n", loadinfo->dspace->region);
|
binfo(" region: %08lx\n", loadinfo->dspace->region);
|
||||||
}
|
}
|
||||||
berr(" datasize: %08lx\n", loadinfo->datasize);
|
binfo(" datasize: %08lx\n", loadinfo->datasize);
|
||||||
berr(" bsssize: %08lx\n", loadinfo->bsssize);
|
binfo(" bsssize: %08lx\n", loadinfo->bsssize);
|
||||||
berr(" (pad): %08lx\n", loadinfo->dsize - dsize);
|
binfo(" (pad): %08lx\n", loadinfo->dsize - dsize);
|
||||||
berr(" stacksize: %08lx\n", loadinfo->stacksize);
|
binfo(" stacksize: %08lx\n", loadinfo->stacksize);
|
||||||
berr(" dsize: %08lx\n", loadinfo->dsize);
|
binfo(" dsize: %08lx\n", loadinfo->dsize);
|
||||||
|
|
||||||
berr(" RELOCS:\n");
|
binfo(" RELOCS:\n");
|
||||||
berr(" relocstart: %08lx\n", loadinfo->relocstart);
|
binfo(" relocstart: %08lx\n", loadinfo->relocstart);
|
||||||
berr(" reloccount: %d\n", loadinfo->reloccount);
|
binfo(" reloccount: %d\n", loadinfo->reloccount);
|
||||||
|
|
||||||
berr(" HANDLES:\n");
|
binfo(" HANDLES:\n");
|
||||||
berr(" filfd: %d\n", loadinfo->filfd);
|
binfo(" filfd: %d\n", loadinfo->filfd);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define nxflat_dumploadinfo(i)
|
# define nxflat_dumploadinfo(i)
|
||||||
|
|||||||
Reference in New Issue
Block a user