Improve error messaging
This commit is contained in:
parent
2e98ee3a1c
commit
f688baabb7
10
src/fileio.c
10
src/fileio.c
|
@ -887,8 +887,8 @@ static int elf2b(const char *infile, FILE *inf,
|
||||||
if (ph[i].p_type != PT_LOAD || ph[i].p_filesz == 0)
|
if (ph[i].p_type != PT_LOAD || ph[i].p_filesz == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pmsg_notice2("considering PT_LOAD program header entry #%d:\n"
|
pmsg_notice2("considering PT_LOAD program header entry #%d\n", (int) i);
|
||||||
" p_vaddr 0x%x, p_paddr 0x%x, p_filesz %d\n", (int) i, ph[i].p_vaddr, ph[i].p_paddr, ph[i].p_filesz);
|
imsg_notice2("p_vaddr 0x%x, p_paddr 0x%x, p_filesz %d\n", ph[i].p_vaddr, ph[i].p_paddr, ph[i].p_filesz);
|
||||||
|
|
||||||
Elf_Scn *scn = NULL;
|
Elf_Scn *scn = NULL;
|
||||||
while ((scn = elf_nextscn(e, scn)) != NULL) {
|
while ((scn = elf_nextscn(e, scn)) != NULL) {
|
||||||
|
@ -916,7 +916,7 @@ static int elf2b(const char *infile, FILE *inf,
|
||||||
pmsg_notice2("found section %s, LMA 0x%x, sh_size %u\n", sname, lma, sh->sh_size);
|
pmsg_notice2("found section %s, LMA 0x%x, sh_size %u\n", sname, lma, sh->sh_size);
|
||||||
|
|
||||||
if(!(lma >= low && lma + sh->sh_size < high)) {
|
if(!(lma >= low && lma + sh->sh_size < high)) {
|
||||||
msg_notice2(" => skipping, inappropriate for %s memory region\n", mem->desc);
|
imsg_notice2("skipping %s (inappropriate for %s)\n", sname, mem->desc);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -936,7 +936,7 @@ static int elf2b(const char *infile, FILE *inf,
|
||||||
|
|
||||||
Elf_Data *d = NULL;
|
Elf_Data *d = NULL;
|
||||||
while ((d = elf_getdata(scn, d)) != NULL) {
|
while ((d = elf_getdata(scn, d)) != NULL) {
|
||||||
msg_notice2(" Data block: d_buf %p, d_off 0x%x, d_size %ld\n",
|
imsg_notice2("data block: d_buf %p, d_off 0x%x, d_size %ld\n",
|
||||||
d->d_buf, (unsigned int)d->d_off, (long) d->d_size);
|
d->d_buf, (unsigned int)d->d_off, (long) d->d_size);
|
||||||
if (mem->size == 1) {
|
if (mem->size == 1) {
|
||||||
if (d->d_off != 0) {
|
if (d->d_off != 0) {
|
||||||
|
@ -946,7 +946,7 @@ static int elf2b(const char *infile, FILE *inf,
|
||||||
pmsg_error("ELF file section does not contain byte at offset %d\n", foff);
|
pmsg_error("ELF file section does not contain byte at offset %d\n", foff);
|
||||||
rv = -1;
|
rv = -1;
|
||||||
} else {
|
} else {
|
||||||
msg_notice2(" Extracting one byte from file offset %d\n", foff);
|
imsg_notice2("extracting one byte from file offset %d\n", foff);
|
||||||
mem->buf[0] = ((unsigned char *)d->d_buf)[foff];
|
mem->buf[0] = ((unsigned char *)d->d_buf)[foff];
|
||||||
mem->tags[0] = TAG_ALLOCATED;
|
mem->tags[0] = TAG_ALLOCATED;
|
||||||
size = 1;
|
size = 1;
|
||||||
|
|
Loading…
Reference in New Issue