diff options
| author | Matt Fleming <matt.fleming@intel.com> | 2013-07-26 16:35:59 +0100 |
|---|---|---|
| committer | Matt Fleming <matt.fleming@intel.com> | 2013-07-26 16:35:59 +0100 |
| commit | 0006a5e1bc8742fbbc6fbe52d1d12bab05eef311 (patch) | |
| tree | db06a85b4c2d773776e242fe34c90abfc2cdd9f5 /com32/lib/sys/module/common.c | |
| parent | 5131663c4ab29939ef6d23066d9832a23bb445a3 (diff) | |
| download | syslinux-6.02-pre14.tar.gz | |
module: convert to dprintf() to aid debuggingsyslinux-6.02-pre14
dprintf() is much more useful than DBG_PRINT() when trying to figure out
where a module is failing to load because we can enable the debug
statements at runtime.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/lib/sys/module/common.c')
| -rw-r--r-- | com32/lib/sys/module/common.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/com32/lib/sys/module/common.c b/com32/lib/sys/module/common.c index a589f24f..05a27e85 100644 --- a/com32/lib/sys/module/common.c +++ b/com32/lib/sys/module/common.c @@ -77,6 +77,7 @@ FILE *findpath(char *name) snprintf(path, sizeof(path), "%s%s%s", entry->str, slash ? "/" : "", name); + dprintf("findpath: trying \"%s\"\n", path); f = fopen(path, "rb"); if (f) return f; @@ -94,7 +95,7 @@ int image_load(struct elf_module *module) module->u.l._file = findpath(module->name); if (module->u.l._file == NULL) { - DBG_PRINT("Could not open object file '%s'\n", module->name); + dprintf("Could not open object file '%s'\n", module->name); goto error; } @@ -225,30 +226,30 @@ int check_header_common(Elf_Ehdr *elf_hdr) { elf_hdr->e_ident[EI_MAG2] != ELFMAG2 || elf_hdr->e_ident[EI_MAG3] != ELFMAG3) { - DBG_PRINT("The file is not an ELF object\n"); + dprintf("The file is not an ELF object\n"); return -1; } if (elf_hdr->e_ident[EI_CLASS] != ELFCLASS32 && elf_hdr->e_ident[EI_CLASS] != ELFCLASS64) { - DBG_PRINT("Invalid ELF class code\n"); + dprintf("Invalid ELF class code\n"); return -1; } if (elf_hdr->e_ident[EI_DATA] != MODULE_ELF_DATA) { - DBG_PRINT("Invalid ELF data encoding\n"); + dprintf("Invalid ELF data encoding\n"); return -1; } if (elf_hdr->e_ident[EI_VERSION] != MODULE_ELF_VERSION || elf_hdr->e_version != MODULE_ELF_VERSION) { - DBG_PRINT("Invalid ELF file version\n"); + dprintf("Invalid ELF file version\n"); return -1; } if (elf_hdr->e_machine != EM_386 && elf_hdr->e_machine != EM_X86_64) { - DBG_PRINT("Invalid ELF architecture\n"); + dprintf("Invalid ELF architecture\n"); return -1; } @@ -360,7 +361,7 @@ int check_symbols(struct elf_module *module) // and ISOLINUX. See perform_relocations(). if (strong_count == 0 && weak_count == 0) { - DBG_PRINT("Symbol %s is undefined\n", crt_name); + dprintf("Symbol %s is undefined\n", crt_name); printf("Undef symbol FAIL: %s\n",crt_name); return -1; } @@ -371,7 +372,7 @@ int check_symbols(struct elf_module *module) { // It's not an error - at relocation, the most recent symbol // will be considered - DBG_PRINT("Info: Symbol %s is defined more than once\n", crt_name); + dprintf("Info: Symbol %s is defined more than once\n", crt_name); } } //printf("symbol %s laoded from %d\n",crt_name,crt_sym->st_value); @@ -393,7 +394,7 @@ int _module_unload(struct elf_module *module) { struct module_dep *crt_dep, *tmp; // Make sure nobody needs us if (!module_unloadable(module)) { - DBG_PRINT("Module is required by other modules.\n"); + dprintf("Module is required by other modules.\n"); return -1; } @@ -409,9 +410,11 @@ int _module_unload(struct elf_module *module) { if (module->module_addr != NULL) { elf_free(module->module_addr); - DBG_PRINT("%s MODULE %s UNLOADED\n", module->shallow ? "SHALLOW" : "", + dprintf("%s MODULE %s UNLOADED\n", module->shallow ? "SHALLOW" : "", module->name); } + + dprintf("Unloading module %s\n", module->name); // Release the module structure free(module); @@ -487,7 +490,7 @@ static Elf_Sym *module_find_symbol_gnu(const char *name, struct elf_module *modu Elf_Word bitmask_nwords = *cr_word++; if ((bitmask_nwords & (bitmask_nwords - 1)) != 0) { - DBG_PRINT("Invalid GNU Hash structure\n"); + dprintf("Invalid GNU Hash structure\n"); return NULL; } |
