dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pnet-developers] [bugs #9542] GCHandle.AddrOfPinnedObject gives incorre


From: Llewellyn Pritchard
Subject: [Pnet-developers] [bugs #9542] GCHandle.AddrOfPinnedObject gives incorrect address for arrays
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2; .NET CLR 1.1.4322; .NET CLR 2.0.40607)

This mail is an automated notification from the bugs tracker
 of the project: DotGNU Portable.NET.

/**************************************************************************/
[bugs #9542] Latest Modifications:

Changes by: 
                Llewellyn Pritchard <address@hidden>
'Date: 
                Sat 07/03/2004 at 23:08 (GMT)

------------------ Additional Follow-up Comments ----------------------------
Here's a patch to resolve. I'm no sure if that will break something else... 

Summary:

Added to pnet/engine/lib_gc.c in _IL_GCHandle_GCAddrOfPinnedObject:

The ILObject needs to be checked whether its an array so the "real" buffer can 
be passed.

object = GetObjectFromGcBase(ptr);
if (_ILIsSArray((System_Array *)object))
{
  object = ((void *)(((System_Array *)(object)) + 1));
}

Output:
$ ilrun test.exe
270700556 270700556
size of array[x]: 1
==> array(1982) = 1
==> array(1983) = 2






/**************************************************************************/
[bugs #9542] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=9542>
Project: DotGNU Portable.NET
Submitted by: Marcus Urban
On: Sat 07/03/2004 at 21:49

Category:  None
Severity:  5 - Average
Item Group:  None
Resolution:  None
Assigned to:  None
Status:  Open


Summary:  GCHandle.AddrOfPinnedObject gives incorrect address for arrays

Original Submission:  When a GCHandle with GCHandleType.Pinned is created, it 
should be possible to obtain the address of the object with 
GCHandle.AddrOfPinnedObject(). When the object in question is an array, Pnet 
appears to return a pointer to some header information that preceeds the actual 
appear data. However, Rotor returns a pointer to the first element of the 
array. Note in the output samples below that element 1 is incorrect and that 
the array indexes are offset.

To compile the test cases, use

1. gcc -shared -o libtest.so test.c 
2. cscc -o test.exe test.cs 
3. ilrun test.exe 

Output from ilrun:

136372232 136372232
size of array[x]: 1
==> array(1) = 48
==> array(1986) = 1
==> array(1987) = 2

Output from Rotor:

1093363496 1093363496 
size of array[x]: 1 
==> array(1982) = 1 
==> array(1983) = 2



Follow-up Comments
------------------


-------------------------------------------------------
Date: Sat 07/03/2004 at 23:08       By: leppie
Here's a patch to resolve. I'm no sure if that will break something else... 

Summary:

Added to pnet/engine/lib_gc.c in _IL_GCHandle_GCAddrOfPinnedObject:

The ILObject needs to be checked whether its an array so the "real" buffer can 
be passed.

object = GetObjectFromGcBase(ptr);
if (_ILIsSArray((System_Array *)object))
{
  object = ((void *)(((System_Array *)(object)) + 1));
}

Output:
$ ilrun test.exe
270700556 270700556
size of array[x]: 1
==> array(1982) = 1
==> array(1983) = 2






File Attachments
-------------------

-------------------------------------------------------
Date: Sat 07/03/2004 at 23:08  Name: leppie-040704.patch  Size: 32.03KB   By: 
leppie

http://savannah.gnu.org/bugs/download.php?item_id=9542&amp;item_file_id=1458

-------------------------------------------------------
Date: Sat 07/03/2004 at 21:50  Name: test.cs  Size: 510B   By: mathpup
Test case (C# component)
http://savannah.gnu.org/bugs/download.php?item_id=9542&amp;item_file_id=1457

-------------------------------------------------------
Date: Sat 07/03/2004 at 21:49  Name: test.c  Size: 345B   By: mathpup
Test case (C component)
http://savannah.gnu.org/bugs/download.php?item_id=9542&amp;item_file_id=1456






For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=9542>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]