Skip to content

Commit 9a8f0f7

Browse files
committed
More messages use homefy() so regression tests
independent of that aspect of the path of relevant strings. modified: src/bin/dwarfdump/dwarfdump.c
1 parent 992fb90 commit 9a8f0f7

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

src/bin/dwarfdump/dwarfdump.c

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ static struct esb_s global_tied_file_name;
130130

131131
static void print_machine_arch(Dwarf_Debug dbg);
132132

133+
static void homeify(char *s, struct esb_s* out);
134+
133135
static int process_one_file(
134136
const char * file_name,
135137
const char * tied_file_name,
@@ -512,15 +514,26 @@ main(int argc, char *argv[])
512514
&tpath_source,&errcode);
513515
if (res != DW_DLV_OK) {
514516
if (res == DW_DLV_ERROR) {
515-
char *errmsg = dwarf_errmsg_by_number(errcode);
517+
char *errmsg = 0;
518+
struct esb_s m;
519+
520+
esb_constructor(&m);
521+
errmsg = dwarf_errmsg_by_number(errcode);
522+
homeify((char *)sanitized(tied_file_name),&m);
516523
printf("%s ERROR: can't open tied file"
517524
".. %s: %s\n",
518-
glflags.program_name, sanitized(tied_file_name),
525+
glflags.program_name,
526+
esb_get_string(&m),
519527
errmsg);
528+
esb_destructor(&m);
520529
} else {
530+
struct esb_s m;
531+
esb_constructor(&m);
532+
homeify((char *)sanitized(tied_file_name),&m);
521533
printf(
522534
"%s ERROR: tied file not an object file '%s'.\n",
523-
glflags.program_name, sanitized(tied_file_name));
535+
glflags.program_name, esb_get_string(&m));
536+
esb_destructor(&m);
524537
}
525538
glflags.gf_count_major_errors++;
526539
global_destructors();
@@ -529,12 +542,21 @@ main(int argc, char *argv[])
529542
}
530543
if (ftype != tftype || endian != tendian ||
531544
offsetsize != toffsetsize) {
545+
struct esb_s m;
546+
struct esb_s mgf;
547+
548+
esb_constructor(&m);
549+
esb_constructor(&mgf);
550+
homeify((char *)sanitized(tied_file_name),&m);
551+
homeify((char *)esb_get_string(&global_file_name),&mgf);
532552
printf("%s ERROR: tied file \'%s\' and "
533553
"main file \'%s\' not "
534554
"the same kind of object!\n",
535555
glflags.program_name,
536-
sanitized(tied_file_name),
537-
esb_get_string(&global_file_name));
556+
esb_get_string(&m),
557+
esb_get_string(&mgf));
558+
esb_destructor(&m);
559+
esb_destructor(&mgf);
538560
free(temp_path_buf);
539561
global_destructors();
540562
glflags.gf_count_major_errors++;
@@ -544,10 +566,16 @@ main(int argc, char *argv[])
544566
global_tiedfd = open_a_file(esb_get_string(
545567
&global_tied_file_name));
546568
if (global_tiedfd == -1) {
569+
struct esb_s m;
570+
571+
esb_constructor(&m);
572+
homeify((char *)sanitized(esb_get_string(
573+
&global_tied_file_name)), &m);
547574
printf("%s ERROR: can't open tied file"
548575
"... %s\n",
549576
glflags.program_name,
550-
sanitized(esb_get_string(&global_tied_file_name)));
577+
esb_get_string(&m));
578+
esb_destructor(&m);
551579
global_destructors();
552580
glflags.gf_count_major_errors++;
553581
free(temp_path_buf);
@@ -977,7 +1005,13 @@ process_one_file(
9771005
"for section group %d \n",
9781006
file_name,glflags.group_number);
9791007
} else {
980-
printf("No DWARF information present in %s\n",file_name);
1008+
struct esb_s m;
1009+
1010+
esb_constructor(&m);
1011+
homeify((char *)file_name,&m);
1012+
printf("No DWARF information present in %s\n",
1013+
esb_get_string(&m));
1014+
esb_destructor(&m);
9811015
}
9821016
return dres;
9831017
}

0 commit comments

Comments
 (0)