[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-devel-list
Subject:    Re: [Mono-dev] NRE when using pointers on armhf
From:       Slide <slide.o.mix () gmail ! com>
Date:       2015-03-26 22:20:42
Message-ID: CAPiUgVeD7arfwOY7MimfXSWNorCN6uCxqUHZiSxqzyZ_k5iOrw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks for the confirmation. I appreciate the help!

On Thu, Mar 26, 2015 at 3:11 PM Zoltan Varga <vargaz@gmail.com> wrote:

> Hi,
>
>  Mono sets up signal handlers in order to implement throwing null
> reference exceptions. This means that some SIGSEGVs etc. get converted to
> NullReferenceExceptions.
>
>               Zoltan
>
> On Thu, Mar 26, 2015 at 5:37 PM, Slide <slide.o.mix@gmail.com> wrote:
>
>> Yes, I can tell that the pointer is unaligned, I was wondering why I
>> would get a NullReferenceException for an unaligned access. I would assume
>> that mono sets up some handler or something that catches unaligned
>> exceptions? Maybe not?
>>
>> On Thu, Mar 26, 2015 at 2:23 PM Brandon Perry <bperry.volatile@gmail.com>
>> wrote:
>>
>>> Could also cast to an IntPtr and check the Size property, which would
>>> return the number of bytes in the pointer?
>>>
>>>
>>> https://msdn.microsoft.com/en-us/library/system.intptr.size%28v=vs.110%29.aspx
>>>
>>> Might be misunderstanding the issue though.
>>>
>>> On Thu, Mar 26, 2015 at 4:20 PM, Zoltan Varga <vargaz@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>>   You can check whenever the pointer is aligned by converting it into
>>>> an int.
>>>>
>>>>              Zoltan
>>>>
>>>> On Thu, Mar 26, 2015 at 4:53 PM, Slide <slide.o.mix@gmail.com> wrote:
>>>>
>>>>> That's a good point! Can you tell me where in the mono code that the
>>>>> unaligned accesses are handled? I'd just like to confirm.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> slide
>>>>>
>>>>> On Thu, Mar 26, 2015 at 1:13 PM Zoltan Varga <vargaz@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>  arm might require aligned reads, i.e. 'p' should be 4 byte aligned
>>>>>> in this case.
>>>>>>
>>>>>>           Zoltan
>>>>>>
>>>>>> On Thu, Mar 26, 2015 at 3:28 PM, Slide <slide.o.mix@gmail.com> wrote:
>>>>>>
>>>>>>> I am trying to compile and use the ZeroC Ice remoting library for
>>>>>>> armhf to run on my RaPi 2. The compilation goes fine, but when running the
>>>>>>> test suite I am getting a NullReferenceException on the pointer assignment
>>>>>>> in the following code:
>>>>>>>
>>>>>>> fixed(byte* p = &_bytes[_position])
>>>>>>> {
>>>>>>>     *((float*)p) = _valBytes.floatVal; // exception here
>>>>>>> }
>>>>>>>
>>>>>>> This same code works on x86_64, so I am assuming there is something
>>>>>>> that is missing in the armhf implementation.
>>>>>>>
>>>>>>> Is there something I can do to debug what might be missing and
>>>>>>> provide a patch? I've never done work on the mono runtime itself.
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> slide
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mono-devel-list mailing list
>>>>>>> Mono-devel-list@lists.ximian.com
>>>>>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>> _______________________________________________
>>>> Mono-devel-list mailing list
>>>> Mono-devel-list@lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>>
>>>>
>>>
>>>
>>> --
>>> http://volatile-minds.blogspot.com -- blog
>>> http://www.volatileminds.net -- website
>>>
>>
>

[Attachment #5 (text/html)]

<div dir="ltr">Thanks for the confirmation. I appreciate the help!<br></div><br><div \
class="gmail_quote">On Thu, Mar 26, 2015 at 3:11 PM Zoltan Varga &lt;<a \
href="mailto:vargaz@gmail.com">vargaz@gmail.com</a>&gt; wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>  Mono sets up signal \
handlers in order to implement throwing null reference exceptions. This means that \
some SIGSEGVs etc. get converted to NullReferenceExceptions.</div></div><div \
dir="ltr"><div><br></div><div>                     Zoltan</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 26, 2015 at 5:37 PM, \
Slide <span dir="ltr">&lt;<a href="mailto:slide.o.mix@gmail.com" \
target="_blank">slide.o.mix@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Yes, I can tell that the pointer is unaligned, \
I was wondering why I would get a NullReferenceException for an unaligned access. I \
would assume that mono sets up some handler or something that catches unaligned \
exceptions? Maybe not?<br></div><div><div><br><div class="gmail_quote">On Thu, Mar \
26, 2015 at 2:23 PM Brandon Perry &lt;<a href="mailto:bperry.volatile@gmail.com" \
target="_blank">bperry.volatile@gmail.com</a>&gt; wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Could also cast to an IntPtr and check the \
Size property, which would return the number of bytes in the \
pointer?<div><br></div><div><a \
href="https://msdn.microsoft.com/en-us/library/system.intptr.size%28v=vs.110%29.aspx" \
target="_blank">https://msdn.microsoft.com/en-us/library/system.intptr.size%28v=vs.110%29.aspx</a><br></div><div><br></div><div>Might \
be misunderstanding the issue though.</div></div><div class="gmail_extra"></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 26, 2015 at 4:20 PM, \
Zoltan Varga <span dir="ltr">&lt;<a href="mailto:vargaz@gmail.com" \
target="_blank">vargaz@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>   You can check \
whenever the pointer is aligned by converting it into an int.</div><span><font \
color="#888888"><div><br></div><div>                    \
Zoltan</div></font></span></div><div><div><div class="gmail_extra"><br><div \
class="gmail_quote">On Thu, Mar 26, 2015 at 4:53 PM, Slide <span dir="ltr">&lt;<a \
href="mailto:slide.o.mix@gmail.com" \
target="_blank">slide.o.mix@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">That&#39;s a good point! Can you tell me where \
in the mono code that the unaligned accesses are handled? I&#39;d just like to \
confirm.<br><br>Thanks!<span><font \
color="#888888"><div><br></div><div>slide</div></font></span></div><div><div><br><div \
class="gmail_quote">On Thu, Mar 26, 2015 at 1:13 PM Zoltan Varga &lt;<a \
href="mailto:vargaz@gmail.com" target="_blank">vargaz@gmail.com</a>&gt; \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>  arm might \
require aligned reads, i.e. &#39;p&#39; should be 4 byte aligned in this \
case.</div><div><br></div><div>               Zoltan</div></div><div \
class="gmail_extra"><br><div class="gmail_quote"></div></div><div \
class="gmail_extra"><div class="gmail_quote">On Thu, Mar 26, 2015 at 3:28 PM, Slide \
<span dir="ltr">&lt;<a href="mailto:slide.o.mix@gmail.com" \
target="_blank">slide.o.mix@gmail.com</a>&gt;</span> wrote:<br></div></div><div \
class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div \
dir="ltr">I am trying to compile and use the ZeroC Ice remoting library for armhf to \
run on my RaPi 2. The compilation goes fine, but when running the test suite I am \
getting a NullReferenceException on the pointer assignment in the following \
code:<div><br></div><div><div>fixed(byte* p = \
&amp;_bytes[_position])</div><div>{</div><div>      *((float*)p) = \
_valBytes.floatVal; // exception here</div><div>}</div></div><div><br></div><div>This \
same code works on x86_64, so I am assuming there is something that is missing in the \
armhf implementation.  </div><div><br></div><div>Is there something I can do to debug \
what might be missing and provide a patch? I&#39;ve never done work on the mono \
runtime itself.</div><div><br></div><div>Thanks,</div><div><br></div><div>slide</div><div><br></div></div>
 <br></blockquote></div></div><div class="gmail_extra"><div \
class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc \
solid;padding-left:1ex">_______________________________________________<br> \
Mono-devel-list mailing list<br> <a href="mailto:Mono-devel-list@lists.ximian.com" \
target="_blank">Mono-devel-list@lists.ximian.com</a><br> <a \
href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" \
target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br> \
<br></blockquote></div><br></div> </blockquote></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Mono-devel-list mailing list<br>
<a href="mailto:Mono-devel-list@lists.ximian.com" \
target="_blank">Mono-devel-list@lists.ximian.com</a><br> <a \
href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" \
target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br> \
<br></blockquote></div><br><br clear="all"><div><br></div></div><div \
class="gmail_extra">-- <br><div><a href="http://volatile-minds.blogspot.com" \
target="_blank">http://volatile-minds.blogspot.com</a> -- blog<br><a \
href="http://www.volatileminds.net" target="_blank">http://www.volatileminds.net</a> \
-- website</div> </div></blockquote></div>
</div></div></blockquote></div><br></div>
</blockquote></div>



_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic