sched/: Change some *err() message to *info() messages if what was a *dbg() message does not indicate and error condition.

This commit is contained in:
Gregory Nutt
2016-06-11 16:42:42 -06:00
parent a1469a3e95
commit 13cac3b592
47 changed files with 193 additions and 189 deletions
+8 -8
View File
@@ -73,7 +73,7 @@ static inline int mod_readrel(FAR struct mod_loadinfo_s *loadinfo,
if (index < 0 || index > (relsec->sh_size / sizeof(Elf32_Rel)))
{
serr("Bad relocation symbol index: %d\n", index);
serr("ERROR: Bad relocation symbol index: %d\n", index);
return -EINVAL;
}
@@ -125,7 +125,7 @@ static int mod_relocate(FAR struct mod_loadinfo_s *loadinfo, int relidx)
ret = mod_readrel(loadinfo, relsec, i, &rel);
if (ret < 0)
{
serr("Section %d reloc %d: Failed to read relocation entry: %d\n",
serr("ERROR: Section %d reloc %d: Failed to read relocation entry: %d\n",
relidx, i, ret);
return ret;
}
@@ -141,7 +141,7 @@ static int mod_relocate(FAR struct mod_loadinfo_s *loadinfo, int relidx)
ret = mod_readsym(loadinfo, symidx, &sym);
if (ret < 0)
{
serr("Section %d reloc %d: Failed to read symbol[%d]: %d\n",
serr("ERROR: Section %d reloc %d: Failed to read symbol[%d]: %d\n",
relidx, i, symidx, ret);
return ret;
}
@@ -163,13 +163,13 @@ static int mod_relocate(FAR struct mod_loadinfo_s *loadinfo, int relidx)
if (ret == -ESRCH)
{
serr("Section %d reloc %d: Undefined symbol[%d] has no name: %d\n",
serr("ERROR: Section %d reloc %d: Undefined symbol[%d] has no name: %d\n",
relidx, i, symidx, ret);
psym = NULL;
}
else
{
serr("Section %d reloc %d: Failed to get value of symbol[%d]: %d\n",
serr("ERROR: Section %d reloc %d: Failed to get value of symbol[%d]: %d\n",
relidx, i, symidx, ret);
return ret;
}
@@ -179,7 +179,7 @@ static int mod_relocate(FAR struct mod_loadinfo_s *loadinfo, int relidx)
if (rel.r_offset < 0 || rel.r_offset > dstsec->sh_size - sizeof(uint32_t))
{
serr("Section %d reloc %d: Relocation address out of range, offset %d size %d\n",
serr("ERROR: Section %d reloc %d: Relocation address out of range, offset %d size %d\n",
relidx, i, rel.r_offset, dstsec->sh_size);
return -EINVAL;
}
@@ -201,7 +201,7 @@ static int mod_relocate(FAR struct mod_loadinfo_s *loadinfo, int relidx)
static int mod_relocateadd(FAR struct mod_loadinfo_s *loadinfo, int relidx)
{
serr("Not implemented\n");
serr("ERROR: Not implemented\n");
return -ENOSYS;
}
@@ -242,7 +242,7 @@ int mod_bind(FAR struct mod_loadinfo_s *loadinfo)
ret = mod_allocbuffer(loadinfo);
if (ret < 0)
{
serr("mod_allocbuffer failed: %d\n", ret);
serr("ERROR: mod_allocbuffer failed: %d\n", ret);
return -ENOMEM;
}
+6 -6
View File
@@ -102,7 +102,7 @@ static inline int mod_filelen(FAR struct mod_loadinfo_s *loadinfo,
if (ret < 0)
{
int errval = errno;
serr("Failed to stat file: %d\n", errval);
serr("ERROR: Failed to stat file: %d\n", errval);
return -errval;
}
@@ -110,7 +110,7 @@ static inline int mod_filelen(FAR struct mod_loadinfo_s *loadinfo,
if (!S_ISREG(buf.st_mode))
{
serr("Not a regular file. mode: %d\n", buf.st_mode);
serr("ERROR: Not a regular file. mode: %d\n", buf.st_mode);
return -ENOENT;
}
@@ -157,7 +157,7 @@ int mod_initialize(FAR const char *filename,
ret = mod_filelen(loadinfo, filename);
if (ret < 0)
{
serr("mod_filelen failed: %d\n", ret);
serr("ERROR: mod_filelen failed: %d\n", ret);
return ret;
}
@@ -167,7 +167,7 @@ int mod_initialize(FAR const char *filename,
if (loadinfo->filfd < 0)
{
int errval = errno;
serr("Failed to open ELF binary %s: %d\n", filename, errval);
serr("ERROR: Failed to open ELF binary %s: %d\n", filename, errval);
return -errval;
}
@@ -177,7 +177,7 @@ int mod_initialize(FAR const char *filename,
sizeof(Elf32_Ehdr), 0);
if (ret < 0)
{
serr("Failed to read ELF header: %d\n", ret);
serr("ERROR: Failed to read ELF header: %d\n", ret);
return ret;
}
@@ -196,7 +196,7 @@ int mod_initialize(FAR const char *filename,
* is not correctly formed.
*/
serr("Bad ELF header: %d\n", ret);
serr("ERROR: Bad ELF header: %d\n", ret);
return ret;
}
+43 -43
View File
@@ -58,8 +58,8 @@
* Pre-processor Definitions
****************************************************************************/
/* CONFIG_DEBUG_FEATURES, CONFIG_DEBUG_INFO, and CONFIG_DEBUG_BINFMT have to be
* defined or CONFIG_MODULE_DUMPBUFFER does nothing.
/* CONFIG_DEBUG_INFO, and CONFIG_DEBUG_BINFMT have to be defined or
* CONFIG_MODULE_DUMPBUFFER does nothing.
*/
#if !defined(CONFIG_DEBUG_INFO) || !defined (CONFIG_DEBUG_BINFMT)
@@ -84,55 +84,55 @@
* Name: mod_dumploadinfo
****************************************************************************/
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_BINFMT)
#if defined(CONFIG_DEBUG_INFO) && defined(CONFIG_DEBUG_BINFMT)
static void mod_dumploadinfo(FAR struct mod_loadinfo_s *loadinfo)
{
int i;
serr("LOAD_INFO:\n");
serr(" textalloc: %08lx\n", (long)loadinfo->textalloc);
serr(" datastart: %08lx\n", (long)loadinfo->datastart);
serr(" textsize: %ld\n", (long)loadinfo->textsize);
serr(" datasize: %ld\n", (long)loadinfo->datasize);
serr(" filelen: %ld\n", (long)loadinfo->filelen);
serr(" filfd: %d\n", loadinfo->filfd);
serr(" symtabidx: %d\n", loadinfo->symtabidx);
serr(" strtabidx: %d\n", loadinfo->strtabidx);
sinfo("LOAD_INFO:\n");
sinfo(" textalloc: %08lx\n", (long)loadinfo->textalloc);
sinfo(" datastart: %08lx\n", (long)loadinfo->datastart);
sinfo(" textsize: %ld\n", (long)loadinfo->textsize);
sinfo(" datasize: %ld\n", (long)loadinfo->datasize);
sinfo(" filelen: %ld\n", (long)loadinfo->filelen);
sinfo(" filfd: %d\n", loadinfo->filfd);
sinfo(" symtabidx: %d\n", loadinfo->symtabidx);
sinfo(" strtabidx: %d\n", loadinfo->strtabidx);
serr("ELF Header:\n");
serr(" e_ident: %02x %02x %02x %02x\n",
sinfo("ELF Header:\n");
sinfo(" e_ident: %02x %02x %02x %02x\n",
loadinfo->ehdr.e_ident[0], loadinfo->ehdr.e_ident[1],
loadinfo->ehdr.e_ident[2], loadinfo->ehdr.e_ident[3]);
serr(" e_type: %04x\n", loadinfo->ehdr.e_type);
serr(" e_machine: %04x\n", loadinfo->ehdr.e_machine);
serr(" e_version: %08x\n", loadinfo->ehdr.e_version);
serr(" e_entry: %08lx\n", (long)loadinfo->ehdr.e_entry);
serr(" e_phoff: %d\n", loadinfo->ehdr.e_phoff);
serr(" e_shoff: %d\n", loadinfo->ehdr.e_shoff);
serr(" e_flags: %08x\n" , loadinfo->ehdr.e_flags);
serr(" e_ehsize: %d\n", loadinfo->ehdr.e_ehsize);
serr(" e_phentsize: %d\n", loadinfo->ehdr.e_phentsize);
serr(" e_phnum: %d\n", loadinfo->ehdr.e_phnum);
serr(" e_shentsize: %d\n", loadinfo->ehdr.e_shentsize);
serr(" e_shnum: %d\n", loadinfo->ehdr.e_shnum);
serr(" e_shstrndx: %d\n", loadinfo->ehdr.e_shstrndx);
sinfo(" e_type: %04x\n", loadinfo->ehdr.e_type);
sinfo(" e_machine: %04x\n", loadinfo->ehdr.e_machine);
sinfo(" e_version: %08x\n", loadinfo->ehdr.e_version);
sinfo(" e_entry: %08lx\n", (long)loadinfo->ehdr.e_entry);
sinfo(" e_phoff: %d\n", loadinfo->ehdr.e_phoff);
sinfo(" e_shoff: %d\n", loadinfo->ehdr.e_shoff);
sinfo(" e_flags: %08x\n" , loadinfo->ehdr.e_flags);
sinfo(" e_ehsize: %d\n", loadinfo->ehdr.e_ehsize);
sinfo(" e_phentsize: %d\n", loadinfo->ehdr.e_phentsize);
sinfo(" e_phnum: %d\n", loadinfo->ehdr.e_phnum);
sinfo(" e_shentsize: %d\n", loadinfo->ehdr.e_shentsize);
sinfo(" e_shnum: %d\n", loadinfo->ehdr.e_shnum);
sinfo(" e_shstrndx: %d\n", loadinfo->ehdr.e_shstrndx);
if (loadinfo->shdr && loadinfo->ehdr.e_shnum > 0)
{
for (i = 0; i < loadinfo->ehdr.e_shnum; i++)
{
FAR Elf32_Shdr *shdr = &loadinfo->shdr[i];
serr("Sections %d:\n", i);
serr(" sh_name: %08x\n", shdr->sh_name);
serr(" sh_type: %08x\n", shdr->sh_type);
serr(" sh_flags: %08x\n", shdr->sh_flags);
serr(" sh_addr: %08x\n", shdr->sh_addr);
serr(" sh_offset: %d\n", shdr->sh_offset);
serr(" sh_size: %d\n", shdr->sh_size);
serr(" sh_link: %d\n", shdr->sh_link);
serr(" sh_info: %d\n", shdr->sh_info);
serr(" sh_addralign: %d\n", shdr->sh_addralign);
serr(" sh_entsize: %d\n", shdr->sh_entsize);
sinfo("Sections %d:\n", i);
sinfo(" sh_name: %08x\n", shdr->sh_name);
sinfo(" sh_type: %08x\n", shdr->sh_type);
sinfo(" sh_flags: %08x\n", shdr->sh_flags);
sinfo(" sh_addr: %08x\n", shdr->sh_addr);
sinfo(" sh_offset: %d\n", shdr->sh_offset);
sinfo(" sh_size: %d\n", shdr->sh_size);
sinfo(" sh_link: %d\n", shdr->sh_link);
sinfo(" sh_info: %d\n", shdr->sh_info);
sinfo(" sh_addralign: %d\n", shdr->sh_addralign);
sinfo(" sh_entsize: %d\n", shdr->sh_entsize);
}
}
}
@@ -212,7 +212,7 @@ int insmod(FAR const char *filename, FAR const char *modulename)
mod_dumploadinfo(&loadinfo);
if (ret != 0)
{
serr("ERROR: Failed to initialize to load module: %d\n", ret);
sinfo("ERROR: Failed to initialize to load module: %d\n", ret);
goto errout_with_lock;
}
@@ -221,7 +221,7 @@ int insmod(FAR const char *filename, FAR const char *modulename)
modp = (FAR struct module_s *)kmm_zalloc(sizeof(struct module_s));
if (ret != 0)
{
serr("Failed to initialize for load of ELF program: %d\n", ret);
sinfo("Failed to initialize for load of ELF program: %d\n", ret);
goto errout_with_loadinfo;
}
@@ -235,7 +235,7 @@ int insmod(FAR const char *filename, FAR const char *modulename)
mod_dumploadinfo(&loadinfo);
if (ret != 0)
{
serr("Failed to load ELF program binary: %d\n", ret);
sinfo("Failed to load ELF program binary: %d\n", ret);
goto errout_with_registry_entry;
}
@@ -244,7 +244,7 @@ int insmod(FAR const char *filename, FAR const char *modulename)
ret = mod_bind(&loadinfo);
if (ret != 0)
{
serr("Failed to bind symbols program binary: %d\n", ret);
sinfo("Failed to bind symbols program binary: %d\n", ret);
goto errout_with_load;
}
@@ -269,7 +269,7 @@ int insmod(FAR const char *filename, FAR const char *modulename)
ret = initializer(&modp->uninitializer, &modp->arg);
if (ret < 0)
{
serr("Failed to initialize the module: %d\n", ret);
sinfo("Failed to initialize the module: %d\n", ret);
goto errout_with_load;
}
+2 -2
View File
@@ -75,7 +75,7 @@ int mod_allocbuffer(FAR struct mod_loadinfo_s *loadinfo)
loadinfo->iobuffer = (FAR uint8_t *)kmm_malloc(CONFIG_MODULE_BUFFERSIZE);
if (!loadinfo->iobuffer)
{
serr("Failed to allocate an I/O buffer\n");
serr("ERROR: Failed to allocate an I/O buffer\n");
return -ENOMEM;
}
@@ -111,7 +111,7 @@ int mod_reallocbuffer(FAR struct mod_loadinfo_s *loadinfo, size_t increment)
buffer = kmm_realloc((FAR void *)loadinfo->iobuffer, newsize);
if (!buffer)
{
serr("Failed to reallocate the I/O buffer\n");
serr("ERROR: Failed to reallocate the I/O buffer\n");
return -ENOMEM;
}
+3 -3
View File
@@ -126,7 +126,7 @@ int mod_read(FAR struct mod_loadinfo_s *loadinfo, FAR uint8_t *buffer,
if (rpos != offset)
{
int errval = errno;
serr("Failed to seek to position %lu: %d\n",
serr("ERROR: Failed to seek to position %lu: %d\n",
(unsigned long)offset, errval);
return -errval;
}
@@ -142,14 +142,14 @@ int mod_read(FAR struct mod_loadinfo_s *loadinfo, FAR uint8_t *buffer,
if (errval != EINTR)
{
serr("Read from offset %lu failed: %d\n",
serr("ERROR: Read from offset %lu failed: %d\n",
(unsigned long)offset, errval);
return -errval;
}
}
else if (nbytes == 0)
{
serr("Unexpected end of file\n");
serr("ERROR: Unexpected end of file\n");
return -ENODATA;
}
else
+9 -9
View File
@@ -85,7 +85,7 @@ static inline int mod_sectname(FAR struct mod_loadinfo_s *loadinfo,
shstrndx = loadinfo->ehdr.e_shstrndx;
if (shstrndx == SHN_UNDEF)
{
serr("No section header string table\n");
serr("ERROR: No section header string table\n");
return -EINVAL;
}
@@ -118,7 +118,7 @@ static inline int mod_sectname(FAR struct mod_loadinfo_s *loadinfo,
{
if (loadinfo->filelen <= offset)
{
serr("At end of file\n");
serr("ERROR: At end of file\n");
return -EINVAL;
}
@@ -131,7 +131,7 @@ static inline int mod_sectname(FAR struct mod_loadinfo_s *loadinfo,
ret = mod_read(loadinfo, buffer, readlen, offset);
if (ret < 0)
{
serr("Failed to read section name\n");
serr("ERROR: Failed to read section name: %d\n", ret);
return ret;
}
@@ -151,7 +151,7 @@ static inline int mod_sectname(FAR struct mod_loadinfo_s *loadinfo,
ret = mod_reallocbuffer(loadinfo, CONFIG_MODULE_BUFFERINCR);
if (ret < 0)
{
serr("mod_reallocbuffer failed: %d\n", ret);
serr("ERROR: mod_reallocbuffer failed: %d\n", ret);
return ret;
}
}
@@ -188,7 +188,7 @@ int mod_loadshdrs(FAR struct mod_loadinfo_s *loadinfo)
if (loadinfo->ehdr.e_shnum < 1)
{
serr("No sections(?)\n");
serr("ERROR: No sections(?)\n");
return -EINVAL;
}
@@ -197,7 +197,7 @@ int mod_loadshdrs(FAR struct mod_loadinfo_s *loadinfo)
shdrsize = (size_t)loadinfo->ehdr.e_shentsize * (size_t)loadinfo->ehdr.e_shnum;
if (loadinfo->ehdr.e_shoff + shdrsize > loadinfo->filelen)
{
serr("Insufficent space in file for section header table\n");
serr("ERROR: Insufficent space in file for section header table\n");
return -ESPIPE;
}
@@ -206,7 +206,7 @@ int mod_loadshdrs(FAR struct mod_loadinfo_s *loadinfo)
loadinfo->shdr = (FAR FAR Elf32_Shdr *)kmm_malloc(shdrsize);
if (!loadinfo->shdr)
{
serr("Failed to allocate the section header table. Size: %ld\n",
serr("ERROR: Failed to allocate the section header table. Size: %ld\n",
(long)shdrsize);
return -ENOMEM;
}
@@ -217,7 +217,7 @@ int mod_loadshdrs(FAR struct mod_loadinfo_s *loadinfo)
loadinfo->ehdr.e_shoff);
if (ret < 0)
{
serr("Failed to read section header table: %d\n", ret);
serr("ERROR: Failed to read section header table: %d\n", ret);
}
return ret;
@@ -256,7 +256,7 @@ int mod_findsection(FAR struct mod_loadinfo_s *loadinfo,
ret = mod_sectname(loadinfo, shdr);
if (ret < 0)
{
serr("mod_sectname failed: %d\n", ret);
serr("ERROR: mod_sectname failed: %d\n", ret);
return ret;
}
+10 -9
View File
@@ -93,7 +93,7 @@ static int mod_symname(FAR struct mod_loadinfo_s *loadinfo,
if (sym->st_name == 0)
{
serr("Symbol has no name\n");
serr("ERROR: Symbol has no name\n");
return -ESRCH;
}
@@ -112,7 +112,7 @@ static int mod_symname(FAR struct mod_loadinfo_s *loadinfo,
{
if (loadinfo->filelen <= offset)
{
serr("At end of file\n");
serr("ERROR: At end of file\n");
return -EINVAL;
}
@@ -125,7 +125,7 @@ static int mod_symname(FAR struct mod_loadinfo_s *loadinfo,
ret = mod_read(loadinfo, buffer, readlen, offset);
if (ret < 0)
{
serr("mod_read failed: %d\n", ret);
serr("ERROR: mod_read failed: %d\n", ret);
return ret;
}
@@ -145,7 +145,7 @@ static int mod_symname(FAR struct mod_loadinfo_s *loadinfo,
ret = mod_reallocbuffer(loadinfo, CONFIG_MODULE_BUFFERINCR);
if (ret < 0)
{
serr("mod_reallocbuffer failed: %d\n", ret);
serr("ERROR: mod_reallocbuffer failed: %d\n", ret);
return ret;
}
}
@@ -191,7 +191,7 @@ int mod_findsymtab(FAR struct mod_loadinfo_s *loadinfo)
if (loadinfo->symtabidx == 0)
{
serr("No symbols in ELF file\n");
serr("ERROR: No symbols in ELF file\n");
return -EINVAL;
}
@@ -225,7 +225,7 @@ int mod_readsym(FAR struct mod_loadinfo_s *loadinfo, int index,
if (index < 0 || index > (symtab->sh_size / sizeof(Elf32_Sym)))
{
serr("Bad relocation symbol index: %d\n", index);
serr("ERROR: Bad relocation symbol index: %d\n", index);
return -EINVAL;
}
@@ -273,7 +273,7 @@ int mod_symvalue(FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym)
{
/* NuttX ELF modules should be compiled with -fno-common. */
serr("SHN_COMMON: Re-compile with -fno-common\n");
serr("ERROR: SHN_COMMON: Re-compile with -fno-common\n");
return -ENOSYS;
}
@@ -298,7 +298,7 @@ int mod_symvalue(FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym)
* indicate the nameless symbol.
*/
serr("SHN_UNDEF: Failed to get symbol name: %d\n", ret);
serr("ERROR: SHN_UNDEF: Failed to get symbol name: %d\n", ret);
return ret;
}
@@ -315,7 +315,8 @@ int mod_symvalue(FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym)
#endif
if (!symbol)
{
serr("SHN_UNDEF: Exported symbol \"%s\" not found\n", loadinfo->iobuffer);
serr("ERROR: SHN_UNDEF: Exported symbol \"%s\" not found\n",
loadinfo->iobuffer);
return -ENOENT;
}
+3 -3
View File
@@ -79,7 +79,7 @@ int mod_verifyheader(FAR const Elf32_Ehdr *ehdr)
{
if (!ehdr)
{
serr("NULL ELF header!");
serr("ERROR: NULL ELF header!");
return -ENOEXEC;
}
@@ -96,7 +96,7 @@ int mod_verifyheader(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_type != ET_REL)
{
serr("Not a relocatable file: e_type=%d\n", ehdr->e_type);
serr("ERROR: Not a relocatable file: e_type=%d\n", ehdr->e_type);
return -EINVAL;
}
@@ -104,7 +104,7 @@ int mod_verifyheader(FAR const Elf32_Ehdr *ehdr)
if (up_checkarch(ehdr))
{
serr("Not a supported architecture\n");
serr("ERROR: Not a supported architecture\n");
return -ENOEXEC;
}