Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err()

This commit is contained in:
Gregory Nutt
2016-06-11 15:50:49 -06:00
parent e99301d7c2
commit a1469a3e95
1091 changed files with 5971 additions and 5966 deletions
+2 -2
View File
@@ -114,7 +114,7 @@ int binfmt_copyargv(FAR struct binary_s *bin, FAR char * const *argv)
if (nargs > MAX_EXEC_ARGS)
{
bdbg("ERROR: Too many arguments: %lu\n", (unsigned long)argvsize);
berr("ERROR: Too many arguments: %lu\n", (unsigned long)argvsize);
return -E2BIG;
}
}
@@ -129,7 +129,7 @@ int binfmt_copyargv(FAR struct binary_s *bin, FAR char * const *argv)
bin->argbuffer = (FAR char *)kmm_malloc(argvsize + argsize);
if (!bin->argbuffer)
{
bdbg("ERROR: Failed to allocate the argument buffer\n");
berr("ERROR: Failed to allocate the argument buffer\n");
return -ENOMEM;
}
+11 -11
View File
@@ -86,21 +86,21 @@ int dump_module(FAR const struct binary_s *bin)
{
if (bin)
{
bdbg("Module:\n");
bdbg(" filename: %s\n", bin->filename);
bdbg(" argv: %p\n", bin->argv);
bdbg(" entrypt: %p\n", bin->entrypt);
bdbg(" mapped: %p size=%d\n", bin->mapped, bin->mapsize);
bdbg(" alloc: %p %p %p\n", bin->alloc[0], bin->alloc[1], bin->alloc[2]);
berr("Module:\n");
berr(" filename: %s\n", bin->filename);
berr(" argv: %p\n", bin->argv);
berr(" entrypt: %p\n", bin->entrypt);
berr(" mapped: %p size=%d\n", bin->mapped, bin->mapsize);
berr(" alloc: %p %p %p\n", bin->alloc[0], bin->alloc[1], bin->alloc[2]);
#ifdef CONFIG_BINFMT_CONSTRUCTORS
bdbg(" ctors: %p nctors=%d\n", bin->ctors, bin->nctors);
bdbg(" dtors: %p ndtors=%d\n", bin->dtors, bin->ndtors);
berr(" ctors: %p nctors=%d\n", bin->ctors, bin->nctors);
berr(" dtors: %p ndtors=%d\n", bin->dtors, bin->ndtors);
#endif
#ifdef CONFIG_ARCH_ADDRENV
bdbg(" addrenv: %p\n", bin->addrenv);
berr(" addrenv: %p\n", bin->addrenv);
#endif
bdbg(" stacksize: %d\n", bin->stacksize);
bdbg(" unload: %p\n", bin->unload);
berr(" stacksize: %d\n", bin->stacksize);
berr(" unload: %p\n", bin->unload);
}
return OK;
+7 -7
View File
@@ -94,7 +94,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
bin = (FAR struct binary_s *)kmm_zalloc(sizeof(struct binary_s));
if (!bin)
{
bdbg("ERROR: Failed to allocate binary_s\n");
berr("ERROR: Failed to allocate binary_s\n");
errcode = ENOMEM;
goto errout;
}
@@ -111,7 +111,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
if (ret < 0)
{
errcode = -ret;
bdbg("ERROR: Failed to copy argv[]: %d\n", errcode);
berr("ERROR: Failed to copy argv[]: %d\n", errcode);
goto errout_with_bin;
}
@@ -121,7 +121,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
if (ret < 0)
{
errcode = get_errno();
bdbg("ERROR: Failed to load program '%s': %d\n", filename, errcode);
berr("ERROR: Failed to load program '%s': %d\n", filename, errcode);
goto errout_with_argv;
}
@@ -138,7 +138,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
if (pid < 0)
{
errcode = get_errno();
bdbg("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
berr("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
goto errout_with_lock;
}
@@ -150,7 +150,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
if (ret < 0)
{
errcode = get_errno();
bdbg("ERROR: Failed to schedule unload '%s': %d\n", filename, errcode);
berr("ERROR: Failed to schedule unload '%s': %d\n", filename, errcode);
}
sched_unlock();
@@ -183,7 +183,7 @@ errout:
if (ret < 0)
{
errcode = get_errno();
bdbg("ERROR: Failed to load program '%s': %d\n", filename, errcode);
berr("ERROR: Failed to load program '%s': %d\n", filename, errcode);
goto errout;
}
@@ -193,7 +193,7 @@ errout:
if (ret < 0)
{
errcode = get_errno();
bdbg("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
berr("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
goto errout_with_module;
}
+8 -8
View File
@@ -172,7 +172,7 @@ int exec_module(FAR const struct binary_s *binp)
ret = up_addrenv_select(&binp->addrenv, &oldenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
berr("ERROR: up_addrenv_select() failed: %d\n", ret);
errcode = -ret;
goto errout_with_tcb;
}
@@ -203,7 +203,7 @@ int exec_module(FAR const struct binary_s *binp)
if (ret < 0)
{
errcode = get_errno();
bdbg("task_init() failed: %d\n", errcode);
berr("task_init() failed: %d\n", errcode);
goto errout_with_addrenv;
}
@@ -224,7 +224,7 @@ int exec_module(FAR const struct binary_s *binp)
ret = up_addrenv_kstackalloc(&tcb->cmn);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
berr("ERROR: up_addrenv_select() failed: %d\n", ret);
errcode = -ret;
goto errout_with_tcbinit;
}
@@ -236,7 +236,7 @@ int exec_module(FAR const struct binary_s *binp)
ret = shm_group_initialize(tcb->cmn.group);
if (ret < 0)
{
bdbg("ERROR: shm_group_initialize() failed: %d\n", ret);
berr("ERROR: shm_group_initialize() failed: %d\n", ret);
errcode = -ret;
goto errout_with_tcbinit;
}
@@ -261,7 +261,7 @@ int exec_module(FAR const struct binary_s *binp)
if (ret < 0)
{
errcode = -ret;
bdbg("ERROR: up_addrenv_clone() failed: %d\n", ret);
berr("ERROR: up_addrenv_clone() failed: %d\n", ret);
goto errout_with_tcbinit;
}
@@ -289,7 +289,7 @@ int exec_module(FAR const struct binary_s *binp)
if (ret < 0)
{
errcode = get_errno();
bdbg("task_activate() failed: %d\n", errcode);
berr("task_activate() failed: %d\n", errcode);
goto errout_with_tcbinit;
}
@@ -299,7 +299,7 @@ int exec_module(FAR const struct binary_s *binp)
ret = up_addrenv_restore(&oldenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
berr("ERROR: up_addrenv_select() failed: %d\n", ret);
errcode = -ret;
goto errout_with_tcbinit;
}
@@ -323,7 +323,7 @@ errout_with_tcb:
errout:
set_errno(errcode);
bdbg("returning errno: %d\n", errcode);
berr("returning errno: %d\n", errcode);
return ERROR;
}
+2 -2
View File
@@ -91,7 +91,7 @@ static int load_default_priority(FAR struct binary_s *bin)
ret = sched_getparam(0, &param);
if (ret < 0)
{
bdbg("ERROR: sched_getparam failed: %d\n", get_errno());
berr("ERROR: sched_getparam failed: %d\n", get_errno());
return ERROR;
}
@@ -262,7 +262,7 @@ int load_module(FAR struct binary_s *bin)
if (ret < 0)
{
bdbg("ERROR: Returning errno %d\n", -ret);
berr("ERROR: Returning errno %d\n", -ret);
set_errno(-ret);
return ERROR;
}
+3 -3
View File
@@ -99,7 +99,7 @@ static inline int exec_dtors(FAR struct binary_s *binp)
ret = up_addrenv_select(&binp->addrenv, &oldenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
berr("ERROR: up_addrenv_select() failed: %d\n", ret);
return ret;
}
#endif
@@ -161,7 +161,7 @@ int unload_module(FAR struct binary_s *binp)
ret = binp->unload(binp);
if (ret < 0)
{
bdbg("binp->unload() failed: %d\n", ret);
berr("binp->unload() failed: %d\n", ret);
set_errno(-ret);
return ERROR;
}
@@ -173,7 +173,7 @@ int unload_module(FAR struct binary_s *binp)
ret = exec_dtors(binp);
if (ret < 0)
{
bdbg("exec_ctors() failed: %d\n", ret);
berr("exec_ctors() failed: %d\n", ret);
set_errno(-ret);
return ERROR;
}
+4 -4
View File
@@ -103,7 +103,7 @@ static int builtin_loadbinary(struct binary_s *binp)
if (fd < 0)
{
int errval = get_errno();
bdbg("ERROR: Failed to open binary %s: %d\n", binp->filename, errval);
berr("ERROR: Failed to open binary %s: %d\n", binp->filename, errval);
return -errval;
}
@@ -115,7 +115,7 @@ static int builtin_loadbinary(struct binary_s *binp)
if (ret < 0)
{
int errval = get_errno();
bdbg("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval);
berr("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval);
close(fd);
return -errval;
}
@@ -128,7 +128,7 @@ static int builtin_loadbinary(struct binary_s *binp)
if (index < 0)
{
int errval = get_errno();
bdbg("ERROR: %s is not a builtin application\n", filename);
berr("ERROR: %s is not a builtin application\n", filename);
close(fd);
return -errval;
@@ -176,7 +176,7 @@ int builtin_initialize(void)
ret = register_binfmt(&g_builtin_binfmt);
if (ret != 0)
{
bdbg("Failed to register binfmt: %d\n", ret);
berr("Failed to register binfmt: %d\n", ret);
}
return ret;
+47 -47
View File
@@ -115,58 +115,58 @@ static void elf_dumploadinfo(FAR struct elf_loadinfo_s *loadinfo)
{
int i;
bdbg("LOAD_INFO:\n");
bdbg(" textalloc: %08lx\n", (long)loadinfo->textalloc);
bdbg(" dataalloc: %08lx\n", (long)loadinfo->dataalloc);
bdbg(" textsize: %ld\n", (long)loadinfo->textsize);
bdbg(" datasize: %ld\n", (long)loadinfo->datasize);
bdbg(" filelen: %ld\n", (long)loadinfo->filelen);
berr("LOAD_INFO:\n");
berr(" textalloc: %08lx\n", (long)loadinfo->textalloc);
berr(" dataalloc: %08lx\n", (long)loadinfo->dataalloc);
berr(" textsize: %ld\n", (long)loadinfo->textsize);
berr(" datasize: %ld\n", (long)loadinfo->datasize);
berr(" filelen: %ld\n", (long)loadinfo->filelen);
#ifdef CONFIG_BINFMT_CONSTRUCTORS
bdbg(" ctoralloc: %08lx\n", (long)loadinfo->ctoralloc);
bdbg(" ctors: %08lx\n", (long)loadinfo->ctors);
bdbg(" nctors: %d\n", loadinfo->nctors);
bdbg(" dtoralloc: %08lx\n", (long)loadinfo->dtoralloc);
bdbg(" dtors: %08lx\n", (long)loadinfo->dtors);
bdbg(" ndtors: %d\n", loadinfo->ndtors);
berr(" ctoralloc: %08lx\n", (long)loadinfo->ctoralloc);
berr(" ctors: %08lx\n", (long)loadinfo->ctors);
berr(" nctors: %d\n", loadinfo->nctors);
berr(" dtoralloc: %08lx\n", (long)loadinfo->dtoralloc);
berr(" dtors: %08lx\n", (long)loadinfo->dtors);
berr(" ndtors: %d\n", loadinfo->ndtors);
#endif
bdbg(" filfd: %d\n", loadinfo->filfd);
bdbg(" symtabidx: %d\n", loadinfo->symtabidx);
bdbg(" strtabidx: %d\n", loadinfo->strtabidx);
berr(" filfd: %d\n", loadinfo->filfd);
berr(" symtabidx: %d\n", loadinfo->symtabidx);
berr(" strtabidx: %d\n", loadinfo->strtabidx);
bdbg("ELF Header:\n");
bdbg(" e_ident: %02x %02x %02x %02x\n",
berr("ELF Header:\n");
berr(" 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]);
bdbg(" e_type: %04x\n", loadinfo->ehdr.e_type);
bdbg(" e_machine: %04x\n", loadinfo->ehdr.e_machine);
bdbg(" e_version: %08x\n", loadinfo->ehdr.e_version);
bdbg(" e_entry: %08lx\n", (long)loadinfo->ehdr.e_entry);
bdbg(" e_phoff: %d\n", loadinfo->ehdr.e_phoff);
bdbg(" e_shoff: %d\n", loadinfo->ehdr.e_shoff);
bdbg(" e_flags: %08x\n" , loadinfo->ehdr.e_flags);
bdbg(" e_ehsize: %d\n", loadinfo->ehdr.e_ehsize);
bdbg(" e_phentsize: %d\n", loadinfo->ehdr.e_phentsize);
bdbg(" e_phnum: %d\n", loadinfo->ehdr.e_phnum);
bdbg(" e_shentsize: %d\n", loadinfo->ehdr.e_shentsize);
bdbg(" e_shnum: %d\n", loadinfo->ehdr.e_shnum);
bdbg(" e_shstrndx: %d\n", loadinfo->ehdr.e_shstrndx);
berr(" e_type: %04x\n", loadinfo->ehdr.e_type);
berr(" e_machine: %04x\n", loadinfo->ehdr.e_machine);
berr(" e_version: %08x\n", loadinfo->ehdr.e_version);
berr(" e_entry: %08lx\n", (long)loadinfo->ehdr.e_entry);
berr(" e_phoff: %d\n", loadinfo->ehdr.e_phoff);
berr(" e_shoff: %d\n", loadinfo->ehdr.e_shoff);
berr(" e_flags: %08x\n" , loadinfo->ehdr.e_flags);
berr(" e_ehsize: %d\n", loadinfo->ehdr.e_ehsize);
berr(" e_phentsize: %d\n", loadinfo->ehdr.e_phentsize);
berr(" e_phnum: %d\n", loadinfo->ehdr.e_phnum);
berr(" e_shentsize: %d\n", loadinfo->ehdr.e_shentsize);
berr(" e_shnum: %d\n", loadinfo->ehdr.e_shnum);
berr(" 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];
bdbg("Sections %d:\n", i);
bdbg(" sh_name: %08x\n", shdr->sh_name);
bdbg(" sh_type: %08x\n", shdr->sh_type);
bdbg(" sh_flags: %08x\n", shdr->sh_flags);
bdbg(" sh_addr: %08x\n", shdr->sh_addr);
bdbg(" sh_offset: %d\n", shdr->sh_offset);
bdbg(" sh_size: %d\n", shdr->sh_size);
bdbg(" sh_link: %d\n", shdr->sh_link);
bdbg(" sh_info: %d\n", shdr->sh_info);
bdbg(" sh_addralign: %d\n", shdr->sh_addralign);
bdbg(" sh_entsize: %d\n", shdr->sh_entsize);
berr("Sections %d:\n", i);
berr(" sh_name: %08x\n", shdr->sh_name);
berr(" sh_type: %08x\n", shdr->sh_type);
berr(" sh_flags: %08x\n", shdr->sh_flags);
berr(" sh_addr: %08x\n", shdr->sh_addr);
berr(" sh_offset: %d\n", shdr->sh_offset);
berr(" sh_size: %d\n", shdr->sh_size);
berr(" sh_link: %d\n", shdr->sh_link);
berr(" sh_info: %d\n", shdr->sh_info);
berr(" sh_addralign: %d\n", shdr->sh_addralign);
berr(" sh_entsize: %d\n", shdr->sh_entsize);
}
}
}
@@ -193,7 +193,7 @@ static void elf_dumpentrypt(FAR struct binary_s *binp,
ret = elf_addrenv_select(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_addrenv_select() failed: %d\n", ret);
berr("ERROR: elf_addrenv_select() failed: %d\n", ret);
return;
}
#endif
@@ -207,7 +207,7 @@ static void elf_dumpentrypt(FAR struct binary_s *binp,
ret = elf_addrenv_restore(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_addrenv_restore() failed: %d\n", ret);
berr("ERROR: elf_addrenv_restore() failed: %d\n", ret);
}
#endif
}
@@ -237,7 +237,7 @@ static int elf_loadbinary(FAR struct binary_s *binp)
elf_dumploadinfo(&loadinfo);
if (ret != 0)
{
bdbg("Failed to initialize for load of ELF program: %d\n", ret);
berr("Failed to initialize for load of ELF program: %d\n", ret);
goto errout;
}
@@ -247,7 +247,7 @@ static int elf_loadbinary(FAR struct binary_s *binp)
elf_dumploadinfo(&loadinfo);
if (ret != 0)
{
bdbg("Failed to load ELF program binary: %d\n", ret);
berr("Failed to load ELF program binary: %d\n", ret);
goto errout_with_init;
}
@@ -256,7 +256,7 @@ static int elf_loadbinary(FAR struct binary_s *binp)
ret = elf_bind(&loadinfo, binp->exports, binp->nexports);
if (ret != 0)
{
bdbg("Failed to bind symbols program binary: %d\n", ret);
berr("Failed to bind symbols program binary: %d\n", ret);
goto errout_with_load;
}
@@ -343,7 +343,7 @@ int elf_initialize(void)
ret = register_binfmt(&g_elfbinfmt);
if (ret != 0)
{
bdbg("Failed to register binfmt: %d\n", ret);
berr("Failed to register binfmt: %d\n", ret);
}
return ret;
+4 -4
View File
@@ -101,7 +101,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
ret = up_addrenv_create(textsize, datasize, heapsize, &loadinfo->addrenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_create failed: %d\n", ret);
berr("ERROR: up_addrenv_create failed: %d\n", ret);
return ret;
}
@@ -114,14 +114,14 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
ret = up_addrenv_vtext(&loadinfo->addrenv, &vtext);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_vtext failed: %d\n", ret);
berr("ERROR: up_addrenv_vtext failed: %d\n", ret);
return ret;
}
ret = up_addrenv_vdata(&loadinfo->addrenv, textsize, &vdata);
if (ret < 0)
{
bdbg("ERROR: up_adup_addrenv_vdatadrenv_vtext failed: %d\n", ret);
berr("ERROR: up_adup_addrenv_vdatadrenv_vtext failed: %d\n", ret);
return ret;
}
@@ -170,7 +170,7 @@ void elf_addrenv_free(FAR struct elf_loadinfo_s *loadinfo)
ret = up_addrenv_destroy(&loadinfo->addrenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_destroy failed: %d\n", ret);
berr("ERROR: up_addrenv_destroy failed: %d\n", ret);
}
#else
/* If there is an allocation for the ELF image, free it */
+11 -11
View File
@@ -103,7 +103,7 @@ static inline int elf_readrel(FAR struct elf_loadinfo_s *loadinfo,
if (index < 0 || index > (relsec->sh_size / sizeof(Elf32_Rel)))
{
bdbg("Bad relocation symbol index: %d\n", index);
berr("Bad relocation symbol index: %d\n", index);
return -EINVAL;
}
@@ -156,7 +156,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
ret = elf_readrel(loadinfo, relsec, i, &rel);
if (ret < 0)
{
bdbg("Section %d reloc %d: Failed to read relocation entry: %d\n",
berr("Section %d reloc %d: Failed to read relocation entry: %d\n",
relidx, i, ret);
return ret;
}
@@ -172,7 +172,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
ret = elf_readsym(loadinfo, symidx, &sym);
if (ret < 0)
{
bdbg("Section %d reloc %d: Failed to read symbol[%d]: %d\n",
berr("Section %d reloc %d: Failed to read symbol[%d]: %d\n",
relidx, i, symidx, ret);
return ret;
}
@@ -194,13 +194,13 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
if (ret == -ESRCH)
{
bdbg("Section %d reloc %d: Undefined symbol[%d] has no name: %d\n",
berr("Section %d reloc %d: Undefined symbol[%d] has no name: %d\n",
relidx, i, symidx, ret);
psym = NULL;
}
else
{
bdbg("Section %d reloc %d: Failed to get value of symbol[%d]: %d\n",
berr("Section %d reloc %d: Failed to get value of symbol[%d]: %d\n",
relidx, i, symidx, ret);
return ret;
}
@@ -210,7 +210,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
if (rel.r_offset < 0 || rel.r_offset > dstsec->sh_size - sizeof(uint32_t))
{
bdbg("Section %d reloc %d: Relocation address out of range, offset %d size %d\n",
berr("Section %d reloc %d: Relocation address out of range, offset %d size %d\n",
relidx, i, rel.r_offset, dstsec->sh_size);
return -EINVAL;
}
@@ -222,7 +222,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
ret = up_relocate(&rel, psym, addr);
if (ret < 0)
{
bdbg("ERROR: Section %d reloc %d: Relocation failed: %d\n", relidx, i, ret);
berr("ERROR: Section %d reloc %d: Relocation failed: %d\n", relidx, i, ret);
return ret;
}
}
@@ -233,7 +233,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
static int elf_relocateadd(FAR struct elf_loadinfo_s *loadinfo, int relidx,
FAR const struct symtab_s *exports, int nexports)
{
bdbg("Not implemented\n");
berr("Not implemented\n");
return -ENOSYS;
}
@@ -278,7 +278,7 @@ int elf_bind(FAR struct elf_loadinfo_s *loadinfo,
ret = elf_allocbuffer(loadinfo);
if (ret < 0)
{
bdbg("elf_allocbuffer failed: %d\n", ret);
berr("elf_allocbuffer failed: %d\n", ret);
return -ENOMEM;
}
@@ -291,7 +291,7 @@ int elf_bind(FAR struct elf_loadinfo_s *loadinfo,
ret = elf_addrenv_select(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_addrenv_select() failed: %d\n", ret);
berr("ERROR: elf_addrenv_select() failed: %d\n", ret);
return ret;
}
#endif
@@ -352,7 +352,7 @@ int elf_bind(FAR struct elf_loadinfo_s *loadinfo,
status = elf_addrenv_restore(loadinfo);
if (status < 0)
{
bdbg("ERROR: elf_addrenv_restore() failed: %d\n", status);
berr("ERROR: elf_addrenv_restore() failed: %d\n", status);
if (ret == OK)
{
ret = status;
+3 -3
View File
@@ -103,7 +103,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_allocbuffer(loadinfo);
if (ret < 0)
{
bdbg("elf_allocbuffer failed: %d\n", ret);
berr("elf_allocbuffer failed: %d\n", ret);
return -ENOMEM;
}
@@ -166,7 +166,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
loadinfo->ctoralloc = (binfmt_ctor_t *)kumm_malloc(ctorsize);
if (!loadinfo->ctoralloc)
{
bdbg("Failed to allocate memory for .ctors\n");
berr("Failed to allocate memory for .ctors\n");
return -ENOMEM;
}
@@ -178,7 +178,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
shdr->sh_offset);
if (ret < 0)
{
bdbg("Failed to allocate .ctors: %d\n", ret);
berr("Failed to allocate .ctors: %d\n", ret);
return ret;
}
+3 -3
View File
@@ -103,7 +103,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_allocbuffer(loadinfo);
if (ret < 0)
{
bdbg("elf_allocbuffer failed: %d\n", ret);
berr("elf_allocbuffer failed: %d\n", ret);
return -ENOMEM;
}
@@ -166,7 +166,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
loadinfo->ctoralloc = (binfmt_dtor_t *)kumm_malloc(dtorsize);
if (!loadinfo->ctoralloc)
{
bdbg("Failed to allocate memory for .dtors\n");
berr("Failed to allocate memory for .dtors\n");
return -ENOMEM;
}
@@ -178,7 +178,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
shdr->sh_offset);
if (ret < 0)
{
bdbg("Failed to allocate .dtors: %d\n", ret);
berr("Failed to allocate .dtors: %d\n", ret);
return ret;
}
+6 -6
View File
@@ -102,7 +102,7 @@ static inline int elf_filelen(FAR struct elf_loadinfo_s *loadinfo,
if (ret < 0)
{
int errval = errno;
bdbg("Failed to stat file: %d\n", errval);
berr("Failed to stat file: %d\n", errval);
return -errval;
}
@@ -110,7 +110,7 @@ static inline int elf_filelen(FAR struct elf_loadinfo_s *loadinfo,
if (!S_ISREG(buf.st_mode))
{
bdbg("Not a regular file. mode: %d\n", buf.st_mode);
berr("Not a regular file. mode: %d\n", buf.st_mode);
return -ENOENT;
}
@@ -156,7 +156,7 @@ int elf_init(FAR const char *filename, FAR struct elf_loadinfo_s *loadinfo)
ret = elf_filelen(loadinfo, filename);
if (ret < 0)
{
bdbg("elf_filelen failed: %d\n", ret);
berr("elf_filelen failed: %d\n", ret);
return ret;
}
@@ -166,7 +166,7 @@ int elf_init(FAR const char *filename, FAR struct elf_loadinfo_s *loadinfo)
if (loadinfo->filfd < 0)
{
int errval = errno;
bdbg("Failed to open ELF binary %s: %d\n", filename, errval);
berr("Failed to open ELF binary %s: %d\n", filename, errval);
return -errval;
}
@@ -175,7 +175,7 @@ int elf_init(FAR const char *filename, FAR struct elf_loadinfo_s *loadinfo)
ret = elf_read(loadinfo, (FAR uint8_t *)&loadinfo->ehdr, sizeof(Elf32_Ehdr), 0);
if (ret < 0)
{
bdbg("Failed to read ELF header: %d\n", ret);
berr("Failed to read ELF header: %d\n", ret);
return ret;
}
@@ -193,7 +193,7 @@ int elf_init(FAR const char *filename, FAR struct elf_loadinfo_s *loadinfo)
* is not correctly formed.
*/
bdbg("Bad ELF header: %d\n", ret);
berr("Bad ELF header: %d\n", ret);
return ret;
}
+2 -2
View File
@@ -87,7 +87,7 @@ int elf_allocbuffer(FAR struct elf_loadinfo_s *loadinfo)
loadinfo->iobuffer = (FAR uint8_t *)kmm_malloc(CONFIG_ELF_BUFFERSIZE);
if (!loadinfo->iobuffer)
{
bdbg("Failed to allocate an I/O buffer\n");
berr("Failed to allocate an I/O buffer\n");
return -ENOMEM;
}
@@ -123,7 +123,7 @@ int elf_reallocbuffer(FAR struct elf_loadinfo_s *loadinfo, size_t increment)
buffer = kmm_realloc((FAR void *)loadinfo->iobuffer, newsize);
if (!buffer)
{
bdbg("Failed to reallocate the I/O buffer\n");
berr("Failed to reallocate the I/O buffer\n");
return -ENOMEM;
}
+8 -8
View File
@@ -196,7 +196,7 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_read(loadinfo, *pptr, shdr->sh_size, shdr->sh_offset);
if (ret < 0)
{
bdbg("ERROR: Failed to read section %d: %d\n", i, ret);
berr("ERROR: Failed to read section %d: %d\n", i, ret);
return ret;
}
}
@@ -258,7 +258,7 @@ int elf_load(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_loadshdrs(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_loadshdrs failed: %d\n", ret);
berr("ERROR: elf_loadshdrs failed: %d\n", ret);
goto errout_with_buffers;
}
@@ -286,7 +286,7 @@ int elf_load(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_addrenv_alloc(loadinfo, loadinfo->textsize, loadinfo->datasize, heapsize);
if (ret < 0)
{
bdbg("ERROR: elf_addrenv_alloc() failed: %d\n", ret);
berr("ERROR: elf_addrenv_alloc() failed: %d\n", ret);
goto errout_with_buffers;
}
@@ -299,7 +299,7 @@ int elf_load(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_addrenv_select(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_addrenv_select() failed: %d\n", ret);
berr("ERROR: elf_addrenv_select() failed: %d\n", ret);
goto errout_with_buffers;
}
#endif
@@ -309,7 +309,7 @@ int elf_load(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_loadfile(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_loadfile failed: %d\n", ret);
berr("ERROR: elf_loadfile failed: %d\n", ret);
goto errout_with_addrenv;
}
@@ -319,14 +319,14 @@ int elf_load(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_loadctors(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_loadctors failed: %d\n", ret);
berr("ERROR: elf_loadctors failed: %d\n", ret);
goto errout_with_addrenv;
}
ret = elf_loaddtors(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_loaddtors failed: %d\n", ret);
berr("ERROR: elf_loaddtors failed: %d\n", ret);
goto errout_with_addrenv;
}
#endif
@@ -349,7 +349,7 @@ int elf_load(FAR struct elf_loadinfo_s *loadinfo)
ret = elf_addrenv_restore(loadinfo);
if (ret < 0)
{
bdbg("ERROR: elf_addrenv_restore() failed: %d\n", ret);
berr("ERROR: elf_addrenv_restore() failed: %d\n", ret);
goto errout_with_buffers;
}
#endif
+3 -3
View File
@@ -127,7 +127,7 @@ int elf_read(FAR struct elf_loadinfo_s *loadinfo, FAR uint8_t *buffer,
if (rpos != offset)
{
int errval = errno;
bdbg("Failed to seek to position %lu: %d\n",
berr("Failed to seek to position %lu: %d\n",
(unsigned long)offset, errval);
return -errval;
}
@@ -143,14 +143,14 @@ int elf_read(FAR struct elf_loadinfo_s *loadinfo, FAR uint8_t *buffer,
if (errval != EINTR)
{
bdbg("Read from offset %lu failed: %d\n",
berr("Read from offset %lu failed: %d\n",
(unsigned long)offset, errval);
return -errval;
}
}
else if (nbytes == 0)
{
bdbg("Unexpected end of file\n");
berr("Unexpected end of file\n");
return -ENODATA;
}
else
+9 -9
View File
@@ -93,7 +93,7 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo,
shstrndx = loadinfo->ehdr.e_shstrndx;
if (shstrndx == SHN_UNDEF)
{
bdbg("No section header string table\n");
berr("No section header string table\n");
return -EINVAL;
}
@@ -126,7 +126,7 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo,
{
if (loadinfo->filelen <= offset)
{
bdbg("At end of file\n");
berr("At end of file\n");
return -EINVAL;
}
@@ -139,7 +139,7 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo,
ret = elf_read(loadinfo, buffer, readlen, offset);
if (ret < 0)
{
bdbg("Failed to read section name\n");
berr("Failed to read section name\n");
return ret;
}
@@ -159,7 +159,7 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo,
ret = elf_reallocbuffer(loadinfo, CONFIG_ELF_BUFFERINCR);
if (ret < 0)
{
bdbg("elf_reallocbuffer failed: %d\n", ret);
berr("elf_reallocbuffer failed: %d\n", ret);
return ret;
}
}
@@ -196,7 +196,7 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
if (loadinfo->ehdr.e_shnum < 1)
{
bdbg("No sections(?)\n");
berr("No sections(?)\n");
return -EINVAL;
}
@@ -205,7 +205,7 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
shdrsize = (size_t)loadinfo->ehdr.e_shentsize * (size_t)loadinfo->ehdr.e_shnum;
if (loadinfo->ehdr.e_shoff + shdrsize > loadinfo->filelen)
{
bdbg("Insufficent space in file for section header table\n");
berr("Insufficent space in file for section header table\n");
return -ESPIPE;
}
@@ -214,7 +214,7 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
loadinfo->shdr = (FAR FAR Elf32_Shdr *)kmm_malloc(shdrsize);
if (!loadinfo->shdr)
{
bdbg("Failed to allocate the section header table. Size: %ld\n",
berr("Failed to allocate the section header table. Size: %ld\n",
(long)shdrsize);
return -ENOMEM;
}
@@ -225,7 +225,7 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
loadinfo->ehdr.e_shoff);
if (ret < 0)
{
bdbg("Failed to read section header table: %d\n", ret);
berr("Failed to read section header table: %d\n", ret);
}
return ret;
@@ -264,7 +264,7 @@ int elf_findsection(FAR struct elf_loadinfo_s *loadinfo,
ret = elf_sectname(loadinfo, shdr);
if (ret < 0)
{
bdbg("elf_sectname failed: %d\n", ret);
berr("elf_sectname failed: %d\n", ret);
return ret;
}
+9 -9
View File
@@ -97,7 +97,7 @@ static int elf_symname(FAR struct elf_loadinfo_s *loadinfo,
if (sym->st_name == 0)
{
bdbg("Symbol has no name\n");
berr("Symbol has no name\n");
return -ESRCH;
}
@@ -116,7 +116,7 @@ static int elf_symname(FAR struct elf_loadinfo_s *loadinfo,
{
if (loadinfo->filelen <= offset)
{
bdbg("At end of file\n");
berr("At end of file\n");
return -EINVAL;
}
@@ -129,7 +129,7 @@ static int elf_symname(FAR struct elf_loadinfo_s *loadinfo,
ret = elf_read(loadinfo, buffer, readlen, offset);
if (ret < 0)
{
bdbg("elf_read failed: %d\n", ret);
berr("elf_read failed: %d\n", ret);
return ret;
}
@@ -149,7 +149,7 @@ static int elf_symname(FAR struct elf_loadinfo_s *loadinfo,
ret = elf_reallocbuffer(loadinfo, CONFIG_ELF_BUFFERINCR);
if (ret < 0)
{
bdbg("elf_reallocbuffer failed: %d\n", ret);
berr("elf_reallocbuffer failed: %d\n", ret);
return ret;
}
}
@@ -195,7 +195,7 @@ int elf_findsymtab(FAR struct elf_loadinfo_s *loadinfo)
if (loadinfo->symtabidx == 0)
{
bdbg("No symbols in ELF file\n");
berr("No symbols in ELF file\n");
return -EINVAL;
}
@@ -229,7 +229,7 @@ int elf_readsym(FAR struct elf_loadinfo_s *loadinfo, int index,
if (index < 0 || index > (symtab->sh_size / sizeof(Elf32_Sym)))
{
bdbg("Bad relocation symbol index: %d\n", index);
berr("Bad relocation symbol index: %d\n", index);
return -EINVAL;
}
@@ -278,7 +278,7 @@ int elf_symvalue(FAR struct elf_loadinfo_s *loadinfo, FAR Elf32_Sym *sym,
{
/* NuttX ELF modules should be compiled with -fno-common. */
bdbg("SHN_COMMON: Re-compile with -fno-common\n");
berr("SHN_COMMON: Re-compile with -fno-common\n");
return -ENOSYS;
}
@@ -303,7 +303,7 @@ int elf_symvalue(FAR struct elf_loadinfo_s *loadinfo, FAR Elf32_Sym *sym,
* indicate the nameless symbol.
*/
bdbg("SHN_UNDEF: Failed to get symbol name: %d\n", ret);
berr("SHN_UNDEF: Failed to get symbol name: %d\n", ret);
return ret;
}
@@ -316,7 +316,7 @@ int elf_symvalue(FAR struct elf_loadinfo_s *loadinfo, FAR Elf32_Sym *sym,
#endif
if (!symbol)
{
bdbg("SHN_UNDEF: Exported symbol \"%s\" not found\n", loadinfo->iobuffer);
berr("SHN_UNDEF: Exported symbol \"%s\" not found\n", loadinfo->iobuffer);
return -ENOENT;
}
+3 -3
View File
@@ -87,7 +87,7 @@ int elf_verifyheader(FAR const Elf32_Ehdr *ehdr)
{
if (!ehdr)
{
bdbg("NULL ELF header!");
berr("NULL ELF header!");
return -ENOEXEC;
}
@@ -104,7 +104,7 @@ int elf_verifyheader(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_type != ET_REL)
{
bdbg("Not a relocatable file: e_type=%d\n", ehdr->e_type);
berr("Not a relocatable file: e_type=%d\n", ehdr->e_type);
return -EINVAL;
}
@@ -112,7 +112,7 @@ int elf_verifyheader(FAR const Elf32_Ehdr *ehdr)
if (up_checkarch(ehdr))
{
bdbg("Not a supported architecture\n");
berr("Not a supported architecture\n");
return -ENOEXEC;
}
+6 -6
View File
@@ -103,7 +103,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
dspace = (FAR struct dspace_s *)kmm_malloc(sizeof(struct dspace_s));
if (dspace == 0)
{
bdbg("ERROR: Failed to allocate DSpace\n");
berr("ERROR: Failed to allocate DSpace\n");
return -ENOMEM;
}
@@ -124,7 +124,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
ret = up_addrenv_create(0, envsize, heapsize, &loadinfo->addrenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_create failed: %d\n", ret);
berr("ERROR: up_addrenv_create failed: %d\n", ret);
goto errout_with_dspace;
}
@@ -137,7 +137,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
ret = up_addrenv_vdata(&loadinfo->addrenv, 0, &vdata);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_vdata failed: %d\n", ret);
berr("ERROR: up_addrenv_vdata failed: %d\n", ret);
goto errout_with_addrenv;
}
@@ -148,7 +148,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
ret = up_addrenv_select(loadinfo->addrenv, &oldenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_select failed: %d\n", ret);
berr("ERROR: up_addrenv_select failed: %d\n", ret);
goto errout_with_addrenv;
}
@@ -157,7 +157,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
ret = up_addrenv_restore(oldenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_restore failed: %d\n", ret);
berr("ERROR: up_addrenv_restore failed: %d\n", ret);
goto errout_with_addrenv;
}
@@ -227,7 +227,7 @@ void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo)
ret = up_addrenv_destroy(loadinfo->addrenv);
if (ret < 0)
{
bdbg("ERROR: up_addrenv_destroy failed: %d\n", ret);
berr("ERROR: up_addrenv_destroy failed: %d\n", ret);
}
loadinfo->addrenv = 0;
+11 -11
View File
@@ -117,7 +117,7 @@ static inline int nxflat_bindrel32i(FAR struct nxflat_loadinfo_s *loadinfo,
}
else
{
bdbg("Offset: %08 does not lie in D-Space size: %08x\n",
berr("Offset: %08 does not lie in D-Space size: %08x\n",
offset, loadinfo->dsize);
return -EINVAL;
}
@@ -156,7 +156,7 @@ static inline int nxflat_bindrel32d(FAR struct nxflat_loadinfo_s *loadinfo,
}
else
{
bdbg("Offset: %08 does not lie in D-Space size: %08x\n",
berr("Offset: %08 does not lie in D-Space size: %08x\n",
offset, loadinfo->dsize);
return -EINVAL;
}
@@ -198,7 +198,7 @@ static inline int nxflat_bindrel32id(FAR struct nxflat_loadinfo_s *loadinfo,
}
else
{
bdbg("Offset: %08 does not lie in D-Space size: %08x\n",
berr("Offset: %08 does not lie in D-Space size: %08x\n",
offset, loadinfo->dsize);
return -EINVAL;
}
@@ -265,7 +265,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
ret = nxflat_addrenv_select(loadinfo);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_select() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_select() failed: %d\n", ret);
return ret;
}
#endif
@@ -329,7 +329,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
default:
{
bdbg("ERROR: Unrecognized relocation type: %d\n", NXFLAT_RELOC_TYPE(reloc.r_info));
berr("ERROR: Unrecognized relocation type: %d\n", NXFLAT_RELOC_TYPE(reloc.r_info));
result = -EINVAL;
}
break;
@@ -359,7 +359,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
ret = nxflat_addrenv_restore(loadinfo);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_restore() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_restore() failed: %d\n", ret);
}
#endif
@@ -418,7 +418,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
ret = nxflat_addrenv_select(loadinfo);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_select() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_select() failed: %d\n", ret);
return ret;
}
#endif
@@ -473,7 +473,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
#endif
if (!symbol)
{
bdbg("Exported symbol \"%s\" not found\n", symname);
berr("Exported symbol \"%s\" not found\n", symname);
#ifdef CONFIG_ARCH_ADDRENV
(void)nxflat_addrenv_restore(loadinfo);
#endif
@@ -504,7 +504,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
ret = nxflat_addrenv_restore(loadinfo);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_restore() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_restore() failed: %d\n", ret);
}
return ret;
@@ -542,7 +542,7 @@ static inline int nxflat_clearbss(FAR struct nxflat_loadinfo_s *loadinfo)
ret = nxflat_addrenv_select(loadinfo);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_select() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_select() failed: %d\n", ret);
return ret;
}
#endif
@@ -558,7 +558,7 @@ static inline int nxflat_clearbss(FAR struct nxflat_loadinfo_s *loadinfo)
ret = nxflat_addrenv_restore(loadinfo);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_restore() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_restore() failed: %d\n", ret);
}
return ret;
+3 -3
View File
@@ -112,7 +112,7 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
if (loadinfo->filfd < 0)
{
int errval = errno;
bdbg("Failed to open NXFLAT binary %s: %d\n", filename, errval);
berr("Failed to open NXFLAT binary %s: %d\n", filename, errval);
return -errval;
}
@@ -122,7 +122,7 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
sizeof(struct nxflat_hdr_s), 0);
if (ret < 0)
{
bdbg("Failed to read NXFLAT header: %d\n", ret);
berr("Failed to read NXFLAT header: %d\n", ret);
return ret;
}
@@ -140,7 +140,7 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
* done so.
*/
bdbg("Bad NXFLAT header\n");
berr("Bad NXFLAT header\n");
return -ENOEXEC;
}
+5 -5
View File
@@ -150,7 +150,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
MAP_SHARED | MAP_FILE, loadinfo->filfd, 0);
if (loadinfo->ispace == (uint32_t)MAP_FAILED)
{
bdbg("Failed to map NXFLAT ISpace: %d\n", errno);
berr("Failed to map NXFLAT ISpace: %d\n", errno);
return -errno;
}
@@ -163,7 +163,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
ret = nxflat_addrenv_alloc(loadinfo, loadinfo->dsize);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_alloc() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_alloc() failed: %d\n", ret);
return ret;
}
@@ -180,7 +180,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
ret = nxflat_addrenv_select(loadinfo);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_select() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_select() failed: %d\n", ret);
return ret;
}
#endif
@@ -193,7 +193,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
dreadsize, doffset);
if (ret < 0)
{
bdbg("Failed to read .data section: %d\n", ret);
berr("Failed to read .data section: %d\n", ret);
goto errout;
}
@@ -206,7 +206,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
ret = nxflat_addrenv_restore(loadinfo);
if (ret < 0)
{
bdbg("ERROR: nxflat_addrenv_restore() failed: %d\n", ret);
berr("ERROR: nxflat_addrenv_restore() failed: %d\n", ret);
return ret;
}
#endif
+3 -3
View File
@@ -129,7 +129,7 @@ int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, int readsize,
if (rpos != offset)
{
int errval = errno;
bdbg("Failed to seek to position %d: %d\n", offset, errval);
berr("Failed to seek to position %d: %d\n", offset, errval);
return -errval;
}
@@ -141,13 +141,13 @@ int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, int readsize,
int errval = errno;
if (errval != EINTR)
{
bdbg("Read from offset %d failed: %d\n", offset, errval);
berr("Read from offset %d failed: %d\n", offset, errval);
return -errval;
}
}
else if (nbytes == 0)
{
bdbg("Unexpected end of file\n");
berr("Unexpected end of file\n");
return -ENODATA;
}
else
+2 -2
View File
@@ -79,7 +79,7 @@ int nxflat_verifyheader(const struct nxflat_hdr_s *header)
{
if (!header)
{
bdbg("NULL NXFLAT header!");
berr("NULL NXFLAT header!");
return -ENOEXEC;
}
@@ -91,7 +91,7 @@ int nxflat_verifyheader(const struct nxflat_hdr_s *header)
if (strncmp(header->h_magic, NXFLAT_MAGIC, 4) != 0)
{
bdbg("Unrecognized magic=\"%c%c%c%c\"\n",
berr("Unrecognized magic=\"%c%c%c%c\"\n",
header->h_magic[0], header->h_magic[1],
header->h_magic[2], header->h_magic[3]);
return -ENOEXEC;
+23 -23
View File
@@ -107,31 +107,31 @@ static void nxflat_dumploadinfo(struct nxflat_loadinfo_s *loadinfo)
{
unsigned long dsize = loadinfo->datasize + loadinfo->bsssize;
bdbg("LOAD_INFO:\n");
bdbg(" ISPACE:\n");
bdbg(" ispace: %08lx\n", loadinfo->ispace);
bdbg(" entryoffs: %08lx\n", loadinfo->entryoffs);
bdbg(" isize: %08lx\n", loadinfo->isize);
berr("LOAD_INFO:\n");
berr(" ISPACE:\n");
berr(" ispace: %08lx\n", loadinfo->ispace);
berr(" entryoffs: %08lx\n", loadinfo->entryoffs);
berr(" isize: %08lx\n", loadinfo->isize);
bdbg(" DSPACE:\n");
bdbg(" dspace: %08lx\n", loadinfo->dspace);
berr(" DSPACE:\n");
berr(" dspace: %08lx\n", loadinfo->dspace);
if (loadinfo->dspace != NULL)
{
bdbg(" crefs: %d\n", loadinfo->dspace->crefs);
bdbg(" region: %08lx\n", loadinfo->dspace->region);
berr(" crefs: %d\n", loadinfo->dspace->crefs);
berr(" region: %08lx\n", loadinfo->dspace->region);
}
bdbg(" datasize: %08lx\n", loadinfo->datasize);
bdbg(" bsssize: %08lx\n", loadinfo->bsssize);
bdbg(" (pad): %08lx\n", loadinfo->dsize - dsize);
bdbg(" stacksize: %08lx\n", loadinfo->stacksize);
bdbg(" dsize: %08lx\n", loadinfo->dsize);
berr(" datasize: %08lx\n", loadinfo->datasize);
berr(" bsssize: %08lx\n", loadinfo->bsssize);
berr(" (pad): %08lx\n", loadinfo->dsize - dsize);
berr(" stacksize: %08lx\n", loadinfo->stacksize);
berr(" dsize: %08lx\n", loadinfo->dsize);
bdbg(" RELOCS:\n");
bdbg(" relocstart: %08lx\n", loadinfo->relocstart);
bdbg(" reloccount: %d\n", loadinfo->reloccount);
berr(" RELOCS:\n");
berr(" relocstart: %08lx\n", loadinfo->relocstart);
berr(" reloccount: %d\n", loadinfo->reloccount);
bdbg(" HANDLES:\n");
bdbg(" filfd: %d\n", loadinfo->filfd);
berr(" HANDLES:\n");
berr(" filfd: %d\n", loadinfo->filfd);
}
#else
# define nxflat_dumploadinfo(i)
@@ -159,7 +159,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
nxflat_dumploadinfo(&loadinfo);
if (ret != 0)
{
bdbg("Failed to initialize for load of NXFLAT program: %d\n", ret);
berr("Failed to initialize for load of NXFLAT program: %d\n", ret);
goto errout;
}
@@ -169,7 +169,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
nxflat_dumploadinfo(&loadinfo);
if (ret != 0)
{
bdbg("Failed to load NXFLAT program binary: %d\n", ret);
berr("Failed to load NXFLAT program binary: %d\n", ret);
goto errout_with_init;
}
@@ -178,7 +178,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
ret = nxflat_bind(&loadinfo, binp->exports, binp->nexports);
if (ret != 0)
{
bdbg("Failed to bind symbols program binary: %d\n", ret);
berr("Failed to bind symbols program binary: %d\n", ret);
goto errout_with_load;
}
@@ -256,7 +256,7 @@ int nxflat_initialize(void)
ret = register_binfmt(&g_nxflatbinfmt);
if (ret != 0)
{
bdbg("Failed to register binfmt: %d\n", ret);
berr("Failed to register binfmt: %d\n", ret);
}
return ret;
}
+13 -13
View File
@@ -174,7 +174,7 @@ static int pcode_mount_testfs(void)
NSECTORS(ROMFS_IMG_LEN), SECTORSIZE);
if (ret < 0)
{
bdbg("ERROR: romdisk_register failed: %d\n", ret);
berr("ERROR: romdisk_register failed: %d\n", ret);
return ret;
}
@@ -190,7 +190,7 @@ static int pcode_mount_testfs(void)
int errval = get_errno();
DEBUGASSERT(errval > 0);
bdbg("ERROR: mount(%s,%s,romfs) failed: %d\n",
berr("ERROR: mount(%s,%s,romfs) failed: %d\n",
CONFIG_PCODE_TEST_DEVPATH, CONFIG_PCODE_TEST_MOUNTPOINT, errval);
return -errval;
}
@@ -266,7 +266,7 @@ static int pcode_proxy(int argc, char **argv)
ret = on_exit(pcode_onexit, binp);
if (ret < 0)
{
bdbg("ERROR: on_exit failed: %d\n", get_errno());
berr("ERROR: on_exit failed: %d\n", get_errno());
kmm_free(fullpath);
return EXIT_FAILURE;
}
@@ -283,7 +283,7 @@ static int pcode_proxy(int argc, char **argv)
if (ret < 0)
{
bdbg("ERROR: Execution failed\n");
berr("ERROR: Execution failed\n");
return EXIT_FAILURE;
}
@@ -318,7 +318,7 @@ static int pcode_load(struct binary_s *binp)
if (fd < 0)
{
int errval = get_errno();
bdbg("ERROR: Failed to open binary %s: %d\n", binp->filename, errval);
berr("ERROR: Failed to open binary %s: %d\n", binp->filename, errval);
return -errval;
}
@@ -341,12 +341,12 @@ static int pcode_load(struct binary_s *binp)
if (errval != EINTR)
{
bdbg("ERROR: read failed: %d\n", errval);
berr("ERROR: read failed: %d\n", errval);
ret = -errval;
goto errout_with_fd;
}
bdbg("Interrupted by a signal\n");
berr("Interrupted by a signal\n");
}
else
{
@@ -366,7 +366,7 @@ static int pcode_load(struct binary_s *binp)
if (memcmp(&hdr.fh_ident, FHI_POFF_MAG, 4) != 0 || hdr.fh_type != FHT_EXEC)
{
dbg("ERROR: File is not a P-code executable: %d\n");
err("ERROR: File is not a P-code executable: %d\n");
ret = -ENOEXEC;
goto errout_with_fd;
}
@@ -399,7 +399,7 @@ static int pcode_load(struct binary_s *binp)
g_pcode_handoff.fullpath = strdup(binp->filename);
if (!g_pcode_handoff.fullpath)
{
bdbg("ERROR: Failed to duplicate the full path: %d\n",
berr("ERROR: Failed to duplicate the full path: %d\n",
binp->filename);
sem_post(&g_pcode_handoff.exclsem);
@@ -473,7 +473,7 @@ int pcode_initialize(void)
ret = pcode_mount_testfs();
if (ret < 0)
{
bdbg("ERROR: Failed to mount test file system: %d\n", ret);
berr("ERROR: Failed to mount test file system: %d\n", ret);
return ret;
}
@@ -484,7 +484,7 @@ int pcode_initialize(void)
ret = register_binfmt(&g_pcode_binfmt);
if (ret != 0)
{
bdbg("Failed to register binfmt: %d\n", ret);
berr("Failed to register binfmt: %d\n", ret);
}
return ret;
@@ -513,7 +513,7 @@ void pcode_uninitialize(void)
int errval = get_errno();
DEBUGASSERT(errval > 0);
bdbg("ERROR: unregister_binfmt() failed: %d\n", errval);
berr("ERROR: unregister_binfmt() failed: %d\n", errval);
UNUSED(errval);
}
@@ -524,7 +524,7 @@ void pcode_uninitialize(void)
int errval = get_errno();
DEBUGASSERT(errval > 0);
bdbg("ERROR: umount(%s) failed: %d\n", CONFIG_PCODE_TEST_MOUNTPOINT, errval);
berr("ERROR: umount(%s) failed: %d\n", CONFIG_PCODE_TEST_MOUNTPOINT, errval);
UNUSED(errval);
}
#endif