Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Translate between managaed java and unmanaged jvm

Reply
Thread Tools

Translate between managaed java and unmanaged jvm

 
 
JR
Guest
Posts: n/a
 
      05-13-2010
Hello All -
When I debug .net ihave the docs and automated tool to interpret .net
managed objects from unmanaged code. So when i dump a native callstack
and see mscorwks.dll->CallMethDesc, i know that that is the native
code used to call into the .net managed code. I can then translate
mscorwks.dll->CallMethDesc to myclass->myNetFunction with one command.
This way i can debug mixed managed and unmanaged code very easily. I
assumed Java would be similiar but i have ben unabale to find tools or
documents that explain what method(s) in jvm.dll actually invoke the
managed java methods and how to get that info. For example, I have
this stack


08c3faac 7c827d0b 77e61d1e 000005ec 00000000 ntdll!KiFastSystemCallRet
08c3fab0 77e61d1e 000005ec 00000000 00000000 ntdll!
NtWaitForSingleObject+0xc
08c3fb20 77e61c8d 000005ec ffffffff 00000000 kernel32!
WaitForSingleObjectEx+0xac
08c3fb34 080a686e 000005ec ffffffff 0334b7e0 kernel32!
WaitForSingleObject+0x12
08c3fb70 080c119d 0334b660 1e20dd80 0334b660 jvm!JVM_FindSignal
+0x19be2
08c3fb90 0806aee5 0334b7e0 08c3fbc4 0334b660 jvm!
JVM_RegisterPerfMethods+0x13126
08c3fbb0 00887a7e 0334b660 08c3fbc4 00887a52 jvm+0x6aee5
08c3fbe8 00882c03 00000000 00000000 103f98f8 0x887a7e
08c3fc1c 00882c03 00000000 103f98f8 103f9558 0x882c03
08c3fc50 00882cda 103f9558 1e20de20 08c3fc60 0x882c03
08c3fd64 08070c8a 08c3fd98 08c3ff3c 0000000a 0x882cda
08c3fde4 080aab6d 0000000a 00000000 08c3fe94 jvm+0x70c8a
08c3fe20 08070b97 08070b9c 08c3ff34 08c3fe48 jvm!JVM_FindSignal
+0x1dee1
08c3fe3c 08070893 08c3ff34 0334b7dc 08c3fe94 jvm+0x70b97

i know this is executing a managed function but don't know how to get
that data. Does anyone know the tools or methods used to do this? It
looks like the jvm!JVM_FindSignal function is responsible for setting
up and calling managed java code but i am not sure.
 
Reply With Quote
 
 
 
 
Arne Vajhj
Guest
Posts: n/a
 
      05-13-2010
On 13-05-2010 17:46, JR wrote:
> When I debug .net ihave the docs and automated tool to interpret .net
> managed objects from unmanaged code. So when i dump a native callstack
> and see mscorwks.dll->CallMethDesc, i know that that is the native
> code used to call into the .net managed code. I can then translate
> mscorwks.dll->CallMethDesc to myclass->myNetFunction with one command.
> This way i can debug mixed managed and unmanaged code very easily. I
> assumed Java would be similiar but i have ben unabale to find tools or
> documents that explain what method(s) in jvm.dll actually invoke the
> managed java methods and how to get that info.


managed-unmanaged is not prioritized as high i Java as
in .NET, so I am not surprised that the tool support is
not as good.

But somewhere there must be some map for jvm.dll.

The extreme solution for you would be to get OpenJDK
and build it with the options to debug it.

Arne
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      05-13-2010
JR wrote:
> When I debug .net i [sic]have the docs and automated tool to interpret .net
> managed objects from unmanaged code. So when i [sic] dump a native callstack
> and see mscorwks.dll->CallMethDesc, i [sic] know that that is the native
> code used to call into the .net managed code. I can then translate
> mscorwks.dll->CallMethDesc to myclass->myNetFunction with one command.
> This way i [sic] can debug mixed managed and unmanaged code very easily. I
> assumed Java would be similiar but i [sic] have ben unabale to find tools or
> documents that explain what method(s) in jvm.dll actually invoke the
> managed java [sic] methods and how to get that info. For example, I have
> this stack
>
>
> 08c3faac 7c827d0b 77e61d1e 000005ec 00000000 ntdll!KiFastSystemCallRet
> 08c3fab0 77e61d1e 000005ec 00000000 00000000 ntdll!
> NtWaitForSingleObject+0xc
> 08c3fb20 77e61c8d 000005ec ffffffff 00000000 kernel32!
> WaitForSingleObjectEx+0xac
> 08c3fb34 080a686e 000005ec ffffffff 0334b7e0 kernel32!
> WaitForSingleObject+0x12
> 08c3fb70 080c119d 0334b660 1e20dd80 0334b660 jvm!JVM_FindSignal
> +0x19be2
> 08c3fb90 0806aee5 0334b7e0 08c3fbc4 0334b660 jvm!
> JVM_RegisterPerfMethods+0x13126
> 08c3fbb0 00887a7e 0334b660 08c3fbc4 00887a52 jvm+0x6aee5
> 08c3fbe8 00882c03 00000000 00000000 103f98f8 0x887a7e
> 08c3fc1c 00882c03 00000000 103f98f8 103f9558 0x882c03
> 08c3fc50 00882cda 103f9558 1e20de20 08c3fc60 0x882c03
> 08c3fd64 08070c8a 08c3fd98 08c3ff3c 0000000a 0x882cda
> 08c3fde4 080aab6d 0000000a 00000000 08c3fe94 jvm+0x70c8a
> 08c3fe20 08070b97 08070b9c 08c3ff34 08c3fe48 jvm!JVM_FindSignal
> +0x1dee1
> 08c3fe3c 08070893 08c3ff34 0334b7dc 08c3fe94 jvm+0x70b97
>
> i [sic] know this is executing a managed function but don't know how to get
> that data. Does anyone know the tools or methods used to do this? It
> looks like the jvm!JVM_FindSignal function is responsible for setting
> up and calling managed java [sic] code but i [sic] am not sure.


Don't do that.

The word "managed" has no relevance in Java because the word "unmanaged" has
no meaning. Everything is "managed". There is no "managed function", just
"method".

--
Lew
 
Reply With Quote
 
JR
Guest
Posts: n/a
 
      05-13-2010
On May 13, 6:26*pm, Lew <(E-Mail Removed)> wrote:
> JR wrote:
> > When I debug .net i [sic]have the docs and automated tool to interpret ..net
> > managed objects from unmanaged code. So when i [sic] dump a native callstack
> > and see mscorwks.dll->CallMethDesc, i [sic] know that that is the native
> > code used to call into the .net managed code. I can then translate
> > mscorwks.dll->CallMethDesc to myclass->myNetFunction with one command.
> > This way i [sic] can debug mixed managed and unmanaged code very easily.. I
> > assumed Java would be similiar but i [sic] have ben unabale to find tools or
> > documents that explain what method(s) in jvm.dll actually invoke the
> > managed java [sic] methods and how to get that info. For example, I have
> > this stack

>
> > 08c3faac 7c827d0b 77e61d1e 000005ec 00000000 ntdll!KiFastSystemCallRet
> > 08c3fab0 77e61d1e 000005ec 00000000 00000000 ntdll!
> > NtWaitForSingleObject+0xc
> > 08c3fb20 77e61c8d 000005ec ffffffff 00000000 kernel32!
> > WaitForSingleObjectEx+0xac
> > 08c3fb34 080a686e 000005ec ffffffff 0334b7e0 kernel32!
> > WaitForSingleObject+0x12
> > 08c3fb70 080c119d 0334b660 1e20dd80 0334b660 jvm!JVM_FindSignal
> > +0x19be2
> > 08c3fb90 0806aee5 0334b7e0 08c3fbc4 0334b660 jvm!
> > JVM_RegisterPerfMethods+0x13126
> > 08c3fbb0 00887a7e 0334b660 08c3fbc4 00887a52 jvm+0x6aee5
> > 08c3fbe8 00882c03 00000000 00000000 103f98f8 0x887a7e
> > 08c3fc1c 00882c03 00000000 103f98f8 103f9558 0x882c03
> > 08c3fc50 00882cda 103f9558 1e20de20 08c3fc60 0x882c03
> > 08c3fd64 08070c8a 08c3fd98 08c3ff3c 0000000a 0x882cda
> > 08c3fde4 080aab6d 0000000a 00000000 08c3fe94 jvm+0x70c8a
> > 08c3fe20 08070b97 08070b9c 08c3ff34 08c3fe48 jvm!JVM_FindSignal
> > +0x1dee1
> > 08c3fe3c 08070893 08c3ff34 0334b7dc 08c3fe94 jvm+0x70b97

>
> > i [sic] know this is executing a managed function but don't know how to get
> > that data. Does anyone know the tools or methods used to do this? It
> > looks like the jvm!JVM_FindSignal function is responsible for setting
> > up and calling managed java [sic] code but i [sic] am not sure.

>
> Don't do that.
>
> The word "managed" has no relevance in Java because the word "unmanaged" has
> no meaning. *Everything is "managed". There is no "managed function", just
> "method".
>
> --
> Lew- Hide quoted text -
>
> - Show quoted text -


consider it native code run by cpu vs byte code run by jvm.

You understand what im getting at though right?
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-13-2010
On 13-05-2010 19:26, Lew wrote:
> The word "managed" has no relevance in Java because the word "unmanaged"
> has no meaning. Everything is "managed". There is no "managed function",
> just "method".


It is .NET terminology.

Translation to Java:

managed = Java code
unmanaged = native code

Arne
 
Reply With Quote
 
JR
Guest
Posts: n/a
 
      05-14-2010
On May 13, 6:46*pm, Arne Vajhj <(E-Mail Removed)> wrote:
> On 13-05-2010 19:26, Lew wrote:
>
> > The word "managed" has no relevance in Java because the word "unmanaged"
> > has no meaning. Everything is "managed". There is no "managed function",
> > just "method".

>
> It is .NET terminology.
>
> Translation to Java:
>
> managed = Java code
> unmanaged = native code
>
> Arne


k, so given a windows crash dump how would one determine what java
code was being run by the jvm?
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      05-14-2010
Lew wrote:
>> The word "managed" has no relevance in Java because the word "unmanaged"
>> has no meaning. Everything is "managed". There is no "managed function",
>> just "method".


Arne Vajhøj wrote:
> It is .NET terminology.
>
> Translation to Java:
>
> managed = Java code
> unmanaged = native code


That is instructive. I thought "unmanaged" code in .Net (with which I'm
barely passingly familiar) meant high-level code still (e.g., C#), but without
the memory-management features (GC).

--
Lew
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      05-14-2010
JR wrote:
> consider it native code run by cpu vs byte code run by jvm.
>
> You understand what im [sic] getting at though right?


Now I do, thanks to your and Arne's explanations. I don't get why you need
that information.

Also, the native code run in the JVM changes during execution, at least with
the Hotspot compiler, as optimizations come and go.

Much more convenient that non-portably hacking the JVM, I'd think, would be
using the inbuilt debugging facilities of the JVM, which explicitly provide
for peering into the methods and data in use by a program.

--
Lew
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-14-2010
On 13-05-2010 20:31, Lew wrote:
> Lew wrote:
>>> The word "managed" has no relevance in Java because the word "unmanaged"
>>> has no meaning. Everything is "managed". There is no "managed function",
>>> just "method".

>
> Arne Vajhøj wrote:
>> It is .NET terminology.
>>
>> Translation to Java:
>>
>> managed = Java code
>> unmanaged = native code

>
> That is instructive. I thought "unmanaged" code in .Net (with which I'm
> barely passingly familiar) meant high-level code still (e.g., C#), but
> without the memory-management features (GC).


The very short version is that:

managed code = C# code

unmanaged code = C/C++ code called via one of DllImport, COM interop or
mixed mode C++.

Arne

 
Reply With Quote
 
Arne Vajhj
Guest
Posts: n/a
 
      05-14-2010
On 13-05-2010 20:37, Thomas Pornin wrote:
> According to Lew<(E-Mail Removed)>:
>> That is instructive. I thought "unmanaged" code in .Net (with which
>> I'm barely passingly familiar) meant high-level code still (e.g., C#),
>> but without the memory-management features (GC).

>
> Well, C# has that, too. C# syntax tends to agglomerate features quite
> fast. You can have "unmanaged" C# code, with C-like things like explicit
> pointer arithmetic. But the term "unmanaged" is also used to describe
> native code. Basically, in the .NET world, "managed" means "code where
> types, array accesses, memory management,... is under strict control of
> the VM" and "unmanaged" means "whatever is not managed".


Unmanaged code is native code. You can not produce that with
Microsofts C# compiler. C# code does not become unmanaged just
by using unsafe features.

C# managed code can somewhat work with unmanaged data though
interop classes.

Arne
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link aggregation between managed and unmanaged switch yash Cisco 0 05-17-2006 11:28 AM
translate a language that runs on JVM jrefactors@hotmail.com Java 9 01-04-2005 11:48 AM
MS JVM and Sun JVM problem Young-Jin Lee Java 3 01-21-2004 04:25 AM
Different behavior for newStringUTF() for Sun JVM and IBM Jvm Lasse Java 1 01-05-2004 07:49 PM
Re: Handling both MS JVM and Sun JVM Kevin Hooke Java 2 09-02-2003 05:31 AM



Advertisments