mono/mono — pull request #350 by robwilkens (2012-06-25 15:04:32+00:00)
Title: Bug 1089 Fix: Fix proc/mod name match by also starting at last / in proc...

...name

Per Bug 1089, found we were failing to match process name to module name
when we were running a process via a subdirectory.

We were already stripping the path off the module name in the following
lines:

lastsep = strrchr (mname, '/');
if (lastsep)
if (!strcmp (lastsep+1, pname))
result = TRUE;

But we never did a similar strip of the module (pname) file path. My
presumption is that if it's safe to strip the path off the process name, it
should be equally safe to strip the path off the module name.

This works for the sample code in bug 1089:
https://bugzilla.xamarin.com/show_bug.cgi?id=1089

I am not sure it's smart to strip the path off either process name or module
name, but if you do it from one, it should be safe to do it from the other.

Feel free to reject this patch if you do not like this change. This is my
first time modifying C code in mono, and i feel a little uneasy doing it.

I will be straightforward and honest here, I did some debugging, and
the process name was resolving as follows when run as a subdirectory:

pname=[/home/robwilkens/test10.exe]

The actual path should have been (when run as : "mono monotests/test10.exe")

/home/robwilkens/monotests/test10.exe

The monotests part of the directory was never included in pname.

So the relative path was lost somewhere along the way.