summaryrefslogtreecommitdiff
path: root/src/ildasm
diff options
context:
space:
mode:
authorManu <manu-silicon@users.noreply.github.com>2016-02-16 15:27:24 +0900
committerManu <manu-silicon@users.noreply.github.com>2016-02-18 10:40:34 +0900
commitabb5d8d97411b4260631f00fe3097e61e12466f1 (patch)
treee1b50ef3ae8aa98ddf2cfcf6b2a9680c4f2b0271 /src/ildasm
parentb4d8a8d865c2c1eba7166e5d6c822419b6f1a1ea (diff)
downloadcoreclr-abb5d8d97411b4260631f00fe3097e61e12466f1.tar.gz
coreclr-abb5d8d97411b4260631f00fe3097e61e12466f1.tar.bz2
coreclr-abb5d8d97411b4260631f00fe3097e61e12466f1.zip
Fix ildasm to be run without specifying the full path
Using the fixed version of GetEntrypointExecutableAbsolutePath when the program name on the command line does not reflect an actual file on disk (case when a program is launched by finding it in the PATH). This should fix issue#3190.
Diffstat (limited to 'src/ildasm')
-rw-r--r--src/ildasm/unixcoreclrloader/coreclrloader.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/ildasm/unixcoreclrloader/coreclrloader.cpp b/src/ildasm/unixcoreclrloader/coreclrloader.cpp
index 4cb7cf367d..11c5bd4d10 100644
--- a/src/ildasm/unixcoreclrloader/coreclrloader.cpp
+++ b/src/ildasm/unixcoreclrloader/coreclrloader.cpp
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
#include <stdio.h>
+#include <assert.h>
#include "dlfcn.h"
#include "coreclrloader.h"
#include "coreruncommon.h"
@@ -11,12 +12,15 @@ using namespace std;
void *CoreCLRLoader::LoadFunction(const char *funcName)
{
void *func = nullptr;
- if (coreclrLib == nullptr) {
+ if (coreclrLib == nullptr)
+ {
fprintf(stderr, "Error: coreclr should be loaded before loading a function: %s\n", funcName);
}
- else {
+ else
+ {
func = dlsym(coreclrLib, funcName);
- if (func == nullptr) {
+ if (func == nullptr)
+ {
fprintf(stderr, "Error: cannot find %s in coreclr\n", funcName);
}
}
@@ -26,7 +30,12 @@ void *CoreCLRLoader::LoadFunction(const char *funcName)
CoreCLRLoader* CoreCLRLoader::Create(const char *exePath)
{
string absolutePath, coreClrPath;
- GetAbsolutePath(exePath, absolutePath);
+ bool success = GetAbsolutePath(exePath, absolutePath);
+ if (!success)
+ {
+ success = GetEntrypointExecutableAbsolutePath(absolutePath);
+ assert(success);
+ }
GetDirectory(absolutePath.c_str(), coreClrPath);
coreClrPath.append("/");
coreClrPath.append(coreClrDll);
@@ -63,7 +72,8 @@ CoreCLRLoader* CoreCLRLoader::Create(const char *exePath)
int CoreCLRLoader::Finish()
{
- if (hostHandle != 0) {
+ if (hostHandle != 0)
+ {
shutdownCoreCLR(hostHandle, domainId);
delete this;
}