Xamarin-5278: Fix Binder.SelectMethod when passed argument is COM object

This patch fixes the problem that reflection doesn't find the
constructor of a class if one of the arguments is a COM object
implemented in unmanaged code. In that case the proxy can't
be converted to a managed object and we didn't check if the
COM object implements the desired interface.

Change-Id: Ie086bbb898ae2de8bd38b9f81422086e017a859e
Some improvements suggested by discussion in pull request

Change-Id: I9d1c2dc31b7f744a7d948fd5fb27d15b77c0ee11
Add unit test for Xamarin-5278

Change-Id: Ic2d9070148b6582933a4116c288d08c176c80738
Build Configuration: Don't build libmono to Release_SGen in x64 Release mode.
DataGrid Bug Fix: Crash b/c Columns not tracked properly when switching tables

Columns are tracked in CurrentTableStlye, if user switched between tables
to a subtable or by going back to a previous table, the number of columns
could change, but specifically when navigating back, the previous column
list was not being restored.

The primary fix in this change is to track CurrentTableStyle and grid_style
by pushing them onto a stack when going to a subtable, and popping them
from a stack when we navigate back to previous table.  This resolves the
crash reported in bug 5511 and possibly 5510.

A Secondary fix, which i discovered while testing once i fixed this, was a
simple one-line fix to call EndEdit in NavigateTo and NavigateBack (where we
would push or pop the stack) so that a cell is not left in edit mode when
we switch between tables.  A consequence of not doing this might be when we
switch tables you'd see a cell from the previous table in edit mode on the
new table.

A unit test for this will be committed next for the primary fix.  The secondary
fix can only be tested by visual inspection.
This is a unit test for Bug5487, Bug 5510, and maybe Bug 5511

Based loosely on the code here:
https://bugzilla.novell.com/show_bug.cgi?id=MONO79788
which was the sample code used to recreate the problems in the first place.
This hides Non-Browsable columns from DataGrid

This addresses at least part of the problem reported here:
https://bugzilla.novell.com/show_bug.cgi?id=322563

When you read a table from XML parent/child table relations are established
by virtue of hidden _Id fields.  Those _Id fields are marked non-browsable
when they are loaded.  This change modifies DataGridTableStyles so that
when it comes across a column that is marked non-browsable, it doesn't make
it browsable (viewable).  That is: It hides the internal use columns.
When reloading a DataGrid rows after, for example, a delete, crash fixed

Anything that would require a change in the number of rows, and trigerred
a DataGrid reload, did not cancel editing of the existing field, so there
was a problem if a row was deleted and you were still editing that row
(had the cursor in it).  I noticed this while testing the following bug report
sample code:

https://bugzilla.novell.com/show_bug.cgi?id=323154

Note: That code crashes if you press spacebar TWICE from my testing in either
.NET or Mono.  However, if you press spacebar ONCE this code behaves also
like .NET in that it will actually delete the row visibly from the screen
and prevent related problems from having an editable field open on a
now-deleted row.

\
Fix:Idle event handler was called on every thread rather than thread assigned on

Summary of changes in order git diff --staged is giving them to me:

(1) Each Xplat driver :
-local "Idle" variable remove, replaced with a Driver-level Idle_Threads
which is assigned by what is now the Idle Property.

-When Idle Called from with thread it used to do:
if (Idle != null)
   Idle (this, e)

now we have to do some additional checks and change the call similar to as
follows to get the per-thread idle event handler:

(pseudo-pseudo-code)
id=ManagedThreadId;
if (Idle_Threads is not null and it contains a key for the id and the key
indexes into a non-null event handler) then
   Idle_Threads [id] (this, e);

(2) Xplat Driver
Here's where the property is added and assigns the Idle event handler to
Idle_Threads.  A Lock was needed the first time we create the Idle_Threads
dictionary.  The Idle_Threads dictionary indexes by managed thread id and
maps onto an event handler for each one.

(3) Win32 Specific change
In my testing, I noticed that Win32 did not call Idle as part of its normal
Run loop processing.  So, when it would call GetMessage and it was Blocking
we now check Idle if we were going to block.  We don't actually call idle
if we first peekMessage and find a message, in those cases we just treat
it as if GetMessage Got the message.  If we are blocking and peek returns
no messages, we call idle.  If we have already called idle once on this
pass through the GetMessage Loop we set CheckIdle to false and go
back to the to to PRocessNextMEssage but this time we block rather than
peek and call idle.

This code was tested on Win32, MacOS/Carbon and Linux/X11.  There have been
some minor formatting changes (Code style) since the testing, which should
not affect test results.
Bug 1089 Fix: Fix proc/mod name match by also starting at last / in procname

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.
[debian] Update Debian submodule with packaging bugfixes
Merge pull request #394 from directhex/master

[debian] Update Debian submodule
Move some declarations out of a #ifdef in pthread_support.c to fix platforms without thread local alloc.
Add test for the behavior of discarding pending io events on appdomain unload.
When calculating allowance, don't blindly cast from double to uint as it might not saturate the result.

	* sgen-gc.c (try_calculate_minor_collection_allowance): For workloads with very high
	survival rates the calculated allowance_target can overflow a mword on 32bits systems.
	Given this behavior is unspecified and we've been bitten by it, let's take the safe
	side and manually saturate it.
[debian] Big bundle of packaging fixes, to massively simplify the job at Wrench's end, including a new script to build Debian packages inside the existing dirty prefix.
Fixed Math.Sqrtf and Math.Abs with LLVM.
Merge pull request #396 from directhex/master

Refresh Debian packaging
Merge pull request #397 from xen2/llvm_sqrt_abs

Fixed Math.Sqrtf and Math.Abs with LLVM.
Bump the debian-snapshot submodule again