Cherry-pick CL 1250286 from SC stg.

HSA Finalizer: Add dumping of code object, ISA and executable to loader.

This is controlled by loader options -dump-all, -dump-isa, -dump-code, -dump-exec

The options can now also be set with env variable LOADER_OPTIONS_APPEND.

Added tests to finalizer_offline

Testing: smoke, dumping on hardware

Reviewed by: Konstantin Zhuravlyov

[git-p4: depot-paths = "//depot/stg/hsa/drivers/hsa/runtime/": change = 1255351]
Šī revīzija ir iekļauta:
Nikolay Haustov [TEXT]
2016-04-07 06:01:20 -05:00
vecāks 823c254d61
revīzija a795909bca
5 mainīti faili ar 177 papildinājumiem un 0 dzēšanām
@@ -47,6 +47,7 @@
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <sstream>
#ifdef _WIN32
#include <Windows.h>
#include <io.h>
@@ -1029,5 +1030,20 @@ void ltrim(std::string &str) {
str.erase(str.begin(), std::find_if(str.begin(), str.end(), IsNotSpace));
}
std::string DumpFileName(const std::string& dir, const char* prefix, const char* ext, unsigned n, unsigned i)
{
std::ostringstream ss;
if (!dir.empty()) {
ss << dir << "/";
}
ss <<
prefix <<
std::setfill('0') << std::setw(3) << n;
if (i) { ss << "_" << i; }
if (ext) { ss << "." << ext; }
return ss.str();
}
}
}