From 0a330c0479a363bc5ab2e2c036fd938b52f4c92c Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 4 Apr 2011 09:52:31 +0200 Subject: Added debugging output to elf2e32_qtwrapper. Reviewed-by: Trust me --- bin/elf2e32_qtwrapper.pl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl index 6675012..8b8eab9 100755 --- a/bin/elf2e32_qtwrapper.pl +++ b/bin/elf2e32_qtwrapper.pl @@ -81,9 +81,37 @@ my $fixupFile = ""; my $runCount = 0; my $returnCode = 0; +# For debugging. Make it nonzero to give verbose output. +my $debugScript = 1; +my @usedDefFiles; +sub recordDefFile { + return if (!$debugScript); + + my ($msg, $file) = @_; + my $content = "$msg, $file:\n"; + my $defFileFd; + if (!open($defFileFd, "< $file")) { + print("Warning: Could not open $file (for debug analysis)\n"); + return; + } + while (<$defFileFd>) { + $content .= $_; + } + + push(@usedDefFiles, $content); +} +sub printRecordedDefFiles { + return if (!$debugScript); + + foreach (@usedDefFiles) { + print ("$_\n"); + } +} + while (1) { if (++$runCount > 2) { print("Internal error in $0, link succeeded, but exports may be wrong.\n"); + printRecordedDefFiles; last; } @@ -110,6 +138,9 @@ while (1) { } close($elf2e32Pipe); + recordDefFile("Run no $runCount, elf2e32 DEF file input", "$definput[1]"); + recordDefFile("Run no $runCount, elf2e32 DEF file output", "$defoutput[1]"); + if ($errors) { $returnCode = 1; last; -- cgit v0.12