summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-25 19:33:47 -0400
committermidipix <writeonce@midipix.org>2016-11-10 23:35:55 -0500
commit7ac294060c4789e19e8f541ee5af129593276144 (patch)
tree260966b7427bee6c3811b55b2fabde73b528bd2d
parentdf5be5d0ee9944c2436216ff3a4d07ba76ad043c (diff)
downloadperk-7ac294060c4789e19e8f541ee5af129593276144.tar.bz2
perk-7ac294060c4789e19e8f541ee5af129593276144.tar.xz
output: pe_output_error_record(): refined the record's unit header.
-rw-r--r--src/output/pe_output_error.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/output/pe_output_error.c b/src/output/pe_output_error.c
index e644fee..401ef6b 100644
--- a/src/output/pe_output_error.c
+++ b/src/output/pe_output_error.c
@@ -47,6 +47,18 @@ static const char * pe_output_error_header(const struct pe_error_info * erri)
return "distorted state";
}
+static const char * pe_output_unit_header(const struct pe_error_info * erri)
+{
+ if (!(erri->eflags & PERK_ERROR_CUSTOM))
+ return "while opening";
+
+ else if (erri->elibcode == PERK_ERR_IMAGE_SIZE_ZERO)
+ return "while mapping";
+
+ else
+ return "while parsing";
+}
+
static const char * pe_output_strerror(const struct pe_error_info * erri)
{
if (erri->eflags & PERK_ERROR_CUSTOM)
@@ -79,8 +91,9 @@ static int pe_output_error_record_plain(
: erri->eunit;
if (epath && !(erri->eflags & PERK_ERROR_NESTED))
- if (fprintf(stderr,"%s: [while opening] '%s':\n",
+ if (fprintf(stderr,"%s: [%s] '%s':\n",
dctx->program,
+ pe_output_unit_header(erri),
epath) < 0)
return -1;
@@ -110,13 +123,14 @@ static int pe_output_error_record_annotated(
if (epath && !(erri->eflags & PERK_ERROR_NESTED))
if (fprintf(
stderr,
- "%s%s%s:%s %s[while opening]%s %s%s'%s'%s:\n",
+ "%s%s%s:%s %s[%s]%s %s%s'%s'%s:\n",
aclr_bold,aclr_magenta,
dctx->program,
aclr_reset,
aclr_bold,
+ pe_output_unit_header(erri),
aclr_reset,
aclr_bold,aclr_red,